From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.bugs Subject: bug#5293: 23.1; unload-feature on buffer-local hooks Date: Sun, 03 Jan 2010 08:06:14 +1100 Message-ID: <87hbr4p67t.fsf@blah.blah> Reply-To: Kevin Ryde , 5293@debbugs.gnu.org NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1262467161 22256 80.91.229.12 (2 Jan 2010 21:19:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Jan 2010 21:19:21 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 02 22:19:13 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NRBNR-00029r-1T for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Jan 2010 22:19:13 +0100 Original-Received: from localhost ([127.0.0.1]:37501 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRBNR-0005cG-9G for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Jan 2010 16:19:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NRBNO-0005c1-2s for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:19:10 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NRBNE-0005aS-7h for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:19:09 -0500 Original-Received: from [199.232.76.173] (port=60898 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRBNE-0005aP-2n for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:19:00 -0500 Original-Received: from [140.186.70.43] (port=60453 helo=debbugs.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NRBND-0005k1-SL for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:19:00 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NRBBe-0007lS-FT; Sat, 02 Jan 2010 16:07:02 -0500 X-Loop: bug-gnu-emacs@gnu.org Mail-Followup-To: Kevin Ryde , 5293@debbugs.gnu.org Resent-From: Kevin Ryde Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Jan 2010 21:07:02 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: report 5293 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@debbugs.gnu.org id=B.126246639529833 (code B ref -1); Sat, 02 Jan 2010 21:07:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Jan 2010 21:06:35 +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 1NRBBD-0007l8-Jr for submit@debbugs.gnu.org; Sat, 02 Jan 2010 16:06:35 -0500 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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) Original-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) Original-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 User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list X-Spam-Score: -5.5 (-----) Resent-Date: Sat, 02 Jan 2010 16:07:02 -0500 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:33868 Archived-At: --=-=-= 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 --=-=-=--