aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorNoam Postavsky2018-02-27 19:44:35 -0500
committerNoam Postavsky2018-02-27 20:21:26 -0500
commit2291d9ae888961ce7e4f22675244f535db54df56 (patch)
tree8d2660283f74010496aa929201db41830c33d9ef /lisp/progmodes/python.el
parent4494c4cb63808df8f962e90e5d1ac4cf0d5d2f83 (diff)
downloademacs-2291d9ae888961ce7e4f22675244f535db54df56.tar.gz
emacs-2291d9ae888961ce7e4f22675244f535db54df56.zip
Fix python.el for Emacs 24, bump ELPA version to 0.26.1 (Bug#30633)
Since python.el is distributed via GNU ELPA, it should be functional in earlier Emacs versions. Also fix some compile warnings. * lisp/progmodes/python.el: Bump version to 0.26.1. Define `prog-first-column' and `file-local-name' also at compile time, as needed. (inferior-python-mode-hook): Declare for the benefit of Emacs 24.3. (python-nav-end-of-statement): Fix format string for assertion error. (python-shell-tramp-refresh-process-environment): Don't `function' quote a symbol which might not be fbound. (python-mode): Only use prettify-symbols settings if they're bound.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el30
1 files changed, 22 insertions, 8 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 530eb2fb95e..142e6eb3f3c 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -4,7 +4,7 @@
4 4
5;; Author: Fabián E. Gallina <fgallina@gnu.org> 5;; Author: Fabián E. Gallina <fgallina@gnu.org>
6;; URL: https://github.com/fgallina/python.el 6;; URL: https://github.com/fgallina/python.el
7;; Version: 0.26 7;; Version: 0.26.1
8;; Package-Requires: ((emacs "24.1") (cl-lib "1.0")) 8;; Package-Requires: ((emacs "24.1") (cl-lib "1.0"))
9;; Maintainer: emacs-devel@gnu.org 9;; Maintainer: emacs-devel@gnu.org
10;; Created: Jul 2010 10;; Created: Jul 2010
@@ -287,9 +287,20 @@
287;;; 24.x Compat 287;;; 24.x Compat
288 288
289 289
290(unless (fboundp 'prog-first-column) 290(eval-and-compile
291 (defun prog-first-column () 291 (unless (fboundp 'prog-first-column)
292 0)) 292 (defun prog-first-column ()
293 0))
294 (unless (fboundp 'file-local-name)
295 (defun file-local-name (file)
296 "Return the local name component of FILE.
297It returns a file name which can be used directly as argument of
298`process-file', `start-file-process', or `shell-command'."
299 (or (file-remote-p file 'localname) file))))
300
301;; In Emacs 24.3 and earlier, `define-derived-mode' does not define
302;; the hook variable, it only puts documentation on the symbol.
303(defvar inferior-python-mode-hook)
293 304
294 305
295;;; Bindings 306;;; Bindings
@@ -1509,7 +1520,8 @@ of the statement."
1509 ;; narrowing. 1520 ;; narrowing.
1510 (cl-assert (> string-start last-string-end) 1521 (cl-assert (> string-start last-string-end)
1511 :show-args 1522 :show-args
1512 "Overlapping strings detected") 1523 "
1524Overlapping strings detected (start=%d, last-end=%d)")
1513 (goto-char string-start) 1525 (goto-char string-start)
1514 (if (python-syntax-context 'paren) 1526 (if (python-syntax-context 'paren)
1515 ;; Ended up inside a paren, roll again. 1527 ;; Ended up inside a paren, roll again.
@@ -2148,7 +2160,7 @@ of `exec-path'."
2148(defun python-shell-tramp-refresh-process-environment (vec env) 2160(defun python-shell-tramp-refresh-process-environment (vec env)
2149 "Update VEC's process environment with ENV." 2161 "Update VEC's process environment with ENV."
2150 ;; Stolen from `tramp-open-connection-setup-interactive-shell'. 2162 ;; Stolen from `tramp-open-connection-setup-interactive-shell'.
2151 (let ((env (append (when (fboundp #'tramp-get-remote-locale) 2163 (let ((env (append (when (fboundp 'tramp-get-remote-locale)
2152 ;; Emacs<24.4 compat. 2164 ;; Emacs<24.4 compat.
2153 (list (tramp-get-remote-locale vec))) 2165 (list (tramp-get-remote-locale vec)))
2154 (copy-sequence env))) 2166 (copy-sequence env)))
@@ -5381,8 +5393,10 @@ REPORT-FN is Flymake's callback function."
5381 "`outline-level' function for Python mode." 5393 "`outline-level' function for Python mode."
5382 (1+ (/ (current-indentation) python-indent-offset)))) 5394 (1+ (/ (current-indentation) python-indent-offset))))
5383 5395
5384 (set (make-local-variable 'prettify-symbols-alist) 5396 (when (and (boundp 'prettify-symbols-alist)
5385 python--prettify-symbols-alist) 5397 (boundp 'python--prettify-symbols-alist))
5398 (set (make-local-variable 'prettify-symbols-alist)
5399 python--prettify-symbols-alist))
5386 5400
5387 (python-skeleton-add-menu-items) 5401 (python-skeleton-add-menu-items)
5388 5402