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: Fixing post-self-insert-hook. Date: Fri, 17 Sep 2021 16:04:58 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9283"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org, =?windows-1252?B?Sm/jbyBU4XZvcmE=?= To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 17 22:07:16 2021 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 1mRK8h-0002Bx-C1 for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Sep 2021 22:07:15 +0200 Original-Received: from localhost ([::1]:45630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRK8f-0007vf-WF for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Sep 2021 16:07:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRK7e-0007G4-OF for emacs-devel@gnu.org; Fri, 17 Sep 2021 16:06:10 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:12941) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRK7b-00047z-US for emacs-devel@gnu.org; Fri, 17 Sep 2021 16:06:09 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 59BBA441000; Fri, 17 Sep 2021 16:06:05 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B77A0440D23; Fri, 17 Sep 2021 16:06:03 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1631909163; bh=6u7MJ/yMVlYmP85LSlqY8W4rfEBlW7S+m6fLbMAes4Q=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Hbs3Bi3OfLomOBikYvpSJDII5rX4jfwi0qI/fh4JAF74mrawzKuKW3kz2hfJ14YXE FM++LmbsSRVRCr1/GLxP1fd7qf8HHa+6yVkYMp+wj1XBJHJO7TakOuUpEA7QzGuaZk fzDUZM5n2qjEttY99M1wNbMczj6YZ5vT3qVNGXk/dQJj8Gmsb6XTWTKg9vXLxy/BC8 6ER310EagsCdQYdM8Ccw9R9u1P9CvOBS8Q5R5vm6wJyLq0FTxIGFJli5fcRD+ruqhp A9lZo0HFwhTG7/s4UPcusqdQNZpE0MPPBU2LGPAHJwQkhPQQ4UfrFIgtNjG3aZUfLj dro6TYs1BqrEg== Original-Received: from ceviche (modemcable004.216-203-24.mc.videotron.ca [24.203.216.4]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8AE60120172; Fri, 17 Sep 2021 16:06:03 -0400 (EDT) In-Reply-To: (Alan Mackenzie's message of "Fri, 17 Sep 2021 19:37:27 +0000") 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:274932 Archived-At: > What is sometimes done with it is to effect buffer changes additional to > the prime change caused by self-insert-function. FWIW, I think the above "sometimes" really means "always" or "almost always" ;-) [ That was the primary motivation for the addition of this hook. ] > What isn't fine is when self-insert-function is called from Lisp, as it > is 293 times from our sources, including from cc-cmds.el. The question here is why those effects are undesirable while the other effects (like auto-fill or abbrev expansion) aren't. I suspect that those 293 uses fall into roughly 3 different camps: - Those that really do want the full `self-insert-command` effects. - Those that call `self-insert-command` mostly because the author didn't know better and they should really call `insert` instead. - The rest that wants more than `insert` but less than `self-insert-command`. The last group might indeed deserve a new function. Stefan PS: I do have one regret regarding `post-self-insert-hook`: I should have defined a `self-insert-function` variable instead. This is because some of the `post-self-insert-hook` functions would be cleaner if they could be turned into (add-function :around self-insert-function ...). Sadly, `add-function` didn't exist back then :-(