From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: master c9a8a47ba4: Add new user option 'yank-transform-functions' Date: Tue, 24 May 2022 12:15:13 -0400 Message-ID: References: <165299854484.648.782279094390042574@vcs2.savannah.gnu.org> <20220519221545.35270C009A8@vcs2.savannah.gnu.org> <87k0aahqbg.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28559"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 24 18:43:40 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ntXdE-0007Dm-Ct for ged-emacs-devel@m.gmane-mx.org; Tue, 24 May 2022 18:43:40 +0200 Original-Received: from localhost ([::1]:40804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntXdA-0007Zg-AF for ged-emacs-devel@m.gmane-mx.org; Tue, 24 May 2022 12:43:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntXBp-000458-I0 for emacs-devel@gnu.org; Tue, 24 May 2022 12:15:21 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:60782) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntXBm-0002Zm-A7 for emacs-devel@gnu.org; Tue, 24 May 2022 12:15:19 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 3AC8A1001CB; Tue, 24 May 2022 12:15:16 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 6D9F2100091; Tue, 24 May 2022 12:15:14 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1653408914; bh=otQdRpIqs8IIxKlaTLPdXGsi2I02+TyrZt8LA2Nr9rs=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=DLekDuUZyS8KLwYJj15fYExBb7Hw1UU9onktA5eGqRu2fA4R0SyygMnaCUsRv/Xqk hDckg33Bm5mJcba8Lw2qYKIZw+4R0EFmShKYOQTx6/wAsvt38QMFrk9azxcaBWSnAC 8uiYdn+bXndAZ92eFXPxOgbOOwJwV/BMEILjg+PFWJyCkt3l3S5rPB/8ZbGTbWguHF FU+htDwBuhQAzbFruRU8f85l9PR/+Xw62vcqewP9QPaB1YcVlK8UBYy5mUX0nGVVA7 ivRtjQGFvphxeZLrIPOVzSxtVnduIEyA5Etf9mptu5eLTsS0ZQosM4E4klPl6x7jHf NrqGoX4JXDrQA== Original-Received: from pastel (unknown [45.72.221.51]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 41D7812034C; Tue, 24 May 2022 12:15:14 -0400 (EDT) In-Reply-To: <87k0aahqbg.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 24 May 2022 18:02:11 +0200") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:290198 Archived-At: Lars Ingebrigtsen [2022-05-24 18:02:11] wrote: > Stefan Monnier writes: >>> * 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? > > It's a list of functions because it's a defcustom, really. [ FWIW, `kill-transform-function` is also a defcustom, tho I'd argue it would be better defined as a `defvar` for the same kinds of reasons. ] > I envisioned that people might be wanting to add other things to it to > (say) record yanked text, for instance. "Record yanked text" doesn't seem like a very compelling example. I've never heard of anyone requesting such a feature or anything nearby. And I'd expect such a feature to come in the form of a minor mode instead (whose code then programmatically sets this var). The problem with making it a defcustom is that packages can't programmatically modify this var without risks of interfering with Custom (e.g. the famous "CHANGED OUTSIDE CUSTOMIZE"). >>> +@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? > It's in the lispref manual. Right, but it's the only example I can find (and any uses of Custom on this var during the above command may result in an incorrect value being saved in the user's init file). [ FWIW, this discussion is prompted by my trying to use this var in `nhexl-mode` where it would be set rather than being let-bound. ] Stefan