[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors 754de4e 243/434: Backport set-temporary-o
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors 754de4e 243/434: Backport set-temporary-overlay-map to emacs <24.3 |
Date: |
Sat, 7 Aug 2021 09:20:34 -0400 (EDT) |
branch: elpa/multiple-cursors
commit 754de4e63b4b15b17aff69d58ff6c5b0a2a47a7e
Author: Magnar Sveen <magnars@gmail.com>
Commit: Magnar Sveen <magnars@gmail.com>
Backport set-temporary-overlay-map to emacs <24.3
Fixes #88
---
mc-mark-more.el | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/mc-mark-more.el b/mc-mark-more.el
index d641673..3368474 100644
--- a/mc-mark-more.el
+++ b/mc-mark-more.el
@@ -281,6 +281,44 @@ With zero ARG, skip the last one and mark next."
(multiple-cursors-mode 1)
(multiple-cursors-mode 0)))
+(when (not (fboundp 'set-temporary-overlay-map))
+ ;; Backport this function from newer emacs versions
+ (defun set-temporary-overlay-map (map &optional keep-pred)
+ "Set a new keymap that will only exist for a short period of time.
+The new keymap to use must be given in the MAP variable. When to
+remove the keymap depends on user input and KEEP-PRED:
+
+- if KEEP-PRED is nil (the default), the keymap disappears as
+ soon as any key is pressed, whether or not the key is in MAP;
+
+- if KEEP-PRED is t, the keymap disappears as soon as a key *not*
+ in MAP is pressed;
+
+- otherwise, KEEP-PRED must be a 0-arguments predicate that will
+ decide if the keymap should be removed (if predicate returns
+ nil) or kept (otherwise). The predicate will be called after
+ each key sequence."
+
+ (let* ((clearfunsym (make-symbol "clear-temporary-overlay-map"))
+ (overlaysym (make-symbol "t"))
+ (alist (list (cons overlaysym map)))
+ (clearfun
+ `(lambda ()
+ (unless ,(cond ((null keep-pred) nil)
+ ((eq t keep-pred)
+ `(eq this-command
+ (lookup-key ',map
+ (this-command-keys-vector))))
+ (t `(funcall ',keep-pred)))
+ (remove-hook 'pre-command-hook ',clearfunsym)
+ (setq emulation-mode-map-alists
+ (delq ',alist emulation-mode-map-alists))))))
+ (set overlaysym overlaysym)
+ (fset clearfunsym clearfun)
+ (add-hook 'pre-command-hook clearfunsym)
+
+ (push alist emulation-mode-map-alists))))
+
;;;###autoload
(defun mc/mark-more-like-this-extended ()
"Like mark-more-like-this, but then lets you adjust with arrows key.
- [nongnu] elpa/multiple-cursors aa9a1ec 220/434: Add failing scenarios for mark-all-symbols/words, (continued)
- [nongnu] elpa/multiple-cursors aa9a1ec 220/434: Add failing scenarios for mark-all-symbols/words, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors e7a5fe6 213/434: Release 1.2.1, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 6b09b9c 172/434: Add some more basic commands to the run-all and run-once lists., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 7382b46 170/434: Merge pull request #30 from gvol/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 5f7c92b 173/434: Add more backward-delete commands to run-for-all, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 3f3cdc6 207/434: Merge pull request #56 from paradoxxxzero/transient-mark-mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 7d79b98 182/434: Autoload new functions., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 0b9aae1 188/434: Merge pull request #40 from tkf/fix-dump-list, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 56839df 208/434: Update docs with mc/edit-*-lines, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors dc0aa99 193/434: Simplify travis run script, and make it work when ECUKES_EMACS has a space in the path, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 754de4e 243/434: Backport set-temporary-overlay-map to emacs <24.3,
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors 4c293c4 244/434: Disable snapshot CI, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 8dfe725 269/434: Abort immediately when empty search pattern is passed to 'mc/mark-all-in-region', ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ec47813 274/434: Derp, multiple cursors means > 1, not > 0., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 17c48f9 278/434: Merge pull request #111 from mathrick/mark-all-dwim, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors cfe4bd9 280/434: Add python-indent-dedent-line-backspace to run-for-all, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 3cfae1d 290/434: Merge pull request #122 from kyanagi/appropriate-error-messages-when-no-fake-cursors-exist, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors f5866d6 294/434: Fix typo in readme, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 0847147 300/434: Merge pull request #143 from mjdarby/jedi-mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d184f35 301/434: Add company-mode to the list of unsupported minor modes., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 4b0e912 310/434: Added description of mc-hide-unmached-mode to Readme, ELPA Syncer, 2021/08/07