Commit 4a093419 authored by Noam Postavsky's avatar Noam Postavsky

Fix issues turned up by previous python.el change

See [1] for more discussion.
* lisp/progmodes/python.el (python--prettify-symbols-alist): Define
the obsolete alias before the variable proper, so that we correctly
get the user's settings regardless of which name they set.
(python-nav-end-of-statement): Add missing backslash.
(python-shell-send-file): Call `expand-file-name' before
`file-local-name', the expansion of "~" could be different on remote
(python-mode): Declare prettify-symbols-alist instead of checking if
it's bound.  Use the non-obsolete python-prettify-symbols-alist name,
rather than checking if the obsolete name is bound (it always is too,
but the Emacs 24 byte compiler doesn't recognize that
define-obsolete-variable-alias defines a variable).

parent 703fdeec
......@@ -647,15 +647,15 @@ The type returned can be `comment', `string' or `paren'."
((python-rx string-delimiter)
(0 (ignore (python-syntax-stringify))))))
(define-obsolete-variable-alias 'python--prettify-symbols-alist
'python-prettify-symbols-alist "26.1")
(defvar python-prettify-symbols-alist
'(("lambda" . ?λ)
("and" . ?)
("or" . ?))
"Value for `prettify-symbols-alist' in `python-mode'.")
(define-obsolete-variable-alias 'python--prettify-symbols-alist
'python-prettify-symbols-alist "26.1")
(defsubst python-syntax-count-quotes (quote-char &optional point limit)
"Count number of quotes around point (max is 3).
QUOTE-CHAR is the quote char to count. Optional argument POINT is
......@@ -1520,7 +1520,7 @@ of the statement."
;; narrowing.
(cl-assert (> string-start last-string-end)
Overlapping strings detected (start=%d, last-end=%d)")
(goto-char string-start)
(if (python-syntax-context 'paren)
......@@ -3196,10 +3196,10 @@ t when called interactively."
(or temp-file-name file-name))
(file-name (expand-file-name (file-local-name file-name)))
(file-name (file-local-name (expand-file-name file-name)))
(temp-file-name (when temp-file-name
(file-local-name temp-file-name)))))
(file-local-name (expand-file-name
......@@ -5299,6 +5299,7 @@ REPORT-FN is Flymake's callback function."
(save-excursion (insert (make-string 2 last-command-event)))))
(defvar electric-indent-inhibit)
(defvar prettify-symbols-alist)
(define-derived-mode python-mode prog-mode "Python"
......@@ -5393,10 +5394,8 @@ REPORT-FN is Flymake's callback function."
"`outline-level' function for Python mode."
(1+ (/ (current-indentation) python-indent-offset))))
(when (and (boundp 'prettify-symbols-alist)
(boundp 'python--prettify-symbols-alist))
(set (make-local-variable 'prettify-symbols-alist)
(set (make-local-variable 'prettify-symbols-alist)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment