aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/simple.el24
1 files changed, 13 insertions, 11 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 6bcfd42d46c..e05c1e7af8d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -992,13 +992,18 @@ ring directly.")
992(defvar kill-ring-yank-pointer nil 992(defvar kill-ring-yank-pointer nil
993 "The tail of the kill ring whose car is the last thing yanked.") 993 "The tail of the kill ring whose car is the last thing yanked.")
994 994
995(defun kill-new (string) 995(defun kill-new (string &optional replace)
996 "Make STRING the latest kill in the kill ring. 996 "Make STRING the latest kill in the kill ring.
997Set the kill-ring-yank pointer to point to it. 997Set the kill-ring-yank pointer to point to it.
998If `interprogram-cut-function' is non-nil, apply it to STRING." 998If `interprogram-cut-function' is non-nil, apply it to STRING.
999 (setq kill-ring (cons string kill-ring)) 999Optional second argument REPLACE non-nil means that STRING will replace
1000 (if (> (length kill-ring) kill-ring-max) 1000the front of the kill ring, rather than being added to the list."
1001 (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil)) 1001 (menu-bar-update-yank-menu string (and replace (car kill-ring)))
1002 (if replace
1003 (setcar kill-ring string)
1004 (setq kill-ring (cons string kill-ring))
1005 (if (> (length kill-ring) kill-ring-max)
1006 (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil)))
1002 (setq kill-ring-yank-pointer kill-ring) 1007 (setq kill-ring-yank-pointer kill-ring)
1003 (if interprogram-cut-function 1008 (if interprogram-cut-function
1004 (funcall interprogram-cut-function string t))) 1009 (funcall interprogram-cut-function string t)))
@@ -1008,12 +1013,9 @@ If `interprogram-cut-function' is non-nil, apply it to STRING."
1008If BEFORE-P is non-nil, prepend STRING to the kill. 1013If BEFORE-P is non-nil, prepend STRING to the kill.
1009If `interprogram-cut-function' is set, pass the resulting kill to 1014If `interprogram-cut-function' is set, pass the resulting kill to
1010it." 1015it."
1011 (setcar kill-ring 1016 (kill-new (if before-p
1012 (if before-p 1017 (concat string (car kill-ring))
1013 (concat string (car kill-ring)) 1018 (concat (car kill-ring) string)) t))
1014 (concat (car kill-ring) string)))
1015 (if interprogram-cut-function
1016 (funcall interprogram-cut-function (car kill-ring))))
1017 1019
1018(defun current-kill (n &optional do-not-move) 1020(defun current-kill (n &optional do-not-move)
1019 "Rotate the yanking point by N places, and then return that kill. 1021 "Rotate the yanking point by N places, and then return that kill.