f90 indentation fix.
[bpt/emacs.git] / lisp / progmodes / python.el
index a7851c5..38bf955 100644 (file)
@@ -86,7 +86,6 @@
 (add-to-list 'interpreter-mode-alist (cons (purecopy "python") 'python-mode))
 ;;;###autoload
 (add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'")  'python-mode))
-(add-to-list 'same-window-buffer-names (purecopy "*Python*"))
 \f
 ;;;; Font lock
 
@@ -99,7 +98,9 @@
             "import" "in" "is" "lambda" "not" "or" "pass" "print"
             "raise" "return" "try" "while" "with" "yield"
              ;; Not real keywords, but close enough to be fontified as such
-             "self" "True" "False")
+             "self" "True" "False"
+             ;; Python 3
+             "nonlocal")
         symbol-end)
     (,(rx symbol-start "None" symbol-end)      ; see ยง Keywords in 2.7 manual
      . font-lock-constant-face)
@@ -294,7 +295,7 @@ Used for syntactic keywords.  N is the match number (1, 2 or 3)."
         :filter (lambda (&rest junk)
                    (abbrev-table-menu python-mode-abbrev-table)))
        "-"
-       ["Start interpreter" python-shell
+       ["Start interpreter" run-python
         :help "Run `inferior' Python in separate buffer"]
        ["Import/reload file" python-load-file
         :help "Load into inferior Python session"]
@@ -326,14 +327,6 @@ Used for syntactic keywords.  N is the match number (1, 2 or 3)."
 ;; eric has items including: (un)indent, (un)comment, restart script,
 ;; run script, debug script; also things for profiling, unit testing.
 
-(defvar python-shell-map
-  (let ((map (copy-keymap comint-mode-map)))
-    (define-key map [tab]   'tab-to-tab-stop)
-    (define-key map "\C-c-" 'py-up-exception)
-    (define-key map "\C-c=" 'py-down-exception)
-    map)
-  "Keymap used in *Python* shell buffers.")
-
 (defvar python-mode-syntax-table
   (let ((table (make-syntax-table)))
     ;; Give punctuation syntax to ASCII that normally has symbol
@@ -1343,7 +1336,7 @@ local value.")
     (define-key map "\C-c\C-l" 'python-load-file)
     (define-key map "\C-c\C-v" 'python-check)
     ;; Note that we _can_ still use these commands which send to the
-    ;; Python process even at the prompt iff we have a normal prompt,
+    ;; Python process even at the prompt if we have a normal prompt,
     ;; i.e. '>>> ' and not '... '.  See the comment before
     ;; python-send-region.  Fixme: uncomment these if we address that.
 
@@ -1866,6 +1859,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'."
@@ -2359,6 +2353,7 @@ Interactively, prompt for the name with completion."
 
 (autoload 'pymacs-load "pymacs" nil t)
 (autoload 'brm-init "bikemacs")
+(defvar brm-menu)
 
 ;; I'm not sure how useful BRM really is, and it's certainly dangerous
 ;; the way it modifies files outside Emacs...  Also note that the
@@ -2378,7 +2373,7 @@ without confirmation."
              (features (cons 'python-mode features))) ; and requires this
          (brm-init)                    ; second line of normal recipe
          (remove-hook 'python-mode-hook ; undo this from `brm-init'
-                      '(lambda () (easy-menu-add brm-menu)))
+                      (lambda () (easy-menu-add brm-menu)))
          (easy-menu-define
            python-brm-menu python-mode-map
            "Bicycle Repair Man"
@@ -2417,7 +2412,7 @@ without confirmation."
 (defvar python-mode-running)            ;Dynamically scoped var.
 
 ;;;###autoload
-(define-derived-mode python-mode fundamental-mode "Python"
+(define-derived-mode python-mode prog-mode "Python"
   "Major mode for editing Python files.
 Turns on Font Lock mode unconditionally since it is currently required
 for correct parsing of the source.
@@ -2728,6 +2723,16 @@ comint believe the user typed this string so that
 (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)