unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
Cc: 8781@debbugs.gnu.org, 8730@debbugs.gnu.org
Subject: bug#8730: bug#8781: 24.0.50; unload-feature don't restore default key
Date: Wed, 1 Jun 2011 18:27:55 +0200	[thread overview]
Message-ID: <BANLkTinJfEPqjuUU+DzQDW=DQVu03q3NOw@mail.gmail.com> (raw)
In-Reply-To: <4DE628AC.9000604@easy-emacs.de>

> 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)





  reply	other threads:[~2011-06-01 16:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01 11:55 bug#8781: 24.0.50; unload-feature don't restore default key Andreas Röhler
2011-06-01 16:27 ` Juanma Barranquero [this message]
2011-06-02  4:11   ` bug#8730: " Stefan Monnier
2011-06-02 11:40     ` bug#8730: bug#8781: " Juanma Barranquero
2011-06-02 12:26       ` Stefan Monnier
2011-06-02 13:59         ` bug#8781: " Juanma Barranquero
2011-06-02 14:26           ` Stefan Monnier
2011-06-23 10:17             ` Juanma Barranquero
2011-06-25 13:30               ` Stefan Monnier
2011-06-25 16:49                 ` bug#8781: " Juanma Barranquero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTinJfEPqjuUU+DzQDW=DQVu03q3NOw@mail.gmail.com' \
    --to=lekktu@gmail.com \
    --cc=8730@debbugs.gnu.org \
    --cc=8781@debbugs.gnu.org \
    --cc=andreas.roehler@easy-emacs.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).