diff options
author | Tom Willemse | 2013-05-13 17:34:23 +0200 |
---|---|---|
committer | Tom Willemse | 2013-05-16 22:39:20 +0200 |
commit | 487951419022fe425c18ab53aeabb9f0ac214029 (patch) | |
tree | 86be81f5c0c015b7e2c5919b874f5f7351dca8a3 /packages/app-editors/emacs/files/emacs-python-docstrings.patch | |
parent | 27cb0dd97e27de7b27e2ee66e6c2f5158c68f519 (diff) | |
download | exoni-emacs.tar.gz exoni-emacs.zip |
Diffstat (limited to 'packages/app-editors/emacs/files/emacs-python-docstrings.patch')
-rw-r--r-- | packages/app-editors/emacs/files/emacs-python-docstrings.patch | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/packages/app-editors/emacs/files/emacs-python-docstrings.patch b/packages/app-editors/emacs/files/emacs-python-docstrings.patch new file mode 100644 index 0000000..0baa5f6 --- /dev/null +++ b/packages/app-editors/emacs/files/emacs-python-docstrings.patch @@ -0,0 +1,40 @@ +diff --git a/python.el b/python.el +index 54a657a..f01360c 100644 +--- a/lisp/progmodes/python.el ++++ b/lisp/progmodes/python.el +@@ -405,6 +405,23 @@ The type returned can be `comment', `string' or `paren'." + 'python-info-ppss-comment-or-string-p + #'python-syntax-comment-or-string-p "24.3") + ++(defun python-doc-string-at-p (pos) ++ "Check to see if there is a docstring at POS." ++ (save-excursion ++ (goto-char pos) ++ (if (looking-at-p "'''\\|\"\"\"") ++ (progn ++ (python-nav-backward-statement) ++ (looking-at "\\`\\|class \\|def ")) ++ nil))) ++ ++(defun python-font-lock-syntactic-face-function (state) ++ (if (nth 3 state) ++ (if (python-doc-string-at-p (nth 8 state)) ++ font-lock-doc-face ++ font-lock-string-face) ++ font-lock-comment-face)) ++ + (defvar python-font-lock-keywords + ;; Keywords + `(,(rx symbol-start +@@ -3226,7 +3243,10 @@ if that value is non-nil." + 'python-nav-forward-sexp) + + (set (make-local-variable 'font-lock-defaults) +- '(python-font-lock-keywords nil nil nil nil)) ++ '(python-font-lock-keywords ++ nil nil nil nil ++ (font-lock-syntactic-face-function ++ . python-font-lock-syntactic-face-function))) + + (set (make-local-variable 'syntax-propertize-function) + python-syntax-propertize-function) |