Mercurial > emacs
comparison lisp/simple.el @ 8763:2b54e6deed2f
(kill-new): New optional argument means replace most recent kill.
(kill-append): Use that new interface.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Thu, 15 Sep 1994 21:30:21 +0000 |
parents | bd55f44d82f1 |
children | e2073805b688 |
comparison
equal
deleted
inserted
replaced
8762:644919e8d067 | 8763:2b54e6deed2f |
---|---|
990 "*Maximum length of kill ring before oldest elements are thrown away.") | 990 "*Maximum length of kill ring before oldest elements are thrown away.") |
991 | 991 |
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))) |
1005 | 1010 |
1006 (defun kill-append (string before-p) | 1011 (defun kill-append (string before-p) |
1007 "Append STRING to the end of the latest kill in the kill ring. | 1012 "Append STRING to the end of the latest kill in the kill ring. |
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. |
1020 If N is zero, `interprogram-paste-function' is set, and calling it | 1022 If N is zero, `interprogram-paste-function' is set, and calling it |
1021 returns a string, then that string is added to the front of the | 1023 returns a string, then that string is added to the front of the |