diff options
| author | Sam Steingold | 2009-08-26 20:55:39 +0000 |
|---|---|---|
| committer | Sam Steingold | 2009-08-26 20:55:39 +0000 |
| commit | 4ed8c7aadb59c8ae75641710e3d9ff5bddbbd952 (patch) | |
| tree | fb8aeebbad289d02283142298d99a601d1bb0f9f | |
| parent | 5654bf6320a8469c5ea37a8aa09b2c16f773865e (diff) | |
| download | emacs-4ed8c7aadb59c8ae75641710e3d9ff5bddbbd952.tar.gz emacs-4ed8c7aadb59c8ae75641710e3d9ff5bddbbd952.zip | |
(save-interprogram-paste-before-kill): New user option.
(kill-new): When `save-interprogram-paste-before-kill' is non-nil,
save the interprogram-paste into kill-ring before overriding it
with the Emacs kill.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/simple.el | 23 |
2 files changed, 30 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f3ab3384170..d35097f74a1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2009-08-26 Sam Steingold <sds@gnu.org> | ||
| 2 | |||
| 3 | * simple.el (save-interprogram-paste-before-kill): New user option. | ||
| 4 | (kill-new): When `save-interprogram-paste-before-kill' is non-nil, | ||
| 5 | save the interprogram-paste into kill-ring before overriding it | ||
| 6 | with the Emacs kill. | ||
| 7 | |||
| 1 | 2009-08-26 Dan Nicolaescu <dann@ics.uci.edu> | 8 | 2009-08-26 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 9 | ||
| 3 | * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el. | 10 | * vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el. |
diff --git a/lisp/simple.el b/lisp/simple.el index 7349f4d0617..88cc61a835b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -2794,6 +2794,17 @@ ring directly.") | |||
| 2794 | (defvar kill-ring-yank-pointer nil | 2794 | (defvar kill-ring-yank-pointer nil |
| 2795 | "The tail of the kill ring whose car is the last thing yanked.") | 2795 | "The tail of the kill ring whose car is the last thing yanked.") |
| 2796 | 2796 | ||
| 2797 | (defcustom save-interprogram-paste-before-kill nil | ||
| 2798 | "Save the paste strings into `kill-ring' before replacing it with emacs strings. | ||
| 2799 | When one selects something in another program to paste it into Emacs, | ||
| 2800 | but kills something in Emacs before actually pasting it, | ||
| 2801 | this selection is gone unless this variable is non-nil, | ||
| 2802 | in which case the other program's selection is saved in the `kill-ring' | ||
| 2803 | before the Emacs kill and one can still paste it using \\[yank] \\[yank-pop]." | ||
| 2804 | :type 'boolean | ||
| 2805 | :group 'killing | ||
| 2806 | :version "23.2") | ||
| 2807 | |||
| 2797 | (defun kill-new (string &optional replace yank-handler) | 2808 | (defun kill-new (string &optional replace yank-handler) |
| 2798 | "Make STRING the latest kill in the kill ring. | 2809 | "Make STRING the latest kill in the kill ring. |
| 2799 | Set `kill-ring-yank-pointer' to point to it. | 2810 | Set `kill-ring-yank-pointer' to point to it. |
| @@ -2806,6 +2817,10 @@ inserted into a buffer; see `insert-for-yank' for details. | |||
| 2806 | When a yank handler is specified, STRING must be non-empty (the yank | 2817 | When a yank handler is specified, STRING must be non-empty (the yank |
| 2807 | handler, if non-nil, is stored as a `yank-handler' text property on STRING). | 2818 | handler, if non-nil, is stored as a `yank-handler' text property on STRING). |
| 2808 | 2819 | ||
| 2820 | When `save-interprogram-paste-before-kill' and `interprogram-paste-function' | ||
| 2821 | are non-nil, saves the interprogram paste string(s) into `kill-ring' before | ||
| 2822 | STRING. | ||
| 2823 | |||
| 2809 | When the yank handler has a non-nil PARAM element, the original STRING | 2824 | When the yank handler has a non-nil PARAM element, the original STRING |
| 2810 | argument is not used by `insert-for-yank'. However, since Lisp code | 2825 | argument is not used by `insert-for-yank'. However, since Lisp code |
| 2811 | may access and use elements from the kill ring directly, the STRING | 2826 | may access and use elements from the kill ring directly, the STRING |
| @@ -2819,6 +2834,14 @@ argument should still be a \"useful\" string for such uses." | |||
| 2819 | (list string "yank-handler specified for empty string")))) | 2834 | (list string "yank-handler specified for empty string")))) |
| 2820 | (if (fboundp 'menu-bar-update-yank-menu) | 2835 | (if (fboundp 'menu-bar-update-yank-menu) |
| 2821 | (menu-bar-update-yank-menu string (and replace (car kill-ring)))) | 2836 | (menu-bar-update-yank-menu string (and replace (car kill-ring)))) |
| 2837 | (when save-interprogram-paste-before-kill | ||
| 2838 | (let ((interprogram-paste (and interprogram-paste-function | ||
| 2839 | (funcall interprogram-paste-function)))) | ||
| 2840 | (when interprogram-paste | ||
| 2841 | (if (listp interprogram-paste) | ||
| 2842 | (dolist (s (nreverse interprogram-paste)) | ||
| 2843 | (push s kill-ring)) | ||
| 2844 | (push interprogram-paste kill-ring))))) | ||
| 2822 | (if (and replace kill-ring) | 2845 | (if (and replace kill-ring) |
| 2823 | (setcar kill-ring string) | 2846 | (setcar kill-ring string) |
| 2824 | (push string kill-ring) | 2847 | (push string kill-ring) |