Mercurial > emacs
changeset 28841:354a826d7b20
(describe-variable): Have customize button pop the
help-xref stack when invoked.
(help-xref-symbol-regexp): Add `face'.
(help-make-xrefs): Check for quoted face names and adapt regexp
submatch numbers to cope.
(help-xref-interned): Maybe insert face doc too. Separate
sections with a line of hyphens.
author | Dave Love <fx@gnu.org> |
---|---|
date | Tue, 09 May 2000 15:50:39 +0000 |
parents | d0531e35d9f2 |
children | 979956ac9352 |
files | lisp/help.el |
diffstat | 1 files changed, 31 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/help.el Tue May 09 15:45:57 2000 +0000 +++ b/lisp/help.el Tue May 09 15:50:39 2000 +0000 @@ -858,11 +858,12 @@ (save-excursion (re-search-backward (concat "\\(" customize-label "\\)") nil t) - (help-xref-button 1 #'(lambda (v) - (customize-variable v)) + (help-xref-button 1 (lambda (v) + (if help-xref-stack + (pop help-xref-stack)) + (customize-variable v)) variable - "mouse-2, RET: customize variable") - )))) + "mouse-2, RET: customize variable"))))) ;; Make a hyperlink to the library if appropriate. (Don't ;; change the format of the buffer's initial line in case ;; anything expects the current format.) @@ -1014,6 +1015,7 @@ (defconst help-xref-symbol-regexp (purecopy (concat "\\(\\<\\(\\(variable\\|option\\)\\|" "\\(function\\|command\\)\\|" + "\\(face\\)\\|" "\\(symbol\\)\\)\\s-+\\)?" ;; Note starting with word-syntax character: "`\\(\\sw\\(\\sw\\|\\s_\\)+\\)'")) @@ -1077,7 +1079,7 @@ ;; Quoted symbols (save-excursion (while (re-search-forward help-xref-symbol-regexp nil t) - (let* ((data (match-string 6)) + (let* ((data (match-string 7)) (sym (intern-soft data))) (if sym (cond @@ -1085,28 +1087,35 @@ (and (boundp sym) ; `variable' doesn't ensure ; it's actually bound (help-xref-button - 6 #'describe-variable sym + 7 #'describe-variable sym "mouse-2, RET: describe this variable"))) ((match-string 4) ; `function' &c (and (fboundp sym) ; similarly (help-xref-button - 6 #'describe-function sym + 7 #'describe-function sym "mouse-2, RET: describe this function"))) - ((match-string 5)) ; nothing for symbol + ((match-string 5) ; `face' + (and (facep sym) + (help-xref-button 7 #'describe-face sym + "mouse-2, RET: describe this face"))) + ((match-string 6)) ; nothing for symbol ((and (boundp sym) (fboundp sym)) ;; We can't intuit whether to use the ;; variable or function doc -- supply both. (help-xref-button - 6 #'help-xref-interned sym + 7 #'help-xref-interned sym "mouse-2, RET: describe this symbol")) ((boundp sym) (help-xref-button - 6 #'describe-variable sym + 7 #'describe-variable sym "mouse-2, RET: describe this variable")) ((fboundp sym) (help-xref-button - 6 #'describe-function sym - "mouse-2, RET: describe this function"))))))) + 7 #'describe-function sym + "mouse-2, RET: describe this function")) + ((facep sym) + (help-xref-button + 7 #'describe-face sym))))))) ;; An obvious case of a key substitution: (save-excursion (while (re-search-forward @@ -1194,16 +1203,23 @@ Both variable and function documentation are extracted into a single help buffer." - (let ((fdoc (when (fboundp symbol) (describe-function symbol)))) + (let ((fdoc (when (fboundp symbol) (describe-function symbol))) + (facedoc (when (facep symbol) (describe-face symbol)))) (when (or (boundp symbol) (not fdoc)) (describe-variable symbol) ;; We now have a help buffer on the variable. Insert the function ;; text before it. - (when fdoc + (when (or fdoc facedoc) (with-current-buffer "*Help*" (goto-char (point-min)) (let ((inhibit-read-only t)) - (insert fdoc "\n\n" (symbol-name symbol) " is also a variable.\n\n")) + (when fdoc + (insert fdoc "\n\n")) + (when facedoc + (insert (make-string 30 ?-) "\n\n" (symbol-name symbol) + " is also a " "face." "\n\n" facedoc "\n\n")) + (insert (make-string 30 ?-) "\n\n" (symbol-name symbol) + " is also a " "variable." "\n\n")) (help-setup-xref (list #'help-xref-interned symbol) nil)))))) (defun help-xref-mode (buffer)