From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.bugs Subject: bug#5293: 23.1; unload-feature on buffer-local hooks Date: Wed, 13 Jul 2011 22:28:02 +0200 Message-ID: References: <87hbr4p67t.fsf@blah.blah> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1310588968 26956 80.91.229.12 (13 Jul 2011 20:29:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 13 Jul 2011 20:29:28 +0000 (UTC) Cc: 5293-done@debbugs.gnu.org To: Kevin Ryde Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 13 22:29:24 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qh63f-0003OV-0u for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Jul 2011 22:29:23 +0200 Original-Received: from localhost ([::1]:41386 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qh63d-0001C9-M3 for geb-bug-gnu-emacs@m.gmane.org; Wed, 13 Jul 2011 16:29:21 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:34213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qh63N-0001Bd-L8 for bug-gnu-emacs@gnu.org; Wed, 13 Jul 2011 16:29:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qh63L-0000nP-AZ for bug-gnu-emacs@gnu.org; Wed, 13 Jul 2011 16:29:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38999) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qh63L-0000nG-4s for bug-gnu-emacs@gnu.org; Wed, 13 Jul 2011 16:29:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Qh63K-0006RH-JX for bug-gnu-emacs@gnu.org; Wed, 13 Jul 2011 16:29:02 -0400 Resent-From: Juanma Barranquero Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Jul 2011 20:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 5293 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 5293@debbugs.gnu.org, lekktu@gmail.com Original-Received: via spool by 5293-done@debbugs.gnu.org id=D5293.131058893124732 (code D ref 5293); Wed, 13 Jul 2011 20:29:02 +0000 Original-Received: (at 5293-done) by debbugs.gnu.org; 13 Jul 2011 20:28:51 +0000 Original-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 Original-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 Original-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= Original-Received: by 10.142.222.14 with SMTP id u14mr636339wfg.309.1310588922109; Wed, 13 Jul 2011 13:28:42 -0700 (PDT) Original-Received: by 10.142.144.4 with HTTP; Wed, 13 Jul 2011 13:28:02 -0700 (PDT) In-Reply-To: <87hbr4p67t.fsf@blah.blah> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 13 Jul 2011 16:29:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:48923 Archived-At: > 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