unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Štěpán Němec" <stepnem@gmail.com>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: Kevin Ryde <user42@zip.com.au>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	5293@debbugs.gnu.org
Subject: bug#5293: 23.1; unload-feature on buffer-local hooks
Date: Mon, 06 Apr 2020 23:27:55 +0200	[thread overview]
Message-ID: <87o8s4jodg.fsf@gmail.com> (raw)
In-Reply-To: <CAAeL0SSzT=7e1StO4uiM8gR_4Sd-Vzro6ROxML7Kbx9x_rn6pA@mail.gmail.com>

On Mon, 06 Apr 2020 22:39:50 +0200
Juanma Barranquero wrote:

> On Mon, Apr 6, 2020 at 7:24 PM Štěpán Němec <stepnem@gmail.com> 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.

-- 
Štěpán





  reply	other threads:[~2020-04-06 21:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-02 21:06 bug#5293: 23.1; unload-feature on buffer-local hooks Kevin Ryde
2010-01-02 23:14 ` Juanma Barranquero
2011-07-13 20:28 ` Juanma Barranquero
2011-07-15  0:26   ` Kevin Ryde
2011-07-15  0:34     ` Juanma Barranquero
2011-07-15  8:52       ` Štěpán Němec
2011-07-15 11:24         ` Juanma Barranquero
2011-07-15 16:08           ` Štěpán Němec
2011-07-15 16:20             ` Juanma Barranquero
2011-07-16 18:50     ` Stefan Monnier
2011-08-06  1:20       ` Kevin Ryde
2020-04-06 17:24         ` Štěpán Němec
2020-04-06 18:06           ` Stefan Monnier
2020-04-06 19:17             ` Štěpán Němec
2020-09-30 18:44               ` Lars Ingebrigtsen
2020-10-20 10:20                 ` Štěpán Němec
2020-10-20 11:13                   ` Lars Ingebrigtsen
2020-10-21 17:00                     ` Štěpán Němec
2020-04-06 20:39           ` Juanma Barranquero
2020-04-06 21:27             ` Štěpán Němec [this message]
2020-04-06 23:01               ` Juanma Barranquero

Reply instructions:

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

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

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

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

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

  git send-email \
    --in-reply-to=87o8s4jodg.fsf@gmail.com \
    --to=stepnem@gmail.com \
    --cc=5293@debbugs.gnu.org \
    --cc=lekktu@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=user42@zip.com.au \
    /path/to/YOUR_REPLY

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

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

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

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