/[emacs]/emacs/lisp/emacs-lisp/lisp-mode.el
ViewVC logotype

Diff of /emacs/lisp/emacs-lisp/lisp-mode.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.185 by monnier, Wed Oct 5 14:07:18 2005 UTC revision 1.186 by monnier, Wed Oct 5 15:03:09 2005 UTC
# Line 147  Line 147 
147  (put 'define-ibuffer-filter 'doc-string-elt 2)  (put 'define-ibuffer-filter 'doc-string-elt 2)
148  (put 'define-ibuffer-op 'doc-string-elt 3)  (put 'define-ibuffer-op 'doc-string-elt 3)
149  (put 'define-ibuffer-sorter 'doc-string-elt 2)  (put 'define-ibuffer-sorter 'doc-string-elt 2)
150    (put 'lambda 'doc-string-elt 2)
151    
152    (defvar lisp-doc-string-elt-property 'doc-string-elt
153      "The symbol property that holds the docstring position info.")
154    
155  (defun lisp-font-lock-syntactic-face-function (state)  (defun lisp-font-lock-syntactic-face-function (state)
156    (if (nth 3 state)    (if (nth 3 state)
157        (if (and (eq (nth 0 state) 1)        ;; This might be a docstring.
158                 ;; This might be a docstring.        (let* ((listbeg (nth 1 state))
159                 (save-excursion               (firstsym (and listbeg
160                   (let ((n 0))                              (save-excursion
161                     (goto-char (nth 8 state))                                (goto-char listbeg)
162                     (condition-case nil                                (and (looking-at "([ \t\n]*\\(\\(\\sw\\|\\s_\\)+\\)")
163                         (while (and (not (bobp))                                     (match-string 1)))))
164                                     (progn (backward-sexp 1) (setq n (1+ n)))))               (docelt (and firstsym (get (intern-soft firstsym)
165                       (scan-error nil))                                          lisp-doc-string-elt-property))))
166                     (when (> n 0)          (if (and docelt
167                       (let ((sym (intern-soft                   ;; It's a string passed to a macro that has docstrings.
168                                   (buffer-substring                   ;; Check whether it's in docstring position.
169                                    (point) (progn (forward-sexp 1) (point))))))                   (let ((startpos (nth 8 state)))
170                         (eq n (get sym 'doc-string-elt)))))))                     (save-excursion
171            font-lock-doc-face                       (when (functionp docelt)
172          font-lock-string-face)                         (goto-char (match-end 1))
173                           (setq docelt (funcall docelt)))
174                         (goto-char listbeg)
175                         (forward-char 1)
176                         (condition-case nil
177                             (while (and (> docelt 0) (< (point) startpos)
178                                         (progn (forward-sexp 1) t))
179                               (setq docelt (1- docelt)))
180                           (error nil))
181                         (and (zerop docelt) (<= (point) startpos)
182                              (progn (forward-comment (point-max)) t)
183                              (= (point) (nth 8 state))))))
184                font-lock-doc-face
185              font-lock-string-face))
186      font-lock-comment-face))      font-lock-comment-face))
187    
188  ;; The LISP-SYNTAX argument is used by code in inf-lisp.el and is  ;; The LISP-SYNTAX argument is used by code in inf-lisp.el and is

Legend:
Removed from v.1.185  
changed lines
  Added in v.1.186

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26