pkgbuilds/emacs-bzr/docstrings2.patch

70 lines
3.1 KiB
Diff

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: tom@ryuslash.org-20130202085403-n4iv0tg5xh4dwbnm
# target_branch: bzr://bzr.savannah.gnu.org/emacs/trunk/
# testament_sha1: dca687d2bd301e20ea2dafb8af371ca897851137
# timestamp: 2013-02-02 09:54:17 +0100
# base_revision_id: rgm@gnu.org-20121227082108-3z2ppeegxrhychws
#
# Begin patch
=== modified file 'lisp/progmodes/python.el'
--- lisp/progmodes/python.el 2012-12-13 05:29:15 +0000
+++ lisp/progmodes/python.el 2013-02-02 08:54:03 +0000
@@ -406,6 +406,23 @@
'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
@@ -3213,7 +3230,10 @@
'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)
# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWS+Ut6kAAd3fgF8QUOP/91sA
zIT/7//0UAQ7teAGnjYAA1NEamyjQ0yaPUaaBoAAA000NAZQmmo09NGiaExkIYjIxMjRjQjINRGT
QQGmI2kAAGTE0bUAZAamFCaGgNA0ADTIAGhoAAkkEa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