* info.el dots in node names
@ 2003-06-04 23:42 Kevin Ryde
2003-06-05 21:46 ` Richard Stallman
0 siblings, 1 reply; 8+ messages in thread
From: Kevin Ryde @ 2003-06-04 23:42 UTC (permalink / raw)
Cc: Karl Berry
[-- Attachment #1: Type: text/plain, Size: 724 bytes --]
[This started on the autoconf-patches list about dots in node names in
the autoconf manual, eg. "config.status".]
* info.el (Info-following-node-name): Accept "." followed by allowed
non-whitespace non-")" chars, so filenames like foo.h can be in node
names.
The standalone info reader uses a similar rule (skip_node_characters
in info/search.c), though currently it includes the "." in "node.,",
which I'm not sure it should, in case someone puts a comma after an
@pxref (foo.texi below).
foo.texi below is a little sample I was testing with. Notice with
this change that the cross references in the "something.txt" node
work, as does the index entry. The top-level menu entry already
worked.
[-- Attachment #2: info.el.node-name-dots.diff --]
[-- Type: text/plain, Size: 2090 bytes --]
*** info.el.~1.350.~ Thu Jun 5 02:58:08 2003
--- info.el Thu Jun 5 08:33:52 2003
*************** (defun Info-extract-pointer (name &optio
*** 1403,1415 ****
(defun Info-following-node-name (&optional allowedchars)
"Return the node name in the buffer following point.
ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
! saying which chars may appear in the node name."
(skip-chars-forward " \t")
(buffer-substring-no-properties
(point)
(progn
(while (looking-at (concat "[" (or allowedchars "^,\t\n") "]"))
(skip-chars-forward (concat (or allowedchars "^,\t\n") "("))
(if (looking-at "(")
(skip-chars-forward "^)")))
(skip-chars-backward " ")
--- 1403,1433 ----
(defun Info-following-node-name (&optional allowedchars)
"Return the node name in the buffer following point.
ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
! saying which chars may appear in the node name.
!
! If \".\" is not among the allowed chars, it will still be accepted if it (or
! a sequence of dots) is followed by a non-whitespace, non-\")\", allowed
! char. A cross reference normally ends at a \".\", but this rule lets
! filenames like foo.h appear in the node name. Note that it still correctly
! stops at the \".\" for things like the following which can arise from
! @pxref.
!
! *note something: node name., etc
! (go to *note something: node name.) etc
! "
!
! ;; For reference, the standalone info reader applies a similar rule for
! ;; ".", see texinfo info/search.c skip_node_characters().
!
(skip-chars-forward " \t")
(buffer-substring-no-properties
(point)
(progn
(while (looking-at (concat "[" (or allowedchars "^,\t\n") "]"))
(skip-chars-forward (concat (or allowedchars "^,\t\n") "("))
+ (if (and (looking-at "\\.+[^) \t\n]")
+ (looking-at (concat "\\.+[" (or allowedchars "^,\t\n") "]")))
+ (goto-char (match-end 0)))
(if (looking-at "(")
(skip-chars-forward "^)")))
(skip-chars-backward " ")
[-- Attachment #3: foo.texi --]
[-- Type: application/x-texinfo, Size: 458 bytes --]
[-- Attachment #4: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: info.el dots in node names
2003-06-04 23:42 info.el dots in node names Kevin Ryde
@ 2003-06-05 21:46 ` Richard Stallman
2003-06-06 12:22 ` Andreas Schwab
2003-06-06 22:16 ` Kevin Ryde
0 siblings, 2 replies; 8+ messages in thread
From: Richard Stallman @ 2003-06-05 21:46 UTC (permalink / raw)
Cc: emacs-devel
Would this fail for `(@xref{foo}.)'? I don't have time to study the
surrounding code to understand your change, but your descripion
suggests that case might fail.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: info.el dots in node names
2003-06-05 21:46 ` Richard Stallman
@ 2003-06-06 12:22 ` Andreas Schwab
2003-06-08 1:07 ` Richard Stallman
2003-06-06 22:16 ` Kevin Ryde
1 sibling, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2003-06-06 12:22 UTC (permalink / raw)
Cc: emacs-devel
Richard Stallman <rms@gnu.org> writes:
|> Would this fail for `(@xref{foo}.)'?
IMHO that is broken to begin with. It should be written `(@pxref{foo})'
instead.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: info.el dots in node names
2003-06-05 21:46 ` Richard Stallman
2003-06-06 12:22 ` Andreas Schwab
@ 2003-06-06 22:16 ` Kevin Ryde
2003-06-06 23:41 ` Kevin Ryde
1 sibling, 1 reply; 8+ messages in thread
From: Kevin Ryde @ 2003-06-06 22:16 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 601 bytes --]
Richard Stallman <rms@gnu.org> writes:
>
> Would this fail for `(@xref{foo}.)'?
Actually, when there's only a node name like that, giving
(*Note foo::.)
it already worked, due to the "::" like a menu entry.
But if you're wondering about something like
(*Note a fooish thing: foo.)
then yes, I allowed for that, "." followed by ")" is the end of the
node name.
What I did botch in my regexp though was multiple dots, like
*note something: node name..
Clearly this wouldn't be written deliberately, but it's all too easy
to forget @pxref inserts a dot, and add an extra. New effort below.
[-- Attachment #2: info.el.node-name-dots-2.diff --]
[-- Type: text/plain, Size: 2243 bytes --]
*** info.el.~1.355.~ Sat Jun 7 08:08:15 2003
--- info.el Sat Jun 7 08:11:51 2003
*************** (defun Info-extract-pointer (name &optio
*** 1403,1414 ****
(defun Info-following-node-name (&optional allowedchars)
"Return the node name in the buffer following point.
ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
! saying which chars may appear in the node name."
(skip-chars-forward " \t")
(buffer-substring-no-properties
(point)
(progn
(while (looking-at (concat "[" (or allowedchars "^,\t\n") "]"))
(skip-chars-forward (concat (or allowedchars "^,\t\n") "("))
(if (looking-at "(")
(skip-chars-forward "^)")))
--- 1403,1434 ----
(defun Info-following-node-name (&optional allowedchars)
"Return the node name in the buffer following point.
ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
! saying which chars may appear in the node name.
!
! If \".\" is not among the allowed chars, it will still be accepted if it (or
! a sequence of dots) is followed by a non-whitespace, non-\")\", allowed
! char. A node name in a cross reference normally ends at a \".\", but this
! rule lets filenames like foo.h appear there."
!
! ;; For reference, the standalone info reader applies a similar rule for
! ;; ".", see texinfo info/search.c skip_node_characters().
! ;;
! ;; "(*note something: node name.)" is a reasonably typical cross
! ;; reference, and is the reason we disallow ")" after ".".
! ;;
! ;; "*note something: node name.," or "*note something: node name.." can
! ;; arise from "@pxref{node name}," or "@pxref{node name}." and although
! ;; the latter is no doubt erroneous since pxref inserts its own ".", it
! ;; still seems worth handling correctly.
!
(skip-chars-forward " \t")
(buffer-substring-no-properties
(point)
(progn
(while (looking-at (concat "[" (or allowedchars "^,\t\n") "]"))
+ (if (and (looking-at "\\.+\\([^.) ,\t\n]\\)")
+ (string-match (concat "^[" (or allowedchars "^,\t\n") "]")))
+ (skip-chars-forward "."))
(skip-chars-forward (concat (or allowedchars "^,\t\n") "("))
(if (looking-at "(")
(skip-chars-forward "^)")))
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: info.el dots in node names
2003-06-06 22:16 ` Kevin Ryde
@ 2003-06-06 23:41 ` Kevin Ryde
2003-06-06 23:58 ` Kevin Ryde
0 siblings, 1 reply; 8+ messages in thread
From: Kevin Ryde @ 2003-06-06 23:41 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 453 bytes --]
I wrote:
>
> New effort below.
Sorry, yet another botchup, third time lucky below. Perhaps someone
smarter than me can give it a glance. I think the concept is sound,
but I thought I could be clever and just add a couple of lines to make
it happen.
Maybe more radical surgery would be clearer, like look for "(" pairing
with ")" only at the start, since it's always "(filename)nodename".
After that it'd be only allowedchars and the "." exception.
[-- Attachment #2: info.el.node-name-dots-3.diff --]
[-- Type: text/plain, Size: 2341 bytes --]
*** info.el.~1.355.~ Sat Jun 7 08:08:15 2003
--- info.el Sat Jun 7 09:30:47 2003
*************** (defun Info-extract-pointer (name &optio
*** 1403,1414 ****
(defun Info-following-node-name (&optional allowedchars)
"Return the node name in the buffer following point.
ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
! saying which chars may appear in the node name."
(skip-chars-forward " \t")
(buffer-substring-no-properties
(point)
(progn
! (while (looking-at (concat "[" (or allowedchars "^,\t\n") "]"))
(skip-chars-forward (concat (or allowedchars "^,\t\n") "("))
(if (looking-at "(")
(skip-chars-forward "^)")))
--- 1403,1436 ----
(defun Info-following-node-name (&optional allowedchars)
"Return the node name in the buffer following point.
ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
! saying which chars may appear in the node name.
!
! If \".\" is not among the allowed chars, it will still be accepted if it (or
! a sequence of dots) is followed by a non-whitespace, non-\")\", allowed
! char. A node name in a cross reference normally ends at a \".\", but this
! rule lets filenames like foo.h appear there."
!
! ;; For reference, the standalone info reader applies a similar rule for
! ;; ".", see texinfo info/search.c skip_node_characters().
! ;;
! ;; "(*note something: node name.)" is a reasonably typical cross
! ;; reference, and is the reason we disallow ")" after ".".
! ;;
! ;; "*note something: node name.," or "*note something: node name.." can
! ;; arise from "@pxref{node name}," or "@pxref{node name}." and although
! ;; the latter is no doubt erroneous since pxref inserts its own ".", it
! ;; still seems worth handling correctly.
!
(skip-chars-forward " \t")
(buffer-substring-no-properties
(point)
(progn
! (while (progn
! (and (looking-at "\\.+\\([^.) ,\t\n]\\)")
! (string-match (concat "^[" (or allowedchars "^,\t\n") "]")
! (match-string 1))
! (skip-chars-forward "."))
! (looking-at (concat "[" (or allowedchars "^,\t\n") "]")))
(skip-chars-forward (concat (or allowedchars "^,\t\n") "("))
(if (looking-at "(")
(skip-chars-forward "^)")))
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: info.el dots in node names
2003-06-06 23:41 ` Kevin Ryde
@ 2003-06-06 23:58 ` Kevin Ryde
[not found] ` <200306070029.h570TdJL008307@rum.cs.yale.edu>
0 siblings, 1 reply; 8+ messages in thread
From: Kevin Ryde @ 2003-06-06 23:58 UTC (permalink / raw)
In case anyone wonders, Info-index ("i") doesn't like entries with
node names with dots in them. But that's not down to me :-), it was
so before, I guess due to the "pattern" regexp in that function
stopping at the first dot.
If I reach an actual working Info-following-node-name then perhaps
Info-index can be next. Unless anyone beats me to it.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: info.el dots in node names
[not found] ` <200306070029.h570TdJL008307@rum.cs.yale.edu>
@ 2003-06-07 0:50 ` Kevin Ryde
0 siblings, 0 replies; 8+ messages in thread
From: Kevin Ryde @ 2003-06-07 0:50 UTC (permalink / raw)
"Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu> writes:
>
> BTW, it would be best if you could end up with just a regexp, so
> that it can also be used to build the completion tables and
> stuff (which require the matching to be fast, i.e. no elisp).
I started in that direction, then realized Info-following-node-name
was where it all happened.
The only thing with a regexp would be that in theory there's three
cases,
- default allowedchars in Info-following-node-name
- Info-extract-menu-node-name disallowing "."
- Info-extract-menu-node-name disallowing "." and allowing "\n",
under the multi-line option
It might be nice if a node name could be parsed out context-free, but
I'm not sure if it's possible.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: info.el dots in node names
2003-06-06 12:22 ` Andreas Schwab
@ 2003-06-08 1:07 ` Richard Stallman
0 siblings, 0 replies; 8+ messages in thread
From: Richard Stallman @ 2003-06-08 1:07 UTC (permalink / raw)
Cc: emacs-devel
|> Would this fail for `(@xref{foo}.)'?
IMHO that is broken to begin with. It should be written `(@pxref{foo})'
instead.
Both are correct in different circumstances. The former is an entire
sentence in parentheses. The latter the way to write a parenthetical
remark inside a sentence.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2003-06-08 1:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-04 23:42 info.el dots in node names Kevin Ryde
2003-06-05 21:46 ` Richard Stallman
2003-06-06 12:22 ` Andreas Schwab
2003-06-08 1:07 ` Richard Stallman
2003-06-06 22:16 ` Kevin Ryde
2003-06-06 23:41 ` Kevin Ryde
2003-06-06 23:58 ` Kevin Ryde
[not found] ` <200306070029.h570TdJL008307@rum.cs.yale.edu>
2003-06-07 0:50 ` Kevin Ryde
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).