+2011-06-25 Juanma Barranquero <lekktu@gmail.com>
+
+ Fix bug#8730, bug#8781.
+
+ * 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.
+
2011-06-25 Stefan Monnier <monnier@iro.umontreal.ca>
* mail/rmail.el (rmail-show-message-1): Use restore-buffer-modified-p.
(define-obsolete-variable-alias 'unload-hook-features-list
'unload-function-defs-list "22.2")
+(defun unload--set-major-mode ()
+ (save-current-buffer
+ (dolist (buffer (buffer-list))
+ (set-buffer buffer)
+ (let ((proposed 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 fundamental
+ ;; mode, or proposed is not nil and not major-mode, and so we use it.
+ (funcall (or proposed 'fundamental-mode)))))))
+
;;;###autoload
(defun unload-feature (feature &optional force)
"Unload the library that provided FEATURE.
(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.
+ (unload--set-major-mode)
+
(when (fboundp 'elp-restore-function) ; remove ELP stuff first
(dolist (elt unload-function-defs-list)
(when (symbolp elt)
(declare-function info-lookup-maybe-add-help "info-look" (&rest arg))
+;;;###autoload
(defun python-after-info-look ()
"Set up info-look for Python.
Used with `eval-after-load'."
(defun python-sentinel (_proc _msg)
(setq overlay-arrow-position nil))
+(defun python-unload-function ()
+ "Unload the Python library."
+ (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)