From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 02 16:06:35 2010 Received: (at submit) by debbugs.gnu.org; 2 Jan 2010 21:06:35 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NRBBD-0007l8-Jr for submit@debbugs.gnu.org; Sat, 02 Jan 2010 16:06:35 -0500 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NRBBC-0007l2-45 for submit@debbugs.gnu.org; Sat, 02 Jan 2010 16:06:34 -0500 Received: from mail.gnu.org ([199.232.76.166]:33175 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NRBB8-0000nL-0U for submit@debbugs.gnu.org; Sat, 02 Jan 2010 16:06:30 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NRBB5-0001Rx-IJ for submit@debbugs.gnu.org; Sat, 02 Jan 2010 16:06:29 -0500 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on monty-python X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO,UNPARSEABLE_RELAY autolearn=ham version=3.1.0 Received: from lists.gnu.org ([199.232.76.165]:52737) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NRBB5-0001Rp-Af for submit@debbugs.gnu.org; Sat, 02 Jan 2010 16:06:27 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NRBB5-0000Bf-8s for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:06:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NRBB0-00005t-C2 for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:06:26 -0500 Received: from [199.232.76.173] (port=60117 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRBB0-00005h-7x for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:06:22 -0500 Received: from mailout2-16.pacific.net.au ([125.255.80.143]:45346 helo=mailout2.pacific.net.au) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NRBAz-0001Od-DP for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:06:21 -0500 Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.2.162]) by mailout2.pacific.net.au (Postfix) with ESMTP id E309E19C063 for ; Sun, 3 Jan 2010 08:06:18 +1100 (EST) Received: from blah.blah (ppp2155.dyn.pacific.net.au [61.8.33.85]) by mailproxy1.pacific.net.au (Postfix) with ESMTP id DA3DF5BE401 for ; Sun, 3 Jan 2010 08:06:17 +1100 (EST) Received: from gg by blah.blah with local (Exim 4.71) (envelope-from ) id 1NRBAt-000230-6Y for bug-gnu-emacs@gnu.org; Sun, 03 Jan 2010 08:06:15 +1100 From: Kevin Ryde To: bug-gnu-emacs@gnu.org Subject: 23.1; unload-feature on buffer-local hooks Date: Sun, 03 Jan 2010 08:06:14 +1100 Message-ID: <87hbr4p67t.fsf@blah.blah> User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.4 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.5 (-----) --=-=-= When `unload-feature' looks in hooks for functions that it's going to unload, it doesn't seem to look in buffer-local values, other than for the current buffer. Evalling the code in try-foo.el below loads then unloads foo.el. It gets an error void-function foo-message where I hoped unload-feature might have purged that `foo-message' from `after-change-functions'. I suppose looking in all buffers is more work for unload-feature, but would be a good protection against bad things happening later. I expect some of the standard hooks like `after-change-functions' are used buffer-local most of the time. If instead it's an intentional omission (to save work) then the elisp manual and the docstring could note it so that modes or packages using buffer-local hook settings can take steps to undo. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=foo.el Content-Transfer-Encoding: quoted-printable (defun foo-message (&rest args) (message "hello")) (switch-to-buffer "foo-buffer") (add-hook 'after-change-functions 'foo-message nil t) ;; buffer-local (provide 'foo) ;;; foo.el ends here --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=try-foo.el Content-Transfer-Encoding: quoted-printable (progn (add-to-list 'load-path (expand-file-name ".")) (load "foo.el") (switch-to-buffer "*scratch*") (unload-feature 'foo t) (switch-to-buffer "foo-buffer") (insert "x")) --=-=-= In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5) of 2009-09-14 on raven, modified by Debian configured using `configure '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_AU value of $XMODIFIERS: nil locale-coding-system: iso-latin-1-unix default-enable-multibyte-characters: t --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 02 18:14:57 2010 Received: (at 5293) by debbugs.gnu.org; 2 Jan 2010 23:14:57 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NRDBR-0000Ig-7q for submit@debbugs.gnu.org; Sat, 02 Jan 2010 18:14:57 -0500 Received: from mail-bw0-f216.google.com ([209.85.218.216]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NRDBP-0000IY-SR for 5293@debbugs.gnu.org; Sat, 02 Jan 2010 18:14:56 -0500 Received: by bwz8 with SMTP id 8so9024201bwz.39 for <5293@debbugs.gnu.org>; Sat, 02 Jan 2010 15:14:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type; bh=NR/ZNTd+BSie+/9MvQp8Gq4OE64LTY3uiNJE+y+s56M=; b=xV16rP6PYdEuYUN+MP61zUo9kobFFDvGFv0fLknR9wc6ocR76JNhC8aP7FEHzi5zDP XatjSNeITiRBtUqwc6Q7eh7Xc4szSn7HoLhNQLzvdt0KV+HOvA3a1cg7xmP0FJnEglWp oRRDyxSzh3hvWP7NT/p1nfvYyfdj5jOLRqvYM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=naLPMCES3zERIiYtaNfUAE/01SLVrJrx8A3v8USE1jHe8Vb1YMmQCCM7zyYasgu8X3 wDO/82ltx9Rt0Peo0BL/LINhif98lziMYazFBBa2LwQ5nexK6FcvzzKpwll+H/JKXBXi ao3t2LZzXV1MXfULUXZ+oOXgvg650Ymp7ikrQ= MIME-Version: 1.0 Received: by 10.204.8.151 with SMTP id h23mr2473823bkh.194.1262474091108; Sat, 02 Jan 2010 15:14:51 -0800 (PST) In-Reply-To: <87hbr4p67t.fsf@blah.blah> References: <87hbr4p67t.fsf@blah.blah> From: Juanma Barranquero Date: Sun, 3 Jan 2010 00:14:31 +0100 Message-ID: Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks To: Kevin Ryde Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 5293 Cc: 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.8 (--) On Sat, Jan 2, 2010 at 22:06, Kevin Ryde wrote: > When `unload-feature' looks in hooks for functions that it's going to > unload, it doesn't seem to look in buffer-local values, other than for > the current buffer. [...] > I suppose looking in all buffers is more work for unload-feature, but > would be a good protection against bad things happening later. Yes, unload-feature should look at buffer-local values, too. For the moment being, a package like foo should define a function (foo in the function name matches the feature name you're unloading): (defun foo-unload-function () ;; do whatever is necessary; in foo's case: (with-current-buffer (get-buffer "foo-bufer") (remove-hook 'after-change-functions 'foo-message t)) ;; continue standard unloading nil) that will be automatically called upon unloading foo.el; in most cases, it should return nil to allow unload-feature to continue the normal unloading process. Juanma From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 13 16:28:51 2011 Received: (at 5293-done) by debbugs.gnu.org; 13 Jul 2011 20:28:51 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qh639-0006Qr-2K for submit@debbugs.gnu.org; Wed, 13 Jul 2011 16:28:51 -0400 Received: from mail-pv0-f172.google.com ([74.125.83.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qh636-0006Qf-26 for 5293-done@debbugs.gnu.org; Wed, 13 Jul 2011 16:28:48 -0400 Received: by pvh18 with SMTP id 18so5391597pvh.3 for <5293-done@debbugs.gnu.org>; Wed, 13 Jul 2011 13:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=ZclQL+eMsDPNHAKvE/ISyRKGSzccaB7Ng3kObyg93JQ=; b=tQMRHEYDmP4bSFQ5Fk7u12t7XZ/TUfYFHWwEtxl03aeSGvexFaLXtS4ac6ML8zdxwO qUdf1+DyVgDq2fi/U/dq1w95ARr/rQ0H4n+jvEAJpqAMldoHd7eny5c8AH2d4O4MAb1e b4ZrZxoTn+UkFt355FBRFkpTMJzDpiSXcEGK8= Received: by 10.142.222.14 with SMTP id u14mr636339wfg.309.1310588922109; Wed, 13 Jul 2011 13:28:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.144.4 with HTTP; Wed, 13 Jul 2011 13:28:02 -0700 (PDT) In-Reply-To: <87hbr4p67t.fsf@blah.blah> References: <87hbr4p67t.fsf@blah.blah> From: Juanma Barranquero Date: Wed, 13 Jul 2011 22:28:02 +0200 Message-ID: Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks To: Kevin Ryde Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: 5293-done Cc: 5293-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) > Evalling the code in try-foo.el below loads then unloads foo.el. =C2=A0It > gets an error > > =C2=A0 =C2=A0void-function foo-message > > where I hoped unload-feature might have purged that `foo-message' from > `after-change-functions'. > > I suppose looking in all buffers is more work for unload-feature, but > would be a good protection against bad things happening later. =C2=A0I ex= pect > some of the standard hooks like `after-change-functions' are used > buffer-local most of the time. You're right that some hooks are used buffer-locally most of the time, but it's also true that in many cases they are used from a major mode, i.e., in your case, if foo.el defined a foo-mode and set `after-change-functions' locally in foo-mode buffers, unload-feature would do OK (with the current trunk, not any released Emacsen). As it is, foo.el is doing something non-standard, and unload-feature cannot try to revert by itself every non-standard thing packages do. That's why FEATURE-unload-function exists. So, in this case, the right fix would be adding this function to foo.el: (defun foo-unload-function () "Unload foo.el." (ignore-errors (with-current-buffer (get-buffer "foo-buffer") (remove-hook 'after-change-functions 'foo-message t))) ;; continue standard unloading nil) That said, there are improvements that could be made to unload-feature (for example, trying to automatically deactivate minor modes being undefined), but I'm not sure that looking in every buffer-local variable of every live buffer is a sensible thing to do. I'm closing this one because it is not really a bug. We can open a wishlist bug for unload-feature is you want. =C2=A0 =C2=A0 Juanma From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 14 20:28:02 2011 Received: (at 5293) by debbugs.gnu.org; 15 Jul 2011 00:28:03 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhWGA-00072H-7o for submit@debbugs.gnu.org; Thu, 14 Jul 2011 20:28:02 -0400 Received: from mailout2-6.pacific.net.au ([61.8.2.229] helo=mailout2.pacific.net.au) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhWG7-000722-Oe for 5293@debbugs.gnu.org; Thu, 14 Jul 2011 20:28:00 -0400 Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout2.pacific.net.au (Postfix) with ESMTP id 233102BDFC4; Fri, 15 Jul 2011 10:27:53 +1000 (EST) Received: from blah.blah (unknown [203.26.175.98]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id C1F022741C; Fri, 15 Jul 2011 10:27:46 +1000 (EST) Received: from gg by blah.blah with local (Exim 4.72) (envelope-from ) id 1QhWF1-00064H-8A; Fri, 15 Jul 2011 10:26:51 +1000 From: Kevin Ryde To: Juanma Barranquero Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks References: <87hbr4p67t.fsf@blah.blah> Date: Fri, 15 Jul 2011 10:26:51 +1000 In-Reply-To: (Juanma Barranquero's message of "Wed, 13 Jul 2011 22:28:02 +0200") Message-ID: <871uxsl778.fsf@blah.blah> User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 5293 Cc: 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) Juanma Barranquero writes: > > but I'm not sure that looking in every buffer-local > variable of every live buffer No, just the hooks. If it makes sense to remove unloaded funcs from hook global values then surely the same rationale applies to remove them from the buffer-local values too. Or conversely, it's undesirable to leave behind an unbound func in a hook, and the same undesirability as to a buffer-local value as a global value. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 14 20:35:20 2011 Received: (at 5293) by debbugs.gnu.org; 15 Jul 2011 00:35:20 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhWND-0007Cb-RZ for submit@debbugs.gnu.org; Thu, 14 Jul 2011 20:35:20 -0400 Received: from mail-pv0-f172.google.com ([74.125.83.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhWN8-0007CM-Us for 5293@debbugs.gnu.org; Thu, 14 Jul 2011 20:35:19 -0400 Received: by pvh18 with SMTP id 18so752132pvh.3 for <5293@debbugs.gnu.org>; Thu, 14 Jul 2011 17:35:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=fQc/Rl7OiH4lDiw7QBdvaWpzXcktA/JtWZQ/MFCNMAM=; b=ZMtJSADUeRnIccZZP7BqqXrW1p4xJE699hOkZzy11nRjg5FIdS3TV6rq7+y7ZWwI0u jDMdbiktGyXOi+DLVTI4J0QJWzIin0IqlzBFMoPKMiY9Xg5P53UqLUC16PLNQNO/x2O9 +mfexAtFtZIJMBrde/Iw5JWDCptbuJ02AZ2Xc= Received: by 10.142.120.1 with SMTP id s1mr1265372wfc.252.1310690109115; Thu, 14 Jul 2011 17:35:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.144.4 with HTTP; Thu, 14 Jul 2011 17:34:29 -0700 (PDT) In-Reply-To: <871uxsl778.fsf@blah.blah> References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> From: Juanma Barranquero Date: Fri, 15 Jul 2011 02:34:29 +0200 Message-ID: Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks To: Kevin Ryde Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 5293 Cc: 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) On Fri, Jul 15, 2011 at 02:26, Kevin Ryde wrote: > Or conversely, it's undesirable to leave behind an unbound func in a > hook, and the same undesirability as to a buffer-local value as a global > value. But the usual case is that these buffer-local values are set via major modes also defined in the same package, and so they are automatically removed when the major modes are disabled (i.e., when the buffers are switched to other major modes). The only case where a buffer-local value is left behind is when the package's code sets it in non-standard ways, and in this case, it's the package responsability to define a FEATURE-unload-function to undo the changes. The philosophy behind unload-feature is: we try to automatically undo the easy/standard things, and give the package the opportunity to undo the hard/unstandard things itself. And I think it's the right approach. =C2=A0 =C2=A0 Juanma From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 15 04:57:04 2011 Received: (at 5293) by debbugs.gnu.org; 15 Jul 2011 08:57:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QheCl-0001gf-Pi for submit@debbugs.gnu.org; Fri, 15 Jul 2011 04:57:04 -0400 Received: from mail-fx0-f42.google.com ([209.85.161.42]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QheCj-0001gB-KZ for 5293@debbugs.gnu.org; Fri, 15 Jul 2011 04:57:02 -0400 Received: by fxe23 with SMTP id 23so2846304fxe.29 for <5293@debbugs.gnu.org>; Fri, 15 Jul 2011 01:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; bh=ol0mEKswTCd8oL5iiOjsugbZdpNNzJTkj+7j9THTZBw=; b=gj0146JcqUPg1gi9wEKRs2YTUr5zOkxFACgPpR2N/1ocw7lNJWAjsbDuxysguNdvEf EDFgcQcl5nlbjJCvYN0Gb7d6PCuhHlv7GHY/+A1NrK96fVfZu2xbALJgTAimSMltJcxX ktjkX+fdHTikQw9jf1un2eoOa+IwIyak4dL/I= Received: by 10.223.75.25 with SMTP id w25mr1368824faj.140.1310720215464; Fri, 15 Jul 2011 01:56:55 -0700 (PDT) Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id a24sm652534fak.12.2011.07.15.01.56.52 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Jul 2011 01:56:52 -0700 (PDT) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Juanma Barranquero Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks In-Reply-To: (Juanma Barranquero's message of "Fri, 15 Jul 2011 02:34:29 +0200") References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Date: Fri, 15 Jul 2011 10:52:30 +0200 Message-ID: <87oc0wdiy9.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 5293 Cc: Kevin Ryde , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) Juanma Barranquero writes: > On Fri, Jul 15, 2011 at 02:26, Kevin Ryde wrote: > >> Or conversely, it's undesirable to leave behind an unbound func in a >> hook, and the same undesirability as to a buffer-local value as a global >> value. > > But the usual case is that these buffer-local values are set via major > modes also defined in the same package, and so they are automatically > removed when the major modes are disabled (i.e., when the buffers are > switched to other major modes). The only case where a buffer-local > value is left behind is when the package's code sets it in > non-standard ways, and in this case, it's the package responsability > to define a FEATURE-unload-function to undo the changes. > > The philosophy behind unload-feature is: we try to automatically undo > the easy/standard things, and give the package the opportunity to undo > the hard/unstandard things itself. And I think it's the right > approach. 1) If your reasoning about hooks being added via modes were correct, you wouldn't have to remove even the global hook additions. If it's faulty (which is probably the case), both global and local hooks need to be managed, as Kevin said. 2) The `unload-feature' docstring says it undoes "any additions that the library has made to hook variables", but that's apparently not what's really happening, so if things stay as they are, the doc string should be corrected. 3) Are local hook additions really such a "hard/unstandard" thing to undo? =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 15 07:24:50 2011 Received: (at 5293) by debbugs.gnu.org; 15 Jul 2011 11:24:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhgVm-000500-5u for submit@debbugs.gnu.org; Fri, 15 Jul 2011 07:24:50 -0400 Received: from mail-pz0-f41.google.com ([209.85.210.41]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QhgVj-0004zn-FM for 5293@debbugs.gnu.org; Fri, 15 Jul 2011 07:24:48 -0400 Received: by pzk4 with SMTP id 4so1328658pzk.0 for <5293@debbugs.gnu.org>; Fri, 15 Jul 2011 04:24:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=GQuZnquTma6KApUzLs0Wy3zbZ1mMFAYW2iT66lvzL4Y=; b=EVaYEsCuBilez+ff95PSay+2ha3qxYttuOp5P6k8DZmpfik9LJhzENKVZziDzmJ7XM hABZhxcYWcK8KdiJbnfHTUiAq3g5eQL4Wm39fq8j7zA8drAQONBPIYMAQl0L50j9dybI Sy70PZZBr9VHwvw/pSB/amuH3l9auDeRFgufk= Received: by 10.142.222.14 with SMTP id u14mr1431012wfg.309.1310729081370; Fri, 15 Jul 2011 04:24:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.144.4 with HTTP; Fri, 15 Jul 2011 04:24:00 -0700 (PDT) In-Reply-To: <87oc0wdiy9.fsf@gmail.com> References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> <87oc0wdiy9.fsf@gmail.com> From: Juanma Barranquero Date: Fri, 15 Jul 2011 13:24:00 +0200 Message-ID: Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 5293 Cc: Kevin Ryde , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.3 (---) On Fri, Jul 15, 2011 at 10:52, =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec wrote: > 1) If your reasoning about hooks being added via modes were correct, you > wouldn't have to remove even the global hook additions. Why? Global additions are not removed when the buffer's major mode is switched. Local variables, including local values of hooks, are. > If it's faulty > (which is probably the case), both global and local hooks need to be > managed, as Kevin said. I'm more of the opinion that both should be un-managed. A look at the sources is enough to see that hook removal is currently ugly and ad-hoc, and ugly too. > 2) The `unload-feature' docstring says it undoes "any additions that the > library has made to hook variables", but that's apparently not what's > really happening, so if things stay as they are, the doc string should > be corrected. Yes. The docstring for unload-feature has always promised more than it could reasonably accomplish. Yours is only one example. > 3) Are local hook additions really such a "hard/unstandard" thing to > undo? Local hook additions aren't. And they are correctly treated right now. What we are discussing is local hooks in buffers whose major mode wasn't also defined in the same feature being unloaded. For example, things like ;;; my-mode.el (define-derived-mode my-mode ...) (defun my-mode-this () ...) (defun my-mode-that () ...) (defun my-mode-hook () ...) (with-current-buffer (get-buffer "some poor unsuspecting buffer")) ;;; do not set the buffer major mode to my-mode, but (add-hook 'some-hook 'my-mode-hook nil t)) (provide 'my-mode) ;;;; end of my-mode.el and that kind of thing is unfrequent enough that the better fix is (defun my-mode-unload-function () (ignore-errors (with-current-buffer (get-buffer "some poor unsuspecting buffer") (remove-hook 'some-hook 'my-mode-hook t))) nil) Both Kevin and you seem to think that unload-feature should do everything and that having to define FEATURE-unload-function is a bug or something like that. It is not. I'm all for making unload-feature smarter, as long as it does not trample on the programmer's ability to do. I can perfectly well imagine unloading a package but setting a hook with an autoloading function from that same package. =C2=A0 =C2=A0 Juanma From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 15 12:13:33 2011 Received: (at 5293) by debbugs.gnu.org; 15 Jul 2011 16:13:33 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qhl1B-000825-FS for submit@debbugs.gnu.org; Fri, 15 Jul 2011 12:13:33 -0400 Received: from mail-fx0-f42.google.com ([209.85.161.42]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qhl18-00081g-Em for 5293@debbugs.gnu.org; Fri, 15 Jul 2011 12:13:31 -0400 Received: by fxe23 with SMTP id 23so3551793fxe.29 for <5293@debbugs.gnu.org>; Fri, 15 Jul 2011 09:13:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; bh=wJaC0H38CMQ4sBTQG/IYEFNHlpZdzvzAPTUi5ECPdxU=; b=F2ZAi35pNnX+QOLpwxte1haRQnU+xwpJ0XWi7TF/T//XxcRed3b7LlPDZu1VYBPiA2 NvOf//xjO81GVGFjgSwaDqtNze02a9mPBWZZG0RjJJXZKCyvWcjdRvR6MDmu6dF7xIGd dNQaqmjsqOTcbjEe+r6pPO9qYmVhqxyVg1xuE= Received: by 10.223.21.141 with SMTP id j13mr5524537fab.79.1310746404519; Fri, 15 Jul 2011 09:13:24 -0700 (PDT) Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id h9sm846835faa.15.2011.07.15.09.13.20 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Jul 2011 09:13:21 -0700 (PDT) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Juanma Barranquero Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks In-Reply-To: (Juanma Barranquero's message of "Fri, 15 Jul 2011 13:24:00 +0200") References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> <87oc0wdiy9.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Date: Fri, 15 Jul 2011 18:08:58 +0200 Message-ID: <87k4bjedb9.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 5293 Cc: Kevin Ryde , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) Juanma Barranquero writes: > On Fri, Jul 15, 2011 at 10:52, =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec wrote: > >> 1) If your reasoning about hooks being added via modes were correct, you >> wouldn't have to remove even the global hook additions. > > Why? Global additions are not removed when the buffer's major mode is > switched. Local variables, including local values of hooks, are. Note I omitted the "major" part, i.e., it's not uncommon for minor modes to make global hook additions. Sorry if that's not really related to the problem at hand. >> If it's faulty >> (which is probably the case), both global and local hooks need to be >> managed, as Kevin said. > > I'm more of the opinion that both should be un-managed. A look at the > sources is enough to see that hook removal is currently ugly and > ad-hoc, and ugly too. Fine with me, as long as the documentation reflects this. >> 2) The `unload-feature' docstring says it undoes "any additions that the >> library has made to hook variables", but that's apparently not what's >> really happening, so if things stay as they are, the doc string should >> be corrected. > > Yes. The docstring for unload-feature has always promised more than it > could reasonably accomplish. Yours is only one example. Please do update it then. [...] > Both Kevin and you seem to think that unload-feature should do > everything and that having to define FEATURE-unload-function is a bug > or something like that. It is not. I'm all for making unload-feature > smarter, as long as it does not trample on the programmer's ability to > do. I can perfectly well imagine unloading a package but setting a > hook with an autoloading function from that same package. Right... I do know about unload functions and use them where appropriate. The important thing is that the documentation needs to describe what actually happens, so whatever you decide to do about this, please update the documentation (which, as you confirmed, needs to be done anyway). =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 15 12:22:09 2011 Received: (at 5293) by debbugs.gnu.org; 15 Jul 2011 16:22:09 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qhl9Q-0000fC-Hj for submit@debbugs.gnu.org; Fri, 15 Jul 2011 12:22:09 -0400 Received: from mail-pv0-f172.google.com ([74.125.83.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qhl8m-0000da-Fk for 5293@debbugs.gnu.org; Fri, 15 Jul 2011 12:21:56 -0400 Received: by pvh18 with SMTP id 18so1401651pvh.3 for <5293@debbugs.gnu.org>; Fri, 15 Jul 2011 09:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=h4hq7HKJOddDQOC5DmsZQ0+E9xaVOPcUt1RMMG3jhJ0=; b=Tzup1yqKCD/KfUeJSu0bXD2YoSJ10SlzOWbQjIP+60GwpSs7mEjRDX2Uh4bvIzCzxj qJhmiburtkQqDajjXs1W5sgZZ5/fuYPkXaN48dx8jJZj1olpaHVP45VLeBnA6ZoFE8cM 7ph2xbzrA0iciwhSMg+k/8tbOChyCFkg9/z6M= Received: by 10.142.234.3 with SMTP id g3mr1543113wfh.423.1310746875128; Fri, 15 Jul 2011 09:21:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.144.4 with HTTP; Fri, 15 Jul 2011 09:20:35 -0700 (PDT) In-Reply-To: <87k4bjedb9.fsf@gmail.com> References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> <87oc0wdiy9.fsf@gmail.com> <87k4bjedb9.fsf@gmail.com> From: Juanma Barranquero Date: Fri, 15 Jul 2011 18:20:35 +0200 Message-ID: Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 5293 Cc: Kevin Ryde , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) On Fri, Jul 15, 2011 at 18:08, =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec wrote: > Note I omitted the "major" part, i.e., it's not uncommon for minor modes > to make global hook additions. Sorry if that's not really related to the > problem at hand. Currently, minor modes are not automatically turned off; packages that define minor modes *need* a FEATURE-unload-function. See allout.el, hi-lock.el, hl-line.el, linum.el, etc. Turning off the minor mode should remove these hooks. > The important thing is that the documentation needs to > describe what actually happens, so whatever you decide to do about this, > please update the documentation (which, as you confirmed, needs to be > done anyway). I agree that the documentation should better reflect what unload-feature actually does, but I won't be the one writing it. I suck at that. =C2=A0 =C2=A0 Juanma From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 16 14:51:03 2011 Received: (at 5293) by debbugs.gnu.org; 16 Jul 2011 18:51:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qi9x8-00038k-Qq for submit@debbugs.gnu.org; Sat, 16 Jul 2011 14:51:03 -0400 Received: from [207.164.135.98] (helo=soln-sr3720.solutionip.com) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qi9x7-000382-Fl for 5293@debbugs.gnu.org; Sat, 16 Jul 2011 14:51:02 -0400 Received: from [172.22.15.247] (helo=ceviche.home) by soln-sr3720.solutionip.com with esmtp (Exim 3.34 #1) id 1Qi9x1-0000qw-00; Sat, 16 Jul 2011 14:50:55 -0400 Received: by ceviche.home (Postfix, from userid 20848) id E426C660D5; Sat, 16 Jul 2011 14:50:54 -0400 (EDT) From: Stefan Monnier To: Kevin Ryde Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks Message-ID: References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> Date: Sat, 16 Jul 2011 14:50:54 -0400 In-Reply-To: <871uxsl778.fsf@blah.blah> (Kevin Ryde's message of "Fri, 15 Jul 2011 10:26:51 +1000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 5293 Cc: Juanma Barranquero , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > No, just the hooks. If it makes sense to remove unloaded funcs from > hook global values then surely the same rationale applies to remove them > from the buffer-local values too. Agreed. Someone would have to try it out to see if it can be done efficiently. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 05 21:22:26 2011 Received: (at 5293) by debbugs.gnu.org; 6 Aug 2011 01:22:26 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QpVas-0004md-5q for submit@debbugs.gnu.org; Fri, 05 Aug 2011 21:22:26 -0400 Received: from mailout2-6.pacific.net.au ([61.8.2.229] helo=mailout2.pacific.net.au) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QpVao-0004mQ-1M; Fri, 05 Aug 2011 21:22:23 -0400 Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout2.pacific.net.au (Postfix) with ESMTP id AE7222C09B0; Sat, 6 Aug 2011 11:21:31 +1000 (EST) Received: from blah.blah (unknown [203.26.175.151]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id 7DC9527419; Sat, 6 Aug 2011 11:21:25 +1000 (EST) Received: from gg by blah.blah with local (Exim 4.72) (envelope-from ) id 1QpVZB-00052r-5r; Sat, 06 Aug 2011 11:20:41 +1000 From: Kevin Ryde To: control@debbugs.gnu.org Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> Date: Sat, 06 Aug 2011 11:20:41 +1000 In-Reply-To: (Stefan Monnier's message of "Sat, 16 Jul 2011 14:50:54 -0400") Message-ID: <87aabnnxna.fsf@blah.blah> User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: 5293 Cc: Juanma Barranquero , Stefan Monnier , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) reopen 5293 thanks Stefan Monnier writes: > >> No, just the hooks. If it makes sense to remove unloaded funcs from >> hook global values then surely the same rationale applies to remove them >> from the buffer-local values too. > > Agreed. Someone would have to try it out to see if it can be > done efficiently. Reopened for that, or failing that then for clarifying the docstring. I imagine there's not normally many hooks or many buffers, or many buffer-local variables, whichever one of those was the efficient way to scan ... and unload-feature isn't used very much anyway. (Actually the way unload-feature seems not much used and not getting much attention from packages makes me wonder if it's worth bothering. But if unload-feature did a little more then it would increase its usefulness, perhaps to the point where it would be used more :-) From unknown Fri Jun 20 07:25:04 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: Did not alter fixed versions and reopened. Date: Sat, 06 Aug 2011 01:23:02 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # Did not alter fixed versions and reopened. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 28 20:23:33 2019 Received: (at control) by debbugs.gnu.org; 1 Mar 2019 01:23:33 +0000 Received: from localhost ([127.0.0.1]:55669 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzWth-0006Zr-16 for submit@debbugs.gnu.org; Thu, 28 Feb 2019 20:23:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37113) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gzWtd-0006Zb-Jq for control@debbugs.gnu.org; Thu, 28 Feb 2019 20:23:31 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:52467) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzWtU-0005Gw-Gt for control@debbugs.gnu.org; Thu, 28 Feb 2019 20:23:21 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1gzWtT-0004Ce-8G for control@debbugs.gnu.org; Thu, 28 Feb 2019 20:23:20 -0500 Subject: control message for bug 34686 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Thu, 28 Feb 2019 20:23:19 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) forcemerge 5293 34686 From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 06 13:24:23 2020 Received: (at 5293) by debbugs.gnu.org; 6 Apr 2020 17:24:23 +0000 Received: from localhost ([127.0.0.1]:49164 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLVTz-000287-6M for submit@debbugs.gnu.org; Mon, 06 Apr 2020 13:24:23 -0400 Received: from mail-wr1-f43.google.com ([209.85.221.43]:34304) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLVTx-00027e-25 for 5293@debbugs.gnu.org; Mon, 06 Apr 2020 13:24:21 -0400 Received: by mail-wr1-f43.google.com with SMTP id 65so452597wrl.1 for <5293@debbugs.gnu.org>; Mon, 06 Apr 2020 10:24:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=XDcIPMcHHW2xL8wDI1ZR5PWLrAN9Z653lOLqJfToGxE=; b=n6euSnCC6DGJPUgHWqK9TqaIscYUsiDjaWyw2CQGzQGL25lxMCAQBlRtV6i/Ei0jzl pvfbQVAJE2vTycsaEx/eCDqtBgnotbWwzIXDFRjC1Y9xmFl1dW+28IHahoA2p+Qd3BqW +MF6glK55OAD1PIhnxiLl+NqFTZCTcugNhH7mSTrx1jRKbntqVGxVf0f7YzAk/lqlI9j Rog9+R+OYptEuZ6uj0E+mDi7NT+Qt50svkUyvQBLQJctUoJPLZsCIRejfixfPXRzDSf4 tqa0m0yNB+GgMbGTxxi8QF2e9agmYcIg53VSQqPcQRjaZur8vcKKDksZM/8UivRJzqCp T4yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=XDcIPMcHHW2xL8wDI1ZR5PWLrAN9Z653lOLqJfToGxE=; b=e8zJRI+LHReU5JqmLX/FBkvFz3oBjK2kM0ZYtDYPvGQnHsOT0FUF+AcuIWVfs4CWcA gNyaJ12hPKpmMCQyUsRK3KnU7hdw6fbbAP6wuNeQKSdJwpninZfB8691SG5eU3zzIJ6E oFR1xPiZahcINE+mvTrml6lS0c6eVo0MHmefchdguq/J0r0pyRv1+CLqZnx6VFVPxeT4 XnRx2E5U3MHBNt28iw1IOb42HTm0edXxcgeLHBuUoJrV798Zp0Ehs9Vjj1gkxYbvZQHH CvUXXye6h/3rL8FzU+X9deL7JpjF5292KhE8kD3yqDTKf5rWHj0mrbgjZQIIcxp2Yfb5 auvw== X-Gm-Message-State: AGi0PuZ9/ZAzN3nThdrEGEKvx7CW3sF5dfzc041TFyQOkgofVrm+9s0U tYIixJSPVEkc0A6Rbwkkyn0= X-Google-Smtp-Source: APiQypKJF45fIcgy/X8fUsrxH/M1e3/uhIvGT+AXvLGJ7nt3H/h9UbUv9fHW5TLDH/QRQWWI4lxgKg== X-Received: by 2002:adf:ea82:: with SMTP id s2mr216061wrm.407.1586193854851; Mon, 06 Apr 2020 10:24:14 -0700 (PDT) Received: from localhost ([185.112.167.47]) by smtp.gmail.com with ESMTPSA id z3sm294985wma.22.2020.04.06.10.24.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 10:24:13 -0700 (PDT) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Kevin Ryde Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks In-Reply-To: <87aabnnxna.fsf@blah.blah> (Kevin Ryde's message of "Sat, 06 Aug 2011 11:20:41 +1000") References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> <87aabnnxna.fsf@blah.blah> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Date: Mon, 06 Apr 2020 19:24:40 +0200 Message-ID: <87zhbojzmv.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 5293 Cc: Juanma Barranquero , Stefan Monnier , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain On Sat, 06 Aug 2011 11:20:41 +1000 Kevin Ryde wrote: > reopen 5293 > thanks > > Stefan Monnier writes: >> >>> No, just the hooks. If it makes sense to remove unloaded funcs from >>> hook global values then surely the same rationale applies to remove them >>> from the buffer-local values too. >> >> Agreed. Someone would have to try it out to see if it can be >> done efficiently. ^^^^^^^^^^^ :-D > Reopened for that, or failing that then for clarifying the docstring. > > I imagine there's not normally many hooks or many buffers, or many > buffer-local variables, whichever one of those was the efficient way to > scan ... and unload-feature isn't used very much anyway. Coming back to this after 10 years, it appears that we (I, certainly) underestimated the computation involved. While the attached patch(es) work for emacs -Q toy examples like Kevin's or more recently the one from bug#34686, when I tried M-x load-library allout RET M-x unload-feature allout RET in my normal Emacs session with ~300 buffers and ~1000 features, it took my venerable laptop 8 minutes to complete. Based on that experience, unless someone has better ideas, I suggest we close this and clarify the (henceforth intentional) lack of attention to buffer-local hook values in the documentation instead. Actually, I wonder if ignoring even the global hooks (as opined by Juanma) and enforcing more widespread usage of FEATURE-unload-function wouldn't be better; or/also, couldn't stray undefined functions on hooks be handled similarly to how it's done for errors e.g. in `post-command-hook', i.e. auto-removed when encountered? I guess wrapping all hooks like that would be overkill? (That said, I think [1/3] and [3/3] could/should be applied nonetheless.) --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-unload-feature-Improve-logic-don-t-repeat-computatio.patch >From 394f2bf6821196a4171fd79fc9a10dc626619a58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Mon, 6 Apr 2020 13:25:41 +0200 Subject: [PATCH 1/3] unload-feature: Improve logic (don't repeat computation) * lisp/loadhist.el (unload-feature): Don't do the same computation twice. --- lisp/loadhist.el | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/lisp/loadhist.el b/lisp/loadhist.el index a1ff2f6270..60da00cceb 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -287,22 +287,23 @@ unload-feature ;; functions which the package might just have installed, and ;; there might be other important state, but this tactic ;; normally works. - (mapatoms - (lambda (x) - (when (and (boundp x) - (or (and (consp (symbol-value x)) ; Random hooks. - (string-match "-hooks?\\'" (symbol-name x))) - (memq x unload-feature-special-hooks))) ; Known abnormal hooks etc. - (dolist (y unload-function-defs-list) - (when (and (eq (car-safe y) 'defun) - (not (get (cdr y) 'autoload))) - (remove-hook x (cdr y))))))) - ;; Remove any feature-symbols from auto-mode-alist as well. - (dolist (y unload-function-defs-list) - (when (and (eq (car-safe y) 'defun) - (not (get (cdr y) 'autoload))) - (setq auto-mode-alist - (rassq-delete-all (cdr y) auto-mode-alist))))) + (let ((removables (cl-loop for def in unload-function-defs-list + when (and (eq (car-safe def) 'defun) + (not (get (cdr def) 'autoload))) + collect (cdr def)))) + (mapatoms + (lambda (x) + (when (and (boundp x) + (or (and (consp (symbol-value x)) ; Random hooks. + (string-match "-hooks?\\'" (symbol-name x))) + ;; Known abnormal hooks etc. + (memq x unload-feature-special-hooks))) + (dolist (func removables) + (remove-hook x func))))) + ;; Remove any feature-symbols from auto-mode-alist as well. + (dolist (func removables) + (setq auto-mode-alist + (rassq-delete-all func auto-mode-alist))))) ;; Change major mode in all buffers using one defined in the feature being unloaded. (unload--set-major-mode) -- 2.26.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-unload-feature-Handle-local-hooks.patch >From d2372157c031b79cad4e3bf331aa6e167ff48199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Mon, 6 Apr 2020 13:30:11 +0200 Subject: [PATCH 2/3] unload-feature: Handle local hooks Buffer-local hooks were introduced in 1994-09-30T20:47:13+00:00!rms@gnu.org 0e4d378b32 (add-hook): Initialize default value and local value. but `unload-feature' has not been updated to handle them. * lisp/loadhist.el (unload-feature): Handle local hooks. --- etc/NEWS | 3 +++ lisp/loadhist.el | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index 765a923bf7..fa90edc4d1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -297,6 +297,9 @@ optional argument specifying whether to follow symbolic links. ** 'parse-time-string' can now parse ISO 8601 format strings, such as "2020-01-15T16:12:21-08:00". +--- +** 'unload-feature' now also tries to undo additions to buffer-local hooks. + * Changes in Emacs 28.1 on Non-Free Operating Systems diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 60da00cceb..2fd2d3f6be 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -299,7 +299,11 @@ unload-feature ;; Known abnormal hooks etc. (memq x unload-feature-special-hooks))) (dolist (func removables) - (remove-hook x func))))) + (remove-hook x func) + (save-current-buffer + (dolist (buffer (buffer-list)) + (set-buffer buffer) + (remove-hook x func t))))))) ;; Remove any feature-symbols from auto-mode-alist as well. (dolist (func removables) (setq auto-mode-alist -- 2.26.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0003-unload-feature-Correct-doc-string-to-match-info-manu.patch >From a418282b70e514065159a217a4106226395aa98e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Mon, 6 Apr 2020 17:05:33 +0200 Subject: [PATCH 3/3] unload-feature: Correct doc string to match info manual and reality 'unload-feature' doesn't try to "undo any additions the library has made" to hooks, it tries to remove functions defined by the library from hooks, no matter how they got there. * lisp/loadhist.el (unload-feature): Correct the doc string. * doc/lispref/loading.texi (Unloading): Clarify, fix typo. --- doc/lispref/loading.texi | 4 ++-- lisp/loadhist.el | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index 2894282079..f1ee638357 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi @@ -1063,7 +1063,7 @@ Unloading (Loading saves these in the @code{autoload} property of the symbol.) Before restoring the previous definitions, @code{unload-feature} runs -@code{remove-hook} to remove functions in the library from certain +@code{remove-hook} to remove functions defined by the library from certain hooks. These hooks include variables whose names end in @samp{-hook} (or the deprecated suffix @samp{-hooks}), plus those listed in @code{unload-feature-special-hooks}, as well as @@ -1071,7 +1071,7 @@ Unloading function because important hooks refer to functions that are no longer defined. -Standard unloading activities also undoes ELP profiling of functions +Standard unloading activities also undo ELP profiling of functions in that library, unprovides any features provided by the library, and cancels timers held in variables defined by the library. diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 2fd2d3f6be..9718a4840d 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -234,11 +234,10 @@ unload-feature is nil, raise an error. Standard unloading activities include restoring old autoloads for -functions defined by the library, undoing any additions that the -library has made to hook variables or to `auto-mode-alist', undoing -ELP profiling of functions in that library, unproviding any features -provided by the library, and canceling timers held in variables -defined by the library. +functions defined by the library, removing such functions from +hooks and `auto-mode-alist', undoing their ELP profiling, +unproviding any features provided by the library, and canceling +timers held in variables defined by the library. If a function `FEATURE-unload-function' is defined, this function calls it with no arguments, before doing anything else. That function -- 2.26.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 06 14:06:12 2020 Received: (at 5293) by debbugs.gnu.org; 6 Apr 2020 18:06:12 +0000 Received: from localhost ([127.0.0.1]:49188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLW8R-0004KV-U9 for submit@debbugs.gnu.org; Mon, 06 Apr 2020 14:06:12 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:30565) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLW8Q-0004K4-3Q for 5293@debbugs.gnu.org; Mon, 06 Apr 2020 14:06:11 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 823FC44FD2D; Mon, 6 Apr 2020 14:06:04 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 0572544FD2A; Mon, 6 Apr 2020 14:06:03 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1586196363; bh=WmuT7K7Mg+ftM6GqUHavZufjxYjrbAyBKNFffZNmRco=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=lnay1FZmWaSYSoY4RFsScnQ6rQdFjnj6FOcdc8/azQM/j4bX/ysRYJg4ohIxRWbDv rSC0rVjPNWpmwDuD/9LLH+9pKLSKPoIEI9xlczwdhtjiN/gPtc6eLYRHZ7KV5Z+XE0 ZUXVe51sKT4ajuOxvQixf5bkKa8Kw/qD/EYcdssQ3XjlIM/hoY/sjW7GpatyVw68oi W84Kb364M7doGOkYXlSX3XfYtkbtgjn5SPT5LL7fqazuj2g/H6lEYRnaLLkLEhBMeG E/X6p/nFSB66COCPXq9MM5bU/gv8jN9H+ugzqSIWpYvjup0GQxIGe8DaBuN9AfuTXV tZy3s9gJXWnvg== Received: from alfajor (unknown [104.247.241.114]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B079C12068D; Mon, 6 Apr 2020 14:06:02 -0400 (EDT) From: Stefan Monnier To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks Message-ID: References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> <87aabnnxna.fsf@blah.blah> <87zhbojzmv.fsf@gmail.com> Date: Mon, 06 Apr 2020 14:06:02 -0400 In-Reply-To: <87zhbojzmv.fsf@gmail.com> (=?utf-8?B?IsWgdMSbcMOhbiBOxJtt?= =?utf-8?B?ZWMiJ3M=?= message of "Mon, 06 Apr 2020 19:24:40 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.123 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 5293 Cc: Juanma Barranquero , Kevin Ryde , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > @@ -299,7 +299,11 @@ unload-feature > ;; Known abnormal hooks etc. > (memq x unload-feature-special-hooks))) > (dolist (func removables) > - (remove-hook x func))))) > + (remove-hook x func) > + (save-current-buffer > + (dolist (buffer (buffer-list)) > + (set-buffer buffer) > + (remove-hook x func t))))))) > ;; Remove any feature-symbols from auto-mode-alist as well. > (dolist (func removables) > (setq auto-mode-alist Maybe instead of `(dolist (buffer (buffer-list))` within that big `mapatoms` within `(dolist (func removables)` (which is O(B*F*V) where B is the number of buffers, F is the number of functions and V is the number of hook vars), we should instead do it as: (dolist (buffer (buffer-list)) (dolist (varvar (buffer-local-variables buffer)) (when (dolist (func removables) (remove-hook func t))))) If we need it to go faster maybe we could also arrange for (add-hook V F ..) to do (cl-pushnew V (get F 'hooks-where-it-has-been-put)). So we could do (let ((relevant-hooks (mapcan (lambda (f) (get F 'hooks-where-it-has-been-put)) funcs))) (dolist (buffer (buffer-list)) (dolist (varvar (buffer-local-variables buffer)) (when (memq var relevant-hooks) (dolist (func removables) (remove-hook func t))))) -- Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 06 15:17:16 2020 Received: (at 5293) by debbugs.gnu.org; 6 Apr 2020 19:17:16 +0000 Received: from localhost ([127.0.0.1]:49252 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLXFE-00085v-Fw for submit@debbugs.gnu.org; Mon, 06 Apr 2020 15:17:16 -0400 Received: from mail-wr1-f53.google.com ([209.85.221.53]:37716) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLXFC-00085V-AM for 5293@debbugs.gnu.org; Mon, 06 Apr 2020 15:17:14 -0400 Received: by mail-wr1-f53.google.com with SMTP id w10so872365wrm.4 for <5293@debbugs.gnu.org>; Mon, 06 Apr 2020 12:17:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=BGAXL9JJB7eIFqLl47bpfwPNcHadc1L3IKYl8qwxI9M=; b=FNvCiRclSo7y2ZSIW35VS3XJsvi0x4+bsOyLmKno/7/2kqixGnfQC9GEl3T4xulVe9 7eyLn2lJSQ9jceRGo68PcaWX/4SwQ+Fkj+jZr5atcTpKalY3i6WomqKIpHFziIdj6eYZ 436tvv4uhnLCxFvHEZWulcb8ie+eQSMvZglERMBIU2M5hLYmMHzdjkQ9KQV78rxYYSJ8 1skvk1C1TzyfEiJLw42JR80Equ5hfpDhCHLpKBZrleuJacafMz4pzvYLQ6PffNQWX+9a k7LusFQWukNt5yNXtVnuYX8NHtdzKfDpdD1VGI6FSX3vhnPzCl+sbIjmHmArMBHNlJ5o b26Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=BGAXL9JJB7eIFqLl47bpfwPNcHadc1L3IKYl8qwxI9M=; b=Q549HfYIjB8QQWFsNv8vX98aCUlwKEEHADbdzihhljylzpF2OCnj5VypT/vtaAt/2h c6LxGGWsDJRfskqejoFIpMFc4tbRAFHL11/f42m0NxqPRoypMNZIGcEEaXe9jStlaTZO E+1d5Z18IwLmo2M/4NIrxsvjxeJgr3oqZBe3/YnaebcUlolpe2cVe2K/cww8hK0B96IE MiI//E/Cx92DOA0PvCbMJqA/dF70i39USgE31J0p9B24Wpdr4rcm8PvjMX2YMkEoe+0A VgGoyhILUiAvJPUQ3fA0ljhF4EKx04gkvqxfPl1JYruM+Oms3o9OGYBDp6qcqcGw7HNr 1HhQ== X-Gm-Message-State: AGi0PuaI7DRhXVa8z4eRrLxDNwnBzc6YcoMEJit+xIpOEx6NBryBzM/5 IUKgtqZHHyp3sIk4Ih5F2TI= X-Google-Smtp-Source: APiQypIgCe8sKBx8rhTNpVkdBTsLDca+n+uaymJVb2UbMFg4bMcMHp+n8FZLqG2C2uhz7m7S0t3ZDg== X-Received: by 2002:adf:f1ce:: with SMTP id z14mr807096wro.68.1586200628427; Mon, 06 Apr 2020 12:17:08 -0700 (PDT) Received: from localhost ([185.112.167.47]) by smtp.gmail.com with ESMTPSA id u22sm591639wmu.43.2020.04.06.12.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 12:17:07 -0700 (PDT) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Stefan Monnier Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks In-Reply-To: References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> <87aabnnxna.fsf@blah.blah> <87zhbojzmv.fsf@gmail.com> User-Agent: Notmuch/0.29.3 (https://notmuchmail.org) Emacs/28.0.50 (x86_64-pc-linux-gnu) Date: Mon, 06 Apr 2020 21:17:34 +0200 Message-ID: <87v9mcjuep.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 5293 Cc: Juanma Barranquero , Kevin Ryde , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, 06 Apr 2020 14:06:02 -0400 Stefan Monnier wrote: >> @@ -299,7 +299,11 @@ unload-feature >> ;; Known abnormal hooks etc. >> (memq x unload-feature-special-hooks))) >> (dolist (func removables) >> - (remove-hook x func))))) >> + (remove-hook x func) >> + (save-current-buffer >> + (dolist (buffer (buffer-list)) >> + (set-buffer buffer) >> + (remove-hook x func t))))))) >> ;; Remove any feature-symbols from auto-mode-alist as well. >> (dolist (func removables) >> (setq auto-mode-alist > > Maybe instead of `(dolist (buffer (buffer-list))` within that big > `mapatoms` within `(dolist (func removables)` (which is O(B*F*V) where > B is the number of buffers, F is the number of functions and V is the > number of hook vars), we should instead do it as: > > (dolist (buffer (buffer-list)) > (dolist (varvar (buffer-local-variables buffer)) ^^^^^^^^^^^^^^^^^^^^^^ Ha! Didn't know/think about that one, and indeed it makes a world of difference. Thanks! So I guess my defeatism will not prevail after all. Updated [2/3] attached. --=20 =C5=A0t=C4=9Bp=C3=A1n --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-unload-feature-Handle-local-hooks.patch >From fd9b67b10fcc9596fc1eeae50bb351ef235eea68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Mon, 6 Apr 2020 13:30:11 +0200 Subject: [PATCH 2/3 v2] unload-feature: Handle local hooks Buffer-local hooks were introduced in 1994-09-30T20:47:13+00:00!rms@gnu.org 0e4d378b32 (add-hook): Initialize default value and local value. but `unload-feature' has not been updated to handle them. * lisp/loadhist.el (unload-feature): Handle local hooks. --- etc/NEWS | 3 +++ lisp/loadhist.el | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 765a923bf7..fa90edc4d1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -297,6 +297,9 @@ optional argument specifying whether to follow symbolic links. ** 'parse-time-string' can now parse ISO 8601 format strings, such as "2020-01-15T16:12:21-08:00". +--- +** 'unload-feature' now also tries to undo additions to buffer-local hooks. + * Changes in Emacs 28.1 on Non-Free Operating Systems diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 60da00cceb..81576679c3 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -300,6 +300,15 @@ unload-feature (memq x unload-feature-special-hooks))) (dolist (func removables) (remove-hook x func))))) + (save-current-buffer + (dolist (buffer (buffer-list)) + (pcase-dolist (`(,sym . ,val) (buffer-local-variables buffer)) + (when (or (and (consp val) + (string-match "-hooks?\\'" (symbol-name sym))) + (memq sym unload-feature-special-hooks)) + (set-buffer buffer) + (dolist (func removables) + (remove-hook sym func t)))))) ;; Remove any feature-symbols from auto-mode-alist as well. (dolist (func removables) (setq auto-mode-alist -- 2.26.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 06 16:40:33 2020 Received: (at 5293) by debbugs.gnu.org; 6 Apr 2020 20:40:33 +0000 Received: from localhost ([127.0.0.1]:49263 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLYXo-0003xw-RI for submit@debbugs.gnu.org; Mon, 06 Apr 2020 16:40:33 -0400 Received: from mail-qv1-f51.google.com ([209.85.219.51]:42298) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLYXn-0003xT-GG for 5293@debbugs.gnu.org; Mon, 06 Apr 2020 16:40:32 -0400 Received: by mail-qv1-f51.google.com with SMTP id ca9so717239qvb.9 for <5293@debbugs.gnu.org>; Mon, 06 Apr 2020 13:40:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LmUUPcYIXet0GmYzbA7gRXKzWub7J/JjbW7N0NAhstc=; b=a1yilRfV/KPjIpTaywJaowt60xzTfv8i1kkoW644xyy1vRllMjxTu/G0Rbm2FU3yCg PtOkSlGxYWQ+90+TxqEmyB3R4R0PWnOSmjyn3Q6FdQJy3d2FmiLRWfCKBrRShN4AAIjQ Xe/7HxBbRHcpUN99Avz+s3DOSqTd/GCXpjSGCmoQ3DKMJVq5hZa5Ubr8Oq3Cy6gLU+6X EgdaDCCDVyQxbb+RHdEMq5+zRyh++hRtGLozXYLqNhnzPpoDvQOuKA6UHauBjKRdMwn3 qkXr9EddjKHNOwP6kUYwG3F6LgU9VRMc9dwnsMI/XNjcb5+cADRLz9k0xia3A5MRszK/ +0NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LmUUPcYIXet0GmYzbA7gRXKzWub7J/JjbW7N0NAhstc=; b=XMoS8jFHOm6TdZpyxVjfiYU/A4pZZL2jOBPPnWGRIYqHaV5HV+MaK6u+HsQTDXKjVY V0SiaGPm6BmUS2+Vk9XGGNh9OpArBGFXFQYMj+pHimNJUByH/3AczKE6tNFlyLSmDPCh MzNDa/C91V5HOT7uMVPZt3EOTNJOPpxIRiSauMCm8rqc8PW5npDhPZc7tNWMvKRuDntO yQmNW3URBDscunch+p5N5GtSWBqcQsBVAmHHXOrSiga5pHi/gQWSZzLnaLUxmaYNDsfS TYuTxq0mecPuif78fyCKaTXYFX2rp3Tl2YlEFxrHtCT2o+O+mMa12BUmBDjq+Sx1wenU whfw== X-Gm-Message-State: AGi0Pubf1MOwDbFesZpn0HzAnBtugB+ryMEQrlruK7lLMr8wg+mh6XT1 +GL/E8VkrDPEY7t1bHUAqcpzfyncHATjDw4WRE0= X-Google-Smtp-Source: APiQypJgNc/1NcDzBBall9ciVOdzWvt9SHpfkYr3J0kn2nYU5LZr59OdE71cgd5iWBF66wg2NW/aM2cHVF8D96tNnIE= X-Received: by 2002:a05:6214:1449:: with SMTP id b9mr1669502qvy.217.1586205625870; Mon, 06 Apr 2020 13:40:25 -0700 (PDT) MIME-Version: 1.0 References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> <87aabnnxna.fsf@blah.blah> <87zhbojzmv.fsf@gmail.com> In-Reply-To: <87zhbojzmv.fsf@gmail.com> From: Juanma Barranquero Date: Mon, 6 Apr 2020 22:39:50 +0200 Message-ID: Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Content-Type: multipart/alternative; boundary="000000000000deff9405a2a54633" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 5293 Cc: Kevin Ryde , Stefan Monnier , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000deff9405a2a54633 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 6, 2020 at 7:24 PM =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec wrote: > Actually, I wonder if ignoring even the global hooks (as opined by > Juanma) and enforcing more widespread usage of FEATURE-unload-function > wouldn't be better; Anything automatically done in the unload-hook is just an ad hoc fix for things the module author knows how to do better than us. FEATURE-unload-function has already been there for a few years. I don't remember right now whether we suggest in the mode-creation documentation to use it, but certainly that's something module authors should do, and the automatic unloading is just a last-resort feature for those old modules that don't. There's no point IMHO to make the hands off approach work better. --000000000000deff9405a2a54633 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Apr 6, 2020 at 7:24 PM =C5=A0t=C4= =9Bp=C3=A1n N=C4=9Bmec <stepnem@gma= il.com> wrote:

> Actually= , I wonder if ignoring even the global hooks (as opined by
> Juanma) = and enforcing more widespread usage of FEATURE-unload-function
> woul= dn't be better;

Anything automatically done in the unload-hook is just an ad = hoc fix for things the
module author knows = how to do better than us. FEATURE-unload-function has already
been there for a few years. I don't remember right n= ow whether we suggest in the
mode-creation = documentation to use it, but certainly that's something module authors<= /div>
should do, and the automatic unloading is j= ust a last-resort feature for those old
mod= ules that don't. There's no point IMHO to make the hands off approa= ch work better.
=C2=A0
--000000000000deff9405a2a54633-- From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 06 17:27:33 2020 Received: (at 5293) by debbugs.gnu.org; 6 Apr 2020 21:27:33 +0000 Received: from localhost ([127.0.0.1]:49313 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLZHJ-0006T1-Fg for submit@debbugs.gnu.org; Mon, 06 Apr 2020 17:27:33 -0400 Received: from mail-lf1-f50.google.com ([209.85.167.50]:44404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLZHG-0006SW-Pr for 5293@debbugs.gnu.org; Mon, 06 Apr 2020 17:27:31 -0400 Received: by mail-lf1-f50.google.com with SMTP id 131so650931lfh.11 for <5293@debbugs.gnu.org>; Mon, 06 Apr 2020 14:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-transfer-encoding; bh=I9r3Xq7b7RnzSsJrgiJa8v/kEyYbQuk3pFdF4ckALo8=; b=O9/n01n/+25XFTOL9hKzaBjAVB0Rxk4FJKt/WqLJ7HOGNV21KmmWYbbzZlYOyF+vaq o7qHyV+fiW5BSvDkFbikNAb1k0j7L1PvEFMAwf2JdxZfBCyeFbcufcRU7EqOaCJEPIq6 Vn9l6wrYsExjXQKJCljxng1BOzue4fGEQ/SlhD2S6QT/CC+J68efggmb7blwlwYYf4VH AAMRj3Riy4BdeLZ9NtSvKvtb3PSHIkMh34O3OU1GeIvs8tDcxLkOiD/JlUTzrbxb872y +sgSEUFZcqMvae318apECj3pSsFwXJfZNJCu/IXpKnWImJaVmEoLaQt3vFSUBXnJ2pcF PyYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-transfer-encoding; bh=I9r3Xq7b7RnzSsJrgiJa8v/kEyYbQuk3pFdF4ckALo8=; b=AN/X3lI2tcNA0hJpUtDHgpc33WfhOYdRhLn+CWJeLMDFOCFP+V1IS0gCYcWJU9/QPS yeYNpuPJNZVOCJwUr0yFR8WUm5lbhEVHtjajMM11Y64Dz9mkaSBZ29s6Oq0OnsIM3nLz DGmMH+Yk4Xozx8sL5pboIzH0zvcQxOLnyPKiUwt6r3aleOV1ZeyVX69mZQe+nDCmO1zV I7/5Pj20zc6ML1OdACmCWqfPx+KIZhiGV1FLSsBr3Yuc0g9LrIfLmqbfRdF1QZGrEQ00 u17i+m7Sb9cylRUfX2HthWp1a5dfGQ5id0xorusLmXa2redFijVyXcLKg2qoqnRDYAvP u2bg== X-Gm-Message-State: AGi0PubO9YXUrSSEaNBUTwcwu8x3cPn6WqUnleuwj0km2pVWGBWvt4IH 9L7xaiCReCmG5gVlpiWsfTw= X-Google-Smtp-Source: APiQypKdMw7JLzVUF2j92aSiQpsJPAeUbuRVw5qufLoakQpT5AO9mmP2OkN9WhFNRagx66uHFWG8fw== X-Received: by 2002:a19:e345:: with SMTP id c5mr14154480lfk.188.1586208444674; Mon, 06 Apr 2020 14:27:24 -0700 (PDT) Received: from localhost ([185.112.167.47]) by smtp.gmail.com with ESMTPSA id 133sm10652216ljj.91.2020.04.06.14.27.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 14:27:24 -0700 (PDT) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Juanma Barranquero Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks In-Reply-To: References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> <87aabnnxna.fsf@blah.blah> <87zhbojzmv.fsf@gmail.com> User-Agent: Notmuch/0.29.3 (https://notmuchmail.org) Emacs/28.0.50 (x86_64-pc-linux-gnu) Date: Mon, 06 Apr 2020 23:27:55 +0200 Message-ID: <87o8s4jodg.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 5293 Cc: Kevin Ryde , Stefan Monnier , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Mon, 06 Apr 2020 22:39:50 +0200 Juanma Barranquero wrote: > On Mon, Apr 6, 2020 at 7:24 PM =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec wrote: > >> Actually, I wonder if ignoring even the global hooks (as opined by >> Juanma) and enforcing more widespread usage of FEATURE-unload-function >> wouldn't be better; > > Anything automatically done in the unload-hook is just an ad hoc fix > for things the module author knows how to do better than us. One common scenario where this doesn't quite hold IIUC is minor modes which users are supposed to put on various hooks themselves: the library author has no way of dealing with that, short of doing something like `unload-feature' does, although checking for just a few known symbols from an unload function instead of the brute-force approach of the latter would arguably be more effective. > FEATURE-unload-function has already been there for a few years. I > don't remember right now whether we suggest in the mode-creation > documentation to use it, We do (lispref/tips.texi). Unfortunately, most elisp libraries in the wild seem to be written by people who either haven't read it, or have remained resistent to most of its edificatory influence. > but certainly that's something module authors should do, and the > automatic unloading is just a last-resort feature for those old > modules that don't. Actually, IME the older, the better behaved. I can't remember last time I saw a newish package with an unload function (while I do remember those without one which left my Emacs broken when I tried unloading them). > There's no point IMHO to make the hands off approach work better. I don't know what you mean by "hands off" here, but in any case, while I used to argue for handling as much as possible in `unload-feature', these days I don't feel strongly about it. So even though this particular issue (local hooks) does seem solvable (thanks again to Stefan!) without making anything much worse or uglier than it already is, I remain of two minds on whether it is the best thing to do or not. --=20 =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 06 19:02:40 2020 Received: (at 5293) by debbugs.gnu.org; 6 Apr 2020 23:02:40 +0000 Received: from localhost ([127.0.0.1]:49361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLalL-00058D-Kx for submit@debbugs.gnu.org; Mon, 06 Apr 2020 19:02:40 -0400 Received: from mail-qv1-f48.google.com ([209.85.219.48]:42496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jLalJ-00057l-NF for 5293@debbugs.gnu.org; Mon, 06 Apr 2020 19:02:38 -0400 Received: by mail-qv1-f48.google.com with SMTP id ca9so921081qvb.9 for <5293@debbugs.gnu.org>; Mon, 06 Apr 2020 16:02:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=A/ke6lsPVK36z7P+X7K0ksnaaubdeJAA0+FQbpd7bLY=; b=p2GKnygcmPpxQjiRpJO5HVIq2ZS1Xz+78TpSa68cHq7pTCqQRTF8NHmunsfrTrpIaX +PULgvXlt+wuKMn6od8Kk8AfD58zoVVlu5uwPLDVnn4c6DfMUU8hnAzqYzPNmObQQSom r6DzvHgvg5z+xwEO9mXQMM7MEpuj6HmfvFg8fkCF7Di9G0KH4pNDRVgDnnQPXoEB42r0 oXsfz/bm0wwLazDpwSKhocwDgrpylPAhCom5wLBOW2KQA/Bb37gP680MUYFmzqlqi6O/ Rem/2xyCIPlS9gCbFscl+wTB9DsvQ+/cAvLovUKkHzdVQ2RObPVsRfsNHAKK5T7uiEdp 0a4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=A/ke6lsPVK36z7P+X7K0ksnaaubdeJAA0+FQbpd7bLY=; b=Sm/LkUdwLQeTjZfnKv0/syLrFy6go/2hvWvoOq82CPpTHrGsVVdnX3uoHgYIO1smUB ndbpNKF41jRXohZ17R6QkBQOWQUr7BTFoKrwak94gpJHx7wzw9T9RYE07kuG/s8uXWvi 6xACqgI7kdHWnb9Qkjsa8JEc5axGGynsEsJKJ0MXK4akCDxFODcxIKUs3d/JevAUjvkW W0p8sgyog41uML680D9uuO51yoOJ/JHE2J9yElRmOthFj1BQ2C5z7iySLzILXFRpQwSC aH1Oe2TCSvlnxh7WPgW02P6QzTxrQ/ys0+B+9yI4jGBLQwM3qt01rKt2qDEmTpgGjb9K 11cg== X-Gm-Message-State: AGi0Pub4cq6g01KvGNLIhsl+QmM7H6zn2PaUucwImwkZLqPzquKK4leW eUCMqk4ChVKQkHsEqcsUZOtHkONOp9owXLanSZOfWg== X-Google-Smtp-Source: APiQypLGcrIkKRcJeApWPcIgqfSunwSYBGAII5nL1O/OBDon64LMeOHG6JNjoIjKEI3Lm5++Ky9fvBJJAr/GSrdN9dY= X-Received: by 2002:a05:6214:1449:: with SMTP id b9mr2182789qvy.217.1586214152078; Mon, 06 Apr 2020 16:02:32 -0700 (PDT) MIME-Version: 1.0 References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> <87aabnnxna.fsf@blah.blah> <87zhbojzmv.fsf@gmail.com> <87o8s4jodg.fsf@gmail.com> In-Reply-To: <87o8s4jodg.fsf@gmail.com> From: Juanma Barranquero Date: Tue, 7 Apr 2020 01:01:55 +0200 Message-ID: Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Content-Type: multipart/alternative; boundary="000000000000128af905a2a7435c" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 5293 Cc: Kevin Ryde , Stefan Monnier , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000128af905a2a7435c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Apr 6, 2020 at 11:27 PM =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec wrote: > One common scenario where this doesn't quite hold IIUC is minor modes > which users are supposed to put on various hooks themselves: the library > author has no way of dealing with that, short of doing something like > `unload-feature' does, although checking for just a few known symbols > from an unload function instead of the brute-force approach of the > latter would arguably be more effective. Some minor modes are designed to be put in a few hooks, so these can be checked by the package itself. But you're right that there are occasions where the automatic mechanisms are necessary. > We do (lispref/tips.texi). Unfortunately, most elisp libraries in the > wild seem to be written by people who either haven't read it, or have > remained resistent to most of its edificatory influence. In these cases, I would consider any problem unloading the library as a reportable bug. One good thing of FEATURE-unload-function is that it is totally backwards-compatible. Any library can define such a function and does not need to worry about being run in older Emacsen. > Actually, IME the older, the better behaved. I can't remember last time > I saw a newish package with an unload function (while I do remember > those without one which left my Emacs broken when I tried unloading > them). Well, I think what happens is that many package developers just don't think at all about the package being unloaded. Truth be told, I'm not sure unload-feature is used that often. I spent some effort in making it work with the libraries included in the Emacs distribution, but I think I've use= d unload-feature myself perhaps a couple of times, other than when testing it= . > I don't know what you mean by "hands off" here, I meant the case where the package maintainer isn't willing to make the effort to add FEATURE-unload-function. > but in any case, while I > used to argue for handling as much as possible in `unload-feature', > these days I don't feel strongly about it. So even though this > particular issue (local hooks) does seem solvable (thanks again to > Stefan!) without making anything much worse or uglier than it already > is, I remain of two minds on whether it is the best thing to do or not. Well, I'm not against making unload-feature work better, if at all possible= . It's just that I see as an imperfect solution because the knowledge to unload a package is, mostly, in the package author's hands. It's somewhat of a waste to have to second-guess them. --000000000000128af905a2a7435c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Mon, Apr 6, 2020 at 11:27 PM =C5=A0t=C4=9Bp=C3=A1n = N=C4=9Bmec <stepnem@gmail.com&g= t; wrote:

> One common scenario where this doesn't quite hold= IIUC is minor modes
> which users are supposed to put on various hoo= ks themselves: the library
> author has no way of dealing with that, = short of doing something like
> `unload-feature' does, although c= hecking for just a few known symbols
> from an unload function instea= d of the brute-force approach of the
> latter would arguably be more = effective.

Some minor modes are designed to be put in a few hoo= ks, so these can be
checked by the package itself. But you're= right that there are occasions where
the automatic mechanisms ar= e necessary.

> We do (lispref/tips.texi). Unfor= tunately, most elisp libraries in the
> wild seem to be written by pe= ople who either haven't read it, or have
> remained resistent to = most of its edificatory influence.

In these cases, I would consider = any problem unloading the library as a
reportable bug. One good t= hing of FEATURE-unload-function is that it is
totally backwards-c= ompatible. Any library can define such a function and
does not ne= ed to worry about being run in older Emacsen.

> Actually, = IME the older, the better behaved. I can't remember last time
> I= saw a newish package with an unload function (while I do remember
> = those without one which left my Emacs broken when I tried unloading
>= them).

Well, I think what happens is that many package developers j= ust don't
think at all about the package being unloaded. Trut= h be told, I'm not sure
unload-feature is used that often. I = spent some effort in making it work
with the libraries included i= n the Emacs distribution, but I think I've used
unload-featur= e myself perhaps a couple of times, other than when testing it.

>= I don't know what you mean by "hands off" here,
I meant the case where the package maintainer isn't willin= g to make the
effort to add FEATURE-unload-function.
> but in any case, while I
> used to argue for handli= ng as much as possible in `unload-feature',
> these days I don= 9;t feel strongly about it. So even though this
> particular issue (l= ocal hooks) does seem solvable (thanks again to
> Stefan!) without ma= king anything much worse or uglier than it already
> is, I remain of = two minds on whether it is the best thing to do or not.

Well, I'm not against making unload-feature work better, if at al= l possible.
It's just that I see as an imperfect solution bec= ause the knowledge to
unload a package is, mostly, in the package= author's hands. It's
somewhat of a waste to have to seco= nd-guess them.

--000000000000128af905a2a7435c-- From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 30 14:44:36 2020 Received: (at 5293) by debbugs.gnu.org; 30 Sep 2020 18:44:36 +0000 Received: from localhost ([127.0.0.1]:33122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNh5f-0006Ps-Mm for submit@debbugs.gnu.org; Wed, 30 Sep 2020 14:44:35 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48746) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kNh5d-0006Pd-54 for 5293@debbugs.gnu.org; Wed, 30 Sep 2020 14:44:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=cIOQUG6lkOVhJzPMCi+Qb3kC5rpYh9O/k++LIgqiOn0=; b=VyztoAjZ9uewKhmFp+56vGCZ+p AjVtJpPt8mLTsYFzzKqT0F0z/t/0rVGYMAugpPON/RH0/xnjW1PA7QfwbcNeCsSsxD0shppkve0Aj eytYqW+ZX2W4JkWPZWqR695X+qYIiSx4MGaS/SjCPa6GKsbvS0g7Um42ijG2BBynHCug=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNh5B-0004fO-Hw; Wed, 30 Sep 2020 20:44:08 +0200 From: Lars Ingebrigtsen To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> <87aabnnxna.fsf@blah.blah> <87zhbojzmv.fsf@gmail.com> <87v9mcjuep.fsf@gmail.com> X-Now-Playing: Martin Finke's _Let It Ring_: "Give Me Writer's Block" Date: Wed, 30 Sep 2020 20:44:04 +0200 In-Reply-To: <87v9mcjuep.fsf@gmail.com> (=?utf-8?B?IsWgdMSbcMOhbiBOxJtt?= =?utf-8?B?ZWMiJ3M=?= message of "Mon, 06 Apr 2020 21:17:34 +0200") Message-ID: <87y2krxfyj.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Štěpán Němec writes: > So I guess my defeatism will not prevail after all. Updated [2/3] attached. The patch no longer applied to the trunk, and it referred to a variable called `removables' that I couldn't find. So I've respun it (included below), but not tested. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 5293 Cc: Juanma Barranquero , Kevin Ryde , Stefan Monnier , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec writes: > So I guess my defeatism will not prevail after all. Updated [2/3] attache= d. The patch no longer applied to the trunk, and it referred to a variable called `removables' that I couldn't find. So I've respun it (included below), but not tested. Any comments? diff --git a/etc/NEWS b/etc/NEWS index b4f29ab783..993cb3ca85 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -215,6 +215,9 @@ preserving markers, properties and overlays. The new v= ariable number of seconds that 'revert-buffer-with-fine-grain' should spend trying to be non-destructive. =20 +--- +** 'unload-feature' now also tries to undo additions to buffer-local hooks. + * Changes in Specialized Modes and Packages in Emacs 28.1 =20 diff --git a/lisp/loadhist.el b/lisp/loadhist.el index a1ff2f6270..6f2e313f71 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -297,6 +297,16 @@ unload-feature (when (and (eq (car-safe y) 'defun) (not (get (cdr y) 'autoload))) (remove-hook x (cdr y))))))) + ;; Handle buffer-local hooks. + (save-current-buffer + (dolist (buffer (buffer-list)) + (pcase-dolist (`(,sym . ,val) (buffer-local-variables buffer)) + (when (or (and (consp val) + (string-match "-hooks?\\'" (symbol-name sym))) + (memq sym unload-feature-special-hooks)) + (set-buffer buffer) + (dolist (func unload-function-defs-list) + (remove-hook sym func t)))))) ;; Remove any feature-symbols from auto-mode-alist as well. (dolist (y unload-function-defs-list) (when (and (eq (car-safe y) 'defun) --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 20 06:18:03 2020 Received: (at 5293) by debbugs.gnu.org; 20 Oct 2020 10:18:04 +0000 Received: from localhost ([127.0.0.1]:43699 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUoiR-0004Uz-Ee for submit@debbugs.gnu.org; Tue, 20 Oct 2020 06:18:03 -0400 Received: from mail-ej1-f53.google.com ([209.85.218.53]:41634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUoiO-0004UU-Td for 5293@debbugs.gnu.org; Tue, 20 Oct 2020 06:18:01 -0400 Received: by mail-ej1-f53.google.com with SMTP id x7so1838392eje.8 for <5293@debbugs.gnu.org>; Tue, 20 Oct 2020 03:18:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=KeKi9oC6hAAaEhOHn1vvm1taM0321H/sGyroSr3DfXA=; b=aJF6boGe4tJiUSZAOw/UNxUHMaBSxgiUdJk1Ur3HlK+pw8QQsw5A0qn4TFiAKc82C0 ny/yHgrAZhSUkPlDvqdiW+ffhppbYlKA8LUAT6LOxwwAbYnqeo+pAy4pPc5lHi/2whER 6I8kt3IU9hX54YwPJi0cQOcRxpIRbREo3fPMpqMhA+KrGZw3LbbNCxDSDwInKNt5pPqZ WdzMGHKgn8tvR2036YIIsll0cKK8M0TDsjdC87ZtohPHL6c4oea1XPgZ0kHyKRDj4Tcz +jBxjrG6h5crO6YKRa4r2lSUKLPZddHhqX4w2iismjtNX/Xjm5uc1T2rB0MQq6UTdcWo KS6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=KeKi9oC6hAAaEhOHn1vvm1taM0321H/sGyroSr3DfXA=; b=jJsVT7DLA9NfhgFxqQuJs1Iqt9AN3hKjVMgSnRU+SAdpm2RX2uDqEzl+uP+jyRAbrY bJ3k4trqwOKRDV+s0m8hOpTxr8V2V/kZ1S2HO64IPa0HtYzeTpGTKXaf11Q4I52uGTwQ CL5P0vheilKC4CRK44XFiaZ+aAcFx7GmZVtm9VcNQY4QYkFiO+wJiH1fNoRmM36XF5+k 8HYdBvPBt8Dr/x0SYFq3Vt4vjcbwwXL1N1MGxEfIxZZwMZ+UeTs7t0ajvxmnNL+o/ny7 rMR7DCSLdIYw1AlYCY6EbrAeBenkEKSKB3OKjwnuUlYvjAFKq/y09GO/T4riNbmISa8m fWOg== X-Gm-Message-State: AOAM531Zi/CoGaBpIGD6ULPW1NtX7sZEC17i4YCAfoev2QDb+n3gmxii Yh3gA/TPjLZd/ftt3rHxvAs= X-Google-Smtp-Source: ABdhPJwGUr/kSZJBBRO+a4cLucecwNAq+N1uEjf4xfOoo58QMPXIRF7+bc+7Y7PEUJNnm4L5JGbiuA== X-Received: by 2002:a17:906:d41:: with SMTP id r1mr2269635ejh.383.1603189075102; Tue, 20 Oct 2020 03:17:55 -0700 (PDT) Received: from localhost ([185.112.167.50]) by smtp.gmail.com with ESMTPSA id k11sm1960435eji.72.2020.10.20.03.17.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 03:17:53 -0700 (PDT) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Lars Ingebrigtsen Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks In-Reply-To: <87y2krxfyj.fsf@gnus.org> References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> <87aabnnxna.fsf@blah.blah> <87zhbojzmv.fsf@gmail.com> <87v9mcjuep.fsf@gmail.com> <87y2krxfyj.fsf@gnus.org> User-Agent: Notmuch/0.31 (https://notmuchmail.org) Emacs/28.0.50 (x86_64-pc-linux-gnu) Date: Tue, 20 Oct 2020 12:20:23 +0200 Message-ID: <87blgxi4go.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 5293 Cc: Juanma Barranquero , Kevin Ryde , Stefan Monnier , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Wed, 30 Sep 2020 20:44:04 +0200 Lars Ingebrigtsen wrote: > The patch no longer applied to the trunk, That's just the usual etc/NEWS conflict, I think. > and it referred to a variable called `removables' that I couldn't > find. It's a 3-patch series; the variable is introduced by the previous patch. For convenience, I've attached the whole series rebased on top of current master. Given the lack of further feedback, I haven't pushed (for pushing) this, as I kinda liked Stefan's other suggestion, too ("If we need it to go faster maybe we could also arrange for (add-hook V F ..) to do (cl-pushnew V (get F 'hooks-where-it-has-been-put)).", from https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-04/msg00163.html jwvsghgcxi5.fsf-monnier+emacs@gnu.org ) But this version seems fast enough, so maybe we can push this and be done with it, at least for the time being. --=20 =C5=A0t=C4=9Bp=C3=A1n --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-unload-feature-Improve-logic-don-t-repeat-computatio.patch >From 0d41a85c1881cd24a384e89227b3079bb62d5e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Mon, 6 Apr 2020 13:25:41 +0200 Subject: [PATCH 1/3] unload-feature: Improve logic (don't repeat computation) * lisp/loadhist.el (unload-feature): Don't do the same computation twice. --- lisp/loadhist.el | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/lisp/loadhist.el b/lisp/loadhist.el index a1ff2f6270..60da00cceb 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -287,22 +287,23 @@ unload-feature ;; functions which the package might just have installed, and ;; there might be other important state, but this tactic ;; normally works. - (mapatoms - (lambda (x) - (when (and (boundp x) - (or (and (consp (symbol-value x)) ; Random hooks. - (string-match "-hooks?\\'" (symbol-name x))) - (memq x unload-feature-special-hooks))) ; Known abnormal hooks etc. - (dolist (y unload-function-defs-list) - (when (and (eq (car-safe y) 'defun) - (not (get (cdr y) 'autoload))) - (remove-hook x (cdr y))))))) - ;; Remove any feature-symbols from auto-mode-alist as well. - (dolist (y unload-function-defs-list) - (when (and (eq (car-safe y) 'defun) - (not (get (cdr y) 'autoload))) - (setq auto-mode-alist - (rassq-delete-all (cdr y) auto-mode-alist))))) + (let ((removables (cl-loop for def in unload-function-defs-list + when (and (eq (car-safe def) 'defun) + (not (get (cdr def) 'autoload))) + collect (cdr def)))) + (mapatoms + (lambda (x) + (when (and (boundp x) + (or (and (consp (symbol-value x)) ; Random hooks. + (string-match "-hooks?\\'" (symbol-name x))) + ;; Known abnormal hooks etc. + (memq x unload-feature-special-hooks))) + (dolist (func removables) + (remove-hook x func))))) + ;; Remove any feature-symbols from auto-mode-alist as well. + (dolist (func removables) + (setq auto-mode-alist + (rassq-delete-all func auto-mode-alist))))) ;; Change major mode in all buffers using one defined in the feature being unloaded. (unload--set-major-mode) -- 2.28.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-unload-feature-Handle-local-hooks.patch >From c50b6dec73739e5c3e1f18774b98adae213cf76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Mon, 6 Apr 2020 13:30:11 +0200 Subject: [PATCH 2/3] unload-feature: Handle local hooks Buffer-local hooks were introduced in 1994-09-30T20:47:13+00:00!rms@gnu.org 0e4d378b32 (add-hook): Initialize default value and local value. but `unload-feature' has not been updated to handle them. * lisp/loadhist.el (unload-feature): Handle local hooks. --- etc/NEWS | 3 +++ lisp/loadhist.el | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index c571fa95d1..3739b1c67e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1743,6 +1743,9 @@ to lexical binding, where dynamic (special) variables bound in one file can affect code in another. For details, see the manual section '(Elisp) Converting to Lexical Binding'. +--- +** 'unload-feature' now also tries to undo additions to buffer-local hooks. + * Changes in Emacs 28.1 on Non-Free Operating Systems diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 60da00cceb..81576679c3 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -300,6 +300,15 @@ unload-feature (memq x unload-feature-special-hooks))) (dolist (func removables) (remove-hook x func))))) + (save-current-buffer + (dolist (buffer (buffer-list)) + (pcase-dolist (`(,sym . ,val) (buffer-local-variables buffer)) + (when (or (and (consp val) + (string-match "-hooks?\\'" (symbol-name sym))) + (memq sym unload-feature-special-hooks)) + (set-buffer buffer) + (dolist (func removables) + (remove-hook sym func t)))))) ;; Remove any feature-symbols from auto-mode-alist as well. (dolist (func removables) (setq auto-mode-alist -- 2.28.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0003-unload-feature-Correct-doc-string-to-match-info-manu.patch >From eb9a34d1e1e5527686a41561db5fd2797edb5074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Mon, 6 Apr 2020 17:05:33 +0200 Subject: [PATCH 3/3] unload-feature: Correct doc string to match info manual and reality 'unload-feature' doesn't try to "undo any additions the library has made" to hooks, it tries to remove functions defined by the library from hooks, no matter how they got there. * lisp/loadhist.el (unload-feature): Correct the doc string. * doc/lispref/loading.texi (Unloading): Clarify, fix typo. --- doc/lispref/loading.texi | 4 ++-- lisp/loadhist.el | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index aa6ef307b1..e5364152d5 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi @@ -1063,7 +1063,7 @@ Unloading (Loading saves these in the @code{autoload} property of the symbol.) Before restoring the previous definitions, @code{unload-feature} runs -@code{remove-hook} to remove functions in the library from certain +@code{remove-hook} to remove functions defined by the library from certain hooks. These hooks include variables whose names end in @samp{-hook} (or the deprecated suffix @samp{-hooks}), plus those listed in @code{unload-feature-special-hooks}, as well as @@ -1071,7 +1071,7 @@ Unloading function because important hooks refer to functions that are no longer defined. -Standard unloading activities also undoes ELP profiling of functions +Standard unloading activities also undo ELP profiling of functions in that library, unprovides any features provided by the library, and cancels timers held in variables defined by the library. diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 81576679c3..8ac575e8e3 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -234,11 +234,10 @@ unload-feature is nil, raise an error. Standard unloading activities include restoring old autoloads for -functions defined by the library, undoing any additions that the -library has made to hook variables or to `auto-mode-alist', undoing -ELP profiling of functions in that library, unproviding any features -provided by the library, and canceling timers held in variables -defined by the library. +functions defined by the library, removing such functions from +hooks and `auto-mode-alist', undoing their ELP profiling, +unproviding any features provided by the library, and canceling +timers held in variables defined by the library. If a function `FEATURE-unload-function' is defined, this function calls it with no arguments, before doing anything else. That function -- 2.28.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 20 07:13:34 2020 Received: (at 5293) by debbugs.gnu.org; 20 Oct 2020 11:13:34 +0000 Received: from localhost ([127.0.0.1]:43758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUpaA-0005yt-1q for submit@debbugs.gnu.org; Tue, 20 Oct 2020 07:13:34 -0400 Received: from quimby.gnus.org ([95.216.78.240]:45212) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUpa8-0005yh-Hw for 5293@debbugs.gnu.org; Tue, 20 Oct 2020 07:13:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=3zT15HTvmm3Y6nt0+2UQT3dzEy7J772lj5Bu+aaUd0g=; b=LN/4bJbW4ncV/74HRvSbleR1Kt rdGUcUFbScnSiy3sBMz/y0bVjadsWJpG+lfJSixcBbytzoUzrzJLjUd0Wbg/+1C+Zvw/MBJ9mMHAD WSpbnp6IqhcJydDJbCEOO7pq3bDke705zKkE8igqVi/YneIpWJW1L8Y33FPngNwhJ3Ms=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kUpZe-00075U-00; Tue, 20 Oct 2020 13:13:05 +0200 From: Lars Ingebrigtsen To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> <87aabnnxna.fsf@blah.blah> <87zhbojzmv.fsf@gmail.com> <87v9mcjuep.fsf@gmail.com> <87y2krxfyj.fsf@gnus.org> <87blgxi4go.fsf@gmail.com> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAFVBMVEX8+/rs3NDauKLT sGOta2R5XVr///+8biu3AAAAAWJLR0QGYWa4fQAAAAd0SU1FB+QKFAsLOBNppekAAAG5SURBVDjL bVRRkqwgDCTMHiBBD2CC87+CewAR/1+9cu5/lY2j7sA4+bCKNA2dTtAY2gLRGC9syqAdMc0yPxKe qWKDj3F8fJtrSIzx598HgBsFPjBgAD2r+wBMqMhxewUkBjPmK8Wt5Lo+84UgqwjnKwPcfxGX5+8r kABdThNSDVhIJO0sE0ktrIXspn7OE/j6mpbu0uVRNddFQk+3Na1ZiLhSbEempV9TcEChYkQ290ce OzJQyQLP9v5I4qRukoEm8ZKFtXquC7GzrL2mJU81AD5PfedMuyQo82j8wi1bpJbdW5/6wXW6wSpa pPGra6cWYSvuVgENKgMp4htgxPQdGNI6qSkAtIOx2hCIiVwogUYtzUS3kMnPJTCKD6NsH+7jq0KQ ILOoTU5Eeo8nBVjN0DyiU7PUaDzzTRB+PgV1l5W2AzYy6GrrHDyfChyA85s+IKd2oHpi3DmObnge qKbSPmFyymqKuUB9Z3gaD0X71Uc9jQ5ddnghjp+mHiv/N0v7k/6rfZueI48lYdPMO/Nt1rWMqLX7 QIe0V5AaMIZdTTVy0KkDp8pqgJw68dpZcCC8/32OsJvDxfoXVow7jiP4x5cAAAAldEVYdGRhdGU6 Y3JlYXRlADIwMjAtMTAtMjBUMTE6MTE6NTYrMDA6MDD4InogAAAAJXRFWHRkYXRlOm1vZGlmeQAy MDIwLTEwLTIwVDExOjExOjU2KzAwOjAwiX/CnAAAAABJRU5ErkJggg== X-Now-Playing: Christoph de Babalon's _Hectic Shakes_: "Harakiri" Date: Tue, 20 Oct 2020 13:13:00 +0200 In-Reply-To: <87blgxi4go.fsf@gmail.com> (=?utf-8?B?IsWgdMSbcMOhbiBOxJtt?= =?utf-8?B?ZWMiJ3M=?= message of "Tue, 20 Oct 2020 12:20:23 +0200") Message-ID: <878sc1i20z.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Štěpán Němec writes: > But this version seems fast enough, so maybe we can push this and be > done with it, at least for the time being. Yeah, I think so -- your patch looks like a good idea, and we can always tweak this more later, so please go ahead and push the patch series. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 5293 Cc: Juanma Barranquero , Kevin Ryde , Stefan Monnier , 5293@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec writes: > But this version seems fast enough, so maybe we can push this and be > done with it, at least for the time being. Yeah, I think so -- your patch looks like a good idea, and we can always tweak this more later, so please go ahead and push the patch series. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 21 12:58:10 2020 Received: (at 5293-done) by debbugs.gnu.org; 21 Oct 2020 16:58:10 +0000 Received: from localhost ([127.0.0.1]:50378 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVHRB-00078U-R2 for submit@debbugs.gnu.org; Wed, 21 Oct 2020 12:58:10 -0400 Received: from mail-ej1-f45.google.com ([209.85.218.45]:33909) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVHRA-00078F-CA for 5293-done@debbugs.gnu.org; Wed, 21 Oct 2020 12:58:08 -0400 Received: by mail-ej1-f45.google.com with SMTP id u8so4296340ejg.1 for <5293-done@debbugs.gnu.org>; Wed, 21 Oct 2020 09:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-transfer-encoding; bh=mRjb8YJAn0wllXzNqR8BLbQ54dMpqUWR0NouF2KoQuI=; b=VTxrKzMiQdRmvYP8DhOr29tM8AVcOx7BQSOBKHv6Tgh5vwn1pZCK1kLdRP/CTws28N r1TlnqhcMg7HKOqMMDPQCtK/lV01AwYEWicR45BX92aausNoXkJkvY9M8A9AvaagKxr2 MJ7DnRa/9HC2Vtgg/Ydn4TW8LZt+kzJCLjYtVEwLXCTyB0Gk3BCYzaPS+yC2/izITiu+ 9UPQcK2ORal9IKfiK4BjspeC6h9Y976tEwVfgdrlee1HRd7FqdvPozSgmfcrPhyhwxny KCBPqpMi7eJpNHCHLXVv6YtqbCHd8Y8Zt4xbpfJFUgloroUqyvEfXAc2oVPs2MTdRUqI 67SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-transfer-encoding; bh=mRjb8YJAn0wllXzNqR8BLbQ54dMpqUWR0NouF2KoQuI=; b=lkrSWS7la1Ull19nV+2RDlDDOEiTE5WKZhM1rHQYOuLq4NC5uSR83a8xQuLejKm4bw ZP9tUkzsAeljgRRmzdenw19iAR6Rp5jkDcXVapwOcZ3ssFq+W4fCR8HAc0lGqHAqDIpR jKjnrZvkqemuwMXh2WKKNzc96FH44Gk0V3fL3k1lkXU+MeK38aw7xqMCZzhWpPnMelAz WuINZk9y8VmZWHUFONWPO8lmrC2fyReGiValVcjCoA48oq3Cv/8RglgiSVTNMJ1nEKGL 5mB4ox3Q6nJIC7cTaDqycH4ZksdNpA31m1UesJaNeJausMg/qGZrAoAwjxXty/OM7CjF O+CA== X-Gm-Message-State: AOAM532IAIGgskK+Re/PHi5CHr2ZeLerY49/qRaF2pb5P/1c9j+QztTX lmT9dCx489D5yQWXPVGdQ7E= X-Google-Smtp-Source: ABdhPJwipZT5+XOBeSx3bjceRw86snTQGK70RBpQKpgsEFhhyD9/98uVOJKQSDlwA66rPCzOWLivqA== X-Received: by 2002:a17:906:4d10:: with SMTP id r16mr4747835eju.68.1603299482436; Wed, 21 Oct 2020 09:58:02 -0700 (PDT) Received: from localhost ([185.112.167.50]) by smtp.gmail.com with ESMTPSA id i14sm2550555ejp.2.2020.10.21.09.58.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2020 09:58:01 -0700 (PDT) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Lars Ingebrigtsen Subject: Re: bug#5293: 23.1; unload-feature on buffer-local hooks In-Reply-To: <878sc1i20z.fsf@gnus.org> References: <87hbr4p67t.fsf@blah.blah> <871uxsl778.fsf@blah.blah> <87aabnnxna.fsf@blah.blah> <87zhbojzmv.fsf@gmail.com> <87v9mcjuep.fsf@gmail.com> <87y2krxfyj.fsf@gnus.org> <87blgxi4go.fsf@gmail.com> <878sc1i20z.fsf@gnus.org> User-Agent: Notmuch/0.31 (https://notmuchmail.org) Emacs/28.0.50 (x86_64-pc-linux-gnu) Date: Wed, 21 Oct 2020 19:00:33 +0200 Message-ID: <877drjikem.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 5293-done Cc: Juanma Barranquero , Kevin Ryde , Stefan Monnier , 5293-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Tue, 20 Oct 2020 13:13:00 +0200 Lars Ingebrigtsen wrote: > =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec writes: > >> But this version seems fast enough, so maybe we can push this and be >> done with it, at least for the time being. > > Yeah, I think so -- your patch looks like a good idea, and we can always > tweak this more later, so please go ahead and push the patch series. Done, thank you. 0e9e36747f (unload-feature: Improve logic (don't repeat computation)) 2020-04-06T13:25:41+02:00!stepnem@gmail.com 5c266a71c1 (unload-feature: Handle local hooks (bug#5293)) 2020-04-06T13:30:11+02:00!stepnem@gmail.com 8dc8ab6b42 (unload-feature: Correct doc string to match info manual and rea= lity) 2020-04-06T17:05:33+02:00!stepnem@gmail.com --=20 =C5=A0t=C4=9Bp=C3=A1n From unknown Fri Jun 20 07:25:04 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 19 Nov 2020 12:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator