]> code.delx.au - gnu-emacs/commitdiff
Fixes bug#8730, bug#8781. Do not merge into trunk.
authorJuanma Barranquero <lekktu@gmail.com>
Sun, 5 Jun 2011 00:32:23 +0000 (02:32 +0200)
committerJuanma Barranquero <lekktu@gmail.com>
Sun, 5 Jun 2011 00:32:23 +0000 (02:32 +0200)
lisp/progmodes/python.el (python-after-info-look): Add autoload cookie.
(python-unload-function): New function.

lisp/ChangeLog
lisp/progmodes/python.el

index 805cee8021a5966c9c2ba4ed7be4e152fc7683eb..c403c8045d2b8ddcb86378abf0d8b3b46a5d9a4c 100644 (file)
@@ -1,3 +1,8 @@
+2011-06-05  Juanma Barranquero  <lekktu@gmail.com>
+
+       * progmodes/python.el (python-after-info-look): Add autoload cookie.
+       (python-unload-function): New function. (Bug#8730, bug#8781)
+
 2011-06-04  Reuben Thomas <rrt@sc3d.org>
 
        * progmodes/flymake.el (flymake-compilation-prevents-syntax-check):
index 86f82432578cc7046a192449e29d9af3bfb993b1..f2dbdb5a0136ce673f936ee6ca7966798bc36488 100644 (file)
@@ -1914,6 +1914,7 @@ instance.  Assumes an inferior Python is running."
 
 (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'."
@@ -2895,6 +2896,32 @@ filter."
 (defun python-sentinel (proc msg)
   (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)
+             (remove-hook 'comint-preoutput-filter-functions
+                          'python-preoutput-filter t)
+             (remove-hook 'comint-output-filter-functions
+                          'python-comint-output-filter-function t)
+             (let ((proc (get-buffer-process (current-buffer))))
+               (if (not proc)
+                   (funcall default-mode)
+                 (set-process-sentinel proc nil)
+                 (funcall inferior-mode)))))))
+  (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)