GNU bug report logs - #8730
23.2; unload-feature leaves hook

Previous Next

Package: emacs;

Reported by: Andreas Röhler <andreas.roehler <at> easy-emacs.de>

Date: Wed, 25 May 2011 05:54:01 UTC

Severity: minor

Found in version 23.2

Done: Juanma Barranquero <lekktu <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8730 in the body.
You can then email your comments to 8730 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8730; Package emacs. (Wed, 25 May 2011 05:54:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Röhler <andreas.roehler <at> easy-emacs.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 25 May 2011 05:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.2; unload-feature leaves hook
Date: Wed, 25 May 2011 07:53:37 +0200
`emacs -Q':

M-x python-mode
M-x unload-feature RET python-mode
M-x shell

error in process filter: Symbol's function definition is void: 
python-pdbtrack-track-stack-file
<<< Press Return to bury the buffer list >>>

;;;;;;;;;;;

BTW an explicit call `remove-hook ...' solves the
issue. Seems indicating a bug nonetheless.

Cheers,

Andreas

--
https://code.launchpad.net/~a-roehler/python-mode/components-python-mode
https://code.launchpad.net/s-x-emacs-werkstatt/



In GNU Emacs 23.2.1 (i586-suse-linux-gnu, GTK+ Version 2.22.1)
 of 2011-02-22
Windowing system distributor `The X.Org Foundation', version 11.0.10903000
configured using `configure  '--with-pop' '--without-hesiod' 
'--with-kerberos' '--with-kerberos5' '--with-xim' '--enable-autodepend' 
'--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' 
'--datadir=/usr/share' '--localstatedir=/var' 
'--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--with-x' 
'--with-sound' '--with-sync-input' '--with-xpm' '--with-jpeg' 
'--with-tiff' '--with-gif' '--with-png' '--with-rsvg' '--with-dbus' 
'--without-gpm' '--with-x-toolkit=gtk' '--x-includes=/usr/include' 
'--x-libraries=/usr/lib:/usr/share/X11' '--with-xft' '--with-libotf' 
'--with-m17n-flt' '--build=i586-suse-linux' 
'build_alias=i586-suse-linux' 'CC=gcc-4.3' 'CFLAGS=-fomit-frame-pointer 
-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector 
-funwind-tables -fasynchronous-unwind-tables -g -D_GNU_SOURCE -std=gnu89 
-pipe -Wno-pointer-sign -Wno-unused-variable -Wno-unused-label 
-Wno-unprototyped-calls -fno-optimize-sibling-calls 
-DSYSTEM_PURESIZE_EXTRA=55000 	 -DSITELOAD_PURESIZE_EXTRA=10000 ' 
'LDFLAGS=-Wl,-O2 -Wl,--hash-size=65521''

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: de_DE.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC <down-mouse-1> SPC SPC SPC <mouse-1> SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC M-x s h e l l <return> C-x o M-x e l e <tab>
<return> <down> <down> <return> C-SPC <up> <up> <up>
<up> M-w M-x r e p o r t - e m a c s - b u <tab> <
return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...
Type C-x 1 to delete the help window.
Making completion list...
error in process filter: run-hook-with-args: Symbol's function 
definition is void: python-pdbtrack-track-stack-file
error in process filter: Symbol's function definition is void: 
python-pdbtrack-track-stack-file
error in process filter: run-hook-with-args: Symbol's function 
definition is void: python-pdbtrack-track-stack-file
error in process filter: Symbol's function definition is void: 
python-pdbtrack-track-stack-file
<<< Press Return to bury the buffer list >>>
Mark set

Load-path shadows:
/usr/share/emacs/site-lisp/make-regexp hides 
/usr/share/emacs/site-lisp/psgml/make-regexp
/usr/share/emacs/site-lisp/flim/md5 hides /usr/share/emacs/site-lisp/w3/md5
/usr/share/emacs/site-lisp/ess-sas-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-sas-d
/usr/share/emacs/site-lisp/essd-els hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/essd-els
/usr/share/emacs/site-lisp/ess-compat hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-compat
/usr/share/emacs/site-lisp/ess-mode hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-mode
/usr/share/emacs/site-lisp/ess-toolbar hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-toolbar
/usr/share/emacs/site-lisp/ess-sp3-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-sp3-d
/usr/share/emacs/site-lisp/ess-bugs-l hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-bugs-l
/usr/share/emacs/site-lisp/noweb-font-lock-mode hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/noweb-font-lock-mode
/usr/share/emacs/site-lisp/ess-noweb hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-noweb
/usr/share/emacs/site-lisp/ess-rdired hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-rdired
/usr/share/emacs/site-lisp/ess-mouse hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-mouse
/usr/share/emacs/site-lisp/ess-sp5-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-sp5-d
/usr/share/emacs/site-lisp/ess-lsp-l hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-lsp-l
/usr/share/emacs/site-lisp/ess-sp6w-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-sp6w-d
/usr/share/emacs/site-lisp/ess-sas-a hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-sas-a
/usr/share/emacs/site-lisp/ess-menu hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-menu
/usr/share/emacs/site-lisp/make-regexp hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/make-regexp
/usr/share/emacs/site-lisp/ess-jags-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-jags-d
/usr/share/emacs/site-lisp/ess-rd hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-rd
/usr/share/emacs/site-lisp/ess-trns hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-trns
/usr/share/emacs/site-lisp/ess-s4-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-s4-d
/usr/share/emacs/site-lisp/ess-eldoc hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-eldoc
/usr/share/emacs/site-lisp/ess hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess
/usr/share/emacs/site-lisp/ess-inf hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-inf
/usr/share/emacs/site-lisp/ess-dde hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-dde
/usr/share/emacs/site-lisp/ess-rutils hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-rutils
/usr/share/emacs/site-lisp/ess-bugs-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-bugs-d
/usr/share/emacs/site-lisp/ess-omg-l hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-omg-l
/usr/share/emacs/site-lisp/ess-custom hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-custom
/usr/share/emacs/site-lisp/ess-sp6-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-sp6-d
/usr/share/emacs/site-lisp/ess-xls-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-xls-d
/usr/share/emacs/site-lisp/ess-s-l hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-s-l
/usr/share/emacs/site-lisp/ess-comp hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-comp
/usr/share/emacs/site-lisp/noweb-mode hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/noweb-mode
/usr/share/emacs/site-lisp/ess-arc-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-arc-d
/usr/share/emacs/site-lisp/ess-font-lock hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-font-lock
/usr/share/emacs/site-lisp/ess-swv hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-swv
/usr/share/emacs/site-lisp/ess-sas-l hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-sas-l
/usr/share/emacs/site-lisp/ess-sta-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-sta-d
/usr/share/emacs/site-lisp/ess-sta-l hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-sta-l
/usr/share/emacs/site-lisp/ess-help hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-help
/usr/share/emacs/site-lisp/ess-vst-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-vst-d
/usr/share/emacs/site-lisp/ess-r-args hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-r-args
/usr/share/emacs/site-lisp/mouseme hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/mouseme
/usr/share/emacs/site-lisp/ess-roxy hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-roxy
/usr/share/emacs/site-lisp/ess-site hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-site
/usr/share/emacs/site-lisp/msdos hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/msdos
/usr/share/emacs/site-lisp/ess-r-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-r-d
/usr/share/emacs/site-lisp/ess-utils hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-utils
/usr/share/emacs/site-lisp/ess-s3-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-s3-d
/usr/share/emacs/site-lisp/ess-sp4-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-sp4-d
/usr/share/emacs/site-lisp/ess-omg-d hides 
/usr/share/emacs/site-lisp/ess-5.13/lisp/ess-omg-d
/usr/share/emacs/site-lisp/epg/epg hides /usr/share/emacs/23.2/lisp/epg
/usr/share/emacs/site-lisp/epg/epa-dired hides 
/usr/share/emacs/23.2/lisp/epa-dired
/usr/share/emacs/site-lisp/epg/epa-file hides 
/usr/share/emacs/23.2/lisp/epa-file
/usr/share/emacs/site-lisp/epg/epg-config hides 
/usr/share/emacs/23.2/lisp/epg-config
/usr/share/emacs/site-lisp/epg/epa hides /usr/share/emacs/23.2/lisp/epa
/usr/share/emacs/site-lisp/flim/md4 hides /usr/share/emacs/23.2/lisp/md4
/usr/share/emacs/site-lisp/epg/epa-mail hides 
/usr/share/emacs/23.2/lisp/epa-mail
/usr/share/emacs/site-lisp/ruby-mode hides 
/usr/share/emacs/23.2/lisp/progmodes/ruby-mode
/usr/share/emacs/site-lisp/nxml-mode/nxml-glyph hides 
/usr/share/emacs/23.2/lisp/nxml/nxml-glyph
/usr/share/emacs/site-lisp/nxml-mode/nxml-mode hides 
/usr/share/emacs/23.2/lisp/nxml/nxml-mode
/usr/share/emacs/site-lisp/nxml-mode/xmltok hides 
/usr/share/emacs/23.2/lisp/nxml/xmltok
/usr/share/emacs/site-lisp/nxml-mode/rng-uri hides 
/usr/share/emacs/23.2/lisp/nxml/rng-uri
/usr/share/emacs/site-lisp/nxml-mode/rng-dt hides 
/usr/share/emacs/23.2/lisp/nxml/rng-dt
/usr/share/emacs/site-lisp/nxml-mode/nxml-outln hides 
/usr/share/emacs/23.2/lisp/nxml/nxml-outln
/usr/share/emacs/site-lisp/nxml-mode/rng-maint hides 
/usr/share/emacs/23.2/lisp/nxml/rng-maint
/usr/share/emacs/site-lisp/nxml-mode/rng-match hides 
/usr/share/emacs/23.2/lisp/nxml/rng-match
/usr/share/emacs/site-lisp/nxml-mode/nxml-ns hides 
/usr/share/emacs/23.2/lisp/nxml/nxml-ns
/usr/share/emacs/site-lisp/nxml-mode/nxml-rap hides 
/usr/share/emacs/23.2/lisp/nxml/nxml-rap
/usr/share/emacs/site-lisp/nxml-mode/rng-valid hides 
/usr/share/emacs/23.2/lisp/nxml/rng-valid
/usr/share/emacs/site-lisp/nxml-mode/rng-parse hides 
/usr/share/emacs/23.2/lisp/nxml/rng-parse
/usr/share/emacs/site-lisp/nxml-mode/rng-xsd hides 
/usr/share/emacs/23.2/lisp/nxml/rng-xsd
/usr/share/emacs/site-lisp/nxml-mode/nxml-util hides 
/usr/share/emacs/23.2/lisp/nxml/nxml-util
/usr/share/emacs/site-lisp/nxml-mode/rng-nxml hides 
/usr/share/emacs/23.2/lisp/nxml/rng-nxml
/usr/share/emacs/site-lisp/nxml-mode/nxml-enc hides 
/usr/share/emacs/23.2/lisp/nxml/nxml-enc
/usr/share/emacs/site-lisp/nxml-mode/rng-pttrn hides 
/usr/share/emacs/23.2/lisp/nxml/rng-pttrn
/usr/share/emacs/site-lisp/nxml-mode/rng-cmpct hides 
/usr/share/emacs/23.2/lisp/nxml/rng-cmpct
/usr/share/emacs/site-lisp/nxml-mode/xsd-regexp hides 
/usr/share/emacs/23.2/lisp/nxml/xsd-regexp
/usr/share/emacs/site-lisp/nxml-mode/rng-loc hides 
/usr/share/emacs/23.2/lisp/nxml/rng-loc
/usr/share/emacs/site-lisp/nxml-mode/nxml-uchnm hides 
/usr/share/emacs/23.2/lisp/nxml/nxml-uchnm
/usr/share/emacs/site-lisp/nxml-mode/nxml-parse hides 
/usr/share/emacs/23.2/lisp/nxml/nxml-parse
/usr/share/emacs/site-lisp/nxml-mode/rng-util hides 
/usr/share/emacs/23.2/lisp/nxml/rng-util
/usr/share/emacs/site-lisp/nxml-mode/nxml-maint hides 
/usr/share/emacs/23.2/lisp/nxml/nxml-maint
/usr/share/emacs/site-lisp/flim/ntlm hides 
/usr/share/emacs/23.2/lisp/net/ntlm
/usr/share/emacs/site-lisp/flim/sasl-digest hides 
/usr/share/emacs/23.2/lisp/net/sasl-digest
/usr/share/emacs/site-lisp/flim/hmac-md5 hides 
/usr/share/emacs/23.2/lisp/net/hmac-md5
/usr/share/emacs/site-lisp/flim/sasl-ntlm hides 
/usr/share/emacs/23.2/lisp/net/sasl-ntlm
/usr/share/emacs/site-lisp/flim/hmac-def hides 
/usr/share/emacs/23.2/lisp/net/hmac-def
/usr/share/emacs/site-lisp/flim/sasl hides 
/usr/share/emacs/23.2/lisp/net/sasl
/usr/share/emacs/site-lisp/flim/sasl-cram hides 
/usr/share/emacs/23.2/lisp/net/sasl-cram
/usr/share/emacs/site-lisp/egg/its/thai hides 
/usr/share/emacs/23.2/lisp/language/thai
/usr/share/emacs/site-lisp/egg/leim-list hides 
/usr/share/emacs/23.2/leim/leim-list

Features:
(shadow sort mail-extr message idna sendmail regexp-opt ecomplete rfc822
mml mml-sec password-cache mm-decode mm-bodies mm-encode mailcap
mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader
gnus-util netrc time-date mm-util mail-prsvr gmm-utils wid-edit
mailheader canlock sha1 hex-util hashcash mail-utils emacsbug ebuff-menu
electric ansi-color shell pp help-mode view help-fns loadhist easymenu
comint ring egg-util lpr disp-table tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev loaddefs button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process dbusbind
system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8730; Package emacs. (Wed, 01 Jun 2011 16:29:02 GMT) Full text and rfc822 format available.

Message #8 received at 8730 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Cc: 8781 <at> debbugs.gnu.org, 8730 <at> debbugs.gnu.org
Subject: Re: bug#8781: 24.0.50; unload-feature don't restore default key
Date: Wed, 1 Jun 2011 18:27:55 +0200
> M-x unload-feature python
>
> M-x describe-key <backspace>
>
> sends error:
>
> describe-key: Symbol's function definition is void: python-backspace

and

> M-x python-mode
> M-x unload-feature RET python-mode
> M-x shell
>
> error in process filter: Symbol's function definition is void: python-pdbtrack-track-stack-file
> <<< Press Return to bury the buffer list >>>

unload-feature should surely be smarted, but for the time being, the
only way to fix these is to add a python-unload-function which tries
to undo the changes that unload-feature isn't smart enough to do by
itself.

Try the following patch. It sets [pj]ython-mode buffers to
(default-value 'major-mode), and inferior-python-mode buffers to the
parent of this mode (comint). It also removes the hook that causes
bug#8730, and undoes a couple other changes.

Removing things from after-load-alist is a bit unclean, so I've opted
instead for adding an autoload cookie for `python-after-info-look';
that will avoid an error if the user does

M-x python-mode <RET>
M-x unload-feature <RET> python <RET>
M-x info-look-symbol <RET> ;; etc.

though of course python-mode will be loaded again. Not a common enough
situation to be worth a cleaner fix, I think.  (Though if I'm mistaken
and there's a clean way to remove from after-load-alist, I'm all
ears.)

   Juanma


=== modified file 'lisp/progmodes/python.el'
--- lisp/progmodes/python.el	2011-05-13 12:44:48 +0000
+++ lisp/progmodes/python.el	2011-06-01 16:09:34 +0000
@@ -1915,4 +1915,5 @@
 (declare-function info-lookup-maybe-add-help "info-look" (&rest arg))

+;;;###autoload
 (defun python-after-info-look ()
   "Set up info-look for Python.
@@ -2896,4 +2897,23 @@
   (setq overlay-arrow-position nil))

+(defun python-unload-function ()
+  "Unload the Python library."
+  (let* ((default-mode (default-value 'major-mode))
+         (inferior-mode (or (get 'inferior-python-mode 'derived-mode-parent)
+                            default-mode)))
+    (dolist (buffer (buffer-list))
+      (set-buffer buffer)
+      (cond ((memq major-mode '(python-mode jython-mode))
+             (funcall default-mode))
+            ((eq major-mode 'inferior-python-mode)
+             (funcall inferior-mode)))))
+  (remove-hook 'comint-output-filter-functions
'python-pdbtrack-track-stack-file)
+  (setq minor-mode-alist (assq-delete-all 'python-pdbtrack-is-tracking-p
+                                          minor-mode-alist))
+  (dolist (error '("^No symbol" "^Can't shift all lines enough"))
+    (setq debug-ignored-errors (delete error debug-ignored-errors)))
+  ;; continue standard unloading
+  nil)
+
 (provide 'python)
 (provide 'python-21)




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8730; Package emacs. (Thu, 02 Jun 2011 04:12:02 GMT) Full text and rfc822 format available.

Message #11 received at 8730 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 8781 <at> debbugs.gnu.org,
	Andreas Röhler <andreas.roehler <at> easy-emacs.de>,
	8730 <at> debbugs.gnu.org
Subject: Re: bug#8730: bug#8781: 24.0.50;
	unload-feature don't restore default key
Date: Thu, 02 Jun 2011 01:11:30 -0300
> Try the following patch. It sets [pj]ython-mode buffers to
> (default-value 'major-mode), and inferior-python-mode buffers to the
> parent of this mode (comint).

I guess this part could be part of the generic unload-feature code.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8730; Package emacs. (Thu, 02 Jun 2011 11:41:02 GMT) Full text and rfc822 format available.

Message #14 received at 8730 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 8781 <at> debbugs.gnu.org, 8730 <at> debbugs.gnu.org
Subject: Re: bug#8781: bug#8730: bug#8781: 24.0.50; unload-feature don't
	restore default key
Date: Thu, 2 Jun 2011 13:40:12 +0200
On Thu, Jun 2, 2011 at 06:11, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
>> Try the following patch. It sets [pj]ython-mode buffers to
>> (default-value 'major-mode), and inferior-python-mode buffers to the
>> parent of this mode (comint).
>
> I guess this part could be part of the generic unload-feature code.

How can we reliably determine that a symbol represents a major mode
name? Or are you proposing to go through the buffer list and checking
whether their major modes are defined in the package being unloaded?

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8730; Package emacs. (Thu, 02 Jun 2011 12:28:01 GMT) Full text and rfc822 format available.

Message #17 received at 8730 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 8781 <at> debbugs.gnu.org, 8730 <at> debbugs.gnu.org
Subject: Re: bug#8781: bug#8730: bug#8781: 24.0.50;
	unload-feature don't restore default key
Date: Thu, 02 Jun 2011 09:26:59 -0300
>>> Try the following patch. It sets [pj]ython-mode buffers to
>>> (default-value 'major-mode), and inferior-python-mode buffers to the
>>> parent of this mode (comint).
>> I guess this part could be part of the generic unload-feature code.
> How can we reliably determine that a symbol represents a major mode
> name?

We don't have to do it for all cases, but recognizing major modes
defined by define-derived-mode is easy: check the
`derived-mode-parent' property.

> Or are you proposing to go through the buffer list and checking
> whether their major modes are defined in the package being unloaded?

Ah, yes, indeed, that's another solution that would work as well.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8730; Package emacs. (Thu, 02 Jun 2011 14:01:02 GMT) Full text and rfc822 format available.

Message #20 received at 8730 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 8781 <at> debbugs.gnu.org, 8730 <at> debbugs.gnu.org
Subject: Re: bug#8730: bug#8781: bug#8730: bug#8781: 24.0.50; unload-feature
	don't restore default key
Date: Thu, 2 Jun 2011 15:59:50 +0200
On Thu, Jun 2, 2011 at 14:26, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:

>> Or are you proposing to go through the buffer list and checking
>> whether their major modes are defined in the package being unloaded?
>
> Ah, yes, indeed, that's another solution that would work as well.

I prefer that, because it is more thorough. There's no point in a
buffer keeping a major mode that is going to be undefined.

But anyway, this is a new feature, sort of. I suggest installing my
fix for emacs-23 and then doing what you propose in the trunk.

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8730; Package emacs. (Thu, 02 Jun 2011 14:27:02 GMT) Full text and rfc822 format available.

Message #23 received at 8730 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 8781 <at> debbugs.gnu.org, 8730 <at> debbugs.gnu.org
Subject: Re: bug#8730: bug#8781: bug#8730: bug#8781: 24.0.50;
	unload-feature don't restore default key
Date: Thu, 02 Jun 2011 11:26:42 -0300
>>> Or are you proposing to go through the buffer list and checking
>>> whether their major modes are defined in the package being unloaded?
>> Ah, yes, indeed, that's another solution that would work as well.
> I prefer that, because it is more thorough.  There's no point in a
> buffer keeping a major mode that is going to be undefined.

Agreed.

> But anyway, this is a new feature, sort of.

Yes, it's clearly not for emacs-23.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8730; Package emacs. (Thu, 23 Jun 2011 10:18:01 GMT) Full text and rfc822 format available.

Message #26 received at 8730 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 8781 <at> debbugs.gnu.org, 8730 <at> debbugs.gnu.org
Subject: Re: bug#8730: bug#8781: bug#8730: bug#8781: 24.0.50; unload-feature
	don't restore default key
Date: Thu, 23 Jun 2011 12:17:02 +0200
I've implemented a variant of the change we discussed.

What I do, while unloading feature F, is to look for all buffers
having a major mode M defined in F.

If found, I follow back the chain of derivation until I find a major
mode M' which is not defined in F.

If found, I use M'; if not, I switch the buffer to  "(or (default
'major-mode) 'fundamental-mode)".

That's better IMHO, because text modes will be in text-mode,
programming modes will be in prog-mode, inferior modes will be in
comint-mode, etc.

There's an additional check, for cases where (default 'major-mode)
does the unexpected. For example, I have it set to a function that
calls `set-auto-mode', so funcalling it usually sets the buffer to the
same mode it already was. In that case, I default to fundamental-mode
again.

WDYT?


=== modified file 'lisp/loadhist.el'
--- lisp/loadhist.el	2011-06-08 07:17:26 +0000
+++ lisp/loadhist.el	2011-06-23 10:06:48 +0000
@@ -186,7 +186,8 @@
 	 restore-autoload
 	 (name (symbol-name feature))
          (unload-hook (intern-soft (concat name "-unload-hook")))
-	 (unload-func (intern-soft (concat name "-unload-function"))))
+	 (unload-func (intern-soft (concat name "-unload-function")))
+	 (default-mode (or (default-value 'major-mode) 'fundamental-mode)))
     ;; If FEATURE-unload-function is defined and returns non-nil,
     ;; don't try to do anything more; otherwise proceed normally.
     (unless (and (fboundp unload-func)
@@ -222,6 +223,24 @@
 		     (not (get (cdr y) 'autoload)))
 	    (setq auto-mode-alist
 		  (rassq-delete-all (cdr y) auto-mode-alist)))))
+
+      ;; Change major mode in all buffers using one defined in the
feature being unloaded.
+      (save-current-buffer
+        (dolist (buffer (buffer-list))
+          (set-buffer buffer)
+          (let ((proposed major-mode)
+                (original major-mode))
+            ;; Look for an antecessor mode not defined in the feature
we're processing
+            (while (and proposed (rassq proposed unload-function-defs-list))
+              (setq proposed (get proposed 'derived-mode-parent)))
+            (unless (eq proposed major-mode)
+              ;; Two cases: either proposed is nil, and we want to
switch to the default
+              ;; major mode, or proposed is not nil and not
major-mode, and so we use it.
+              (funcall (or proposed default-mode))
+              ;; This check protects agains the user having a weird
default major-mode;
+              ;; for example, one that calls set-auto-mode (been
here, done that).
+              (when (eq major-mode original) (funcall 'fundamental-mode))))))
+
       (when (fboundp 'elp-restore-function) ; remove ELP stuff first
 	(dolist (elt unload-function-defs-list)
 	  (when (symbolp elt)




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8730; Package emacs. (Sat, 25 Jun 2011 13:31:02 GMT) Full text and rfc822 format available.

Message #29 received at 8730 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 8781 <at> debbugs.gnu.org, 8730 <at> debbugs.gnu.org
Subject: Re: bug#8730: bug#8781: bug#8730: bug#8781: 24.0.50;
	unload-feature don't restore default key
Date: Sat, 25 Jun 2011 09:30:19 -0400
> If found, I follow back the chain of derivation until I find a major
> mode M' which is not defined in F.

Sounds good.

> If found, I use M'; if not, I switch the buffer to  "(or (default
> 'major-mode) 'fundamental-mode)".

I'd just use fundamental-mode which is treated by define-derived-mode as
the implicit parent when there's no parent.

> +
> +      ;; Change major mode in all buffers using one defined in the
> feature being unloaded.
> +      (save-current-buffer
> +        (dolist (buffer (buffer-list))
> +          (set-buffer buffer)
> +          (let ((proposed major-mode)
> +                (original major-mode))
> +            ;; Look for an antecessor mode not defined in the feature
> we're processing
> +            (while (and proposed (rassq proposed unload-function-defs-list))
> +              (setq proposed (get proposed 'derived-mode-parent)))
> +            (unless (eq proposed major-mode)
> +              ;; Two cases: either proposed is nil, and we want to
> switch to the default
> +              ;; major mode, or proposed is not nil and not
> major-mode, and so we use it.
> +              (funcall (or proposed default-mode))
> +              ;; This check protects agains the user having a weird
> default major-mode;
> +              ;; for example, one that calls set-auto-mode (been
> here, done that).
> +              (when (eq major-mode original) (funcall 'fundamental-mode))))))
> +

But please move it into its own function.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8730; Package emacs. (Sat, 25 Jun 2011 16:50:03 GMT) Full text and rfc822 format available.

Message #32 received at 8730 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 8781 <at> debbugs.gnu.org, 8730 <at> debbugs.gnu.org
Subject: Re: bug#8730: bug#8781: bug#8730: bug#8781: 24.0.50; unload-feature
	don't restore default key
Date: Sat, 25 Jun 2011 18:49:02 +0200
> I'd just use fundamental-mode which is treated by define-derived-mode as
> the implicit parent when there's no parent.

OK, that's even simpler (and more robust).

> But please move it into its own function.

OK.

    Juanma




Reply sent to Juanma Barranquero <lekktu <at> gmail.com>:
You have taken responsibility. (Sat, 25 Jun 2011 19:37:01 GMT) Full text and rfc822 format available.

Notification sent to Andreas Röhler <andreas.roehler <at> easy-emacs.de>:
bug acknowledged by developer. (Sat, 25 Jun 2011 19:37:02 GMT) Full text and rfc822 format available.

Message #37 received at 8730-done <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Cc: 8781-done <at> debbugs.gnu.org, 8730-done <at> debbugs.gnu.org
Subject: Re: bug#8730: 23.2; unload-feature leaves hook
Date: Sat, 25 Jun 2011 21:35:40 +0200
Fixed in the trunk, revno:104702.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 24 Jul 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 287 days ago.

Previous Next


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