1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-23 06:00:41 -08:00

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.
This commit is contained in:
Noam Postavsky 2018-02-27 19:44:35 -05:00
parent 4494c4cb63
commit 2291d9ae88

View file

@ -4,7 +4,7 @@
;; Author: Fabián E. Gallina <fgallina@gnu.org>
;; URL: https://github.com/fgallina/python.el
;; Version: 0.26
;; Version: 0.26.1
;; Package-Requires: ((emacs "24.1") (cl-lib "1.0"))
;; Maintainer: emacs-devel@gnu.org
;; Created: Jul 2010
@ -287,9 +287,20 @@
;;; 24.x Compat
(unless (fboundp 'prog-first-column)
(defun prog-first-column ()
0))
(eval-and-compile
(unless (fboundp 'prog-first-column)
(defun prog-first-column ()
0))
(unless (fboundp 'file-local-name)
(defun file-local-name (file)
"Return the local name component of FILE.
It returns a file name which can be used directly as argument of
`process-file', `start-file-process', or `shell-command'."
(or (file-remote-p file 'localname) file))))
;; In Emacs 24.3 and earlier, `define-derived-mode' does not define
;; the hook variable, it only puts documentation on the symbol.
(defvar inferior-python-mode-hook)
;;; Bindings
@ -1509,7 +1520,8 @@ of the statement."
;; narrowing.
(cl-assert (> string-start last-string-end)
:show-args
"Overlapping strings detected")
"
Overlapping strings detected (start=%d, last-end=%d)")
(goto-char string-start)
(if (python-syntax-context 'paren)
;; Ended up inside a paren, roll again.
@ -2148,7 +2160,7 @@ of `exec-path'."
(defun python-shell-tramp-refresh-process-environment (vec env)
"Update VEC's process environment with ENV."
;; Stolen from `tramp-open-connection-setup-interactive-shell'.
(let ((env (append (when (fboundp #'tramp-get-remote-locale)
(let ((env (append (when (fboundp 'tramp-get-remote-locale)
;; Emacs<24.4 compat.
(list (tramp-get-remote-locale vec)))
(copy-sequence env)))
@ -5381,8 +5393,10 @@ REPORT-FN is Flymake's callback function."
"`outline-level' function for Python mode."
(1+ (/ (current-indentation) python-indent-offset))))
(set (make-local-variable 'prettify-symbols-alist)
python--prettify-symbols-alist)
(when (and (boundp 'prettify-symbols-alist)
(boundp 'python--prettify-symbols-alist))
(set (make-local-variable 'prettify-symbols-alist)
python--prettify-symbols-alist))
(python-skeleton-add-menu-items)