Skip to content

Commit

Permalink
chore: add flyspell to troublesome modes and minor code cleanup
Browse files Browse the repository at this point in the history
Flyspell and parinfer-rust-mode don't play well together. Flyspell
moves the cursor around the buffer when spell checking the buffer and,
for some unknown reason, when `parinfer-rust--execute` is executed it
can detect the cursor position as it was being moved around by
flyspell. In safe mode Emacs is smart enough to handle this and put
the cursor in the right place. However, fast mode will just let the
cursor jump around. So, in order to avoid this flyspell-mode should be
disabled if parinfer-rust is to behave properly
  • Loading branch information
justinbarclay committed May 23, 2024
1 parent ae3a3e9 commit 7ec909e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 1 addition & 4 deletions parinfer-rust-changes.el
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,9 @@
(parinfer-rust--get-cursor-x)))))
(push (list 'lineNo lineNo
'x x
'start start
'end end
'length (length before)
'before-text before
'after-text (buffer-substring-no-properties start end)
'group nil)
'after-text (buffer-substring-no-properties start end))
parinfer-rust--changes))))))

(defun parinfer-rust--changes-signal (id &optional distance)
Expand Down
6 changes: 5 additions & 1 deletion parinfer-rust-helper.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
(declare-function parinfer-rust-mode-enable "parinfer-rust-mode")
(defvar parinfer-rust--mode)
(defvar parinfer-rust-dim-parens)
(defvar parinfer-rust-buffer-replace-strategy)
(defvar parinfer-rust-mode))
(require 'url)

Expand Down Expand Up @@ -139,7 +140,10 @@ Uses PARINFER-RUST-VERSION to download a compatible version of the library."
If the user does not disable these modes then it may cause bugs or crashes"
(let ((warning-list))
(dolist (mode parinfer-rust-troublesome-modes)
(dolist (mode (if (eq parinfer-rust-buffer-replace-strategy
'fast)
(cons 'flyspell-mode parinfer-rust-troublesome-modes)
parinfer-rust-troublesome-modes))
(when (parinfer-rust--is-active-minor-mode mode)
(push mode warning-list)))
(if (and
Expand Down

0 comments on commit 7ec909e

Please sign in to comment.