[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors 84ef509 072/434: Save users own white/bla
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors 84ef509 072/434: Save users own white/black lists in .mc-lists.el |
Date: |
Sat, 7 Aug 2021 09:19:57 -0400 (EDT) |
branch: elpa/multiple-cursors
commit 84ef509350f87fe949218f162fecfab2c770896d
Author: Magnar Sveen <magnars@gmail.com>
Commit: Magnar Sveen <magnars@gmail.com>
Save users own white/black lists in .mc-lists.el
---
multiple-cursors-core.el | 58 +++++++++++++++++++++++++++++-------------------
1 file changed, 35 insertions(+), 23 deletions(-)
diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el
index 8598f5e..f91107f 100644
--- a/multiple-cursors-core.el
+++ b/multiple-cursors-core.el
@@ -177,10 +177,12 @@ cursor with updated info."
(defun mc/prompt-for-inclusion-in-whitelist (original-command)
"Asks the user, then adds the command either to the once-list or the
all-list."
- (if (y-or-n-p (format "Do %S for all cursors?" original-command))
- (add-to-list 'mc/cmds-to-run-for-all original-command)
- (add-to-list 'mc/cmds-to-run-once original-command)
- nil))
+ (let ((all-p (y-or-n-p (format "Do %S for all cursors?" original-command))))
+ (if all-p
+ (add-to-list 'mc/cmds-to-run-for-all original-command)
+ (add-to-list 'mc/cmds-to-run-once original-command))
+ (mc/save-lists)
+ all-p))
(defun mc/num-cursors ()
"The number of cursors (real and fake) in the buffer."
@@ -364,27 +366,37 @@ from being executed if in multiple-cursors-mode."
smart-down)
"Default set of commands that should be mirrored by all cursors")
+(defvar mc/list-file "~/.emacs.d/.mc-lists.el"
+ "The position of the file that keeps track of your preferences
+for running commands with multiple cursors.")
+
+(defun mc/save-lists ()
+ (with-temp-file mc/list-file
+ (emacs-lisp-mode)
+ (insert ";; This file is automatically generated by the multiple-cursors
extension.")
+ (newline)
+ (insert ";; It keeps track of your preferences for running commands with
multiple cursors.")
+ (newline)
+ (newline)
+ (insert "(setq mc/cmds-to-run-for-all '(")
+ (mapc #'(lambda (cmd) (insert (format "%S" cmd)) (newline-and-indent))
mc/cmds-to-run-for-all)
+ (when mc/cmds-to-run-for-all
+ (next-line -1)
+ (end-of-line))
+ (insert "))")
+ (newline)
+ (newline)
+ (insert "(setq mc/cmds-to-run-once '(")
+ (mapc #'(lambda (cmd) (insert (format "%S" cmd)) (newline-and-indent))
mc/cmds-to-run-once)
+ (when mc/cmds-to-run-once
+ (next-line -1)
+ (end-of-line))
+ (insert "))")
+ (newline)))
+
(defvar mc/cmds-to-run-for-all nil
"Commands to run for all cursors in multiple-cursors-mode")
-(setq mc/cmds-to-run-for-all '(save-region-or-current-line
- kill-region-or-backward-word
- change-number-at-point
- dired-back-to-start-of-files
- yank-indented
- wrap-region-trigger
- yas/expand
- org-shiftright
- sgml-slash
- slime-space
- js2-beginning-of-line
- js2-end-of-line
- js2-insert-and-indent
- js2r-inline-var
- c-electric-delete-forward
- c-electric-backspace
- c-electric-paren
- c-electric-semi&comma))
-
+(load mc/list-file t) ;; load, but no errors if it does not exist yet please
(provide 'multiple-cursors-core)
- [nongnu] elpa/multiple-cursors efd79f3 043/434: Add undo to list of known run-only-once commands., (continued)
- [nongnu] elpa/multiple-cursors efd79f3 043/434: Add undo to list of known run-only-once commands., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors b60cbc3 044/434: Add support for yank-pop, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 1db643c 048/434: Add support for modes that remap commands., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 37ddaf2 053/434: Set this-command for each cursor., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d7be50e 041/434: rectangular-region-mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 45488df 052/434: yank-pop is supported, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 6f9911f 054/434: Add more explanatory prose., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 466d036 063/434: Prompt for inclusion in white/black-lists when met with an unknown command, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 092b0a1 074/434: Cycle through cursors with C-v and M-v, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 0512561 076/434: Skip lines in rectangular-region-mode that are too short for the rectangle., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 84ef509 072/434: Save users own white/black lists in .mc-lists.el,
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors 15e88c6 071/434: Move more mode-specific cmds into personal lists., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 0bfd611 068/434: More consistent naming., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ca0e0ae 084/434: Tests for rectangular-region-mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors a4c4714 081/434: Remove multiple cursors when reverting buffer., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 36b262c 086/434: Added mc-version of mark-next-like-this, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 491b206 103/434: Use forward-line instead of next/previous-line in lisp code., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors b1ea7f2 095/434: Add licences to all el-files., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors f6403ea 112/434: Fix assertion, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 6481972 113/434: Update ecukes, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 241e34e 123/434: Remove mark-multiple integration, ELPA Syncer, 2021/08/07