1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-28 16:21:07 -08:00

* 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
This commit is contained in:
Robert Brown (tiny change) 2014-06-19 10:03:45 -04:00 committed by Stefan Monnier
parent 483d1ab6c8
commit 96db005527
3 changed files with 48 additions and 26 deletions

View file

@ -72,6 +72,9 @@ performance improvements when pasting large amounts of text.
* Changes in Specialized Modes and Packages in Emacs 24.5
** Lisp mode
*** Strings after `:documentation' are highlighted as docstrings.
** Rectangle editing
*** Rectangle Mark mode can have corners past EOL or in the middle of a TAB.
*** C-x C-x in rectangle-mark-mode now cycles through the four corners.

View file

@ -1,3 +1,10 @@
2014-06-19 Robert Brown <robert.brown@gmail.com> (tiny change)
* 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 (bug#9130).
2014-06-19 Grégoire Jadi <daimrod@gmail.com>
* net/rcirc.el (rcirc-omit-mode): Fix recenter error. (Bug#17769)

View file

@ -413,15 +413,8 @@ It has `lisp-mode-abbrev-table' as its parent."
(defvar lisp-cl-font-lock-keywords lisp-cl-font-lock-keywords-1
"Default expressions to highlight in Lisp modes.")
(defun lisp-font-lock-syntactic-face-function (state)
(if (nth 3 state)
;; This might be a (doc)string or a |...| symbol.
(let ((startpos (nth 8 state)))
(if (eq (char-after startpos) ?|)
;; This is not a string, but a |...| symbol.
nil
(let* ((listbeg (nth 1 state))
(firstsym (and listbeg
(defun lisp-string-in-doc-position-p (listbeg startpos)
(let* ((firstsym (and listbeg
(save-excursion
(goto-char listbeg)
(and (looking-at "([ \t\n]*\\(\\(\\sw\\|\\s_\\)+\\)")
@ -429,7 +422,7 @@ It has `lisp-mode-abbrev-table' as its parent."
(docelt (and firstsym
(function-get (intern-soft firstsym)
lisp-doc-string-elt-property))))
(if (and docelt
(and docelt
;; It's a string in a form that can have a docstring.
;; Check whether it's in docstring position.
(save-excursion
@ -445,7 +438,26 @@ It has `lisp-mode-abbrev-table' as its parent."
(error nil))
(and (zerop docelt) (<= (point) startpos)
(progn (forward-comment (point-max)) t)
(= (point) (nth 8 state)))))
(= (point) startpos))))))
(defun lisp-string-after-doc-keyword-p (listbeg startpos)
(and listbeg ; We are inside a Lisp form.
(save-excursion
(goto-char startpos)
(ignore-errors
(progn (backward-sexp 1)
(looking-at ":documentation\\_>"))))))
(defun lisp-font-lock-syntactic-face-function (state)
(if (nth 3 state)
;; This might be a (doc)string or a |...| symbol.
(let ((startpos (nth 8 state)))
(if (eq (char-after startpos) ?|)
;; This is not a string, but a |...| symbol.
nil
(let ((listbeg (nth 1 state)))
(if (or (lisp-string-in-doc-position-p listbeg startpos)
(lisp-string-after-doc-keyword-p listbeg startpos))
font-lock-doc-face
font-lock-string-face))))
font-lock-comment-face))