diff options
| author | Noam Postavsky | 2018-03-01 21:52:27 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2018-03-01 22:07:21 -0500 |
| commit | 4a0934192176fb8e372170f5f028edcf0f8cbdc3 (patch) | |
| tree | b9a732517c466f3a8ccdf928e32aa126524735f2 | |
| parent | 703fdeec8c3039a42d16dba46fcea2c1a4428b75 (diff) | |
| download | emacs-4a0934192176fb8e372170f5f028edcf0f8cbdc3.tar.gz emacs-4a0934192176fb8e372170f5f028edcf0f8cbdc3.zip | |
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
filenames.
(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).
[1]: https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00826.html
| -rw-r--r-- | lisp/progmodes/python.el | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 142e6eb3f3c..afafd1b42cd 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -647,15 +647,15 @@ The type returned can be `comment', `string' or `paren'." | |||
| 647 | ((python-rx string-delimiter) | 647 | ((python-rx string-delimiter) |
| 648 | (0 (ignore (python-syntax-stringify)))))) | 648 | (0 (ignore (python-syntax-stringify)))))) |
| 649 | 649 | ||
| 650 | (define-obsolete-variable-alias 'python--prettify-symbols-alist | ||
| 651 | 'python-prettify-symbols-alist "26.1") | ||
| 652 | |||
| 650 | (defvar python-prettify-symbols-alist | 653 | (defvar python-prettify-symbols-alist |
| 651 | '(("lambda" . ?λ) | 654 | '(("lambda" . ?λ) |
| 652 | ("and" . ?∧) | 655 | ("and" . ?∧) |
| 653 | ("or" . ?∨)) | 656 | ("or" . ?∨)) |
| 654 | "Value for `prettify-symbols-alist' in `python-mode'.") | 657 | "Value for `prettify-symbols-alist' in `python-mode'.") |
| 655 | 658 | ||
| 656 | (define-obsolete-variable-alias 'python--prettify-symbols-alist | ||
| 657 | 'python-prettify-symbols-alist "26.1") | ||
| 658 | |||
| 659 | (defsubst python-syntax-count-quotes (quote-char &optional point limit) | 659 | (defsubst python-syntax-count-quotes (quote-char &optional point limit) |
| 660 | "Count number of quotes around point (max is 3). | 660 | "Count number of quotes around point (max is 3). |
| 661 | QUOTE-CHAR is the quote char to count. Optional argument POINT is | 661 | QUOTE-CHAR is the quote char to count. Optional argument POINT is |
| @@ -1520,7 +1520,7 @@ of the statement." | |||
| 1520 | ;; narrowing. | 1520 | ;; narrowing. |
| 1521 | (cl-assert (> string-start last-string-end) | 1521 | (cl-assert (> string-start last-string-end) |
| 1522 | :show-args | 1522 | :show-args |
| 1523 | " | 1523 | "\ |
| 1524 | Overlapping strings detected (start=%d, last-end=%d)") | 1524 | Overlapping strings detected (start=%d, last-end=%d)") |
| 1525 | (goto-char string-start) | 1525 | (goto-char string-start) |
| 1526 | (if (python-syntax-context 'paren) | 1526 | (if (python-syntax-context 'paren) |
| @@ -3196,10 +3196,10 @@ t when called interactively." | |||
| 3196 | (insert-file-contents | 3196 | (insert-file-contents |
| 3197 | (or temp-file-name file-name)) | 3197 | (or temp-file-name file-name)) |
| 3198 | (python-info-encoding))) | 3198 | (python-info-encoding))) |
| 3199 | (file-name (expand-file-name (file-local-name file-name))) | 3199 | (file-name (file-local-name (expand-file-name file-name))) |
| 3200 | (temp-file-name (when temp-file-name | 3200 | (temp-file-name (when temp-file-name |
| 3201 | (expand-file-name | 3201 | (file-local-name (expand-file-name |
| 3202 | (file-local-name temp-file-name))))) | 3202 | temp-file-name))))) |
| 3203 | (python-shell-send-string | 3203 | (python-shell-send-string |
| 3204 | (format | 3204 | (format |
| 3205 | (concat | 3205 | (concat |
| @@ -5299,6 +5299,7 @@ REPORT-FN is Flymake's callback function." | |||
| 5299 | (save-excursion (insert (make-string 2 last-command-event))))) | 5299 | (save-excursion (insert (make-string 2 last-command-event))))) |
| 5300 | 5300 | ||
| 5301 | (defvar electric-indent-inhibit) | 5301 | (defvar electric-indent-inhibit) |
| 5302 | (defvar prettify-symbols-alist) | ||
| 5302 | 5303 | ||
| 5303 | ;;;###autoload | 5304 | ;;;###autoload |
| 5304 | (define-derived-mode python-mode prog-mode "Python" | 5305 | (define-derived-mode python-mode prog-mode "Python" |
| @@ -5393,10 +5394,8 @@ REPORT-FN is Flymake's callback function." | |||
| 5393 | "`outline-level' function for Python mode." | 5394 | "`outline-level' function for Python mode." |
| 5394 | (1+ (/ (current-indentation) python-indent-offset)))) | 5395 | (1+ (/ (current-indentation) python-indent-offset)))) |
| 5395 | 5396 | ||
| 5396 | (when (and (boundp 'prettify-symbols-alist) | 5397 | (set (make-local-variable 'prettify-symbols-alist) |
| 5397 | (boundp 'python--prettify-symbols-alist)) | 5398 | python-prettify-symbols-alist) |
| 5398 | (set (make-local-variable 'prettify-symbols-alist) | ||
| 5399 | python--prettify-symbols-alist)) | ||
| 5400 | 5399 | ||
| 5401 | (python-skeleton-add-menu-items) | 5400 | (python-skeleton-add-menu-items) |
| 5402 | 5401 | ||