[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp ChangeLog simple.el
From: |
Sam Steingold |
Subject: |
[Emacs-diffs] emacs/lisp ChangeLog simple.el |
Date: |
Wed, 26 Aug 2009 20:55:46 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Sam Steingold <sds> 09/08/26 20:55:44
Modified files:
lisp : ChangeLog simple.el
Log message:
(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.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16020&r2=1.16021
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/simple.el?cvsroot=emacs&r1=1.1005&r2=1.1006
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16020
retrieving revision 1.16021
diff -u -b -r1.16020 -r1.16021
--- ChangeLog 26 Aug 2009 17:54:05 -0000 1.16020
+++ ChangeLog 26 Aug 2009 20:55:39 -0000 1.16021
@@ -1,3 +1,10 @@
+2009-08-26 Sam Steingold <address@hidden>
+
+ * simple.el (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.
+
2009-08-26 Dan Nicolaescu <address@hidden>
* vc.el (vc-trunk-p): Rename to vc-rcs-trunk-p and move to vc-rcs.el.
Index: simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.1005
retrieving revision 1.1006
diff -u -b -r1.1005 -r1.1006
--- simple.el 25 Aug 2009 08:45:41 -0000 1.1005
+++ simple.el 26 Aug 2009 20:55:43 -0000 1.1006
@@ -2794,6 +2794,17 @@
(defvar kill-ring-yank-pointer nil
"The tail of the kill ring whose car is the last thing yanked.")
+(defcustom save-interprogram-paste-before-kill nil
+ "Save the paste strings into `kill-ring' before replacing it with emacs
strings.
+When one selects something in another program to paste it into Emacs,
+but kills something in Emacs before actually pasting it,
+this selection is gone unless this variable is non-nil,
+in which case the other program's selection is saved in the `kill-ring'
+before the Emacs kill and one can still paste it using \\[yank] \\[yank-pop]."
+ :type 'boolean
+ :group 'killing
+ :version "23.2")
+
(defun kill-new (string &optional replace yank-handler)
"Make STRING the latest kill in the kill ring.
Set `kill-ring-yank-pointer' to point to it.
@@ -2806,6 +2817,10 @@
When a yank handler is specified, STRING must be non-empty (the yank
handler, if non-nil, is stored as a `yank-handler' text property on STRING).
+When `save-interprogram-paste-before-kill' and `interprogram-paste-function'
+are non-nil, saves the interprogram paste string(s) into `kill-ring' before
+STRING.
+
When the yank handler has a non-nil PARAM element, the original STRING
argument is not used by `insert-for-yank'. However, since Lisp code
may access and use elements from the kill ring directly, the STRING
@@ -2819,6 +2834,14 @@
(list string "yank-handler specified for empty string"))))
(if (fboundp 'menu-bar-update-yank-menu)
(menu-bar-update-yank-menu string (and replace (car kill-ring))))
+ (when save-interprogram-paste-before-kill
+ (let ((interprogram-paste (and interprogram-paste-function
+ (funcall interprogram-paste-function))))
+ (when interprogram-paste
+ (if (listp interprogram-paste)
+ (dolist (s (nreverse interprogram-paste))
+ (push s kill-ring))
+ (push interprogram-paste kill-ring)))))
(if (and replace kill-ring)
(setcar kill-ring string)
(push string kill-ring)