diff options
| author | Karl Heuer | 1994-09-15 21:30:21 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-09-15 21:30:21 +0000 |
| commit | f914dc91cbd28111a52a42e46b97563a94208e5b (patch) | |
| tree | acd5074421b222dc9edb1f2b5f7a7517c6fe7fa5 | |
| parent | f2495b93d43488d819f57bd291296f7c4a8b596b (diff) | |
| download | emacs-f914dc91cbd28111a52a42e46b97563a94208e5b.tar.gz emacs-f914dc91cbd28111a52a42e46b97563a94208e5b.zip | |
(kill-new): New optional argument means replace most recent kill.
(kill-append): Use that new interface.
| -rw-r--r-- | lisp/simple.el | 24 |
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. |
| 997 | Set the kill-ring-yank pointer to point to it. | 997 | Set the kill-ring-yank pointer to point to it. |
| 998 | If `interprogram-cut-function' is non-nil, apply it to STRING." | 998 | If `interprogram-cut-function' is non-nil, apply it to STRING. |
| 999 | (setq kill-ring (cons string kill-ring)) | 999 | Optional second argument REPLACE non-nil means that STRING will replace |
| 1000 | (if (> (length kill-ring) kill-ring-max) | 1000 | the 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." | |||
| 1008 | If BEFORE-P is non-nil, prepend STRING to the kill. | 1013 | If BEFORE-P is non-nil, prepend STRING to the kill. |
| 1009 | If `interprogram-cut-function' is set, pass the resulting kill to | 1014 | If `interprogram-cut-function' is set, pass the resulting kill to |
| 1010 | it." | 1015 | it." |
| 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. |