I tried to setup languagetool in Emacs today but wasn’t successful.
How would I do this when my config is in a .org file and only gets symlinked by Nix?
I wasn’t able to find an example with Sourcegraph or else.
GitHub - mhayashi1120/Emacs-langtool: LanguageTool for Emacs This one?
You’ll need languagetool installed at least. There is a nix package for that: NixOS Search - Loading...
You can still use your .org file the same as if you weren’t using nix. Just, if the config itself gets built into a nix package, you’d need to re-build that package each time you change the config.
(For iterating on an elisp config without having to re-build the nix package, I’d suggest loading/evaluating a config.local.el
or whatever that’s not part of the Nix package; then move the good elisp into your nix package once you’re happy with it).
This package here:
Installation worked without a problem but doesn’t seem to be working.
I get the following message when I try to use it:
locate-file: Wrong type argument: stringp, nil
That error doesn’t help much, it just points at https://www.gnu.org/software/emacs/manual/html_node/elisp/Locating-Files.html#index-locate_002dfile being misused. I’d guess it may be that some kind of binary the package expects to be installed isn’t, but that’s just a wild guess.
Have you tried turning on the debugger (M-x toggle-debug-on-error
) before that function is called? That way you’ll get a traceback so we can figure out what’s actually wrong. Where is your exact configuration?
So managed to get the log.
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
locate-file-internal(nil ("/nix/store/xa7kqr8q1y4h1f6yzvir10w49ny3q002-emacs-..." "/nix/store/vzqny68wq33dcg4hkdala51n5vqhpnwc-python..." "/nix/store/ayv6knl9ifmymrmyy5qvl4svgbyml93j-python..." "/nix/store/9602rhcavm5nqih512szlqj6s44h80mx-cairo-..." "/nix/store/dh5j961clx7bbr8cb9df4s49qbxa1zx2-freety..." "/nix/store/wjf2554ffvap47vanabh9lk0dmj1q295-bzip2-..." "/nix/store/mk9p94cm6v3hm1hn89sqhb29bbkm37yp-libpng..." "/nix/store/xbny6j1qjg7425arm27gdjqc6jbsgvzl-fontco..." "/nix/store/g8w93fyx4gswdk1klb73xvkffkw8i0x2-expat-..." "/nix/store/i6i4h7xkygh0ylvn9jwdlji8q82xf907-glib-2..." "/nix/store/gqzplwy163p94sfy7l5sjgcml5fyshp0-gettex..." "/nix/store/h4mvv5jcqqjfcpdis8zzcg3j0s2l9kcn-glib-2..." "/nix/store/0yvf8n07x253q7v76ywpyadvyhn8g0ld-python..." "/run/wrappers/bin" "/home/andreas/.nix-profile/bin" "/etc/profiles/per-user/andreas/bin" "/nix/var/nix/profiles/default/bin" "/run/current-system/sw/bin" "/nix/store/z3z1ilyq7bmzphg42j83yfyx5gwh0iq0-python..." "/nix/store/k4lvc45h5adkg022jsgrdil2wckzn16a-emacs-...") ("") 1)
locate-file(nil ("/nix/store/xa7kqr8q1y4h1f6yzvir10w49ny3q002-emacs-..." "/nix/store/vzqny68wq33dcg4hkdala51n5vqhpnwc-python..." "/nix/store/ayv6knl9ifmymrmyy5qvl4svgbyml93j-python..." "/nix/store/9602rhcavm5nqih512szlqj6s44h80mx-cairo-..." "/nix/store/dh5j961clx7bbr8cb9df4s49qbxa1zx2-freety..." "/nix/store/wjf2554ffvap47vanabh9lk0dmj1q295-bzip2-..." "/nix/store/mk9p94cm6v3hm1hn89sqhb29bbkm37yp-libpng..." "/nix/store/xbny6j1qjg7425arm27gdjqc6jbsgvzl-fontco..." "/nix/store/g8w93fyx4gswdk1klb73xvkffkw8i0x2-expat-..." "/nix/store/i6i4h7xkygh0ylvn9jwdlji8q82xf907-glib-2..." "/nix/store/gqzplwy163p94sfy7l5sjgcml5fyshp0-gettex..." "/nix/store/h4mvv5jcqqjfcpdis8zzcg3j0s2l9kcn-glib-2..." "/nix/store/0yvf8n07x253q7v76ywpyadvyhn8g0ld-python..." "/run/wrappers/bin" "/home/andreas/.nix-profile/bin" "/etc/profiles/per-user/andreas/bin" "/nix/var/nix/profiles/default/bin" "/run/current-system/sw/bin" "/nix/store/z3z1ilyq7bmzphg42j83yfyx5gwh0iq0-python..." "/nix/store/k4lvc45h5adkg022jsgrdil2wckzn16a-emacs-...") ("") 1)
executable-find(nil)
languagetool-console-invoke-command-region(1 990)
languagetool-console-check(1 990)
languagetool-check(1 990)
funcall-interactively(languagetool-check 1 990)
call-interactively(languagetool-check record nil)
command-execute(languagetool-check record)
counsel-M-x-action("languagetool-check")
Sorry my question was badly written.
What I meant was how can I get e.g. the Nix store path of a package into my .org config.
I don’t mind rebuilding the system after changing the Emacs config but since it’s in an org file I can’t use things like this:
(setq languagetool-java-arguments '("-Dfile.encoding=UTF-8")
languagetool-console-command "${pkgs.languagetool}/bin/languagetool-commandline"
languagetool-server-command "${pkgs.languagetool}/bin/languagetool-server")
I decided to give the extracConfig
parameter a try and specify the paths the Nix way.
I got now a new error:
Debugger entered--Lisp error: (error "There is no valid setting.")
signal(error ("There is no valid setting."))
error("There is no valid setting.")
langtool--checker-mode()
langtool--check-command()
langtool-check()
funcall-interactively(langtool-check)
call-interactively(langtool-check record nil)
command-execute(langtool-check record)
counsel-M-x-action("langtool-check")
ivy-call()
ivy-read("M-x " ("langtool-check" "toggle-debug-on-error" "term" "eshell" "project-find-file" "ansi-term" "customize-mode" "mu4e" "woman" "eglot" "treemacs" "customize-group" "markdown-export" "eval-buffer" "markdown-preview" "set-face-background" "find-file" "sort-lines" "deft-refresh" "package-list-packages" "delete-duplicate-lines" "markdown-footnote-return" "markdown-footnote-goto-text" "cd" "5x5" "amx" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "wos" "xdb" "calc" "deft" "diff" "dirs" "ffap" "gnus" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
counsel-M-x()
funcall-interactively(counsel-M-x)
call-interactively(counsel-M-x nil nil)
command-execute(counsel-M-x)
I got it working with the following commit.
However it feels a bit hacky and redundant to specify all those paths like that.