]> code.delx.au - gnu-emacs/commitdiff
Document support for ':documentation' in Lisp mode
authorShakthi Kannan <shakthimaan@gmail.com>
Wed, 30 Dec 2015 17:59:12 +0000 (19:59 +0200)
committerEli Zaretskii <eliz@gnu.org>
Wed, 30 Dec 2015 17:59:12 +0000 (19:59 +0200)
* 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.

etc/NEWS
lisp/emacs-lisp/lisp-mode.el

index 80e999956c7bd6b1e80d1b496de3ca2bf57de83b..9f321667945cfbfde7987c51bafc2a2d31537706 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -638,7 +638,12 @@ respectively, `show-paren-when-point-inside-paren' or
 `show-paren-when-point-in-periphery'.
 
 ** Lisp mode
+
+---
 *** Strings after `:documentation' are highlighted as docstrings.
+This enhances Lisp mode fontification to handle documentation of the
+form `(:documentation "the doc string")' used in Common Lisp code for
+CLOS class and slot documentation.
 
 ** Rectangle editing
 
index 3448b72c3f1d3cbc728b69ec2bb5f89e5b662a82..e99f8a55ab18a063811ef885fc0ea5e747a83a90 100644 (file)
@@ -488,6 +488,9 @@ This will generate compile-time constants from BINDINGS."
   "Default expressions to highlight in Lisp modes.")
 
 (defun lisp-string-in-doc-position-p (listbeg startpos)
+   "Return true if a doc string may occur at STARTPOS inside a list.
+LISTBEG is the position of the start of the innermost list
+containing STARTPOS."
   (let* ((firstsym (and listbeg
                         (save-excursion
                           (goto-char listbeg)
@@ -518,6 +521,9 @@ This will generate compile-time constants from BINDINGS."
                 (= (point) startpos))))))
 
 (defun lisp-string-after-doc-keyword-p (listbeg startpos)
+  "Return true if `:documentation' symbol ends at STARTPOS inside a list.
+LISTBEG is the position of the start of the innermost list
+containing STARTPOS."
   (and listbeg                          ; We are inside a Lisp form.
        (save-excursion
          (goto-char startpos)
@@ -526,6 +532,9 @@ This will generate compile-time constants from BINDINGS."
                   (looking-at ":documentation\\_>"))))))
 
 (defun lisp-font-lock-syntactic-face-function (state)
+  "Return syntactic face function for the position represented by STATE.
+STATE is a `parse-partial-sexp' state, and the returned function is the
+Lisp font lock syntactic face function."
   (if (nth 3 state)
       ;; This might be a (doc)string or a |...| symbol.
       (let ((startpos (nth 8 state)))