From ddd677091afc7d65ce56d11866e18aeded110ada Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 6 Mar 2025 17:10:53 -0500 Subject: [PATCH] Avoid deprecated ELisp features Activate `lexical-binding` in a few more files. Use `advice-add` rather than `defadvice`. Fix some compilation warnings. Prefer #' to quote function names. Adjust `Package-Requires:` accordingly. --- .gitignore | 4 ++ .../multiple-cursors-steps.el | 24 +++---- features/support/env.el | 12 ++-- mc-cycle-cursors.el | 8 +-- mc-hide-unmatched-lines-mode.el | 10 +-- mc-mark-more.el | 12 ++-- mc-separate-operations.el | 4 +- multiple-cursors-core.el | 67 ++++++++++--------- multiple-cursors.el | 4 +- rectangular-region-mode.el | 31 +++++---- 10 files changed, 93 insertions(+), 83 deletions(-) diff --git a/.gitignore b/.gitignore index 056d1bf..e383c69 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ elpa *.elc /.ecukes-failing-scenarios + +# ELPA-generated files +/multiple-cursors-pkg.el +/multiple-cursors-autoloads.el diff --git a/features/step-definitions/multiple-cursors-steps.el b/features/step-definitions/multiple-cursors-steps.el index 0c299a9..b921689 100644 --- a/features/step-definitions/multiple-cursors-steps.el +++ b/features/step-definitions/multiple-cursors-steps.el @@ -1,4 +1,6 @@ -(require 'cl) ;; For lexical-let +;; -*- lexical-binding: t; -*- + +(require 'multiple-cursors-core) (When "^I mark next like this$" (lambda () (call-interactively 'mc/mark-next-like-this))) @@ -109,26 +111,22 @@ (When "^I copy \"\\(.+\\)\" in another program$" (lambda (text) - (lexical-let ((text text)) - (setq interprogram-paste-function - #'(lambda () (let ((r text)) (setq text nil) r)))))) + (setq interprogram-paste-function + #'(lambda () (let ((r text)) (setq text nil) r))))) (Given "^I have bound C-! to a lambda that inserts \"\\(.+\\)\"$" (lambda (ins) - (lexical-let ((ins ins)) - (global-set-key (kbd "C-!") #'(lambda () (interactive) (insert ins)))))) + (global-set-key (kbd "C-!") #'(lambda () (interactive) (insert ins))))) (Given "^I have bound C-! to a new command that inserts \"\\(.+\\)\"$" (lambda (ins) - (lexical-let ((ins ins)) - (defun mc-test-temp-command () (interactive) (insert ins)) - (global-set-key (kbd "C-!") 'mc-test-temp-command)))) + (defun mc-test-temp-command () (interactive) (insert ins)) + (global-set-key (kbd "C-!") 'mc-test-temp-command))) (Given "^I have bound C-! to another new command that inserts \"\\(.+\\)\"$" (lambda (ins) - (lexical-let ((ins ins)) - (defun mc-test-temp-command-2 () (interactive) (insert ins)) - (global-set-key (kbd "C-!") 'mc-test-temp-command-2)))) + (defun mc-test-temp-command-2 () (interactive) (insert ins)) + (global-set-key (kbd "C-!") 'mc-test-temp-command-2))) (Given "^I have bound C-! to a new command that inserts two read-chars$" (lambda () @@ -171,7 +169,7 @@ (When "^I mark all \\(.+\\)$" (lambda (rest) - (let ((func (intern (mapconcat 'identity + (let ((func (intern (mapconcat #'identity (cons "mc/mark-all" (split-string rest)) "-")))) diff --git a/features/support/env.el b/features/support/env.el index e05985a..47d1f05 100644 --- a/features/support/env.el +++ b/features/support/env.el @@ -1,8 +1,10 @@ -(let* ((current-directory (file-name-directory load-file-name)) - (features-directory (expand-file-name ".." current-directory)) - (project-directory (expand-file-name ".." features-directory))) - (setq multiple-cursors-root-path project-directory) - (setq multiple-cursors-util-path (expand-file-name "util" project-directory))) +;; -*- lexical-binding: t; -*- +(defvar multiple-cursors-root-path + (let* ((current-directory (file-name-directory load-file-name)) + (features-directory (expand-file-name ".." current-directory))) + (expand-file-name ".." features-directory))) +(defvar multiple-cursors-util-path + (expand-file-name "util" multiple-cursors-root-path)) (add-to-list 'load-path multiple-cursors-root-path) (add-to-list 'load-path multiple-cursors-util-path) diff --git a/mc-cycle-cursors.el b/mc-cycle-cursors.el index 4e2b232..f648f2c 100644 --- a/mc-cycle-cursors.el +++ b/mc-cycle-cursors.el @@ -73,7 +73,7 @@ (cursors-after-point (cl-remove-if (lambda (cursor) (< (mc/cursor-beg cursor) point)) cursors)) - (cursors-in-order (cl-sort cursors-after-point '< :key 'mc/cursor-beg))) + (cursors-in-order (cl-sort cursors-after-point #'< :key #'mc/cursor-beg))) (car cursors-in-order))) (defun mc/last-fake-cursor-before (point) @@ -82,7 +82,7 @@ (cursors-before-point (cl-remove-if (lambda (cursor) (> (mc/cursor-end cursor) point)) cursors)) - (cursors-in-order (cl-sort cursors-before-point '> :key 'mc/cursor-end))) + (cursors-in-order (cl-sort cursors-before-point #'> :key #'mc/cursor-end))) (car cursors-in-order))) (cl-defun mc/cycle (next-cursor fallback-cursor loop-message) @@ -110,8 +110,8 @@ (mc/last-fake-cursor-before (point-max)) "We're already at the last cursor")) -(define-key mc/keymap (kbd "C-v") 'mc/cycle-forward) -(define-key mc/keymap (kbd "M-v") 'mc/cycle-backward) +(define-key mc/keymap (kbd "C-v") #'mc/cycle-forward) +(define-key mc/keymap (kbd "M-v") #'mc/cycle-backward) (provide 'mc-cycle-cursors) diff --git a/mc-hide-unmatched-lines-mode.el b/mc-hide-unmatched-lines-mode.el index 973a0aa..ed9db7f 100644 --- a/mc-hide-unmatched-lines-mode.el +++ b/mc-hide-unmatched-lines-mode.el @@ -35,8 +35,8 @@ (defvar hum/hide-unmatched-lines-mode-map (make-sparse-keymap) "Keymap for hide unmatched lines is mainly for rebinding C-g") -(define-key hum/hide-unmatched-lines-mode-map (kbd "C-g") 'hum/keyboard-quit) -(define-key hum/hide-unmatched-lines-mode-map (kbd "") 'hum/keyboard-quit) +(define-key hum/hide-unmatched-lines-mode-map (kbd "C-g") #'hum/keyboard-quit) +(define-key hum/hide-unmatched-lines-mode-map (kbd "") #'hum/keyboard-quit) (defun hum/keyboard-quit () "Leave hide-unmatched-lines mode" @@ -61,10 +61,10 @@ mode. To leave this mode press or \"C-g\"" ;;just in case if mc mode will be disabled while hide-unmatched-lines is active (progn (hum/hide-unmatched-lines) - (add-hook 'multiple-cursors-mode-disabled-hook 'hum/disable-hum-mode t t)) + (add-hook 'multiple-cursors-mode-disabled-hook #'hum/disable-hum-mode t t)) (progn (hum/unhide-unmatched-lines) - (remove-hook 'multiple-cursors-mode-disabled-hook 'hum/disable-hum-mode)))) + (remove-hook 'multiple-cursors-mode-disabled-hook #'hum/disable-hum-mode)))) (defconst hum/invisible-overlay-name 'hum/invisible-overlay-name) @@ -104,6 +104,6 @@ mode. To leave this mode press or \"C-g\"" (defun hum/unhide-unmatched-lines () (remove-overlays nil nil hum/invisible-overlay-name t)) -(define-key mc/keymap (kbd "C-'") 'mc-hide-unmatched-lines-mode) +(define-key mc/keymap (kbd "C-'") #'mc-hide-unmatched-lines-mode) (provide 'mc-hide-unmatched-lines-mode) diff --git a/mc-mark-more.el b/mc-mark-more.el index 34dd357..2ba6e54 100644 --- a/mc-mark-more.el +++ b/mc-mark-more.el @@ -309,7 +309,7 @@ With zero ARG, skip the last one and mark next." (mc/mark-previous-like-this arg))) (defun mc/mark-lines (num-lines direction) - (dotimes (i (if (= num-lines 0) 1 num-lines)) + (dotimes (_ (if (= num-lines 0) 1 num-lines)) (mc/save-excursion (let ((furthest-cursor (cl-ecase direction (forwards (mc/furthest-cursor-after-point)) @@ -500,10 +500,10 @@ remove the keymap depends on user input and KEEP-PRED: (defvar mc/mark-more-like-this-extended-keymap (make-sparse-keymap)) -(define-key mc/mark-more-like-this-extended-keymap (kbd "") 'mc/mmlte--up) -(define-key mc/mark-more-like-this-extended-keymap (kbd "") 'mc/mmlte--down) -(define-key mc/mark-more-like-this-extended-keymap (kbd "") 'mc/mmlte--left) -(define-key mc/mark-more-like-this-extended-keymap (kbd "") 'mc/mmlte--right) +(define-key mc/mark-more-like-this-extended-keymap (kbd "") #'mc/mmlte--up) +(define-key mc/mark-more-like-this-extended-keymap (kbd "") #'mc/mmlte--down) +(define-key mc/mark-more-like-this-extended-keymap (kbd "") #'mc/mmlte--left) +(define-key mc/mark-more-like-this-extended-keymap (kbd "") #'mc/mmlte--right) ;;;###autoload (defun mc/mark-more-like-this-extended () @@ -706,7 +706,7 @@ already there." (mc/maybe-multiple-cursors-mode))) ;;;###autoload -(defalias 'mc/add-cursor-on-click 'mc/toggle-cursor-on-click) +(defalias 'mc/add-cursor-on-click #'mc/toggle-cursor-on-click) ;;;###autoload (defun mc/mark-sgml-tag-pair () diff --git a/mc-separate-operations.el b/mc-separate-operations.el index 9d9ab17..6ece65d 100644 --- a/mc-separate-operations.el +++ b/mc-separate-operations.el @@ -1,4 +1,4 @@ -;;; mc-separate-operations.el - functions that work differently on each cursor -*- lexical-binding: t; -*- +;;; mc-separate-operations.el --- Functions that work differently on each cursor -*- lexical-binding: t; -*- ;; Copyright (C) 2012-2016 Magnar Sveen @@ -118,7 +118,7 @@ (interactive) (unless (use-region-p) (mc/execute-command-for-all-cursors 'mark-sexp)) - (setq mc--strings-to-replace (sort (mc--ordered-region-strings) 'string<)) + (setq mc--strings-to-replace (sort (mc--ordered-region-strings) #'string<)) (mc--replace-region-strings)) diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el index de8b39a..b88145e 100644 --- a/multiple-cursors-core.el +++ b/multiple-cursors-core.el @@ -1,4 +1,4 @@ -;;; multiple-cursors-core.el --- An experiment in multiple cursors for emacs. -*- lexical-binding: t; -*- +;;; multiple-cursors-core.el --- An experiment in multiple cursors for Emacs -*- lexical-binding: t; -*- ;; Copyright (C) 2012-2016 Magnar Sveen @@ -67,7 +67,7 @@ rendered or shift text." (cons (cons 'apply (cons 'activate-cursor-for-undo (list id))) buffer-undo-list)))))) (defun mc/all-fake-cursors (&optional start end) - (cl-remove-if-not 'mc/fake-cursor-p + (cl-remove-if-not #'mc/fake-cursor-p (overlays-in (or start (point-min)) (or end (point-max))))) @@ -95,7 +95,7 @@ rendered or shift text." (mapc #'(lambda (cursor) (when (mc/fake-cursor-p cursor) ,@forms)) - (sort (overlays-in (point-min) (point-max)) 'mc--compare-by-overlay-start)) + (sort (overlays-in (point-min) (point-max)) #'mc--compare-by-overlay-start)) (mc/pop-state-from-overlay (mc/cursor-with-id ,rci))))) (defmacro mc/save-window-scroll (&rest forms) @@ -290,6 +290,8 @@ makes sense for fake cursors." (defvar mc--executing-command-for-fake-cursor nil) (defun mc/execute-command-for-fake-cursor (cmd cursor) + (defvar annoying-arrows-mode) + (defvar smooth-scroll-margin) (let ((mc--executing-command-for-fake-cursor t) (id (overlay-get cursor 'mc-id)) (annoying-arrows-mode nil) @@ -581,7 +583,7 @@ which action is being undone." (defun mc/num-cursors () "The number of cursors (real and fake) in the buffer." - (1+ (cl-count-if 'mc/fake-cursor-p + (1+ (cl-count-if #'mc/fake-cursor-p (overlays-in (point-min) (point-max))))) (defvar mc--this-command nil @@ -613,9 +615,10 @@ not be recognized through the command-remapping lookup." ;; execute-kbd-macro should never be run for fake cursors. The real cursor will ;; execute the keyboard macro, resulting in new commands in the command loop, ;; and the fake cursors can pick up on those instead. -(defadvice execute-kbd-macro (around skip-fake-cursors activate) +(advice-add 'execute-kbd-macro :around #'mc--skip-fake-cursors) +(defun mc--skip-fake-cursors (orig-fun &rest args) (unless mc--executing-command-for-fake-cursor - ad-do-it)) + (apply orig-fun args))) (defun mc/execute-this-command-for-all-cursors-1 () "Used with post-command-hook to execute supported commands for all cursors. @@ -694,7 +697,7 @@ you should disable multiple-cursors-mode." (mc/execute-command-for-all-fake-cursors (lambda () (interactive) (cl-letf (((symbol-function 'read-from-minibuffer) - (lambda (p &optional i k r h d m) (read i)))) + (lambda (_p &optional i &rest _) (read i)))) (repeat-complex-command 0)))))) (defvar mc/keymap nil @@ -703,13 +706,13 @@ Main goal of the keymap is to rebind C-g and to conclude multiple cursors editing.") (unless mc/keymap (setq mc/keymap (make-sparse-keymap)) - (define-key mc/keymap (kbd "C-g") 'mc/keyboard-quit) - (define-key mc/keymap (kbd "") 'multiple-cursors-mode) - (define-key mc/keymap (kbd "C-:") 'mc/repeat-command) + (define-key mc/keymap (kbd "C-g") #'mc/keyboard-quit) + (define-key mc/keymap (kbd "") #'multiple-cursors-mode) + (define-key mc/keymap (kbd "C-:") #'mc/repeat-command) (when (fboundp 'phi-search) - (define-key mc/keymap (kbd "C-s") 'phi-search)) + (define-key mc/keymap (kbd "C-s") #'phi-search)) (when (fboundp 'phi-search-backward) - (define-key mc/keymap (kbd "C-r") 'phi-search-backward))) + (define-key mc/keymap (kbd "C-r") #'phi-search-backward))) (defun mc--all-equal (list) "Are all the items in LIST equal?" @@ -750,13 +753,13 @@ They are temporarily disabled when multiple-cursors are active.") (funcall mode -1))) (defun mc/temporarily-disable-unsupported-minor-modes () - (mapc 'mc/temporarily-disable-minor-mode mc/unsupported-minor-modes)) + (mapc #'mc/temporarily-disable-minor-mode mc/unsupported-minor-modes)) (defun mc/enable-minor-mode (mode) (funcall mode 1)) (defun mc/enable-temporarily-disabled-minor-modes () - (mapc 'mc/enable-minor-mode mc/temporarily-disabled-minor-modes) + (mapc #'mc/enable-minor-mode mc/temporarily-disabled-minor-modes) (setq mc/temporarily-disabled-minor-modes nil)) (defcustom mc/mode-line @@ -776,11 +779,11 @@ They are temporarily disabled when multiple-cursors are active.") (if multiple-cursors-mode (progn (mc/temporarily-disable-unsupported-minor-modes) - (add-hook 'pre-command-hook 'mc/make-a-note-of-the-command-being-run nil t) - (add-hook 'post-command-hook 'mc/execute-this-command-for-all-cursors t t) + (add-hook 'pre-command-hook #'mc/make-a-note-of-the-command-being-run nil t) + (add-hook 'post-command-hook #'mc/execute-this-command-for-all-cursors t t) (run-hooks 'multiple-cursors-mode-enabled-hook)) - (remove-hook 'post-command-hook 'mc/execute-this-command-for-all-cursors t) - (remove-hook 'pre-command-hook 'mc/make-a-note-of-the-command-being-run t) + (remove-hook 'post-command-hook #'mc/execute-this-command-for-all-cursors t) + (remove-hook 'pre-command-hook #'mc/make-a-note-of-the-command-being-run t) (setq mc--this-command nil) (mc--maybe-set-killed-rectangle) (mc/remove-fake-cursors) @@ -792,7 +795,7 @@ They are temporarily disabled when multiple-cursors are active.") (multiple-cursors-mode 0) (run-hooks 'multiple-cursors-mode-disabled-hook)) -(add-hook 'after-revert-hook 'mc/disable-multiple-cursors-mode) +(add-hook 'after-revert-hook #'mc/disable-multiple-cursors-mode) (defun mc/maybe-multiple-cursors-mode () "Enable multiple-cursors-mode if there is more than one currently active cursor." @@ -800,23 +803,26 @@ They are temporarily disabled when multiple-cursors are active.") (multiple-cursors-mode 1) (mc/disable-multiple-cursors-mode))) +(defun mc--unsupported-advice (orig-fun &rest args) + "command isn't supported with multiple cursors." + (unless (and multiple-cursors-mode (called-interactively-p 'any)) + (apply orig-fun args))) + (defmacro unsupported-cmd (cmd msg) "Adds command to list of unsupported commands and prevents it from being executed if in multiple-cursors-mode." `(progn - (put (quote ,cmd) 'mc--unsupported ,msg) - (defadvice ,cmd (around unsupported-advice activate) - "command isn't supported with multiple cursors" - (unless (and multiple-cursors-mode (called-interactively-p 'any)) - ad-do-it)))) + (put ',cmd 'mc--unsupported ,msg) + (advice-add ',cmd :around #'mc--unsupported-advice))) ;; Commands that does not work with multiple-cursors (unsupported-cmd isearch-forward ". Feel free to add a compatible version.") (unsupported-cmd isearch-backward ". Feel free to add a compatible version.") ;; Make sure pastes from other programs are added to all kill-rings when yanking -(defadvice current-kill (before interprogram-paste-for-all-cursors - (n &optional do-not-move) activate) +(advice-add 'current-kill :before #'mc--interprogram-paste-for-all-cursors) +(defun mc--interprogram-paste-for-all-cursors (n &rest _) + ;; FIXME: Shouldn't we check `multiple-cursors-mode' or something? (let ((interprogram-paste (and (= n 0) interprogram-paste-function (funcall interprogram-paste-function)))) @@ -827,7 +833,7 @@ from being executed if in multiple-cursors-mode." ;; something once. It is not a pure function. (let ((interprogram-cut-function nil)) (if (listp interprogram-paste) - (mapc 'kill-new (nreverse interprogram-paste)) + (mapc #'kill-new (nreverse interprogram-paste)) (kill-new interprogram-paste)) ;; And then add interprogram-paste to the kill-rings ;; of all the other cursors too. @@ -835,12 +841,13 @@ from being executed if in multiple-cursors-mode." (let ((kill-ring (overlay-get cursor 'kill-ring)) (kill-ring-yank-pointer (overlay-get cursor 'kill-ring-yank-pointer))) (if (listp interprogram-paste) - (mapc 'kill-new (nreverse interprogram-paste)) + (mapc #'kill-new (nreverse interprogram-paste)) (kill-new interprogram-paste)) (overlay-put cursor 'kill-ring kill-ring) (overlay-put cursor 'kill-ring-yank-pointer kill-ring-yank-pointer))))))) -(defadvice execute-extended-command (after execute-extended-command-for-all-cursors () activate) +(advice-add 'execute-extended-command :after #'mc--execute-extended-command-for-all-cursors) +(defun mc--execute-extended-command-for-all-cursors (&rest _) (when multiple-cursors-mode (unless (or mc/always-run-for-all (not (symbolp this-command)) @@ -870,7 +877,7 @@ for running commands with multiple cursors." (setq mc--list-file-loaded t))) (defun mc/dump-list (list-symbol) - "Insert (setq 'LIST-SYMBOL LIST-VALUE) to current buffer." + "Insert (setq LIST-SYMBOL LIST-VALUE) to current buffer." (cl-symbol-macrolet ((value (symbol-value list-symbol))) (insert "(setq " (symbol-name list-symbol) "\n" " '(") diff --git a/multiple-cursors.el b/multiple-cursors.el index c99963e..4b40ab2 100644 --- a/multiple-cursors.el +++ b/multiple-cursors.el @@ -1,10 +1,10 @@ -;;; multiple-cursors.el --- Multiple cursors for emacs. -*- lexical-binding: t; -*- +;;; multiple-cursors.el --- Multiple cursors for Emacs -*- lexical-binding: t; -*- ;; Copyright (C) 2012-2016 Magnar Sveen ;; Author: Magnar Sveen ;; Package-Version: 1.5.0 -;; Package-Requires: ((cl-lib "0.5")) +;; Package-Requires: ((emacs "24.4") (cl-lib "0.5")) ;; Keywords: editing cursors ;; Homepage: https://github.com/magnars/multiple-cursors.el diff --git a/rectangular-region-mode.el b/rectangular-region-mode.el index 2ce4b30..ad865ea 100644 --- a/rectangular-region-mode.el +++ b/rectangular-region-mode.el @@ -35,8 +35,8 @@ (defvar rectangular-region-mode-map (make-sparse-keymap) "Keymap for rectangular region is mainly for rebinding C-g") -(define-key rectangular-region-mode-map (kbd "C-g") 'rrm/keyboard-quit) -(define-key rectangular-region-mode-map (kbd "") 'rrm/switch-to-multiple-cursors) +(define-key rectangular-region-mode-map (kbd "C-g") #'rrm/keyboard-quit) +(define-key rectangular-region-mode-map (kbd "") #'rrm/switch-to-multiple-cursors) (defvar rectangular-region-mode nil) @@ -71,16 +71,17 @@ multiple cursors to multiple lines." (defun rrm/repaint () "Start from the anchor and draw a rectangle between it and point." (if (not rectangular-region-mode) - (remove-hook 'post-command-hook 'rrm/repaint t) + (remove-hook 'post-command-hook #'rrm/repaint t) ;; else + (defvar annoying-arrows-mode) (rrm/remove-rectangular-region-overlays) (let* ((annoying-arrows-mode nil) (point-column (current-column)) (point-line (mc/line-number-at-pos)) (anchor-column (save-excursion (goto-char rrm/anchor) (current-column))) (anchor-line (save-excursion (goto-char rrm/anchor) (mc/line-number-at-pos))) - (left-column (if (< point-column anchor-column) point-column anchor-column)) - (right-column (if (> point-column anchor-column) point-column anchor-column)) + ;; (left-column (if (< point-column anchor-column) point-column anchor-column)) + ;; (right-column (if (> point-column anchor-column) point-column anchor-column)) (navigation-step (if (< point-line anchor-line) 1 -1))) (move-to-column anchor-column) (set-mark (point)) @@ -95,17 +96,15 @@ multiple cursors to multiple lines." (when (= point-column (current-column)) (mc/create-fake-cursor-at-point)))))))) -(defun rrm/switch-to-multiple-cursors (&rest forms) - "Switch from rectangular-region-mode to multiple-cursors-mode." +(defun rrm/switch-to-multiple-cursors (&rest _) + "Switch from `rectangular-region-mode' to `multiple-cursors-mode'." (interactive) (rectangular-region-mode 0) (multiple-cursors-mode 1)) -(defadvice er/expand-region (before switch-from-rrm-to-mc activate) - (when rectangular-region-mode - (rrm/switch-to-multiple-cursors))) - -(defadvice kill-ring-save (before switch-from-rrm-to-mc activate) +(advice-add 'er/expand-region :before #'rrm//switch-from-rrm-to-mc) +(advice-add 'kill-ring-save :before #'rrm//switch-from-rrm-to-mc) +(defun rrm//switch-from-rrm-to-mc (&rest _) (when rectangular-region-mode (rrm/switch-to-multiple-cursors))) @@ -117,10 +116,10 @@ multiple cursors to multiple lines." :keymap rectangular-region-mode-map (if rectangular-region-mode (progn - (add-hook 'after-change-functions 'rrm/switch-to-multiple-cursors t t) - (add-hook 'post-command-hook 'rrm/repaint t t)) - (remove-hook 'after-change-functions 'rrm/switch-to-multiple-cursors t) - (remove-hook 'post-command-hook 'rrm/repaint t) + (add-hook 'after-change-functions #'rrm/switch-to-multiple-cursors t t) + (add-hook 'post-command-hook #'rrm/repaint t t)) + (remove-hook 'after-change-functions #'rrm/switch-to-multiple-cursors t) + (remove-hook 'post-command-hook #'rrm/repaint t) (set-marker rrm/anchor nil))) (provide 'rectangular-region-mode)