aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Brown (tiny change)2014-06-19 10:03:45 -0400
committerStefan Monnier2014-06-19 10:03:45 -0400
commit96db005527ef9d9c45c5ec8e91b01e91ee37a7fd (patch)
tree9c60f1c41d1537d22f06fec7dd8cdb3608528e9c
parent483d1ab6c84b2d6c7169870d99abf7e2a10dab31 (diff)
downloademacs-96db005527ef9d9c45c5ec8e91b01e91ee37a7fd.tar.gz
emacs-96db005527ef9d9c45c5ec8e91b01e91ee37a7fd.zip
* etc/NEWS: New Tramp method "nc".
* lisp/emacs-lisp/lisp-mode.el (lisp-string-after-doc-keyword-p): New fun. (lisp-string-in-doc-position-p): New function, extracted from lisp-font-lock-syntactic-face-function. (lisp-font-lock-syntactic-face-function): Use them. Fixes: debbugs:9130
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/emacs-lisp/lisp-mode.el64
3 files changed, 48 insertions, 26 deletions
diff --git a/etc/NEWS b/etc/NEWS
index bd928c25376..f9cb42e2d2b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -72,6 +72,9 @@ performance improvements when pasting large amounts of text.
72 72
73* Changes in Specialized Modes and Packages in Emacs 24.5 73* Changes in Specialized Modes and Packages in Emacs 24.5
74 74
75** Lisp mode
76*** Strings after `:documentation' are highlighted as docstrings.
77
75** Rectangle editing 78** Rectangle editing
76*** Rectangle Mark mode can have corners past EOL or in the middle of a TAB. 79*** Rectangle Mark mode can have corners past EOL or in the middle of a TAB.
77*** C-x C-x in rectangle-mark-mode now cycles through the four corners. 80*** C-x C-x in rectangle-mark-mode now cycles through the four corners.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 245cf859ed3..af2eb9712ae 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12014-06-19 Robert Brown <robert.brown@gmail.com> (tiny change)
2
3 * emacs-lisp/lisp-mode.el (lisp-string-after-doc-keyword-p): New fun.
4 (lisp-string-in-doc-position-p): New function, extracted from
5 lisp-font-lock-syntactic-face-function.
6 (lisp-font-lock-syntactic-face-function): Use them (bug#9130).
7
12014-06-19 Grégoire Jadi <daimrod@gmail.com> 82014-06-19 Grégoire Jadi <daimrod@gmail.com>
2 9
3 * net/rcirc.el (rcirc-omit-mode): Fix recenter error. (Bug#17769) 10 * net/rcirc.el (rcirc-omit-mode): Fix recenter error. (Bug#17769)
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 18ad859e0b5..31df353321a 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -413,6 +413,41 @@ It has `lisp-mode-abbrev-table' as its parent."
413(defvar lisp-cl-font-lock-keywords lisp-cl-font-lock-keywords-1 413(defvar lisp-cl-font-lock-keywords lisp-cl-font-lock-keywords-1
414 "Default expressions to highlight in Lisp modes.") 414 "Default expressions to highlight in Lisp modes.")
415 415
416(defun lisp-string-in-doc-position-p (listbeg startpos)
417 (let* ((firstsym (and listbeg
418 (save-excursion
419 (goto-char listbeg)
420 (and (looking-at "([ \t\n]*\\(\\(\\sw\\|\\s_\\)+\\)")
421 (match-string 1)))))
422 (docelt (and firstsym
423 (function-get (intern-soft firstsym)
424 lisp-doc-string-elt-property))))
425 (and docelt
426 ;; It's a string in a form that can have a docstring.
427 ;; Check whether it's in docstring position.
428 (save-excursion
429 (when (functionp docelt)
430 (goto-char (match-end 1))
431 (setq docelt (funcall docelt)))
432 (goto-char listbeg)
433 (forward-char 1)
434 (condition-case nil
435 (while (and (> docelt 0) (< (point) startpos)
436 (progn (forward-sexp 1) t))
437 (setq docelt (1- docelt)))
438 (error nil))
439 (and (zerop docelt) (<= (point) startpos)
440 (progn (forward-comment (point-max)) t)
441 (= (point) startpos))))))
442
443(defun lisp-string-after-doc-keyword-p (listbeg startpos)
444 (and listbeg ; We are inside a Lisp form.
445 (save-excursion
446 (goto-char startpos)
447 (ignore-errors
448 (progn (backward-sexp 1)
449 (looking-at ":documentation\\_>"))))))
450
416(defun lisp-font-lock-syntactic-face-function (state) 451(defun lisp-font-lock-syntactic-face-function (state)
417 (if (nth 3 state) 452 (if (nth 3 state)
418 ;; This might be a (doc)string or a |...| symbol. 453 ;; This might be a (doc)string or a |...| symbol.
@@ -420,32 +455,9 @@ It has `lisp-mode-abbrev-table' as its parent."
420 (if (eq (char-after startpos) ?|) 455 (if (eq (char-after startpos) ?|)
421 ;; This is not a string, but a |...| symbol. 456 ;; This is not a string, but a |...| symbol.
422 nil 457 nil
423 (let* ((listbeg (nth 1 state)) 458 (let ((listbeg (nth 1 state)))
424 (firstsym (and listbeg 459 (if (or (lisp-string-in-doc-position-p listbeg startpos)
425 (save-excursion 460 (lisp-string-after-doc-keyword-p listbeg startpos))
426 (goto-char listbeg)
427 (and (looking-at "([ \t\n]*\\(\\(\\sw\\|\\s_\\)+\\)")
428 (match-string 1)))))
429 (docelt (and firstsym
430 (function-get (intern-soft firstsym)
431 lisp-doc-string-elt-property))))
432 (if (and docelt
433 ;; It's a string in a form that can have a docstring.
434 ;; Check whether it's in docstring position.
435 (save-excursion
436 (when (functionp docelt)
437 (goto-char (match-end 1))
438 (setq docelt (funcall docelt)))
439 (goto-char listbeg)
440 (forward-char 1)
441 (condition-case nil
442 (while (and (> docelt 0) (< (point) startpos)
443 (progn (forward-sexp 1) t))
444 (setq docelt (1- docelt)))
445 (error nil))
446 (and (zerop docelt) (<= (point) startpos)
447 (progn (forward-comment (point-max)) t)
448 (= (point) (nth 8 state)))))
449 font-lock-doc-face 461 font-lock-doc-face
450 font-lock-string-face)))) 462 font-lock-string-face))))
451 font-lock-comment-face)) 463 font-lock-comment-face))