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#5294: 23.1; unload-feature disable minor-mode Date: Sun, 03 Jan 2010 08:09:06 +1100 Message-ID: <87aawwp631.fsf@blah.blah> Reply-To: Kevin Ryde , 5294@debbugs.gnu.org NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1262467204 22377 80.91.229.12 (2 Jan 2010 21:20:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Jan 2010 21:20:04 +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:57 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 1NRBO7-0002NK-No for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Jan 2010 22:19:56 +0100 Original-Received: from localhost ([127.0.0.1]:37759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRBO8-00062m-3A for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Jan 2010 16:19:56 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NRBO2-00061G-CR for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:19:50 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NRBNs-0005qq-F4 for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:19:49 -0500 Original-Received: from [199.232.76.173] (port=60914 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRBNs-0005qa-6h for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:19:40 -0500 Original-Received: from [140.186.70.43] (port=60461 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 1NRBNr-00063Y-SQ for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:19:40 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NRBEZ-0007nI-Mo; Sat, 02 Jan 2010 16:10:03 -0500 X-Loop: bug-gnu-emacs@gnu.org Mail-Followup-To: Kevin Ryde , 5294@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:10:03 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: report 5294 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@debbugs.gnu.org id=B.126246656529945 (code B ref -1); Sat, 02 Jan 2010 21:10:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Jan 2010 21:09:25 +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 1NRBDw-0007mw-SZ for submit@debbugs.gnu.org; Sat, 02 Jan 2010 16:09:25 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NRBDu-0007mq-Ps for submit@debbugs.gnu.org; Sat, 02 Jan 2010 16:09:23 -0500 Original-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 ) id 1NRBDq-0000vG-Nw for submit@debbugs.gnu.org; Sat, 02 Jan 2010 16:09:18 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NRBDp-0002aj-68 for submit@debbugs.gnu.org; Sat, 02 Jan 2010 16:09:18 -0500 Original-Received: from lists.gnu.org ([199.232.76.165]:53125) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NRBDo-0002ab-Sd for submit@debbugs.gnu.org; Sat, 02 Jan 2010 16:09:16 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NRBDo-0001C0-MS for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:09:16 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NRBDk-00019K-8a for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:09:16 -0500 Original-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@gnu.org; Sat, 02 Jan 2010 16:09:11 -0500 Original-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 ) id 1NRBDj-0002ZB-8m for bug-gnu-emacs@gnu.org; Sat, 02 Jan 2010 16:09:11 -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 E6D1619BFF7 for ; Sun, 3 Jan 2010 08:09:09 +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 33E808C11 for ; Sun, 3 Jan 2010 08:09:08 +1100 (EST) Original-Received: from gg by blah.blah with local (Exim 4.71) (envelope-from ) id 1NRBDe-000239-Cm for bug-gnu-emacs@gnu.org; Sun, 03 Jan 2010 08:09:06 +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.6 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list X-Spam-Score: -5.6 (-----) Resent-Date: Sat, 02 Jan 2010 16:10:03 -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:33870 Archived-At: --=-=-= 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='' --=-=-=--