justinbarclay / parinfer-rust-mode

Simplifying how you write Lisp
https://shaunlebron.github.io/parinfer/
GNU General Public License v3.0
227 stars 16 forks source link

Error running timer ‘track-changes--call-signal’ while using vundo #94

Closed justinbarclay closed 3 months ago

justinbarclay commented 3 months ago

When moving through Vundo nodes a warning will pop up mentioning that track-changes failed to work. This seems to be related to vundo making the buffer read-only during node navigation.

Error running timer ‘track-changes--call-signal’: (buffer-read-only #<buffer parinfer-rust-mode.el>)
justinbarclay commented 3 months ago

Reposting from the other thread: My cursory glance at the issue suggests that it's happening because Vundo is making the buffer read-only for some amount of time. If that's the case, it violates a constraint of parinfer as well, as it can run anytime the buffer changes.

Maybe a solution would be for vundo to provide a hook for users to disable some minor modes when vundo is invoked in a buffer? Then it's up to the user to set up parinfer-rust-mode to disable and enable at the appropriate times?

Something like a: vundo-enter-hook vundo-exit-hook

justinbarclay commented 3 months ago

Another solution might be to have parinfer turn itself on and off when the buffer becomes read-only? This could probably be achieved with watching variables

justinbarclay commented 3 months ago

My solution for vundo support

(use-package parinfer-rust-mode
  ;; ...
  :config
  (add-hook 'vundo-pre-enter-hook (lambda () (parinfer-rust-mode 0) nil t))
  (add-hook 'vundo-post-exit-hook (lambda () (parinfer-rust-mode 1) nil t)))
contrapunctus-1 commented 2 months ago

I have the same error when I try to set up parinfer-rust-mode in the eval-expression minibuffer (mostly for the autopair and wrap functionality, since I mostly use that for one-liners i.e. no indentation involved).

In my configuration, I added parinfer-rust-mode to eval-expression-minibuffer-setup-hook. To replicate the issue, I type M-x eval-expression RET and enter an opening parenthesis.

GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) of 2024-05-15, modified by Debian

justinbarclay commented 2 months ago

Hey, that's not a case I intended to support, so I don't have a quick fix for you here. If you know how to get this to work, I am happy to hear suggestions on what to fix. If you find a workaround, I'm happy to add that to the wiki as well.

However, if you want the autopair functionality with as little fuss as possible, I would turn on electric-pair-local-mode instead. See: https://www.gnu.org/software/emacs/manual/html_node/emacs/Matching.html