aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShakthi Kannan2015-12-30 19:59:12 +0200
committerEli Zaretskii2015-12-30 19:59:12 +0200
commit86312ffd93e54bc8993740479c9de3df69935185 (patch)
treeedae251bc62365419b63db2d6eaa1e6afe669e44
parentc930e75bfae40c914ad5d5d1996db4af53a3f340 (diff)
downloademacs-86312ffd93e54bc8993740479c9de3df69935185.tar.gz
emacs-86312ffd93e54bc8993740479c9de3df69935185.zip
Document support for ':documentation' in Lisp mode
* lisp/emacs-lisp/lisp-mode.el (lisp-string-in-doc-position-p) (lisp-string-after-doc-keyword-p) (lisp-font-lock-syntactic-face-function): Add doc strings.
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/emacs-lisp/lisp-mode.el9
2 files changed, 14 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 80e999956c7..9f321667945 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -638,7 +638,12 @@ respectively, `show-paren-when-point-inside-paren' or
638`show-paren-when-point-in-periphery'. 638`show-paren-when-point-in-periphery'.
639 639
640** Lisp mode 640** Lisp mode
641
642---
641*** Strings after `:documentation' are highlighted as docstrings. 643*** Strings after `:documentation' are highlighted as docstrings.
644This enhances Lisp mode fontification to handle documentation of the
645form `(:documentation "the doc string")' used in Common Lisp code for
646CLOS class and slot documentation.
642 647
643** Rectangle editing 648** Rectangle editing
644 649
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 3448b72c3f1..e99f8a55ab1 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -488,6 +488,9 @@ This will generate compile-time constants from BINDINGS."
488 "Default expressions to highlight in Lisp modes.") 488 "Default expressions to highlight in Lisp modes.")
489 489
490(defun lisp-string-in-doc-position-p (listbeg startpos) 490(defun lisp-string-in-doc-position-p (listbeg startpos)
491 "Return true if a doc string may occur at STARTPOS inside a list.
492LISTBEG is the position of the start of the innermost list
493containing STARTPOS."
491 (let* ((firstsym (and listbeg 494 (let* ((firstsym (and listbeg
492 (save-excursion 495 (save-excursion
493 (goto-char listbeg) 496 (goto-char listbeg)
@@ -518,6 +521,9 @@ This will generate compile-time constants from BINDINGS."
518 (= (point) startpos)))))) 521 (= (point) startpos))))))
519 522
520(defun lisp-string-after-doc-keyword-p (listbeg startpos) 523(defun lisp-string-after-doc-keyword-p (listbeg startpos)
524 "Return true if `:documentation' symbol ends at STARTPOS inside a list.
525LISTBEG is the position of the start of the innermost list
526containing STARTPOS."
521 (and listbeg ; We are inside a Lisp form. 527 (and listbeg ; We are inside a Lisp form.
522 (save-excursion 528 (save-excursion
523 (goto-char startpos) 529 (goto-char startpos)
@@ -526,6 +532,9 @@ This will generate compile-time constants from BINDINGS."
526 (looking-at ":documentation\\_>")))))) 532 (looking-at ":documentation\\_>"))))))
527 533
528(defun lisp-font-lock-syntactic-face-function (state) 534(defun lisp-font-lock-syntactic-face-function (state)
535 "Return syntactic face function for the position represented by STATE.
536STATE is a `parse-partial-sexp' state, and the returned function is the
537Lisp font lock syntactic face function."
529 (if (nth 3 state) 538 (if (nth 3 state)
530 ;; This might be a (doc)string or a |...| symbol. 539 ;; This might be a (doc)string or a |...| symbol.
531 (let ((startpos (nth 8 state))) 540 (let ((startpos (nth 8 state)))