comparison lisp/emacs-lisp/lisp-mode.el @ 83383:2a679c81f552

Merged from miles@gnu.org--gnu-2005 (patch 118-132, 551-577) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-551 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-552 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-553 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-554 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-555 Remove CVS keywords from newsticker files * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-556 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-557 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-558 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-559 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-560 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-561 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-562 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-563 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-564 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-565 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-566 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-567 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-568 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-569 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-570 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-571 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-572 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-573 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-574 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-575 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-576 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-577 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-118 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-119 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-120 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-121 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-122 Update from CVS: lisp/mm-url.el (mm-url-decode-entities): Fix regexp. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-123 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-124 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-125 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-126 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-127 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-128 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-129 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-130 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-131 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-132 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-423
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 09 Oct 2005 20:00:17 +0000
parents 4b5af439906f
children 48fff88992ce aa89c814f853
comparison
equal deleted inserted replaced
83382:7a3090aca393 83383:2a679c81f552
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)