Add prettify symbols to python-mode

lisp/progmodes/python.el (python-prettify-symbols-alist): New variable
lisp/progmodes/python.el (python-mode): Use it
This commit is contained in:
Mark Oteiza 2015-09-20 15:20:36 -04:00
parent dd1e684619
commit dadcf33984

View file

@ -620,6 +620,11 @@ The type returned can be `comment', `string' or `paren'."
((python-rx string-delimiter) ((python-rx string-delimiter)
(0 (ignore (python-syntax-stringify)))))) (0 (ignore (python-syntax-stringify))))))
(defconst python--prettify-symbols-alist
'(("lambda" . ?\u03bb)
("and" . ?\u2227)
("or" . ?\u2228)))
(defsubst python-syntax-count-quotes (quote-char &optional point limit) (defsubst python-syntax-count-quotes (quote-char &optional point limit)
"Count number of quotes around point (max is 3). "Count number of quotes around point (max is 3).
QUOTE-CHAR is the quote char to count. Optional argument POINT is QUOTE-CHAR is the quote char to count. Optional argument POINT is
@ -5104,6 +5109,9 @@ returned as is."
"`outline-level' function for Python mode." "`outline-level' function for Python mode."
(1+ (/ (current-indentation) python-indent-offset)))) (1+ (/ (current-indentation) python-indent-offset))))
(set (make-local-variable 'prettify-symbols-alist)
python--prettify-symbols-alist)
(python-skeleton-add-menu-items) (python-skeleton-add-menu-items)
(make-local-variable 'python-shell-internal-buffer) (make-local-variable 'python-shell-internal-buffer)