From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: emacs-devel@gnu.org
Subject: Re: Undocumented hyperlinks in doc strings.
Date: Thu, 9 Oct 2003 22:27:14 -0500 (CDT) [thread overview]
Message-ID: <200310100327.h9A3REl20310@raven.dms.auburn.edu> (raw)
In-Reply-To: <E1A7i8p-0004xc-UI@fencepost.gnu.org> (message from Richard Stallman on Thu, 09 Oct 2003 17:16:11 -0400)
Richard Stallman wrote:
Perhaps it would be a good idea not to make a hyperlink to a face
name unless the word "face" precedes or follows the face name.
Would you like to implement that change?
What about the diff below? It also changes `help-xref-symbol-regexp',
because that variable is used with emacs-lisp-mode-syntax-table,
meaning that newlines do not count as whitespace. As a consequence,
preceding a variable, function or face by `symbol', `variable' and the
like has no effect if the word is separated from the symbol by a
newline. This means that a simple M-q can easily enable or disable
several hyperlinks. This does not seem good. The change in
`help-xref-symbol-regexp' treats newlines as any other whitespace.
The exact specs for face hyperlinks would be:
preceded by "face" or followed by whitespace (including newline),
"face" and then a non word constituent character.
The diff below also makes the comments in `help-make-xrefs' more in
line with (elisp)Comment Tips. Most of this was done for me by C-M-q,
but I made the double semicolons in the commented out code into
triple semicolons myself, because that is how (elisp)Comment Tips
wants code commented out.
If you agree with the diff below, I could commit it and adjust the
documentation in several places of the Elisp manual, documentation
strings and the NEWS accordingly.
===File ~/help-mode-diff====================================
cd ~/emacscvsdir/emacs/lisp/
diff -c /home/teirllm/help-mode.old.el /home/teirllm/emacscvsdir/emacs/lisp/help-mode.el
*** /home/teirllm/help-mode.old.el Tue Sep 2 07:33:28 2003
--- /home/teirllm/emacscvsdir/emacs/lisp/help-mode.el Thu Oct 9 21:17:17 2003
***************
*** 213,219 ****
"\\(function\\|command\\)\\|"
"\\(face\\)\\|"
"\\(symbol\\)\\|"
! "\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)\\s-+\\)?"
;; Note starting with word-syntax character:
"`\\(\\sw\\(\\sw\\|\\s_\\)+\\)'"))
"Regexp matching doc string references to symbols.
--- 213,220 ----
"\\(function\\|command\\)\\|"
"\\(face\\)\\|"
"\\(symbol\\)\\|"
! "\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)"
! "[ \t\n]+\\)?"
;; Note starting with word-syntax character:
"`\\(\\sw\\(\\sw\\|\\s_\\)+\\)'"))
"Regexp matching doc string references to symbols.
***************
*** 342,352 ****
(sym (intern-soft data)))
(if sym
(cond
! ((match-string 3) ; `variable' &c
(and (boundp sym) ; `variable' doesn't ensure
; it's actually bound
(help-xref-button 8 'help-variable sym)))
! ((match-string 4) ; `function' &c
(and (fboundp sym) ; similarly
(help-xref-button 8 'help-function sym)))
((match-string 5) ; `face'
--- 343,353 ----
(sym (intern-soft data)))
(if sym
(cond
! ((match-string 3) ; `variable' &c
(and (boundp sym) ; `variable' doesn't ensure
; it's actually bound
(help-xref-button 8 'help-variable sym)))
! ((match-string 4) ; `function' &c
(and (fboundp sym) ; similarly
(help-xref-button 8 'help-function sym)))
((match-string 5) ; `face'
***************
*** 354,365 ****
(help-xref-button 8 'help-face sym)))
((match-string 6)) ; nothing for `symbol'
((match-string 7)
! ;; this used:
! ;; #'(lambda (arg)
! ;; (let ((location
! ;; (find-function-noselect arg)))
! ;; (pop-to-buffer (car location))
! ;; (goto-char (cdr location))))
(help-xref-button 8 'help-function-def sym))
((and (boundp sym) (fboundp sym))
;; We can't intuit whether to use the
--- 355,366 ----
(help-xref-button 8 'help-face sym)))
((match-string 6)) ; nothing for `symbol'
((match-string 7)
! ;;; this used:
! ;;; #'(lambda (arg)
! ;;; (let ((location
! ;;; (find-function-noselect arg)))
! ;;; (pop-to-buffer (car location))
! ;;; (goto-char (cdr location))))
(help-xref-button 8 'help-function-def sym))
((and (boundp sym) (fboundp sym))
;; We can't intuit whether to use the
***************
*** 370,376 ****
((fboundp sym)
(help-xref-button 8 'help-function sym))
((facep sym)
! (help-xref-button 8 'help-face sym)))))))
;; An obvious case of a key substitution:
(save-excursion
(while (re-search-forward
--- 371,378 ----
((fboundp sym)
(help-xref-button 8 'help-function sym))
((facep sym)
! (if (save-match-data (looking-at "[ \t\n]*face\\W"))
! (help-xref-button 8 'help-face sym))))))))
;; An obvious case of a key substitution:
(save-excursion
(while (re-search-forward
Diff finished at Thu Oct 9 21:26:20
============================================================
next prev parent reply other threads:[~2003-10-10 3:27 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-09 0:50 Undocumented hyperlinks in doc strings Luc Teirlinck
2003-10-09 21:16 ` Richard Stallman
2003-10-10 3:27 ` Luc Teirlinck [this message]
2003-10-10 14:14 ` Stefan Monnier
2003-10-10 15:31 ` Luc Teirlinck
2003-10-10 16:29 ` Luc Teirlinck
2003-10-10 17:23 ` Stefan Monnier
2003-10-10 18:21 ` Luc Teirlinck
2003-10-10 19:24 ` Stefan Monnier
2003-10-11 17:12 ` Richard Stallman
2003-10-14 21:03 ` Stefan Monnier
2003-10-15 1:38 ` Luc Teirlinck
2003-10-15 20:00 ` Richard Stallman
2003-10-15 23:52 ` Luc Teirlinck
2003-10-16 23:06 ` Richard Stallman
2003-10-16 14:06 ` Richard Stallman
2003-10-17 3:32 ` Luc Teirlinck
2003-10-17 13:47 ` Stefan Monnier
2003-10-18 23:06 ` Richard Stallman
2003-10-19 1:14 ` Luc Teirlinck
2003-10-20 1:48 ` Richard Stallman
2003-10-20 2:24 ` Luc Teirlinck
2003-10-20 14:44 ` Stefan Monnier
2003-10-20 15:22 ` Luc Teirlinck
2003-10-21 14:47 ` Richard Stallman
2003-10-11 5:36 ` Richard Stallman
2003-10-12 3:34 ` Luc Teirlinck
2003-10-13 5:03 ` Richard Stallman
2003-10-14 3:23 ` Luc Teirlinck
2003-10-17 20:46 ` Richard Stallman
2003-10-17 23:30 ` Luc Teirlinck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200310100327.h9A3REl20310@raven.dms.auburn.edu \
--to=teirllm@dms.auburn.edu \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).