emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r104702: * loadhist.el (unload--set-m


From: Juanma Barranquero
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104702: * loadhist.el (unload--set-major-mode): New function.
Date: Sat, 25 Jun 2011 19:42:18 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104702
fixes bug(s): http://debbugs.gnu.org/8781 http://debbugs.gnu.org/8730
committer: Juanma Barranquero <address@hidden>
branch nick: trunk
timestamp: Sat 2011-06-25 19:42:18 +0200
message:
  * 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.
modified:
  lisp/ChangeLog
  lisp/loadhist.el
  lisp/progmodes/python.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-06-25 13:38:32 +0000
+++ b/lisp/ChangeLog    2011-06-25 17:42:18 +0000
@@ -1,3 +1,13 @@
+2011-06-25  Juanma Barranquero  <address@hidden>
+
+       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  <address@hidden>
 
        * mail/rmail.el (rmail-show-message-1): Use restore-buffer-modified-p.

=== modified file 'lisp/loadhist.el'
--- a/lisp/loadhist.el  2011-06-08 07:17:26 +0000
+++ b/lisp/loadhist.el  2011-06-25 17:42:18 +0000
@@ -143,6 +143,19 @@
 (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.
@@ -222,6 +235,10 @@
                     (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)

=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el  2011-06-15 14:07:48 +0000
+++ b/lisp/progmodes/python.el  2011-06-25 17:42:18 +0000
@@ -1868,6 +1868,7 @@
 
 (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'."
@@ -2731,6 +2732,16 @@
 (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)
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]