reddit / emacs

How do I load files to init.el on windows?

LowCom · 2022-05-12 10:13
I tried all of these but doesnt work. (load "D:/files/o/functions.el") (add-to-list 'load-path "D:\\files\\o") I tried escaping backslashes, using forward slashes instead. Doesn't work. load and "add-to-list" both do not work. It gives me the error "invalid read syntax"
SlowValue · 2022-05-12 10:39
not on windows, but have you tried: (add-to-list 'load-path "D:\\files\\o") (load "functions") I suggest naming files with additional endings (like functions_rc.el) to prevent inadvertently loading of system libraries. Then the last line of above code would change to `(load "functions_rc")`
LowCom · 2022-05-12 10:55
Doesn't work. I get "Invalid read syntax (" error
flexibeast · 2022-05-12 11:11
Are you sure there's not a syntax error elsewhere in that file? In particular, before the lines you're trying to add?
LowCom · 2022-05-12 11:13
Found it now, thanks. It was so anooying. There was an extra paren somewhere, the debugger was showing the extra paren at the wrong location. So I could not find it and assumed it was something else.
a_moody · 2022-05-13 02:26
I’d recommend using something like paredit or smartparens on strict mode. That’ll not allow the parenthesis to fall out of balance. If that’s not your cup of tea, you should look into how to better indent lisp. It’ll make unbalanced parenthesis easy to spot.
dpoggio · 2022-05-13 02:33
I use Emacs on Windows at work, all of these work: `(add-to-list 'load-path "C:/Users/user/emacs/.emacs.d/lisp")` `(helm-grep-default-command "/c/Users/user/Documents/git/usr/bin/grep.exe --color=always -a -d skip %e -n%cH -e %p %f")` The load command should'n need any path if it's on load-path.
Illiamen · 2022-05-15 21:29
There's also the built-in command `check-parens` (https://www.gnu.org/software/emacs/manual/html_node/emacs/Parentheses.html), which can be added to `before-save-hook`.