diff options
| author | Shakthi Kannan | 2015-12-30 19:59:12 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-12-30 19:59:12 +0200 |
| commit | 86312ffd93e54bc8993740479c9de3df69935185 (patch) | |
| tree | edae251bc62365419b63db2d6eaa1e6afe669e44 | |
| parent | c930e75bfae40c914ad5d5d1996db4af53a3f340 (diff) | |
| download | emacs-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/NEWS | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 9 |
2 files changed, 14 insertions, 0 deletions
| @@ -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. |
| 644 | This enhances Lisp mode fontification to handle documentation of the | ||
| 645 | form `(:documentation "the doc string")' used in Common Lisp code for | ||
| 646 | CLOS 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. | ||
| 492 | LISTBEG is the position of the start of the innermost list | ||
| 493 | containing 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. | ||
| 525 | LISTBEG is the position of the start of the innermost list | ||
| 526 | containing 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. | ||
| 536 | STATE is a `parse-partial-sexp' state, and the returned function is the | ||
| 537 | Lisp 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))) |