0

The problem: upon opening a .clj file, the clojure-mode correctly starts. However, parinfer-rust-mode doesn't, despite being added to a clojure-mode-hook.

The setup (everything related to clojure from my config):

;; clojure
(use-package clojure-mode
  :init
  (setq clojure-indent-style 'align-arguments)
  (setq clojure-align-forms-automatically t))

;; extra highlight
(use-package clojure-mode-extra-font-locking)

;; cider
(use-package cider)

;; parinfer disables https://www.emacswiki.org/emacs/ElectricPair mode. Look into re-enabling it for other languages I work in
(use-package parinfer-rust-mode
  :hook clojure-mode
  :init
  (setq parinfer-rust-auto-download t))

C-h v clojure-mode-hook:

clojure-mode-hook is a variable defined in ‘clojure-mode.el’.

Its value is shown below.

  This variable may be risky if used as a file-local variable.

Hook run after entering Clojure mode.
No problems result if this variable is not bound.
‘add-hook’ automatically binds it.  (This is true for all hook variables.)

Value:
(parinfer-rust-mode #f(compiled-function
                       ()
                       #<bytecode -0x1e6605021ebab616>)
                    (closure
                     (t)
                     nil
                     (set
                      (make-local-variable 'sesman-system)
                      'CIDER))
                    clojure--check-wrong-major-mode)

If I manually eval (parinfer-rust-mode), mode gets enabled without any warnings or such.

I also tried to remove :hook from use-package and add it manually like so -

(add-hook 'clojure-mode-hook #'parinfer-rust-mode)

but it doesn't change anything, parinfer-rust-mode still doesn't start automatically.

What am I doing wrong?

1 Answer 1

0

Turns out everything was working fine, except the files that I thought would be opened would not be opened really, and instead get loaded from some form of cache or something, apparently with already defined enabled modes. I'm not well-versed in emacs so can't pin-point it, but I know find-alternate-file (C-x C-v) on a Clojure buffer would re-run all the modes, all the hooks and everything would work out well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.