diff options
| author | Tom Willemse | 2014-12-07 11:24:35 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2014-12-07 11:24:35 -0500 |
| commit | 9dfa949c0d24b8b74104e5cd1ac2fc0bdaa37341 (patch) | |
| tree | 6919ef1099c33e89985fc2399b36bbbb055cbab6 | |
| parent | f3a685812a408968a24dd8ca97fdfae8ef266037 (diff) | |
| download | emacs-9dfa949c0d24b8b74104e5cd1ac2fc0bdaa37341.tar.gz emacs-9dfa949c0d24b8b74104e5cd1ac2fc0bdaa37341.zip | |
* lisp/progmodes/python.el: Recognize docstrings.
(python-docstring-at-p, python-font-lock-syntactic-face-function):
New functions.
(python-mode): Use them.
| -rw-r--r-- | lisp/ChangeLog | 14 | ||||
| -rw-r--r-- | lisp/progmodes/python.el | 22 |
2 files changed, 31 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f695e1c3180..50df1cd3253 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,9 +1,16 @@ | |||
| 1 | 2014-12-07 Tom Willemse <tom@ryuslash.org> (tiny change) | ||
| 2 | |||
| 3 | * progmodes/python.el: Recognize docstrings. | ||
| 4 | (python-docstring-at-p, python-font-lock-syntactic-face-function): | ||
| 5 | New functions. | ||
| 6 | (python-mode): Use them. | ||
| 7 | |||
| 1 | 2014-12-06 Ulf Jasper <ulf.jasper@web.de> | 8 | 2014-12-06 Ulf Jasper <ulf.jasper@web.de> |
| 2 | 9 | ||
| 3 | * net/newst-treeview.el (newsticker--treeview-list-add-item) | 10 | * net/newst-treeview.el (newsticker--treeview-list-add-item) |
| 4 | (newsticker--treeview-propertize-tag): Bind tree menu to mouse-3. | 11 | (newsticker--treeview-propertize-tag): Bind tree menu to mouse-3. |
| 5 | (newsticker--treeview-create-groups-menu) | 12 | (newsticker--treeview-create-groups-menu) |
| 6 | (newsticker--treeview-create-tree-menu): Removed. | 13 | (newsticker--treeview-create-tree-menu): Remove. |
| 7 | (newsticker--treeview-tree-open-menu): New. | 14 | (newsticker--treeview-tree-open-menu): New. |
| 8 | (newsticker-treeview-tree-click): Pass event to | 15 | (newsticker-treeview-tree-click): Pass event to |
| 9 | `newsticker-treeview-tree-do-click'. | 16 | `newsticker-treeview-tree-do-click'. |
| @@ -20,8 +27,8 @@ | |||
| 20 | 27 | ||
| 21 | 2014-12-05 Juri Linkov <juri@linkov.net> | 28 | 2014-12-05 Juri Linkov <juri@linkov.net> |
| 22 | 29 | ||
| 23 | * minibuffer.el (minibuffer-completion-help): Compare | 30 | * minibuffer.el (minibuffer-completion-help): |
| 24 | selected-window with minibuffer-window to check whether | 31 | Compare selected-window with minibuffer-window to check whether |
| 25 | completions should be displayed near the minibuffer. (Bug#17809) | 32 | completions should be displayed near the minibuffer. (Bug#17809) |
| 26 | http://lists.gnu.org/archive/html/emacs-devel/2014-12/msg00311.html | 33 | http://lists.gnu.org/archive/html/emacs-devel/2014-12/msg00311.html |
| 27 | 34 | ||
| @@ -52,7 +59,6 @@ | |||
| 52 | both in terms of the column to which it moves and the return | 59 | both in terms of the column to which it moves and the return |
| 53 | value. (Bug#19211) | 60 | value. (Bug#19211) |
| 54 | 61 | ||
| 55 | 2014-12-05 Stephen Berman <stephen.berman@gmx.net> | ||
| 56 | 2014-12-05 Stefan Monnier <monnier@iro.umontreal.ca> | 62 | 2014-12-05 Stefan Monnier <monnier@iro.umontreal.ca> |
| 57 | 63 | ||
| 58 | * vc/ediff-init.el (ediff-odd-p): Remove. | 64 | * vc/ediff-init.el (ediff-odd-p): Remove. |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 9f9db6c6046..33c822a37d5 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -459,6 +459,23 @@ The type returned can be `comment', `string' or `paren'." | |||
| 459 | 'python-info-ppss-comment-or-string-p | 459 | 'python-info-ppss-comment-or-string-p |
| 460 | #'python-syntax-comment-or-string-p "24.3") | 460 | #'python-syntax-comment-or-string-p "24.3") |
| 461 | 461 | ||
| 462 | (defun python-docstring-at-p (pos) | ||
| 463 | "Check to see if there is a docstring at POS." | ||
| 464 | (save-excursion | ||
| 465 | (goto-char pos) | ||
| 466 | (if (looking-at-p "'''\\|\"\"\"") | ||
| 467 | (progn | ||
| 468 | (python-nav-backward-statement) | ||
| 469 | (looking-at "\\`\\|class \\|def ")) | ||
| 470 | nil))) | ||
| 471 | |||
| 472 | (defun python-font-lock-syntactic-face-function (state) | ||
| 473 | (if (nth 3 state) | ||
| 474 | (if (python-docstring-at-p (nth 8 state)) | ||
| 475 | font-lock-doc-face | ||
| 476 | font-lock-string-face) | ||
| 477 | font-lock-comment-face)) | ||
| 478 | |||
| 462 | (defvar python-font-lock-keywords | 479 | (defvar python-font-lock-keywords |
| 463 | ;; Keywords | 480 | ;; Keywords |
| 464 | `(,(rx symbol-start | 481 | `(,(rx symbol-start |
| @@ -4312,7 +4329,10 @@ Arguments START and END narrow the buffer region to work on." | |||
| 4312 | 'python-nav-forward-sexp) | 4329 | 'python-nav-forward-sexp) |
| 4313 | 4330 | ||
| 4314 | (set (make-local-variable 'font-lock-defaults) | 4331 | (set (make-local-variable 'font-lock-defaults) |
| 4315 | '(python-font-lock-keywords nil nil nil nil)) | 4332 | '(python-font-lock-keywords |
| 4333 | nil nil nil nil | ||
| 4334 | (font-lock-syntactic-face-function | ||
| 4335 | . python-font-lock-syntactic-face-function))) | ||
| 4316 | 4336 | ||
| 4317 | (set (make-local-variable 'syntax-propertize-function) | 4337 | (set (make-local-variable 'syntax-propertize-function) |
| 4318 | python-syntax-propertize-function) | 4338 | python-syntax-propertize-function) |