unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: "Štěpán Němec" <stepnem@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: Tue, 7 Apr 2020 01:01:55 +0200	[thread overview]
Message-ID: <CAAeL0SRSdOe6R6rcE6-C9btkP3d2fX9wT-OU3uKp3ZJ+ZpL11A@mail.gmail.com> (raw)
In-Reply-To: <87o8s4jodg.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2603 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3098 bytes --]

      reply	other threads:[~2020-04-06 23:01 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
2020-04-06 23:01               ` Juanma Barranquero [this message]

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=CAAeL0SRSdOe6R6rcE6-C9btkP3d2fX9wT-OU3uKp3ZJ+ZpL11A@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=5293@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=stepnem@gmail.com \
    --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).