unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Subject: Re: master c9a8a47ba4: Add new user option 'yank-transform-functions'
Date: Tue, 24 May 2022 11:24:26 -0400	[thread overview]
Message-ID: <jwvr14jnerg.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20220519221545.35270C009A8@vcs2.savannah.gnu.org> (Lars Ingebrigtsen's message of "Thu, 19 May 2022 18:15:45 -0400 (EDT)")

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




       reply	other threads:[~2022-05-24 15:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <165299854484.648.782279094390042574@vcs2.savannah.gnu.org>
     [not found] ` <20220519221545.35270C009A8@vcs2.savannah.gnu.org>
2022-05-24 15:24   ` Stefan Monnier [this message]
2022-05-24 16:02     ` master c9a8a47ba4: Add new user option 'yank-transform-functions' Lars Ingebrigtsen
2022-05-24 16:15       ` Stefan Monnier
2022-05-24 16:07     ` Robert Pluim
2022-05-24 17:13       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvr14jnerg.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).