aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2011-06-25 19:42:18 +0200
committerJuanma Barranquero2011-06-25 19:42:18 +0200
commit519d22cc0e55fcc5ef7ab7e550af78150f1d1e66 (patch)
treec809ff2f57f9d65fb800aa43ac1d1c2522a87b5d
parentc206f5b0f712f347c37cca49236365e54ff17f63 (diff)
downloademacs-519d22cc0e55fcc5ef7ab7e550af78150f1d1e66.tar.gz
emacs-519d22cc0e55fcc5ef7ab7e550af78150f1d1e66.zip
* loadhist.el (unload--set-major-mode): New function.
(unload-feature): Use it. * progmodes/python.el (python-after-info-look): Add autoload cookie. (python-unload-function): New function. Fixes: debbugs:8781 debbugs:8730
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/loadhist.el17
-rw-r--r--lisp/progmodes/python.el11
3 files changed, 38 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5370471bcc3..4fec617954a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12011-06-25 Juanma Barranquero <lekktu@gmail.com>
2
3 Fix bug#8730, bug#8781.
4
5 * loadhist.el (unload--set-major-mode): New function.
6 (unload-feature): Use it.
7
8 * progmodes/python.el (python-after-info-look): Add autoload cookie.
9 (python-unload-function): New function.
10
12011-06-25 Stefan Monnier <monnier@iro.umontreal.ca> 112011-06-25 Stefan Monnier <monnier@iro.umontreal.ca>
2 12
3 * mail/rmail.el (rmail-show-message-1): Use restore-buffer-modified-p. 13 * mail/rmail.el (rmail-show-message-1): Use restore-buffer-modified-p.
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index 8e00c33cd81..943eac42b02 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -143,6 +143,19 @@ documentation of `unload-feature' for details.")
143(define-obsolete-variable-alias 'unload-hook-features-list 143(define-obsolete-variable-alias 'unload-hook-features-list
144 'unload-function-defs-list "22.2") 144 'unload-function-defs-list "22.2")
145 145
146(defun unload--set-major-mode ()
147 (save-current-buffer
148 (dolist (buffer (buffer-list))
149 (set-buffer buffer)
150 (let ((proposed major-mode))
151 ;; Look for an antecessor mode not defined in the feature we're processing
152 (while (and proposed (rassq proposed unload-function-defs-list))
153 (setq proposed (get proposed 'derived-mode-parent)))
154 (unless (eq proposed major-mode)
155 ;; Two cases: either proposed is nil, and we want to switch to fundamental
156 ;; mode, or proposed is not nil and not major-mode, and so we use it.
157 (funcall (or proposed 'fundamental-mode)))))))
158
146;;;###autoload 159;;;###autoload
147(defun unload-feature (feature &optional force) 160(defun unload-feature (feature &optional force)
148 "Unload the library that provided FEATURE. 161 "Unload the library that provided FEATURE.
@@ -222,6 +235,10 @@ something strange, such as redefining an Emacs function."
222 (not (get (cdr y) 'autoload))) 235 (not (get (cdr y) 'autoload)))
223 (setq auto-mode-alist 236 (setq auto-mode-alist
224 (rassq-delete-all (cdr y) auto-mode-alist))))) 237 (rassq-delete-all (cdr y) auto-mode-alist)))))
238
239 ;; Change major mode in all buffers using one defined in the feature being unloaded.
240 (unload--set-major-mode)
241
225 (when (fboundp 'elp-restore-function) ; remove ELP stuff first 242 (when (fboundp 'elp-restore-function) ; remove ELP stuff first
226 (dolist (elt unload-function-defs-list) 243 (dolist (elt unload-function-defs-list)
227 (when (symbolp elt) 244 (when (symbolp elt)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 3d243f14f07..4d2f15c69d8 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1868,6 +1868,7 @@ instance. Assumes an inferior Python is running."
1868 1868
1869(declare-function info-lookup-maybe-add-help "info-look" (&rest arg)) 1869(declare-function info-lookup-maybe-add-help "info-look" (&rest arg))
1870 1870
1871;;;###autoload
1871(defun python-after-info-look () 1872(defun python-after-info-look ()
1872 "Set up info-look for Python. 1873 "Set up info-look for Python.
1873Used with `eval-after-load'." 1874Used with `eval-after-load'."
@@ -2731,6 +2732,16 @@ comint believe the user typed this string so that
2731(defun python-sentinel (_proc _msg) 2732(defun python-sentinel (_proc _msg)
2732 (setq overlay-arrow-position nil)) 2733 (setq overlay-arrow-position nil))
2733 2734
2735(defun python-unload-function ()
2736 "Unload the Python library."
2737 (remove-hook 'comint-output-filter-functions 'python-pdbtrack-track-stack-file)
2738 (setq minor-mode-alist (assq-delete-all 'python-pdbtrack-is-tracking-p
2739 minor-mode-alist))
2740 (dolist (error '("^No symbol" "^Can't shift all lines enough"))
2741 (setq debug-ignored-errors (delete error debug-ignored-errors)))
2742 ;; continue standard unloading
2743 nil)
2744
2734(provide 'python) 2745(provide 'python)
2735(provide 'python-21) 2746(provide 'python-21)
2736 2747