Mercurial > emacs
comparison 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 |
comparison
equal
deleted
inserted
replaced
90236:7871ecd1281b | 90237:aa89c814f853 |
---|---|
57 (setq i (1+ i))) | 57 (setq i (1+ i))) |
58 (modify-syntax-entry ?\s " " table) | 58 (modify-syntax-entry ?\s " " table) |
59 (modify-syntax-entry ?\t " " table) | 59 (modify-syntax-entry ?\t " " table) |
60 (modify-syntax-entry ?\f " " table) | 60 (modify-syntax-entry ?\f " " table) |
61 (modify-syntax-entry ?\n "> " table) | 61 (modify-syntax-entry ?\n "> " table) |
62 ;;; This is probably obsolete since nowadays such features use overlays. | 62 ;; This is probably obsolete since nowadays such features use overlays. |
63 ;;; ;; Give CR the same syntax as newline, for selective-display. | 63 ;; ;; Give CR the same syntax as newline, for selective-display. |
64 ;;; (modify-syntax-entry ?\^m "> " table) | 64 ;; (modify-syntax-entry ?\^m "> " table) |
65 (modify-syntax-entry ?\; "< " table) | 65 (modify-syntax-entry ?\; "< " table) |
66 (modify-syntax-entry ?` "' " table) | 66 (modify-syntax-entry ?` "' " table) |
67 (modify-syntax-entry ?' "' " table) | 67 (modify-syntax-entry ?' "' " table) |
68 (modify-syntax-entry ?, "' " table) | 68 (modify-syntax-entry ?, "' " table) |
69 (modify-syntax-entry ?@ "' " table) | 69 (modify-syntax-entry ?@ "' " table) |
80 | 80 |
81 (defvar lisp-mode-syntax-table | 81 (defvar lisp-mode-syntax-table |
82 (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table))) | 82 (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table))) |
83 (modify-syntax-entry ?\[ "_ " table) | 83 (modify-syntax-entry ?\[ "_ " table) |
84 (modify-syntax-entry ?\] "_ " table) | 84 (modify-syntax-entry ?\] "_ " table) |
85 (modify-syntax-entry ?# "' 14bn" table) | 85 (modify-syntax-entry ?# "' 14b" table) |
86 (modify-syntax-entry ?| "\" 23b" table) | 86 (modify-syntax-entry ?| "\" 23bn" table) |
87 table)) | 87 table)) |
88 | 88 |
89 (define-abbrev-table 'lisp-mode-abbrev-table ()) | 89 (define-abbrev-table 'lisp-mode-abbrev-table ()) |
90 | 90 |
91 (defvar lisp-imenu-generic-expression | 91 (defvar lisp-imenu-generic-expression |
145 ;; define-global-mode has no explicit docstring. | 145 ;; define-global-mode has no explicit docstring. |
146 (put 'easy-mmode-define-global-mode 'doc-string-elt 0) | 146 (put 'easy-mmode-define-global-mode 'doc-string-elt 0) |
147 (put 'define-ibuffer-filter 'doc-string-elt 2) | 147 (put 'define-ibuffer-filter 'doc-string-elt 2) |
148 (put 'define-ibuffer-op 'doc-string-elt 3) | 148 (put 'define-ibuffer-op 'doc-string-elt 3) |
149 (put 'define-ibuffer-sorter 'doc-string-elt 2) | 149 (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.") | |
150 | 154 |
151 (defun lisp-font-lock-syntactic-face-function (state) | 155 (defun lisp-font-lock-syntactic-face-function (state) |
152 (if (nth 3 state) | 156 (if (nth 3 state) |
153 (if (and (eq (nth 0 state) 1) | 157 ;; This might be a (doc)string or a |...| symbol. |
154 ;; This might be a docstring. | 158 (let ((startpos (nth 8 state))) |
155 (save-excursion | 159 (if (eq (char-after startpos) ?|) |
156 (let ((n 0)) | 160 ;; This is not a string, but a |...| symbol. |
157 (goto-char (nth 8 state)) | 161 nil |
158 (condition-case nil | 162 (let* ((listbeg (nth 1 state)) |
159 (while (and (not (bobp)) | 163 (firstsym (and listbeg |
160 (progn (backward-sexp 1) (setq n (1+ n))))) | 164 (save-excursion |
161 (scan-error nil)) | 165 (goto-char listbeg) |
162 (when (> n 0) | 166 (and (looking-at "([ \t\n]*\\(\\(\\sw\\|\\s_\\)+\\)") |
163 (let ((sym (intern-soft | 167 (match-string 1))))) |
164 (buffer-substring | 168 (docelt (and firstsym (get (intern-soft firstsym) |
165 (point) (progn (forward-sexp 1) (point)))))) | 169 lisp-doc-string-elt-property)))) |
166 (eq n (or (get sym 'doc-string-elt) 3))))))) | 170 (if (and docelt |
167 font-lock-doc-face | 171 ;; It's a string in a form that can have a docstring. |
168 font-lock-string-face) | 172 ;; Check whether it's in docstring position. |
173 (save-excursion | |
174 (when (functionp docelt) | |
175 (goto-char (match-end 1)) | |
176 (setq docelt (funcall docelt))) | |
177 (goto-char listbeg) | |
178 (forward-char 1) | |
179 (condition-case nil | |
180 (while (and (> docelt 0) (< (point) startpos) | |
181 (progn (forward-sexp 1) t)) | |
182 (setq docelt (1- docelt))) | |
183 (error nil)) | |
184 (and (zerop docelt) (<= (point) startpos) | |
185 (progn (forward-comment (point-max)) t) | |
186 (= (point) (nth 8 state))))) | |
187 font-lock-doc-face | |
188 font-lock-string-face)))) | |
169 font-lock-comment-face)) | 189 font-lock-comment-face)) |
170 | 190 |
171 ;; The LISP-SYNTAX argument is used by code in inf-lisp.el and is | 191 ;; The LISP-SYNTAX argument is used by code in inf-lisp.el and is |
172 ;; (uselessly) passed from pp.el, chistory.el, gnus-kill.el and score-mode.el | 192 ;; (uselessly) passed from pp.el, chistory.el, gnus-kill.el and score-mode.el |
173 (defun lisp-mode-variables (&optional lisp-syntax) | 193 (defun lisp-mode-variables (&optional lisp-syntax) |