diff options
| -rw-r--r-- | doc/lispref/text.texi | 14 | ||||
| -rw-r--r-- | lisp/simple.el | 31 |
2 files changed, 26 insertions, 19 deletions
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 2db58f31237..6dde4c00f85 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi | |||
| @@ -1142,7 +1142,7 @@ If @var{n} is zero, indicating a request for the latest kill, | |||
| 1142 | @code{current-kill} calls the value of | 1142 | @code{current-kill} calls the value of |
| 1143 | @code{interprogram-paste-function} (documented below) before | 1143 | @code{interprogram-paste-function} (documented below) before |
| 1144 | consulting the kill ring. If that value is a function and calling it | 1144 | consulting the kill ring. If that value is a function and calling it |
| 1145 | returns a string or a list of several string, @code{current-kill} | 1145 | returns a string or a list of several strings, @code{current-kill} |
| 1146 | pushes the strings onto the kill ring and returns the first string. | 1146 | pushes the strings onto the kill ring and returns the first string. |
| 1147 | It also sets the yanking pointer to point to the kill-ring entry of | 1147 | It also sets the yanking pointer to point to the kill-ring entry of |
| 1148 | the first string returned by @code{interprogram-paste-function}, | 1148 | the first string returned by @code{interprogram-paste-function}, |
| @@ -1155,8 +1155,10 @@ move the yanking pointer. | |||
| 1155 | @defun kill-new string &optional replace | 1155 | @defun kill-new string &optional replace |
| 1156 | This function pushes the text @var{string} onto the kill ring and | 1156 | This function pushes the text @var{string} onto the kill ring and |
| 1157 | makes the yanking pointer point to it. It discards the oldest entry | 1157 | makes the yanking pointer point to it. It discards the oldest entry |
| 1158 | if appropriate. It also invokes the value of | 1158 | if appropriate. It also invokes the values of |
| 1159 | @code{interprogram-cut-function} (see below). | 1159 | @code{interprogram-paste-function} (subject to |
| 1160 | the user option @code{save-interprogram-paste-before-kill}) | ||
| 1161 | and @code{interprogram-cut-function} (see below). | ||
| 1160 | 1162 | ||
| 1161 | If @var{replace} is non-@code{nil}, then @code{kill-new} replaces the | 1163 | If @var{replace} is non-@code{nil}, then @code{kill-new} replaces the |
| 1162 | first element of the kill ring with @var{string}, rather than pushing | 1164 | first element of the kill ring with @var{string}, rather than pushing |
| @@ -1168,8 +1170,10 @@ This function appends the text @var{string} to the first entry in the | |||
| 1168 | kill ring and makes the yanking pointer point to the combined entry. | 1170 | kill ring and makes the yanking pointer point to the combined entry. |
| 1169 | Normally @var{string} goes at the end of the entry, but if | 1171 | Normally @var{string} goes at the end of the entry, but if |
| 1170 | @var{before-p} is non-@code{nil}, it goes at the beginning. This | 1172 | @var{before-p} is non-@code{nil}, it goes at the beginning. This |
| 1171 | function also invokes the value of @code{interprogram-cut-function} | 1173 | function calls @code{kill-new} as a subroutine, thus causing the |
| 1172 | (see below). | 1174 | values of @code{interprogram-cut-function} and possibly |
| 1175 | @code{interprogram-paste-function} (see below) to be invoked by | ||
| 1176 | extension. | ||
| 1173 | @end defun | 1177 | @end defun |
| 1174 | 1178 | ||
| 1175 | @defvar interprogram-paste-function | 1179 | @defvar interprogram-paste-function |
diff --git a/lisp/simple.el b/lisp/simple.el index aa266fd36ba..9483170a0b6 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -4319,12 +4319,11 @@ ring directly.") | |||
| 4319 | "The tail of the kill ring whose car is the last thing yanked.") | 4319 | "The tail of the kill ring whose car is the last thing yanked.") |
| 4320 | 4320 | ||
| 4321 | (defcustom save-interprogram-paste-before-kill nil | 4321 | (defcustom save-interprogram-paste-before-kill nil |
| 4322 | "Save clipboard strings into kill ring before replacing them. | 4322 | "Save existing clipboard text into kill ring before replacing it. |
| 4323 | When one selects something in another program to paste it into Emacs, | 4323 | A non-nil value ensures that Emacs kill operations do not |
| 4324 | but kills something in Emacs before actually pasting it, | 4324 | irrevocably overwrite existing clipboard text by saving it to the |
| 4325 | this selection is gone unless this variable is non-nil, | 4325 | `kill-ring' prior to the kill. Such text can subsequently be |
| 4326 | in which case the other program's selection is saved in the `kill-ring' | 4326 | retrieved via \\[yank] \\[yank-pop]]." |
| 4327 | before the Emacs kill and one can still paste it using \\[yank] \\[yank-pop]." | ||
| 4328 | :type 'boolean | 4327 | :type 'boolean |
| 4329 | :group 'killing | 4328 | :group 'killing |
| 4330 | :version "23.2") | 4329 | :version "23.2") |
| @@ -4344,7 +4343,7 @@ Optional second argument REPLACE non-nil means that STRING will replace | |||
| 4344 | the front of the kill ring, rather than being added to the list. | 4343 | the front of the kill ring, rather than being added to the list. |
| 4345 | 4344 | ||
| 4346 | When `save-interprogram-paste-before-kill' and `interprogram-paste-function' | 4345 | When `save-interprogram-paste-before-kill' and `interprogram-paste-function' |
| 4347 | are non-nil, saves the interprogram paste string(s) into `kill-ring' before | 4346 | are non-nil, save the interprogram paste string(s) into `kill-ring' before |
| 4348 | STRING. | 4347 | STRING. |
| 4349 | 4348 | ||
| 4350 | When the yank handler has a non-nil PARAM element, the original STRING | 4349 | When the yank handler has a non-nil PARAM element, the original STRING |
| @@ -4379,20 +4378,24 @@ argument should still be a \"useful\" string for such uses." | |||
| 4379 | (if interprogram-cut-function | 4378 | (if interprogram-cut-function |
| 4380 | (funcall interprogram-cut-function string))) | 4379 | (funcall interprogram-cut-function string))) |
| 4381 | 4380 | ||
| 4382 | ;; It has been argued that this should work similar to `self-insert-command' | 4381 | ;; It has been argued that this should work like `self-insert-command' |
| 4383 | ;; which merges insertions in undo-list in groups of 20 (hard-coded in cmds.c). | 4382 | ;; which merges insertions in `buffer-undo-list' in groups of 20 |
| 4383 | ;; (hard-coded in `undo-auto-amalgamate'). | ||
| 4384 | (defcustom kill-append-merge-undo nil | 4384 | (defcustom kill-append-merge-undo nil |
| 4385 | "Whether appending to kill ring also makes \\[undo] restore both pieces of text simultaneously." | 4385 | "Amalgamate appending kills with the last kill for undo. |
| 4386 | When non-nil, appending or prepending text to the last kill makes | ||
| 4387 | \\[undo] restore both pieces of text simultaneously." | ||
| 4386 | :type 'boolean | 4388 | :type 'boolean |
| 4387 | :group 'killing | 4389 | :group 'killing |
| 4388 | :version "25.1") | 4390 | :version "25.1") |
| 4389 | 4391 | ||
| 4390 | (defun kill-append (string before-p) | 4392 | (defun kill-append (string before-p) |
| 4391 | "Append STRING to the end of the latest kill in the kill ring. | 4393 | "Append STRING to the end of the latest kill in the kill ring. |
| 4392 | If BEFORE-P is non-nil, prepend STRING to the kill. | 4394 | If BEFORE-P is non-nil, prepend STRING to the kill instead. |
| 4393 | Also removes the last undo boundary in the current buffer, | 4395 | If `interprogram-cut-function' is non-nil, call it with the |
| 4394 | depending on `kill-append-merge-undo'. | 4396 | resulting kill. |
| 4395 | If `interprogram-cut-function' is set, pass the resulting kill to it." | 4397 | If `kill-append-merge-undo' is non-nil, remove the last undo |
| 4398 | boundary in the current buffer." | ||
| 4396 | (let* ((cur (car kill-ring))) | 4399 | (let* ((cur (car kill-ring))) |
| 4397 | (kill-new (if before-p (concat string cur) (concat cur string)) | 4400 | (kill-new (if before-p (concat string cur) (concat cur string)) |
| 4398 | (or (= (length cur) 0) | 4401 | (or (= (length cur) 0) |