[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master c9a8a47ba4: Add new user option 'yank-transform-functions'
From: |
Stefan Monnier |
Subject: |
Re: master c9a8a47ba4: Add new user option 'yank-transform-functions' |
Date: |
Tue, 24 May 2022 11:24:26 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Lars Ingebrigtsen [2022-05-19 18:15:45] wrote:
> * lisp/simple.el (yank-transform-functions): New user option.
> (yank): Mention it.
Hmm... why is this a user option?
[ Also, tho less importantly: Why is it a list of functions instead of
being symmetric with Emacs-28's `kill-transform-function`? ]
Are users expected to be able to make use of this with Custom? How?
> +@defopt yank-transform-functions
> +This variable is a list of functions. Each function is called (in
> +order) with the string to be yanked as the parameter, and should
> +return a (possibly transformed) string. This variable can be set
> +globally, but can also be used to create new commands that are
> +variations on @code{yank}. For instance, to create a command that
> +works like @code{yank}, but cleans up whitespace before inserting, you
> +could say something like:
> +
> +@lisp
> +(defun yank-with-clean-whitespace ()
> + (interactive)
> + (let ((yank-transform-functions
> + '(string-clean-whitespace)))
> + (call-interactively #'yank)))
> +@end lisp
> +@end defopt
This example doesn't call for a `defcustom` but for a `defvar`, no?
Stefan
- Re: master c9a8a47ba4: Add new user option 'yank-transform-functions',
Stefan Monnier <=