/[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.186 by monnier, Wed Oct 5 15:03:09 2005 UTC revision 1.187 by monnier, Wed Oct 5 15:19:38 2005 UTC
# Line 59  Line 59 
59        (modify-syntax-entry ?\t "    " table)        (modify-syntax-entry ?\t "    " table)
60        (modify-syntax-entry ?\f "    " table)        (modify-syntax-entry ?\f "    " table)
61        (modify-syntax-entry ?\n ">   " table)        (modify-syntax-entry ?\n ">   " table)
62  ;;; This is probably obsolete since nowadays such features use overlays.        ;; This is probably obsolete since nowadays such features use overlays.
63  ;;;      ;; Give CR the same syntax as newline, for selective-display.        ;; ;; Give CR the same syntax as newline, for selective-display.
64  ;;;      (modify-syntax-entry ?\^m ">   " table)        ;; (modify-syntax-entry ?\^m ">   " table)
65        (modify-syntax-entry ?\; "<   " table)        (modify-syntax-entry ?\; "<   " table)
66        (modify-syntax-entry ?` "'   " table)        (modify-syntax-entry ?` "'   " table)
67        (modify-syntax-entry ?' "'   " table)        (modify-syntax-entry ?' "'   " table)
# Line 82  Line 82 
82    (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))    (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))
83      (modify-syntax-entry ?\[ "_   " table)      (modify-syntax-entry ?\[ "_   " table)
84      (modify-syntax-entry ?\] "_   " table)      (modify-syntax-entry ?\] "_   " table)
85      (modify-syntax-entry ?# "' 14bn" table)      (modify-syntax-entry ?# "' 14b" table)
86      (modify-syntax-entry ?| "\" 23b" table)      (modify-syntax-entry ?| "\" 23bn" table)
87      table))      table))
88    
89  (define-abbrev-table 'lisp-mode-abbrev-table ())  (define-abbrev-table 'lisp-mode-abbrev-table ())
# Line 154  Line 154 
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        ;; This might be a docstring.        ;; This might be a (doc)string or a |...| symbol.
158        (let* ((listbeg (nth 1 state))        (let ((startpos (nth 8 state)))
159               (firstsym (and listbeg          (if (eq (char-after startpos) ?|)
160                              (save-excursion              ;; This is not a string, but a |...| symbol.
161                                (goto-char listbeg)              nil
162                                (and (looking-at "([ \t\n]*\\(\\(\\sw\\|\\s_\\)+\\)")            (let* ((listbeg (nth 1 state))
163                                     (match-string 1)))))                   (firstsym (and listbeg
164               (docelt (and firstsym (get (intern-soft firstsym)                                  (save-excursion
165                                          lisp-doc-string-elt-property))))                                    (goto-char listbeg)
166          (if (and docelt                                    (and (looking-at "([ \t\n]*\\(\\(\\sw\\|\\s_\\)+\\)")
167                   ;; It's a string passed to a macro that has docstrings.                                         (match-string 1)))))
168                   ;; Check whether it's in docstring position.                   (docelt (and firstsym (get (intern-soft firstsym)
169                   (let ((startpos (nth 8 state)))                                              lisp-doc-string-elt-property))))
170                     (save-excursion              (if (and docelt
171                       (when (functionp docelt)                       ;; It's a string in a form that can have a docstring.
172                         (goto-char (match-end 1))                       ;; Check whether it's in docstring position.
173                         (setq docelt (funcall docelt)))                       (save-excursion
174                       (goto-char listbeg)                         (when (functionp docelt)
175                       (forward-char 1)                           (goto-char (match-end 1))
176                       (condition-case nil                           (setq docelt (funcall docelt)))
177                           (while (and (> docelt 0) (< (point) startpos)                         (goto-char listbeg)
178                                       (progn (forward-sexp 1) t))                         (forward-char 1)
179                             (setq docelt (1- docelt)))                         (condition-case nil
180                         (error nil))                             (while (and (> docelt 0) (< (point) startpos)
181                       (and (zerop docelt) (<= (point) startpos)                                         (progn (forward-sexp 1) t))
182                            (progn (forward-comment (point-max)) t)                               (setq docelt (1- docelt)))
183                            (= (point) (nth 8 state))))))                           (error nil))
184              font-lock-doc-face                         (and (zerop docelt) (<= (point) startpos)
185            font-lock-string-face))                              (progn (forward-comment (point-max)) t)
186                                (= (point) (nth 8 state)))))
187                    font-lock-doc-face
188                  font-lock-string-face))))
189      font-lock-comment-face))      font-lock-comment-face))
190    
191  ;; 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.186  
changed lines
  Added in v.1.187

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