Hello,

Here is an option added to info to avoid being smart when searching for 
nodes. I don't think that there are any flaw with the search in info, on
the contrary, it is too efficient, and then it is hard to know if the node
location information in info files is bogus... makeinfo in C is pretty
buggy, for example, but it cannot be seen since info is so forgiving.

In my opinion, this option --strict-node-count is not really useful 
for anything else than debugging (info documents, and maybe the info
reader). Therefore I didn't document it. How should it be documented?
In --help? In doc/info-stnd.texi? Nowhere?

--
Pat
? cvsup
? strict-node-location-switch.patch
? texi2html/ABOUT-NLS
? texi2html/cvsup
? texi2html/locales
? texi2html/m4
? texi2html/makeinfo.out
? texi2html/texi2any.out
? texi2html/test/formatting/empty_deftype.info
? texi2html/test/formatting/res/allowcodebreaks
? texi2html/test/info_coverage/split-nocopying.info
? texi2html/test/manuals/hello
Index: ChangeLog
===================================================================
RCS file: /sources/texinfo/texinfo/ChangeLog,v
retrieving revision 1.1031
diff -u -3 -p -r1.1031 ChangeLog
--- ChangeLog	10 Mar 2010 00:56:40 -0000	1.1031
+++ ChangeLog	17 Mar 2010 08:44:12 -0000
@@ -1,3 +1,9 @@
+2010-03-17  Patrice Dumas  <[email protected]>
+
+	* info/nodes.c (info_node_of_file_buffer_tags), info.c, info.h:
+	new switch --strict-node-location to avoid being smart when 
+	searching for nodes.
+
 2010-03-09  Karl Berry  <[email protected]>
 
 	* doc/texinfo.txi (Menu Location): Clarify that having the menu
Index: info/info.c
===================================================================
RCS file: /sources/texinfo/texinfo/info/info.c,v
retrieving revision 1.33
diff -u -3 -p -r1.33 info.c
--- info/info.c	14 Aug 2008 17:36:13 -0000	1.33
+++ info/info.c	17 Mar 2010 08:44:12 -0000
@@ -82,6 +82,9 @@ int raw_escapes_p = 1;
 /* Non-zero means print the absolute location of the file to be loaded.  */
 static int print_where_p = 0;
 
+/* Non-zero means don't try to be smart when searching for nodes.  */
+int strict_node_location_p = 0;
+
 #ifdef __MSDOS__
 /* Non-zero indicates that screen output should be made 'speech-friendly'.
    Since on MSDOS the usual behavior is to write directly to the video
@@ -113,6 +116,7 @@ static struct option long_options[] = {
   { "no-show-malformed-multibytes", 0, &show_malformed_multibyte_p, 0 },
   { "restore", 1, 0, RESTORE_OPTION },
   { "show-options", 0, 0, 'O' },
+  { "strict-node-location", 0, &strict_node_location_p, 1 },
   { "subnodes", 0, &dump_subnodes, 1 },
   { "usage", 0, 0, 'O' },
   { "version", 0, &print_version_p, 1 },
Index: info/info.h
===================================================================
RCS file: /sources/texinfo/texinfo/info/info.h,v
retrieving revision 1.9
diff -u -3 -p -r1.9 info.h
--- info/info.h	10 May 2008 14:39:05 -0000	1.9
+++ info/info.h	17 Mar 2010 08:44:12 -0000
@@ -126,6 +126,9 @@ extern int vi_keys_p;
 /* Non-zero means don't remove ANSI escape sequences from man pages.  */
 extern int raw_escapes_p;
 
+/* Non-zero means don't try to be smart when searching for nodes.  */
+extern int strict_node_location_p;
+
 /* Print FORMAT with ARG1 and ARG2.  If the window system was initialized,
    then the message is printed in the echo area.  Otherwise, a message is
    output to stderr. */
Index: info/nodes.c
===================================================================
RCS file: /sources/texinfo/texinfo/info/nodes.c,v
retrieving revision 1.13
diff -u -3 -p -r1.13 nodes.c
--- info/nodes.c	23 Jan 2009 09:37:40 -0000	1.13
+++ info/nodes.c	17 Mar 2010 08:44:12 -0000
@@ -998,10 +998,16 @@ info_node_of_file_buffer_tags (FILE_BUFF
 
               min = max = DEFAULT_INFO_FUDGE;
 
-              if (tag->nodestart < DEFAULT_INFO_FUDGE)
+              if (strict_node_location_p)
+                {
+                  min = 0;
+                  max = 2;
+                }
+
+              if (tag->nodestart < min)
                 min = tag->nodestart;
 
-              if (DEFAULT_INFO_FUDGE >
+              if (max >
                   (subfile->filesize - tag->nodestart))
                 max = subfile->filesize - tag->nodestart;
 

Reply via email to