Skip to content

Commit

Permalink
Automatically switch to fast buffer replace strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbarclay committed May 6, 2024
1 parent a3a8292 commit 13e6251
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions parinfer-rust-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,12 @@ This includes stopping tracking of all changes."
(setq-local parinfer-rust--disable nil)
(setq-local parinfer-rust--disable t)))

(defun parinfer-rust--auto-apply-fast-mode ()
"Switch to the fast buffer replace strategy when the buffer is over 1000 lines."
(when (< 1000 (count-lines (point-min)
(point-max)))
(setq-local parinfer-rust-buffer-replace-strategy 'fast)))

(defun parinfer-rust-mode-enable ()
"Enable Parinfer."
;; Make sure the library is installed at the appropriate location or offer to download it
Expand Down Expand Up @@ -634,5 +640,6 @@ not available."
(t
(parinfer-rust-mode-enable))))

(setq-default parinfer-rust-mode-hook '(parinfer-rust--auto-apply-fast-mode))
(provide 'parinfer-rust-mode)
;;; parinfer-rust-mode.el ends here

0 comments on commit 13e6251

Please sign in to comment.