unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Disappointed by texinfo @anchor construct
@ 2014-11-17  3:11 Alan
  2014-11-17 16:40 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Alan @ 2014-11-17  3:11 UTC (permalink / raw)
  To: help-gnu-emacs

The texinfo construct "@anchor" is used extensively in the texi files that go into making the info file "perldoc-all.info".

(See http://www.gnu.org/software/perl/manual/)

The documentation for @anchor in the texinfo Info file led me to believe that a cross reference to an anchor name would jump to that location in the info file.  I find this not to be the case.  The jump seems to be to the node location where the @anchor statement is found.  This is different from inserting a @cindex index entry name next to the @anchor statment; in that case the defined index name goes directly to the location of the @cindex.

The observed behavior for @anchor makes it much less useful that I had anticipated.

As an example in "perldoc-all.info", do '(Info-goto-node "perlfunc package NAMESPACE")'.  You will end up at the top of the alphabetical list of the perl functions--instead at the location of the anchor for "package NAMESPACE" (see the file perlfunc.texi).


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Disappointed by texinfo @anchor construct
  2014-11-17  3:11 Disappointed by texinfo @anchor construct Alan
@ 2014-11-17 16:40 ` Eli Zaretskii
       [not found] ` <mailman.13899.1416242463.1147.help-gnu-emacs@gnu.org>
  2014-11-21 11:39 ` Alan
  2 siblings, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2014-11-17 16:40 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sun, 16 Nov 2014 19:11:12 -0800 (PST)
> From: Alan <wehmann@fnal.gov>
> Injection-Date: Mon, 17 Nov 2014 03:11:12 +0000
> 
> The documentation for @anchor in the texinfo Info file led me to believe that a cross reference to an anchor name would jump to that location in the info file.  I find this not to be the case.  The jump seems to be to the node location where the @anchor statement is found.

Which Emacs version do you use?  This works for me as you expected in
Emacs 24.4.  I tried this in a manual other than perldoc, but I don't
think there should be a difference.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Disappointed by texinfo @anchor construct
       [not found] ` <mailman.13899.1416242463.1147.help-gnu-emacs@gnu.org>
@ 2014-11-18 22:23   ` Alan
  2014-11-19  3:49     ` Eli Zaretskii
       [not found]     ` <mailman.13992.1416368997.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Alan @ 2014-11-18 22:23 UTC (permalink / raw)
  To: help-gnu-emacs

On Monday, November 17, 2014 10:41:06 AM UTC-6, Eli Zaretskii wrote:
> > Date: Sun, 16 Nov 2014 19:11:12 -0800 (PST)
> > From: Alan <wehmann_at_fnal.gov>
> > Injection-Date: Mon, 17 Nov 2014 03:11:12 +0000
> > 
> > The documentation for @anchor in the texinfo Info file led me to believe that a cross reference to an anchor name would jump to that location in the info file.  I find this not to be the case.  The jump seems to be to the node location where the @anchor statement is found.
> 
> Which Emacs version do you use?  This works for me as you expected in
> Emacs 24.4.  I tried this in a manual other than perldoc, but I don't
> think there should be a difference.

I am using

GNU Emacs 24.3.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2013-03-12 on bob.porkrind.org

I guess that means that I should investigate upgrading to 24.4 (to get the expected behavior of @anchor).


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Disappointed by texinfo @anchor construct
  2014-11-18 22:23   ` Alan
@ 2014-11-19  3:49     ` Eli Zaretskii
       [not found]     ` <mailman.13992.1416368997.1147.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2014-11-19  3:49 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 18 Nov 2014 14:23:02 -0800 (PST)
> From: Alan <wehmann@fnal.gov>
> 
> On Monday, November 17, 2014 10:41:06 AM UTC-6, Eli Zaretskii wrote:
> > > Date: Sun, 16 Nov 2014 19:11:12 -0800 (PST)
> > > From: Alan <wehmann_at_fnal.gov>
> > > Injection-Date: Mon, 17 Nov 2014 03:11:12 +0000
> > > 
> > > The documentation for @anchor in the texinfo Info file led me to believe that a cross reference to an anchor name would jump to that location in the info file.  I find this not to be the case.  The jump seems to be to the node location where the @anchor statement is found.
> > 
> > Which Emacs version do you use?  This works for me as you expected in
> > Emacs 24.4.  I tried this in a manual other than perldoc, but I don't
> > think there should be a difference.
> 
> I am using
> 
> GNU Emacs 24.3.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2013-03-12 on bob.porkrind.org
> 
> I guess that means that I should investigate upgrading to 24.4 (to get the expected behavior of @anchor).

I'm not sure anything has changed in this area since 24.3.

Can you try with one of the manuals distributed with Emacs?



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Disappointed by texinfo @anchor construct
       [not found]     ` <mailman.13992.1416368997.1147.help-gnu-emacs@gnu.org>
@ 2014-11-19  5:22       ` Alan
  2014-11-19 15:39         ` Eli Zaretskii
       [not found]         ` <mailman.14029.1416411570.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Alan @ 2014-11-19  5:22 UTC (permalink / raw)
  To: help-gnu-emacs

On Tuesday, November 18, 2014 9:49:58 PM UTC-6, Eli Zaretskii wrote:
> > Date: Tue, 18 Nov 2014 14:23:02 -0800 (PST)
> > From: Alan <wehmann_at_fnal.gov>
> > 
> > On Monday, November 17, 2014 10:41:06 AM UTC-6, Eli Zaretskii wrote:
> > > > Date: Sun, 16 Nov 2014 19:11:12 -0800 (PST)
> > > > From: Alan <wehmann_at_fnal.gov>
> > > > Injection-Date: Mon, 17 Nov 2014 03:11:12 +0000
> > > > 
> > > > The documentation for @anchor in the texinfo Info file led me to believe that a cross reference to an anchor name would jump to that location in the info file.  I find this not to be the case.  The jump seems to be to the node location where the @anchor statement is found.
> > > 
> > > Which Emacs version do you use?  This works for me as you expected in
> > > Emacs 24.4.  I tried this in a manual other than perldoc, but I don't
> > > think there should be a difference.
> > 
> > I am using
> > 
> > GNU Emacs 24.3.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2013-03-12 on bob.porkrind.org
> > 
> > I guess that means that I should investigate upgrading to 24.4 (to get the expected behavior of @anchor).
> 
> I'm not sure anything has changed in this area since 24.3.
> 
> Can you try with one of the manuals distributed with Emacs?

I upgraded to

GNU Emacs 24.4.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21) of 2014-10-20 on builder10-9.porkrind.org

and the behavior of @anchor was the same.  I tested with perldoc-all.info, with a texinfo file where I keep a bunch of notes and with the texi file that I found for emacs-lisp-intro.

At the moment I'm stumped.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Disappointed by texinfo @anchor construct
  2014-11-19  5:22       ` Alan
@ 2014-11-19 15:39         ` Eli Zaretskii
       [not found]         ` <mailman.14029.1416411570.1147.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2014-11-19 15:39 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 18 Nov 2014 21:22:22 -0800 (PST)
> From: Alan <wehmann@fnal.gov>
> Injection-Date: Wed, 19 Nov 2014 05:22:22 +0000
> 
> I upgraded to
> 
> GNU Emacs 24.4.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21) of 2014-10-20 on builder10-9.porkrind.org
> 
> and the behavior of @anchor was the same.  I tested with perldoc-all.info, with a texinfo file where I keep a bunch of notes and with the texi file that I found for emacs-lisp-intro.
> 
> At the moment I'm stumped.

How many anchors did you try?  Maybe it only happens in some specific
situations.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Disappointed by texinfo @anchor construct
       [not found]         ` <mailman.14029.1416411570.1147.help-gnu-emacs@gnu.org>
@ 2014-11-20  3:45           ` Alan
  2014-11-20 17:29             ` Eli Zaretskii
       [not found]             ` <mailman.14180.1416504607.1147.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Alan @ 2014-11-20  3:45 UTC (permalink / raw)
  To: help-gnu-emacs

On Wednesday, November 19, 2014 9:39:32 AM UTC-6, Eli Zaretskii wrote:
> > Date: Tue, 18 Nov 2014 21:22:22 -0800 (PST)
> > From: Alan <wehmann_at_fnal.gov>
> > Injection-Date: Wed, 19 Nov 2014 05:22:22 +0000
> > 
> > I upgraded to
> > 
> > GNU Emacs 24.4.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21) of 2014-10-20 on builder10-9.porkrind.org
> > 
> > and the behavior of @anchor was the same.  I tested with perldoc-all.info, with a texinfo file where I keep a bunch of notes and with the texi file that I found for emacs-lisp-intro.
> > 
> > At the moment I'm stumped.
> 
> How many anchors did you try?  Maybe it only happens in some specific
> situations.

I've been checking which makeinfo I am using.  I did the latest testing with makeinfo from texinfo 5.2.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Disappointed by texinfo @anchor construct
  2014-11-20  3:45           ` Alan
@ 2014-11-20 17:29             ` Eli Zaretskii
       [not found]             ` <mailman.14180.1416504607.1147.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2014-11-20 17:29 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Wed, 19 Nov 2014 19:45:10 -0800 (PST)
> From: Alan <wehmann@fnal.gov>
> 
> I've been checking which makeinfo I am using.  I did the latest testing with makeinfo from texinfo 5.2.

Pick up an anchor that doesn't work, then visit the Info file
literally, and look up that anchor in the Tag Table at the end of the
file.  It should have the byte offset near it.  Check where does this
byte offset point to in the file.  If it points to the correct place,
then makeinfo is innocent.

Can you try with some other file, like wisent.info that comes with
Emacs?  I just tried there, and the anchor wisent-skip-token,
referenced from the node "Error Recovery", works for me.  Does it work
for you?



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Disappointed by texinfo @anchor construct
       [not found]             ` <mailman.14180.1416504607.1147.help-gnu-emacs@gnu.org>
@ 2014-11-21  4:01               ` Alan
  2014-11-21  4:16               ` Alan
  1 sibling, 0 replies; 13+ messages in thread
From: Alan @ 2014-11-21  4:01 UTC (permalink / raw)
  To: help-gnu-emacs

On Thursday, November 20, 2014 11:30:10 AM UTC-6, Eli Zaretskii wrote:
> > Date: Wed, 19 Nov 2014 19:45:10 -0800 (PST)
> > From: Alan <wehmann_at_fnal.gov>
> > 
> > I've been checking which makeinfo I am using.  I did the latest testing with makeinfo from texinfo 5.2.
> 
> Pick up an anchor that doesn't work, then visit the Info file
> literally, and look up that anchor in the Tag Table at the end of the
> file.  It should have the byte offset near it.  Check where does this
> byte offset point to in the file.  If it points to the correct place,
> then makeinfo is innocent.
> 
> Can you try with some other file, like wisent.info that comes with
> Emacs?  I just tried there, and the anchor wisent-skip-token,
> referenced from the node "Error Recovery", works for me.  Does it work
> for you?

The offset looks okay.  I tried wisent.info and the problem remains.

I then decided to explore the operation of the code, with edebug.  I record my observations below:

I explored code using edebug and found the critical section of code in

(defun Info-find-node-2

To be able to reference particular lines, I added a number at the beginning of each line:

1	      ;; First, search a tag table, if any
2	      (when (marker-position Info-tag-table-marker)
3		(let* ((m Info-tag-table-marker)
4		       (found (Info-find-in-tag-table m regexp strict-case)))
5
6		  (when found
7		    ;; FOUND is (ANCHOR POS MODE).
8		    (setq guesspos (nth 1 found))
9
10		    ;; If this is an indirect file, determine which
11		    ;; file really holds this node and read it in.
12		    (unless (eq (nth 2 found) 'Info-mode)
13		      ;; Note that the current buffer must be the
14		      ;; *info* buffer on entry to
15		      ;; Info-read-subfile.  Thus the hackery above.
16		      (setq guesspos (Info-read-subfile guesspos)))
17
18		    ;; Handle anchor
19		    (when (nth 0 found)
20		      (goto-char (setq anchorpos guesspos))
21		      (throw 'foo t)))))

I have a texinfo file of mine where I've added an anchor & then ran it through makeinfo.  I looked at the tag table for that anchor in the info file and it has an offset that makes sense.  I then examine what happens in the above section of code--using edebug--when I reference that anchor.  At line 8 the guesspos is what I would regard as proper for the anchor.  The test at line 12 fails because the mode recorded in "found" is "fundamental".  Line 16 then changes guesspos to a value that doesn't correspond to the anchor.

My next task is to figure out why the mode recorded in "anchor" isn't 'Info-mode.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Disappointed by texinfo @anchor construct
       [not found]             ` <mailman.14180.1416504607.1147.help-gnu-emacs@gnu.org>
  2014-11-21  4:01               ` Alan
@ 2014-11-21  4:16               ` Alan
  1 sibling, 0 replies; 13+ messages in thread
From: Alan @ 2014-11-21  4:16 UTC (permalink / raw)
  To: help-gnu-emacs

On Thursday, November 20, 2014 11:30:10 AM UTC-6, Eli Zaretskii wrote:
> > Date: Wed, 19 Nov 2014 19:45:10 -0800 (PST)
> > From: Alan <wehmann_at_fnal.gov>
> > 
> > I've been checking which makeinfo I am using.  I did the latest testing with makeinfo from texinfo 5.2.
> 
> Pick up an anchor that doesn't work, then visit the Info file
> literally, and look up that anchor in the Tag Table at the end of the
> file.  It should have the byte offset near it.  Check where does this
> byte offset point to in the file.  If it points to the correct place,
> then makeinfo is innocent.
> 
> Can you try with some other file, like wisent.info that comes with
> Emacs?  I just tried there, and the anchor wisent-skip-token,
> referenced from the node "Error Recovery", works for me.  Does it work
> for you?

The offset looks okay.  I tried wisent.info and the problem remains.

I then decided to explore the operation of the code, with edebug.  I record my observations below:

I explored code using edebug and found the critical section of code in

(defun Info-find-node-2

To be able to reference particular lines, I added a number at the beginning of each line:

1              ;; First, search a tag table, if any
2              (when (marker-position Info-tag-table-marker)
3                (let* ((m Info-tag-table-marker)
4                       (found (Info-find-in-tag-table m regexp strict-case)))
5
6                  (when found
7                    ;; FOUND is (ANCHOR POS MODE).
8                    (setq guesspos (nth 1 found))
9
10                    ;; If this is an indirect file, determine which
11                    ;; file really holds this node and read it in.
12                    (unless (eq (nth 2 found) 'Info-mode)
13                      ;; Note that the current buffer must be the
14                      ;; *info* buffer on entry to
15                      ;; Info-read-subfile.  Thus the hackery above.
16                      (setq guesspos (Info-read-subfile guesspos)))
17
18                    ;; Handle anchor
19                    (when (nth 0 found)
20                      (goto-char (setq anchorpos guesspos))
21                      (throw 'foo t)))))

I have a texinfo file of mine where I've added an anchor & then ran it through makeinfo.  I looked at the tag table for that anchor in the info file and it has an offset that makes sense.  I then examine what happens in the above section of code--using edebug--when I reference that anchor.  At line 8 the guesspos is what I would regard as proper for the anchor.  The test at line 12 fails because the mode recorded in "found" is "fundamental".  Line 16 then changes guesspos to a value that doesn't correspond to the anchor.

My next task is to figure out why the mode recorded in "found" isn't 'Info-mode.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Disappointed by texinfo @anchor construct
  2014-11-17  3:11 Disappointed by texinfo @anchor construct Alan
  2014-11-17 16:40 ` Eli Zaretskii
       [not found] ` <mailman.13899.1416242463.1147.help-gnu-emacs@gnu.org>
@ 2014-11-21 11:39 ` Alan
  2014-11-22 23:19   ` Robert Thorpe
       [not found]   ` <mailman.14359.1416698366.1147.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 13+ messages in thread
From: Alan @ 2014-11-21 11:39 UTC (permalink / raw)
  To: help-gnu-emacs

On Sunday, November 16, 2014 9:11:14 PM UTC-6, Alan wrote:
> The texinfo construct "@anchor" is used extensively in the texi files that go into making the info file "perldoc-all.info".
> 
> (See http://www.gnu.org/software/perl/manual/)
> 
> The documentation for @anchor in the texinfo Info file led me to believe that a cross reference to an anchor name would jump to that location in the info file.  I find this not to be the case.  The jump seems to be to the node location where the @anchor statement is found.  This is different from inserting a @cindex index entry name next to the @anchor statment; in that case the defined index name goes directly to the location of the @cindex.
> 
> The observed behavior for @anchor makes it much less useful that I had anticipated.
> 
> As an example in "perldoc-all.info", do '(Info-goto-node "perlfunc package NAMESPACE")'.  You will end up at the top of the alphabetical list of the perl functions--instead at the location of the anchor for "package NAMESPACE" (see the file perlfunc.texi).

If I start up Emacs with no initialization file then reference to an anchor works properly--i.e. as described in the texinfo Info file.  So, the problem is something that needs fixing in my initialization file.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Disappointed by texinfo @anchor construct
  2014-11-21 11:39 ` Alan
@ 2014-11-22 23:19   ` Robert Thorpe
       [not found]   ` <mailman.14359.1416698366.1147.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Robert Thorpe @ 2014-11-22 23:19 UTC (permalink / raw)
  To: Alan; +Cc: help-gnu-emacs

Alan <wehmann@fnal.gov> writes:

> If I start up Emacs with no initialization file then reference
> to an anchor works properly--i.e. as described in the texinfo
> Info file.  So, the problem is something that needs fixing in
> my initialization file.

You probably have some code that switches buffers in a careless way.
Something that is called frequently as a background task is setting the
current buffer to fundamental-mode then exiting without switching it
back.

You could bisect your init file.

BR,
Robert Thorpe




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Disappointed by texinfo @anchor construct
       [not found]   ` <mailman.14359.1416698366.1147.help-gnu-emacs@gnu.org>
@ 2014-11-23 13:43     ` Alan
  0 siblings, 0 replies; 13+ messages in thread
From: Alan @ 2014-11-23 13:43 UTC (permalink / raw)
  To: help-gnu-emacs

On Saturday, November 22, 2014 5:19:28 PM UTC-6, Robert Thorpe wrote:
> Alan <wehmann_at_fnal.gov> writes:
> 
> > If I start up Emacs with no initialization file then reference
> > to an anchor works properly--i.e. as described in the texinfo
> > Info file.  So, the problem is something that needs fixing in
> > my initialization file.
> 
> You probably have some code that switches buffers in a careless way.
> Something that is called frequently as a background task is setting the
> current buffer to fundamental-mode then exiting without switching it
> back.
> 
> You could bisect your init file.
> 
> BR,
> Robert Thorpe

The problem arose when I was using "man2texi" to create Perl texinfo files from Perl man pages (I wasn't aware of "perldoc-all" at the time--see my initial posting).  I decided to try to keep the bolding and italics seen in the man pages, in the info file.  I implemented this by bracketing such text with special characters, in the texinfo file.  Then, in the generated info file--when used--I had lisp code create extents and eliminate the special characters.  I did this by advising function "Info-find-node" so that my lisp code ran after it did.  I neglected to put 'save-excursion in my lisp code; that didn't seem to matter until I started using the @anchor construct.  Adding 'save-excursion to my lisp function solved my problem.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-11-23 13:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-17  3:11 Disappointed by texinfo @anchor construct Alan
2014-11-17 16:40 ` Eli Zaretskii
     [not found] ` <mailman.13899.1416242463.1147.help-gnu-emacs@gnu.org>
2014-11-18 22:23   ` Alan
2014-11-19  3:49     ` Eli Zaretskii
     [not found]     ` <mailman.13992.1416368997.1147.help-gnu-emacs@gnu.org>
2014-11-19  5:22       ` Alan
2014-11-19 15:39         ` Eli Zaretskii
     [not found]         ` <mailman.14029.1416411570.1147.help-gnu-emacs@gnu.org>
2014-11-20  3:45           ` Alan
2014-11-20 17:29             ` Eli Zaretskii
     [not found]             ` <mailman.14180.1416504607.1147.help-gnu-emacs@gnu.org>
2014-11-21  4:01               ` Alan
2014-11-21  4:16               ` Alan
2014-11-21 11:39 ` Alan
2014-11-22 23:19   ` Robert Thorpe
     [not found]   ` <mailman.14359.1416698366.1147.help-gnu-emacs@gnu.org>
2014-11-23 13:43     ` Alan

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).