GNU bug report logs - #5294
23.1; unload-feature disable minor-mode

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Kevin Ryde <user42@HIDDEN>; dated Sat, 2 Jan 2010 21:10:03 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 5294 <at> debbugs.gnu.org:


Received: (at 5294) by debbugs.gnu.org; 6 Jan 2010 01:09:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 05 20:09:37 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NSKP2-0003va-QL
	for submit <at> debbugs.gnu.org; Tue, 05 Jan 2010 20:09:36 -0500
Received: from mail-bw0-f216.google.com ([209.85.218.216])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <lekktu@HIDDEN>) id 1NSKP0-0003vR-Jt
	for 5294 <at> debbugs.gnu.org; Tue, 05 Jan 2010 20:09:35 -0500
Received: by bwz8 with SMTP id 8so10787409bwz.39
	for <5294 <at> debbugs.gnu.org>; Tue, 05 Jan 2010 17:09:30 -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
	:content-transfer-encoding;
	bh=HIlv5qbzWAxx+LjUJhVmwYcCpYKlYb4tq/lrt4hViMk=;
	b=EwYoJAEgFCkv4NG4VQ4a0dXWIbF6qtK+WW6NLpw7TbHjjpRMg1PumjleqQTVGGGXkQ
	2kXBVwtF8Nm/WgWiNLId3HPQHdcc9YQkawGA2A8fzth4SjxkRl83QXKGani+p3p0MyEc
	a/XDLfOlstnKADr2fnwLUFTiLTwh1yD6QWPz8=
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:content-transfer-encoding;
	b=oZ9yG6vDFRNIPb74ycmXSeKGydmPe4KY4lMHqxNvneElDygKkIvKKmO4l2DZ9+pbLc
	JAo+lRhkgJB8A92l0Or9n9n3QvecKigknl3P2/bOtdhE/vDCBgPVkZJSAEsDQR2f/EWm
	oOpliT65uuWnp6Q/mZXZTfz6M0uy8eJBCIvCI=
MIME-Version: 1.0
Received: by 10.204.32.131 with SMTP id c3mr2107728bkd.190.1262740170207; Tue, 
	05 Jan 2010 17:09:30 -0800 (PST)
In-Reply-To: <87zl4srqr3.fsf@HIDDEN>
References: <87aawwp631.fsf@HIDDEN>
	<f7ccd24b1001021522s5ff3b8ate9de314bdb0eb57f@HIDDEN> 
	<87tyv4njo7.fsf@HIDDEN>
	<f7ccd24b1001021624l3e1e9d70gd72263e068d6bbc5@HIDDEN> 
	<87bpha7ptb.fsf@HIDDEN>
	<f7ccd24b1001031512r3f9a42aftf6c3c206a4ba82f0@HIDDEN> 
	<87iqbgt9h4.fsf@HIDDEN>
	<f7ccd24b1001051623g4b4a2d20g5b00de7f29df6183@HIDDEN> 
	<87zl4srqr3.fsf@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Wed, 6 Jan 2010 02:09:10 +0100
Message-ID: <f7ccd24b1001051709h5a9f6d53vf2a86e59ad4806f3@HIDDEN>
Subject: Re: bug#5294: 23.1; unload-feature disable minor-mode
To: Kevin Ryde <user42@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: 5294
Cc: 5294 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

On Wed, Jan 6, 2010 at 02:01, Kevin Ryde <user42@HIDDEN> wrote:

> Principally that define-minor-mode knows what things it did and
> therefore should be undone, or why they might not be undone at the
> present time.

But that is defined in the same file as the unload-function...

> I think it would be rather repetitive to be obliged to
> write a FOO-unload-function whenever making a minor mode.

You want to write the same code, but put it in define-minor-mode. I
don't think define-minor-mode should worry itself with unloading.

> Which, err, presumes that there may be standardized things that should
> be considered and/or undone for unloading a mode. =C2=A0I see you say the=
re's
> normally not -- where I say there could be a disable or a caution to
> avoid likely breakage, removal from the minor modes menu, etc.

I do not say that there are not, I say that they are not easy to
generalize. Some are. For example, removing a minor-mode for the
minor-modes menu seems a good idea, and should be done by
unload-feature if it is not done already, because calling a
nonexistent function is an error.

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5294; Package emacs. Full text available.

Message received at 5294 <at> debbugs.gnu.org:


Received: (at 5294) by debbugs.gnu.org; 6 Jan 2010 01:01:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 05 20:01:22 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NSKH4-0003rD-OM
	for submit <at> debbugs.gnu.org; Tue, 05 Jan 2010 20:01:22 -0500
Received: from mailout1-6.pacific.net.au ([61.8.2.213]
	helo=mailout1.pacific.net.au)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gg@HIDDEN>) id 1NSKH2-0003r5-1w
	for 5294 <at> debbugs.gnu.org; Tue, 05 Jan 2010 20:01:21 -0500
Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au
	[61.8.2.163])
	by mailout1.pacific.net.au (Postfix) with ESMTP id 20F11511F66;
	Wed,  6 Jan 2010 12:01:14 +1100 (EST)
Received: from blah.blah (ppp26FC.dyn.pacific.net.au [61.8.38.252])
	by mailproxy2.pacific.net.au (Postfix) with ESMTP id 705342741F;
	Wed,  6 Jan 2010 12:01:13 +1100 (EST)
Received: from gg by blah.blah with local (Exim 4.71)
	(envelope-from <gg@HIDDEN>)
	id 1NSKGm-0005AY-Pw; Wed, 06 Jan 2010 12:01:04 +1100
From: Kevin Ryde <user42@HIDDEN>
To: Juanma Barranquero <lekktu@HIDDEN>
Subject: Re: bug#5294: 23.1; unload-feature disable minor-mode
References: <87aawwp631.fsf@HIDDEN>
	<f7ccd24b1001021522s5ff3b8ate9de314bdb0eb57f@HIDDEN>
	<87tyv4njo7.fsf@HIDDEN>
	<f7ccd24b1001021624l3e1e9d70gd72263e068d6bbc5@HIDDEN>
	<87bpha7ptb.fsf@HIDDEN>
	<f7ccd24b1001031512r3f9a42aftf6c3c206a4ba82f0@HIDDEN>
	<87iqbgt9h4.fsf@HIDDEN>
	<f7ccd24b1001051623g4b4a2d20g5b00de7f29df6183@HIDDEN>
Date: Wed, 06 Jan 2010 12:01:04 +1100
In-Reply-To: <f7ccd24b1001051623g4b4a2d20g5b00de7f29df6183@HIDDEN>
	(Juanma Barranquero's message of "Wed, 6 Jan 2010 01:23:41 +0100")
Message-ID: <87zl4srqr3.fsf@HIDDEN>
User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -3.5 (---)
X-Debbugs-Envelope-To: 5294
Cc: 5294 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.5 (---)

Juanma Barranquero <lekktu@HIDDEN> writes:
>
> How is passing that test (presumibly, either a form or a predicate
> function) to define-minor-mode better than putting it into
> FEATURE-unload-function?

Principally that define-minor-mode knows what things it did and
therefore should be undone, or why they might not be undone at the
present time.  I think it would be rather repetitive to be obliged to
write a FOO-unload-function whenever making a minor mode.

Which, err, presumes that there may be standardized things that should
be considered and/or undone for unloading a mode.  I see you say there's
normally not -- where I say there could be a disable or a caution to
avoid likely breakage, removal from the minor modes menu, etc.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5294; Package emacs. Full text available.

Message received at 5294 <at> debbugs.gnu.org:


Received: (at 5294) by debbugs.gnu.org; 6 Jan 2010 00:24:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 05 19:24:09 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NSJh2-000354-Lo
	for submit <at> debbugs.gnu.org; Tue, 05 Jan 2010 19:24:08 -0500
Received: from mail-bw0-f216.google.com ([209.85.218.216])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <lekktu@HIDDEN>) id 1NSJh0-00034m-LB
	for 5294 <at> debbugs.gnu.org; Tue, 05 Jan 2010 19:24:07 -0500
Received: by bwz8 with SMTP id 8so10772562bwz.39
	for <5294 <at> debbugs.gnu.org>; Tue, 05 Jan 2010 16:24:02 -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
	:content-transfer-encoding;
	bh=K9LOsZ2A2nc+jWeCXYqmTunM7xZIQ+49xOe6YLlvXJs=;
	b=vsX5a6gczZ0SqF3GkdwCLBKx9+s/epfEXD5e5dO0rLs0Yn68A8UhGqdqes+IHAKYCc
	+jJIEkxCUwKp0JQoewbUjSUvbavHE3MBy7z/dkV4cIZW58PfkvizkfPEXUAMFHVPqklm
	stIoZM7ZKqCQkKI4FDo5TuVRpZJ+NbeenKl5Y=
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:content-transfer-encoding;
	b=qY2WIyYg7R7k1m0kp2G4fqxgz9C+iJ+abR8qFgbFjRU3ycd9dM2qXxcF4ia9BA6mz8
	V7oBoYr2DMMdOEbSX6dW4uWw6eI2Xgw3qW+FOOoK6UYTENXwinDLGMYSoQgNP9ajpY8m
	1fA36jTrqH8A5jr7eK+m7F4grYKRxBibacTGo=
MIME-Version: 1.0
Received: by 10.204.25.208 with SMTP id a16mr5434461bkc.133.1262737442170; 
	Tue, 05 Jan 2010 16:24:02 -0800 (PST)
In-Reply-To: <87iqbgt9h4.fsf@HIDDEN>
References: <87aawwp631.fsf@HIDDEN>
	<f7ccd24b1001021522s5ff3b8ate9de314bdb0eb57f@HIDDEN> 
	<87tyv4njo7.fsf@HIDDEN>
	<f7ccd24b1001021624l3e1e9d70gd72263e068d6bbc5@HIDDEN> 
	<87bpha7ptb.fsf@HIDDEN>
	<f7ccd24b1001031512r3f9a42aftf6c3c206a4ba82f0@HIDDEN> 
	<87iqbgt9h4.fsf@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Wed, 6 Jan 2010 01:23:41 +0100
Message-ID: <f7ccd24b1001051623g4b4a2d20g5b00de7f29df6183@HIDDEN>
Subject: Re: bug#5294: 23.1; unload-feature disable minor-mode
To: Kevin Ryde <user42@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.7 (--)
X-Debbugs-Envelope-To: 5294
Cc: 5294 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.7 (--)

On Wed, Jan 6, 2010 at 00:31, Kevin Ryde <user42@HIDDEN> wrote:

> To, umm, get slightly back on-topic -- as an alternative for unloading
> minor modes, if the mode is currently enabled in a buffer, or enabled
> globally for a global, then unload-feature might refuse to unload
> (except under FORCE) on that basis that in-use is a kind of dependency
> on the feature's code etc. =C2=A0The same might be applied to major modes=
,
> ie. refuse to unload if in use.

That would be too restrictive; there are instances in which just
deactivating the mode(s) and unloading the package is just what the
user expects. Also, FORCE already has a defined meaning: to bypass
checks for package dependencies, not safety checks for all kinds of
things a package may set up.

> Some generality could be had if there was a way that define-minor-mode
> might tie-in a test that unload-feature would reach when considering
> whether to unload.

How is passing that test (presumibly, either a form or a predicate
function) to define-minor-mode better than putting it into
FEATURE-unload-function?

> define-minor-mode might like to run some code on the
> actual unload too, to reverse some of `add-minor-mode', like removing
> from minor-mode-list (unless perhaps autoloaded minor mode funcs could
> stay there happily enough).

Which can be done from FEATURE-unload-function.

At first you talked about add-ons which would want to piggyback into
the unloading of a package, and I don't think that's a good idea, but
if a package author is really interested on it, it is doable with
advices, etc. But your examples in this message are all things that
can already be done on FEATURE-unload-function, for those packages
that really need it.

If you consider that going through the full buffer list, checking for
the mode and disabling it is too cumbersome, perhaps you can write a
helper function that could be called from the unload function...

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5294; Package emacs. Full text available.

Message received at 5294 <at> debbugs.gnu.org:


Received: (at 5294) by debbugs.gnu.org; 5 Jan 2010 23:31:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 05 18:31:37 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NSIsD-0001al-1S
	for submit <at> debbugs.gnu.org; Tue, 05 Jan 2010 18:31:37 -0500
Received: from mailout2-16.pacific.net.au ([125.255.80.143]
	helo=mailout2.pacific.net.au)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gg@HIDDEN>) id 1NSIsB-0001aY-FQ
	for 5294 <at> debbugs.gnu.org; Tue, 05 Jan 2010 18:31:36 -0500
Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au
	[61.8.2.163])
	by mailout2.pacific.net.au (Postfix) with ESMTP id B84201AAD37;
	Wed,  6 Jan 2010 10:31:29 +1100 (EST)
Received: from blah.blah (ppp26FC.dyn.pacific.net.au [61.8.38.252])
	by mailproxy2.pacific.net.au (Postfix) with ESMTP id 23FBF27413;
	Wed,  6 Jan 2010 10:31:29 +1100 (EST)
Received: from gg by blah.blah with local (Exim 4.71)
	(envelope-from <gg@HIDDEN>)
	id 1NSIrw-00036R-54; Wed, 06 Jan 2010 10:31:20 +1100
From: Kevin Ryde <user42@HIDDEN>
To: 5294 <at> debbugs.gnu.org
Subject: Re: bug#5294: 23.1; unload-feature disable minor-mode
References: <87aawwp631.fsf@HIDDEN>
	<f7ccd24b1001021522s5ff3b8ate9de314bdb0eb57f@HIDDEN>
	<87tyv4njo7.fsf@HIDDEN>
	<f7ccd24b1001021624l3e1e9d70gd72263e068d6bbc5@HIDDEN>
	<87bpha7ptb.fsf@HIDDEN>
	<f7ccd24b1001031512r3f9a42aftf6c3c206a4ba82f0@HIDDEN>
Date: Wed, 06 Jan 2010 10:31:19 +1100
In-Reply-To: <f7ccd24b1001031512r3f9a42aftf6c3c206a4ba82f0@HIDDEN>
	(Juanma Barranquero's message of "Mon, 4 Jan 2010 00:12:55 +0100")
Message-ID: <87iqbgt9h4.fsf@HIDDEN>
User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -3.5 (---)
X-Debbugs-Envelope-To: 5294
Cc: Juanma Barranquero <lekktu@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.5 (---)

To, umm, get slightly back on-topic -- as an alternative for unloading
minor modes, if the mode is currently enabled in a buffer, or enabled
globally for a global, then unload-feature might refuse to unload
(except under FORCE) on that basis that in-use is a kind of dependency
on the feature's code etc.  The same might be applied to major modes,
ie. refuse to unload if in use.

Some generality could be had if there was a way that define-minor-mode
might tie-in a test that unload-feature would reach when considering
whether to unload.  define-minor-mode might like to run some code on the
actual unload too, to reverse some of `add-minor-mode', like removing
from minor-mode-list (unless perhaps autoloaded minor mode funcs could
stay there happily enough).




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5294; Package emacs. Full text available.

Message received at 5294 <at> debbugs.gnu.org:


Received: (at 5294) by debbugs.gnu.org; 3 Jan 2010 23:13:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 03 18:13:21 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NRZdR-0002rP-Bj
	for submit <at> debbugs.gnu.org; Sun, 03 Jan 2010 18:13:21 -0500
Received: from mail-bw0-f216.google.com ([209.85.218.216])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <lekktu@HIDDEN>) id 1NRZdP-0002rG-Sj
	for 5294 <at> debbugs.gnu.org; Sun, 03 Jan 2010 18:13:20 -0500
Received: by bwz8 with SMTP id 8so9340079bwz.39
	for <5294 <at> debbugs.gnu.org>; Sun, 03 Jan 2010 15:13:15 -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
	:content-transfer-encoding;
	bh=tRkx9zfT9doo8tnpWjacnccpZD7eEW3q5YqAIwCViSQ=;
	b=caPR87UVeicTKDnw/KgGrhpJ/co4LD+E8zPc0TwDRWlQUYkzYhaubNJ+hK8zBh0urN
	t0DWsuPDakJzMZ4Z3tbCFi847MXNRWcZetzAyCtfzy2sy4SMADYmN86KD3+FSvB3SFsw
	OROAu2koWMnGllCRw12kZguW2NHKV1Hl7R/ec=
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:content-transfer-encoding;
	b=ooVv8CKzE4iToEiBCs4KhAyrTwtJClYoVplQ8ZKdsj2Imk9UjBuVYaqRjDYcfGFjew
	ND3dmiQNwCngd0up+BltDDFpoAl008VIo00pp2RDV6qHRawfBb963F/XaBRLY5BUOqil
	mhu6k+vci6keAp4gp5t6CE5bzc5/yVkrWlt8I=
MIME-Version: 1.0
Received: by 10.204.8.151 with SMTP id h23mr3092385bkh.194.1262560395130; Sun, 
	03 Jan 2010 15:13:15 -0800 (PST)
In-Reply-To: <87bpha7ptb.fsf@HIDDEN>
References: <87aawwp631.fsf@HIDDEN>
	<f7ccd24b1001021522s5ff3b8ate9de314bdb0eb57f@HIDDEN> 
	<87tyv4njo7.fsf@HIDDEN>
	<f7ccd24b1001021624l3e1e9d70gd72263e068d6bbc5@HIDDEN> 
	<87bpha7ptb.fsf@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Mon, 4 Jan 2010 00:12:55 +0100
Message-ID: <f7ccd24b1001031512r3f9a42aftf6c3c206a4ba82f0@HIDDEN>
Subject: Re: bug#5294: 23.1; unload-feature disable minor-mode
To: Kevin Ryde <user42@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.7 (--)
X-Debbugs-Envelope-To: 5294
Cc: 5294 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.7 (--)

On Mon, Jan 4, 2010 at 00:04, Kevin Ryde <user42@HIDDEN> wrote:

> Though I wonder that an add-on might want to slip in
> after the FOO-unload-function has reported whether the "normal" unload
> actions should be performed.

You can use an around advice, and have almost complete control.

> Mind you, I wonder if unload-feature is slightly doomed in general,
> ie. unless a given package has thought rather carefully about the
> consequences! =C2=A0:-)

Well, certainly unloading can have consequences; that's why I insist
that the best place to define what should do for any package is in the
package itself. Even an add-on to a package should just define its own
feature, and FOO-unload-function for itself, IMO. If you don't use the
FORCE argument, a package cannot be unloaded before unloading its
dependencies, so it is safe to unload the add-ons before.

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5294; Package emacs. Full text available.

Message received at 5294 <at> debbugs.gnu.org:


Received: (at 5294) by debbugs.gnu.org; 3 Jan 2010 23:06:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 03 18:06:50 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NRZX8-0002oQ-4W
	for submit <at> debbugs.gnu.org; Sun, 03 Jan 2010 18:06:50 -0500
Received: from mailout1-6.pacific.net.au ([61.8.2.213]
	helo=mailout1.pacific.net.au)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gg@HIDDEN>) id 1NRZX5-0002oL-4U
	for 5294 <at> debbugs.gnu.org; Sun, 03 Jan 2010 18:06:48 -0500
Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au
	[61.8.2.162])
	by mailout1.pacific.net.au (Postfix) with ESMTP id D9E77515AFC;
	Mon,  4 Jan 2010 10:06:38 +1100 (EST)
Received: from blah.blah (ppp2EA9.dyn.pacific.net.au [61.8.46.169])
	by mailproxy1.pacific.net.au (Postfix) with ESMTP id 2D3FB8C25;
	Mon,  4 Jan 2010 10:06:30 +1100 (EST)
Received: from gg by blah.blah with local (Exim 4.71)
	(envelope-from <gg@HIDDEN>)
	id 1NRZVB-0004SD-9t; Mon, 04 Jan 2010 10:04:49 +1100
From: Kevin Ryde <user42@HIDDEN>
To: Juanma Barranquero <lekktu@HIDDEN>
Subject: Re: bug#5294: 23.1; unload-feature disable minor-mode
References: <87aawwp631.fsf@HIDDEN>
	<f7ccd24b1001021522s5ff3b8ate9de314bdb0eb57f@HIDDEN>
	<87tyv4njo7.fsf@HIDDEN>
	<f7ccd24b1001021624l3e1e9d70gd72263e068d6bbc5@HIDDEN>
Date: Mon, 04 Jan 2010 10:04:48 +1100
In-Reply-To: <f7ccd24b1001021624l3e1e9d70gd72263e068d6bbc5@HIDDEN>
	(Juanma Barranquero's message of "Sun, 3 Jan 2010 01:24:58 +0100")
Message-ID: <87bpha7ptb.fsf@HIDDEN>
User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -3.4 (---)
X-Debbugs-Envelope-To: 5294
Cc: 5294 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.4 (---)

Juanma Barranquero <lekktu@HIDDEN> writes:
>
> advising ... `unload-feature'

Sounds likely.  Though I wonder that an add-on might want to slip in
after the FOO-unload-function has reported whether the "normal" unload
actions should be performed.

> confusing ... not to mention fragile

Hmm, ah dear, yep.

> perhaps `unload-feature-functions'

One thing I was contemplating is whether defadvice might automatically
unload, and what advice.el or the defadvice macro might do to make that
happen.  I'll start another bug for that.

Mind you, I wonder if unload-feature is slightly doomed in general,
ie. unless a given package has thought rather carefully about the
consequences!  :-)




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5294; Package emacs. Full text available.

Message received at 5294 <at> debbugs.gnu.org:


Received: (at 5294) by debbugs.gnu.org; 3 Jan 2010 01:41:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 02 20:41:35 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NRFTL-0001Q2-31
	for submit <at> debbugs.gnu.org; Sat, 02 Jan 2010 20:41:35 -0500
Received: from mail-bw0-f216.google.com ([209.85.218.216])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <lekktu@HIDDEN>) id 1NRFTH-0001Pw-KY
	for 5294 <at> debbugs.gnu.org; Sat, 02 Jan 2010 20:41:33 -0500
Received: by bwz8 with SMTP id 8so9050271bwz.39
	for <5294 <at> debbugs.gnu.org>; Sat, 02 Jan 2010 17:41:27 -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=SpxrpW3rXgaA9OrM/BrcMU8/gTfT+5Gnxl1lv6OqbYg=;
	b=qW6zzaW0UtfTlN9+RaiY0Ztllty322KQptgOL8Myist5C+eZWJyAl3Vuh4SkyQT+b/
	0bnj9WHS+LSFsQQdMpkzR82UwQ1QjyWkc1amhmJI0tRnlbLmyEKekvR2X8raOyXo+uHV
	9pyUexjg38HPREs/2f0GHGz2K4nBQQ01Ws97I=
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=UDyLQZB+jRbUSLBjCpOXlI4IjThaQEpx+/pVZKnaehLMHTZEHbUtdcZdarfYlUa7Od
	o73KnADcsCDF8CB5/pbhsKvE/22EiMydfxUpJvf7Dbkv6KYgwUndcGTQCs3/fGBwFnd5
	sQ0t6OPb/sCS0MzN9uGMMpQm3DF3id64XrqNU=
MIME-Version: 1.0
Received: by 10.204.3.152 with SMTP id 24mr2979168bkn.168.1262482887086; Sat, 
	02 Jan 2010 17:41:27 -0800 (PST)
In-Reply-To: <87iqbkf15l.fsf@HIDDEN>
References: <87aawwp631.fsf@HIDDEN>
	<f7ccd24b1001021522s5ff3b8ate9de314bdb0eb57f@HIDDEN> 
	<87tyv4njo7.fsf@HIDDEN>
	<f7ccd24b1001021624l3e1e9d70gd72263e068d6bbc5@HIDDEN> 
	<87iqbkf15l.fsf@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Sun, 3 Jan 2010 02:41:07 +0100
Message-ID: <f7ccd24b1001021741y7017dea5q92c9983216a32351@HIDDEN>
Subject: Re: bug#5294: 23.1; unload-feature disable minor-mode
To: Kevin Ryde <user42@HIDDEN>
Content-Type: text/plain; charset=UTF-8
X-Spam-Score: -2.7 (--)
X-Debbugs-Envelope-To: 5294
Cc: 5294 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.7 (--)

On Sun, Jan 3, 2010 at 02:05, Kevin Ryde <user42@HIDDEN> wrote:

> Sounds like it could have been better to do those latter actions
> irrespective of the hook. Let only the FOO-unload-function say not to
> do them, for the rare cases they're unwanted.

The now-obsolete functionality (for FOO-unload-hook, not
unload-feature in general) was confusing, badly designed and
ill-documented; changing it would have been backward incompatible, not
to mention fragile. It was better to add a new way. The current
FOO-feature-function was added because in most cases, it's the
package's responsibility to know how to unload itself. For the few
cases that do not, there's always advising; but perhaps
`unload-feature-functions' would be a good idea, and there's no worry
about compatibility.

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5294; Package emacs. Full text available.

Message received at 5294 <at> debbugs.gnu.org:


Received: (at 5294) by debbugs.gnu.org; 3 Jan 2010 01:05:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 02 20:05:56 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NREup-000174-J9
	for submit <at> debbugs.gnu.org; Sat, 02 Jan 2010 20:05:55 -0500
Received: from mailout2-16.pacific.net.au ([125.255.80.143]
	helo=mailout2.pacific.net.au)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gg@HIDDEN>) id 1NREum-00016z-Iq
	for 5294 <at> debbugs.gnu.org; Sat, 02 Jan 2010 20:05:54 -0500
Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au
	[61.8.2.163])
	by mailout2.pacific.net.au (Postfix) with ESMTP id 34436199690;
	Sun,  3 Jan 2010 12:05:46 +1100 (EST)
Received: from blah.blah (ppp2155.dyn.pacific.net.au [61.8.33.85])
	by mailproxy2.pacific.net.au (Postfix) with ESMTP id 94C6027405;
	Sun,  3 Jan 2010 12:05:45 +1100 (EST)
Received: from gg by blah.blah with local (Exim 4.71)
	(envelope-from <gg@HIDDEN>)
	id 1NREuc-0004WJ-UK; Sun, 03 Jan 2010 12:05:43 +1100
From: Kevin Ryde <user42@HIDDEN>
To: Juanma Barranquero <lekktu@HIDDEN>
Subject: Re: bug#5294: 23.1; unload-feature disable minor-mode
References: <87aawwp631.fsf@HIDDEN>
	<f7ccd24b1001021522s5ff3b8ate9de314bdb0eb57f@HIDDEN>
	<87tyv4njo7.fsf@HIDDEN>
	<f7ccd24b1001021624l3e1e9d70gd72263e068d6bbc5@HIDDEN>
Date: Sun, 03 Jan 2010 12:05:42 +1100
In-Reply-To: <f7ccd24b1001021624l3e1e9d70gd72263e068d6bbc5@HIDDEN>
	(Juanma Barranquero's message of "Sun, 3 Jan 2010 01:24:58 +0100")
Message-ID: <87iqbkf15l.fsf@HIDDEN>
User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -3.5 (---)
X-Debbugs-Envelope-To: 5294
Cc: 5294 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.4 (---)

Juanma Barranquero <lekktu@HIDDEN> writes:
>
> In fact, is a hook run *instead* of some other code.

Ah, I didn't know that.

> The very act of
> defining FOO-unload-hook has unexpected consequences: `unlead-feature'
> won't remove FOO functions from hooks, nor from `auto-mode-alist'. And
> it was always so; that's why I pushed for introducing
> FOO-unload-function.

Sounds like it could have been better to do those latter actions
irrespective of the hook.  Let only the FOO-unload-function say not to
do them, for the rare cases they're unwanted.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5294; Package emacs. Full text available.

Message received at 5294 <at> debbugs.gnu.org:


Received: (at 5294) by debbugs.gnu.org; 3 Jan 2010 00:25:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 02 19:25:26 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NREHe-0000pH-8X
	for submit <at> debbugs.gnu.org; Sat, 02 Jan 2010 19:25:26 -0500
Received: from mail-bw0-f216.google.com ([209.85.218.216])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <lekktu@HIDDEN>) id 1NREHc-0000pC-A7
	for 5294 <at> debbugs.gnu.org; Sat, 02 Jan 2010 19:25:24 -0500
Received: by bwz8 with SMTP id 8so9037964bwz.39
	for <5294 <at> debbugs.gnu.org>; Sat, 02 Jan 2010 16:25:19 -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
	:content-transfer-encoding;
	bh=tRwLWkJ7uc+Kh4upP+urnBFqBocQ8PloOaYsIM9jsRg=;
	b=hrv4lIMo627jHEGUVzsOXpAFjbWPrqQLzq2bLCV4qz0Jw9ec54BUsMJwSr2NaxVcY4
	MZ4VpRZFTyaoZyBQqgfknKBdig4Dn5AYqxTyMtOZgO6dMqOuYX91EzDD+JojwW95DieM
	5TkwSZUtNCEIC55G36BRcisYnvUBxBcx0Gwd8=
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:content-transfer-encoding;
	b=cM38ju+vZ23hEg7L4cyDlzVcoykZPP9q8cOYB1Hqupk0ZcjKw7Shsbz/sSgwnOCCbP
	n/VEFtrqx3TZSX70iJHD3u5QqqdEanVtRHWYXMBagTYlwcPUS7qtmlRv5aqvg611EC0M
	fRGbZa2hJuX9pwfetw/SIoxY24RFTAwB86AQg=
MIME-Version: 1.0
Received: by 10.204.0.69 with SMTP id 5mr8114867bka.173.1262478319845; Sat, 02 
	Jan 2010 16:25:19 -0800 (PST)
In-Reply-To: <87tyv4njo7.fsf@HIDDEN>
References: <87aawwp631.fsf@HIDDEN>
	<f7ccd24b1001021522s5ff3b8ate9de314bdb0eb57f@HIDDEN> 
	<87tyv4njo7.fsf@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Sun, 3 Jan 2010 01:24:58 +0100
Message-ID: <f7ccd24b1001021624l3e1e9d70gd72263e068d6bbc5@HIDDEN>
Subject: Re: bug#5294: 23.1; unload-feature disable minor-mode
To: Kevin Ryde <user42@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.7 (--)
X-Debbugs-Envelope-To: 5294
Cc: 5294 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.7 (--)

On Sun, Jan 3, 2010 at 00:58, Kevin Ryde <user42@HIDDEN> wrote:

> It seems unlikely a minor mode can do anything much good when its
> functions have been unloaded. =C2=A0Some "static" effects might be ok,

That is the point. The writer of the mode knows better. I'm not saying
that you're not right in this, only that there could be downsides.

>> FOO-unload-hook is
>
> ... a flexible way for unrelated libraries, macros or bits of code to
> undo things they know about, even different conditionalized parts of one
> .el like in tramp-util.el.

Yeah, well, that and also, it never really worked. You seem to think
that FOO-unload-hook is a hook run while executing `unload-feature'.
In fact, is a hook run *instead* of some other code. The very act of
defining FOO-unload-hook has unexpected consequences: `unlead-feature'
won't remove FOO functions from hooks, nor from `auto-mode-alist'. And
it was always so; that's why I pushed for introducing
FOO-unload-function.

> A kind of inverse to eval-after-load,
> difficult to arrange on a monolithic unload func.

In general, a package is the place where the knowledge about its
unloading should be concentrated, IMO. If you want to piggyback onto
it, there are several ways, like advising FOO-unload-function, if it
is defined, or `unload-feature', etc. There's nothing "difficult to
arrange".

If you want to have an inverse to eval-after-load, I'd suggest you
propose a new hook, unload-feature-functions (not FOO-specific).

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5294; Package emacs. Full text available.

Message received at 5294 <at> debbugs.gnu.org:


Received: (at 5294) by debbugs.gnu.org; 2 Jan 2010 23:59:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 02 18:59:31 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NRDsY-0000da-Pd
	for submit <at> debbugs.gnu.org; Sat, 02 Jan 2010 18:59:30 -0500
Received: from mailout1-6.pacific.net.au ([61.8.2.213]
	helo=mailout1.pacific.net.au)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gg@HIDDEN>) id 1NRDsK-0000dV-9K
	for 5294 <at> debbugs.gnu.org; Sat, 02 Jan 2010 18:59:29 -0500
Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au
	[61.8.2.163])
	by mailout1.pacific.net.au (Postfix) with ESMTP id 234C7508291;
	Sun,  3 Jan 2010 10:59:10 +1100 (EST)
Received: from blah.blah (ppp2155.dyn.pacific.net.au [61.8.33.85])
	by mailproxy2.pacific.net.au (Postfix) with ESMTP id 17F0D27424;
	Sun,  3 Jan 2010 10:59:04 +1100 (EST)
Received: from gg by blah.blah with local (Exim 4.71)
	(envelope-from <gg@HIDDEN>)
	id 1NRDrc-0003Kz-Bt; Sun, 03 Jan 2010 10:58:32 +1100
From: Kevin Ryde <user42@HIDDEN>
To: Juanma Barranquero <lekktu@HIDDEN>
Subject: Re: bug#5294: 23.1; unload-feature disable minor-mode
References: <87aawwp631.fsf@HIDDEN>
	<f7ccd24b1001021522s5ff3b8ate9de314bdb0eb57f@HIDDEN>
Date: Sun, 03 Jan 2010 10:58:32 +1100
Message-ID: <87tyv4njo7.fsf@HIDDEN>
User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -3.6 (---)
X-Debbugs-Envelope-To: 5294
Cc: 5294 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.5 (---)

Juanma Barranquero <lekktu@HIDDEN> writes:
>
> I don't know whether, in general, you want to disable all effects of a
> mode after downloading it.

It seems unlikely a minor mode can do anything much good when its
functions have been unloaded.  Some "static" effects might be ok, but
anything active would presumably stick in an unchanging state or start
to error out, either a bit or badly.


> FOO-unload-hook is

... a flexible way for unrelated libraries, macros or bits of code to
undo things they know about, even different conditionalized parts of one
.el like in tramp-util.el.  A kind of inverse to eval-after-load,
difficult to arrange on a monolithic unload func.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5294; Package emacs. Full text available.

Message received at 5294 <at> debbugs.gnu.org:


Received: (at 5294) by debbugs.gnu.org; 2 Jan 2010 23:23:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 02 18:23:21 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NRDJZ-0000Mu-Gt
	for submit <at> debbugs.gnu.org; Sat, 02 Jan 2010 18:23:21 -0500
Received: from mail-bw0-f216.google.com ([209.85.218.216])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <lekktu@HIDDEN>) id 1NRDJX-0000Mp-CE
	for 5294 <at> debbugs.gnu.org; Sat, 02 Jan 2010 18:23:19 -0500
Received: by bwz8 with SMTP id 8so9025826bwz.39
	for <5294 <at> debbugs.gnu.org>; Sat, 02 Jan 2010 15:23:14 -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
	:content-transfer-encoding;
	bh=/7ASU5n2VpBnokg1EUY+Vb2FHqjcbZzEYzc7WAug6CQ=;
	b=skWo0DQKg0lCCKi0ckSiWqTREaVTNheBeU73Gm5XSSIyC9GCKfxIIk1E5H3Swb/Kjv
	S6egUHGZe59FfMUsiFmtVBoqBLZRMzHloBAnOlSRe0W2YdXUwEecye4XaUajSwb5Gdu3
	ekubnDdN5pxupdjd0p7wU8XpDRRVG+s4l0fPA=
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:content-transfer-encoding;
	b=u0PJiT4ozXXQd+p4iLvSSbYVDRuxQVAKheM7xY8+x2XnXsOaaVm6HBerpdEU6sxclK
	giu9m5/oUvIQIJJ3ukkliqXYllDY39A9lxA6pyzqLekWrwTf7ZHX+c/DFLBWK7Lh7jfk
	z0Q7oiBHQ21MUMDZxUNXJyrC2ihHDAkGHOo84=
MIME-Version: 1.0
Received: by 10.204.18.211 with SMTP id x19mr1229084bka.116.1262474594101; 
	Sat, 02 Jan 2010 15:23:14 -0800 (PST)
In-Reply-To: <87aawwp631.fsf@HIDDEN>
References: <87aawwp631.fsf@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Sun, 3 Jan 2010 00:22:54 +0100
Message-ID: <f7ccd24b1001021522s5ff3b8ate9de314bdb0eb57f@HIDDEN>
Subject: Re: bug#5294: 23.1; unload-feature disable minor-mode
To: Kevin Ryde <user42@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.7 (--)
X-Debbugs-Envelope-To: 5294
Cc: 5294 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.7 (--)

On Sat, Jan 2, 2010 at 22:09, Kevin Ryde <user42@HIDDEN> wrote:

> As an idea for unload-feature, when unloading a buffer-local minor mode
> it could helpfully find buffers where the mode is enabled and disable it
> before unloading.
>
> An example foo.el mode below. =C2=A0Eval the code in try-foo.el and it le=
aves
> the buffer boldened, where disabling the mode could have undone it.

I don't know whether, in general, you want to disable all effects of a
mode after downloading it. Modes that do want can use
FOO-unload-function like in your example.

> Otherwise I expect define-minor-mode could
> chuck some code in `foo-unload-hook' - if it presumes the feature symbol
> will match the load filename.

FOO-unload-hook is deprecated.

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5294; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Jan 2010 21:09:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 02 16:09:25 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1NRBDw-0007mw-SZ
	for submit <at> debbugs.gnu.org; Sat, 02 Jan 2010 16:09:25 -0500
Received: from fencepost.gnu.org ([140.186.70.10])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gg@HIDDEN>) id 1NRBDu-0007mq-Ps
	for submit <at> debbugs.gnu.org; Sat, 02 Jan 2010 16:09:23 -0500
Received: from mail.gnu.org ([199.232.76.166]:33328 helo=mx10.gnu.org)
	by fencepost.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gg@HIDDEN>) id 1NRBDq-0000vG-Nw
	for submit <at> debbugs.gnu.org; Sat, 02 Jan 2010 16:09:18 -0500
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim
	4.60) (envelope-from <gg@HIDDEN>) id 1NRBDp-0002aj-68
	for submit <at> debbugs.gnu.org; Sat, 02 Jan 2010 16:09:18 -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]:53125)
	by monty-python.gnu.org with esmtp (Exim 4.60)
	(envelope-from <gg@HIDDEN>) id 1NRBDo-0002ab-Sd
	for submit <at> debbugs.gnu.org; Sat, 02 Jan 2010 16:09:16 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1NRBDo-0001C0-MS
	for bug-gnu-emacs@HIDDEN; Sat, 02 Jan 2010 16:09:16 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1NRBDk-00019K-8a
	for bug-gnu-emacs@HIDDEN; Sat, 02 Jan 2010 16:09:16 -0500
Received: from [199.232.76.173] (port=38721 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1NRBDj-00019B-Ux
	for bug-gnu-emacs@HIDDEN; Sat, 02 Jan 2010 16:09:11 -0500
Received: from mailout2-16.pacific.net.au ([125.255.80.143]:40805
	helo=mailout2.pacific.net.au)
	by monty-python.gnu.org with esmtp (Exim 4.60)
	(envelope-from <gg@HIDDEN>) id 1NRBDj-0002ZB-8m
	for bug-gnu-emacs@HIDDEN; Sat, 02 Jan 2010 16:09:11 -0500
Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au
	[61.8.2.162])
	by mailout2.pacific.net.au (Postfix) with ESMTP id E6D1619BFF7
	for <bug-gnu-emacs@HIDDEN>; Sun,  3 Jan 2010 08:09:09 +1100 (EST)
Received: from blah.blah (ppp2155.dyn.pacific.net.au [61.8.33.85])
	by mailproxy1.pacific.net.au (Postfix) with ESMTP id 33E808C11
	for <bug-gnu-emacs@HIDDEN>; Sun,  3 Jan 2010 08:09:08 +1100 (EST)
Received: from gg by blah.blah with local (Exim 4.71)
	(envelope-from <gg@HIDDEN>) id 1NRBDe-000239-Cm
	for bug-gnu-emacs@HIDDEN; Sun, 03 Jan 2010 08:09:06 +1100
From: Kevin Ryde <user42@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 23.1; unload-feature disable minor-mode
Date: Sun, 03 Jan 2010 08:09:06 +1100
Message-ID: <87aawwp631.fsf@HIDDEN>
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.6 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.6 (-----)

--=-=-=

As an idea for unload-feature, when unloading a buffer-local minor mode
it could helpfully find buffers where the mode is enabled and disable it
before unloading.

An example foo.el mode below.  Eval the code in try-foo.el and it leaves
the buffer boldened, where disabling the mode could have undone it.

Of course foo.el can do something like the commented-out
`foo-unload-function' itself, but I think almost all minor modes would
benefit from this and that `unload-feature' might therefore handle it.

Identifying a minor mode function would be as easy as looking in
`minor-mode-list' would it?  Otherwise I expect define-minor-mode could
chuck some code in `foo-unload-hook' - if it presumes the feature symbol
will match the load filename.



--=-=-=
Content-Type: application/emacs-lisp
Content-Disposition: inline; filename=foo.el
Content-Transfer-Encoding: quoted-printable


(define-minor-mode foo-mode
  "Bolden the buffer."
  ;; default no :global, so buffer-local
  :type 'boolean
  (if foo-mode
      (overlay-put (make-overlay (point-min) (point-max) (current-buffer)
                                 nil t)
                   'face 'bold)
    (remove-overlays (point-min) (point-max) 'face 'bold)))

;; (defun foo-unload-function ()
;;   (dolist (buffer (buffer-list))
;;     (with-current-buffer buffer
;;       (foo-mode 0)))
;;   nil)

(provide 'foo)

;;; foo.el ends here

--=-=-=
Content-Type: application/emacs-lisp
Content-Disposition: inline; filename=try-foo.el
Content-Transfer-Encoding: quoted-printable

(progn
  (add-to-list 'load-path (expand-file-name "."))
  (load "foo.el")
  (switch-to-buffer "xyz")
  (insert "hello")
  (foo-mode 1)
  (unload-feature 'foo)
  )


--=-=-=



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=''

--=-=-=--





Acknowledgement sent to Kevin Ryde <user42@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#5294; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.