Mercurial > emacs
diff lisp/emacs-lisp/lisp-mode.el @ 90237:aa89c814f853
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-88
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 569-579)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 129-132)
- Update from CVS
- Merge from emacs--cvs-trunk--0
author | Miles Bader <miles@gnu.org> |
---|---|
date | Fri, 07 Oct 2005 07:15:40 +0000 |
parents | a3716f7538f2 4b5af439906f |
children | 7beb78bc1f8e |
line wrap: on
line diff
--- a/lisp/emacs-lisp/lisp-mode.el Thu Oct 06 02:00:50 2005 +0000 +++ b/lisp/emacs-lisp/lisp-mode.el Fri Oct 07 07:15:40 2005 +0000 @@ -59,9 +59,9 @@ (modify-syntax-entry ?\t " " table) (modify-syntax-entry ?\f " " table) (modify-syntax-entry ?\n "> " table) -;;; This is probably obsolete since nowadays such features use overlays. -;;; ;; Give CR the same syntax as newline, for selective-display. -;;; (modify-syntax-entry ?\^m "> " table) + ;; This is probably obsolete since nowadays such features use overlays. + ;; ;; Give CR the same syntax as newline, for selective-display. + ;; (modify-syntax-entry ?\^m "> " table) (modify-syntax-entry ?\; "< " table) (modify-syntax-entry ?` "' " table) (modify-syntax-entry ?' "' " table) @@ -82,8 +82,8 @@ (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table))) (modify-syntax-entry ?\[ "_ " table) (modify-syntax-entry ?\] "_ " table) - (modify-syntax-entry ?# "' 14bn" table) - (modify-syntax-entry ?| "\" 23b" table) + (modify-syntax-entry ?# "' 14b" table) + (modify-syntax-entry ?| "\" 23bn" table) table)) (define-abbrev-table 'lisp-mode-abbrev-table ()) @@ -147,25 +147,45 @@ (put 'define-ibuffer-filter 'doc-string-elt 2) (put 'define-ibuffer-op 'doc-string-elt 3) (put 'define-ibuffer-sorter 'doc-string-elt 2) +(put 'lambda 'doc-string-elt 2) + +(defvar lisp-doc-string-elt-property 'doc-string-elt + "The symbol property that holds the docstring position info.") (defun lisp-font-lock-syntactic-face-function (state) (if (nth 3 state) - (if (and (eq (nth 0 state) 1) - ;; This might be a docstring. - (save-excursion - (let ((n 0)) - (goto-char (nth 8 state)) - (condition-case nil - (while (and (not (bobp)) - (progn (backward-sexp 1) (setq n (1+ n))))) - (scan-error nil)) - (when (> n 0) - (let ((sym (intern-soft - (buffer-substring - (point) (progn (forward-sexp 1) (point)))))) - (eq n (or (get sym 'doc-string-elt) 3))))))) - font-lock-doc-face - font-lock-string-face) + ;; 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 + (save-excursion + (goto-char listbeg) + (and (looking-at "([ \t\n]*\\(\\(\\sw\\|\\s_\\)+\\)") + (match-string 1))))) + (docelt (and firstsym (get (intern-soft firstsym) + lisp-doc-string-elt-property)))) + (if (and docelt + ;; It's a string in a form that can have a docstring. + ;; Check whether it's in docstring position. + (save-excursion + (when (functionp docelt) + (goto-char (match-end 1)) + (setq docelt (funcall docelt))) + (goto-char listbeg) + (forward-char 1) + (condition-case nil + (while (and (> docelt 0) (< (point) startpos) + (progn (forward-sexp 1) t)) + (setq docelt (1- docelt))) + (error nil)) + (and (zerop docelt) (<= (point) startpos) + (progn (forward-comment (point-max)) t) + (= (point) (nth 8 state))))) + font-lock-doc-face + font-lock-string-face)))) font-lock-comment-face)) ;; The LISP-SYNTAX argument is used by code in inf-lisp.el and is