summaryrefslogtreecommitdiff
path: root/doc/emacs/killing.texi
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-06-30 15:55:50 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-06-30 15:55:50 +0200
commitbb56f6c768acc070a8058bc8e7c91d5ee069ef7f (patch)
treefa9e62911c4722fa6e227e5300c53b6b20648364 /doc/emacs/killing.texi
parent46a66c6248be20c7c3ef7f57a8f25af39b975eb6 (diff)
downloademacs-bb56f6c768acc070a8058bc8e7c91d5ee069ef7f.tar.gz
Add new user option to transform kill ring contents
* doc/emacs/killing.texi (Kill Options): Document it. * lisp/simple.el (kill-new): Use it. (kill-transform-function): New user option (bug#29013).
Diffstat (limited to 'doc/emacs/killing.texi')
-rw-r--r--doc/emacs/killing.texi15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi
index 4291afec56f..6e4fd77e8b9 100644
--- a/doc/emacs/killing.texi
+++ b/doc/emacs/killing.texi
@@ -269,6 +269,21 @@ happens. But if you set the variable @code{kill-read-only-ok} to a
non-@code{nil} value, they just print a message in the echo area to
explain why the text has not been erased.
+@vindex kill-transform-function
+ Before saving the kill to the kill ring, you can transform the
+string using @code{kill-transform-function}. It's called with the
+string to be killed, and it should return the string you want to be
+saved. It can also return @code{nil}, in which case the string won't
+be saved to the kill ring. For instance, if you never want to save
+a pure white space string to the kill ring, you can say:
+
+@lisp
+(setq kill-transform-function
+ (lambda (string)
+ (and (not (string-blank-p string))
+ string)))
+@end lisp
+
@vindex kill-do-not-save-duplicates
If you change the variable @code{kill-do-not-save-duplicates} to a
non-@code{nil} value, identical subsequent kills yield a single