From 25b0dca82e3c132d2c7948658b33714914e46194 Mon Sep 17 00:00:00 2001 From: Laurence Warne Date: Sun, 11 Feb 2024 20:16:20 +0000 Subject: [PATCH 1/2] Fix byte compilation warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the byte compilation warnings: In mc--read-char: multiple-cursors-core.el:347:2: Warning: reference to free variable ‘multiple-cursors-mode’ In mc--read-quoted-char: multiple-cursors-core.el:348:2: Warning: reference to free variable ‘multiple-cursors-mode’ In mc--register-read-with-preview: multiple-cursors-core.el:349:2: Warning: reference to free variable ‘multiple-cursors-mode’ In mc--read-char-from-minibuffer: multiple-cursors-core.el:350:2: Warning: reference to free variable ‘multiple-cursors-mode’ In toplevel form: mc-mark-more.el:95:2: Warning: defvar `mc/enclose-search-term' docstring has wrong usage of unescaped single quotes (use \= or different quoting) In mc/mark-more-like-this-extended: mc-mark-more.el:501:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting) mc-mark-more.el:522:22: Warning: reference to free variable ‘mc/mark-more-like-this-extended-keymap’ In end of data: mc-mark-more.el:724:27: Warning: the function ‘sgml-skip-tag-forward’ is not known to be defined. mc-mark-more.el:673:8: Warning: the function ‘sgml-get-context’ is not known to be defined. In end of data: mc-hide-unmatched-lines-mode.el:110:1: Warning: the function ‘sgml-skip-tag-forward’ is not known to be defined. mc-hide-unmatched-lines-mode.el:110:1: Warning: the function ‘sgml-get-context’ is not known to be defined. In end of data: multiple-cursors-core.el:567:43: Warning: the function ‘sgml-skip-tag-forward’ is not known to be defined. multiple-cursors-core.el:535:25: Warning: the function ‘sgml-get-context’ is not known to be defined. In end of data: mc-cycle-cursors.el:124:1: Warning: the function ‘sgml-skip-tag-forward’ is not known to be defined. mc-cycle-cursors.el:124:1: Warning: the function ‘sgml-get-context’ is not known to be defined. --- mc-mark-more.el | 17 +++++++++-------- multiple-cursors-core.el | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/mc-mark-more.el b/mc-mark-more.el index e4a141e..3bc4b9c 100644 --- a/mc-mark-more.el +++ b/mc-mark-more.el @@ -29,6 +29,9 @@ (require 'multiple-cursors-core) (require 'thingatpt) +(require 'sgml-mode) + +(defvar mc/mark-more-like-this-extended-keymap (make-sparse-keymap)) (defun mc/cursor-end (cursor) (if (overlay-get cursor 'mark-active) @@ -96,8 +99,8 @@ to (point)), or nil." "How should mc/mark-more-* search for more matches? Match everything: nil -Match only whole words: 'words -Match only whole symbols: 'symbols +Match only whole words: \\='words +Match only whole symbols: \\='symbols Use like case-fold-search, don't recommend setting it globally.") @@ -502,15 +505,15 @@ remove the keymap depends on user input and KEEP-PRED: "Like mark-more-like-this, but then lets you adjust with arrow keys. The adjustments work like this: - Mark previous like this and set direction to 'up - Mark next like this and set direction to 'down + Mark previous like this and set direction to \\='up + Mark next like this and set direction to \\='down -If direction is 'up: +If direction is \\='up: Skip past the cursor furthest up Remove the cursor furthest up -If direction is 'down: +If direction is \\='down: Remove the cursor furthest down Skip past the cursor furthest down @@ -558,8 +561,6 @@ are we working on the next or previous cursors?") (mc/skip-to-next-like-this)) (mc/mmlte--message)) -(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) diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el index 02a9e75..ead1ed3 100644 --- a/multiple-cursors-core.el +++ b/multiple-cursors-core.el @@ -334,7 +334,7 @@ values." (let ((mc-name (intern (concat "mc--" (symbol-name fn-name))))) `(progn (defun ,mc-name (orig-fun &rest args) - (if (not multiple-cursors-mode) + (if (not (bound-and-true-p multiple-cursors-mode)) (apply orig-fun args) (let* ((cache-key (cons ,(symbol-name fn-name) (,args-cache-key-fn args))) (cached-value (assoc cache-key mc--input-function-cache)) From ba7852f192c149b4639cefdeff860331a63bf99d Mon Sep 17 00:00:00 2001 From: Laurence Warne Date: Tue, 13 Feb 2024 21:00:51 +0000 Subject: [PATCH 2/2] Move mc/mark-more-like-this-extended-keymap defvar location --- mc-mark-more.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mc-mark-more.el b/mc-mark-more.el index 3bc4b9c..51f867e 100644 --- a/mc-mark-more.el +++ b/mc-mark-more.el @@ -31,8 +31,6 @@ (require 'thingatpt) (require 'sgml-mode) -(defvar mc/mark-more-like-this-extended-keymap (make-sparse-keymap)) - (defun mc/cursor-end (cursor) (if (overlay-get cursor 'mark-active) (max (overlay-get cursor 'point) @@ -500,6 +498,13 @@ remove the keymap depends on user input and KEEP-PRED: (push alist emulation-mode-map-alists)))) +(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) + ;;;###autoload (defun mc/mark-more-like-this-extended () "Like mark-more-like-this, but then lets you adjust with arrow keys. @@ -561,11 +566,6 @@ are we working on the next or previous cursors?") (mc/skip-to-next-like-this)) (mc/mmlte--message)) -(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) - (defvar mc--restrict-mark-all-to-symbols nil) ;;;###autoload