[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors ba11b12 051/434: Make interprogram-paste
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors ba11b12 051/434: Make interprogram-paste work for all cursors. |
Date: |
Sat, 7 Aug 2021 09:19:53 -0400 (EDT) |
branch: elpa/multiple-cursors
commit ba11b12c74f25ddf421a65221aa83bcc8a1337af
Author: Magnar Sveen <magnars@gmail.com>
Commit: Magnar Sveen <magnars@gmail.com>
Make interprogram-paste work for all cursors.
---
multiple-cursors-core.el | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el
index 61b4f49..4006599 100644
--- a/multiple-cursors-core.el
+++ b/multiple-cursors-core.el
@@ -39,6 +39,7 @@ highlights the entire width of the window."
"Store relevant info about point and mark in the given overlay."
(overlay-put o 'point (set-marker (make-marker) (point)))
(overlay-put o 'kill-ring kill-ring)
+ (overlay-put o 'kill-ring-yank-pointer kill-ring-yank-pointer)
(overlay-put o 'mark (set-marker (make-marker) (mark)))
(overlay-put o 'mark-ring mark-ring)
(overlay-put o 'mark-active mark-active)
@@ -51,6 +52,7 @@ highlights the entire width of the window."
"Restore point and mark from stored info in the given overlay."
(goto-char (overlay-get o 'point))
(setq kill-ring (overlay-get o 'kill-ring))
+ (setq kill-ring-yank-pointer (overlay-get o 'kill-ring-yank-pointer))
(set-marker (mark-marker) (overlay-get o 'mark))
(setq mark-ring (overlay-get o 'mark-ring))
(setq mark-active (overlay-get o 'mark-active))
@@ -189,6 +191,32 @@ from being executed if in multiple-cursors-mode."
(unsupported-cmd isearch-backward ". Feel free to add a compatible version.")
(unsupported-cmd delete-char ", delete-forward-char is preferred for
interactive use.")
+;; Fixing certain commands
+;;----------------------------------------------------------------------------------------
+;; Make sure pastes from other programs are added to all kill-rings when
yanking
+(defadvice current-kill (before interprogram-paste-for-all-cursors activate)
+ (let ((interprogram-paste (and (= n 0)
+ interprogram-paste-function
+ (funcall interprogram-paste-function))))
+ (when interprogram-paste
+ ;; Add interprogram-paste to normal kill ring, just
+ ;; like current-kill usually does for itself.
+ (let ((interprogram-cut-function nil))
+ (if (listp 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.
+ (mc/for-each-fake-cursor
+ (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))
+ (kill-new interprogram-paste))
+ (overlay-put cursor 'kill-ring kill-ring)
+ (overlay-put cursor 'kill-ring-yank-pointer
kill-ring-yank-pointer)))))))
+;;----------------------------------------------------------------------------------------
+
;; Commands to run only once (not yet in use)
(setq mc--cmds-run-once '(mark-next-like-this
save-buffer
- [nongnu] elpa/multiple-cursors 241e34e 123/434: Remove mark-multiple integration, (continued)
- [nongnu] elpa/multiple-cursors 241e34e 123/434: Remove mark-multiple integration, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors f040a33 143/434: Add execute-extended-command to run-once list, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ef7eddf 021/434: Started adding feature tests., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 00896cf 030/434: Refactor: simplify saving of state for cursors., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors c07d761 009/434: Some thoughts about combining with mark-multiple., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d8f5116 013/434: Add more commands to multiple-cursors whitelist., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 1fcf7ed 016/434: More white-listing of commands., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors b51ee01 017/434: More white-listing., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 53dd119 032/434: Add docstring., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors c2bb81f 042/434: Dont forget to require rectangular-region-mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ba11b12 051/434: Make interprogram-paste work for all cursors.,
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors 8c8d52f 049/434: Run pre-command-hooks for each cursor, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors c1fba2c 111/434: Add travis badge, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors f73569f 125/434: Update documentation., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ce777dc 134/434: Add some mouse-commands to the run-once list., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 879ddb0 150/434: Add Takafumi Arakaki to list of contributors, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 64ffd81 142/434: Add quoted-insert to run-for-all list., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 00f9055 146/434: Add mc/dump-list to make mc/save-lists diff-friendly, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 7a6eb0d 145/434: Never execute keyboard macros for fake cursors., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 82a1fe3 209/434: Add mc/sort-regions and mc/reverse-regions, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors aa9a1ec 220/434: Add failing scenarios for mark-all-symbols/words, ELPA Syncer, 2021/08/07