texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[6502] follow-strategy variable


From: Gavin D. Smith
Subject: [6502] follow-strategy variable
Date: Wed, 05 Aug 2015 23:18:02 +0000

Revision: 6502
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6502
Author:   gavin
Date:     2015-08-05 23:18:01 +0000 (Wed, 05 Aug 2015)
Log Message:
-----------
follow-strategy variable

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/nodes.c
    trunk/info/variables.c
    trunk/info/variables.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-08-05 21:10:30 UTC (rev 6501)
+++ trunk/ChangeLog     2015-08-05 23:18:01 UTC (rev 6502)
@@ -1,12 +1,20 @@
-2015-08-04  Gavin Smith  <address@hidden>
+2015-08-05  Gavin Smith  <address@hidden>
 
+       * info/variables.c (info_variables): New user variable 
+       "follow-strategy".
+       * info/nodes.c (info_get_node_with_defaults): If 
+       follow-strategy=remain (the default), try to remain within the 
+       same directory as the node we're coming from.
+
+2015-08-05  Gavin Smith  <address@hidden>
+
        * configure.ac,
        * tp/Texinfo/Convert/XSParagraph/configure.ac,
        * tp/Texinfo/Convert/XSParagraph/Makefile.am: Recognize
        PERL_EXT_CFLAGS, PERL_EXT_CPPFLAGS, PERL_EXT_LDLAGS as user 
        variables.
 
-2015-08-04  Gavin Smith  <address@hidden>
+2015-08-05  Gavin Smith  <address@hidden>
 
        * configure.ac,
        * tp/Texinfo/Convert/XSParagraph/configure.ac: Add 

Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c  2015-08-05 21:10:30 UTC (rev 6501)
+++ trunk/info/nodes.c  2015-08-05 23:18:01 UTC (rev 6502)
@@ -901,6 +901,11 @@
   return i - binding->start;
 }
 
+#define FOLLOW_REMAIN 0
+#define FOLLOW_PATH 1
+
+int follow_strategy;
+
 /* Return a pointer to a NODE structure for the Info node (FILENAME)NODENAME,
    using DEFAULTS for defaults.  If DEFAULTS is null, the defaults are:
    - If FILENAME is NULL, `dir' is used.
@@ -934,9 +939,36 @@
       goto cleanup_and_exit;
     }
 
-  /* Find the correct info file, or give up.  */
-  file_buffer = info_find_file (filename);
 
+  if (follow_strategy == FOLLOW_REMAIN
+      && defaults && defaults->fullpath)
+    {
+      /* Find the directory in the filename for defaults, and look in
+         that directory first. */
+      char *file_in_same_dir;
+      char saved_char, *p;
+
+      p = defaults->fullpath + strlen (defaults->fullpath);
+      while (p > defaults->fullpath && !IS_SLASH (*p))
+        p--;
+
+      if (p > defaults->fullpath)
+        {
+          saved_char = *p;
+          *p = 0;
+
+          file_in_same_dir = info_add_extension (defaults->fullpath,
+                                                 filename, 0);
+          if (file_in_same_dir)
+            file_buffer = info_find_file (file_in_same_dir);
+          free (file_in_same_dir);
+          *p = saved_char;
+        }
+    }
+
+  if (!file_buffer)
+    file_buffer = info_find_file (filename);
+
   if (file_buffer)
     {
       /* Look for the node.  */

Modified: trunk/info/variables.c
===================================================================
--- trunk/info/variables.c      2015-08-05 21:10:30 UTC (rev 6501)
+++ trunk/info/variables.c      2015-08-05 23:18:01 UTC (rev 6502)
@@ -36,6 +36,8 @@
 
 static char *mouse_choices[] = { "Off", "normal-tracking", NULL };
 
+static char *follow_strategy_choices[] = { "remain", "path", NULL };
+
 /* Choices used by the completer when reading a value for the user-visible
    variable "scroll-behaviour". */
 static char *info_scroll_choices[] = { "Continuous", "Next Only",
@@ -128,6 +130,10 @@
       N_("Method to use to track mouse events"),
     &mouse_protocol, (char **)mouse_choices },
 
+  { "follow-strategy",
+      N_("Method to use to track mouse events"),
+    &follow_strategy, (char **)follow_strategy_choices },
+
   { NULL }
 };
 

Modified: trunk/info/variables.h
===================================================================
--- trunk/info/variables.h      2015-08-05 21:10:30 UTC (rev 6501)
+++ trunk/info/variables.h      2015-08-05 23:18:01 UTC (rev 6502)
@@ -83,6 +83,7 @@
 extern int highlight_searches_p;
 extern int xref_rendition_p;
 extern int mouse_protocol;
+extern int follow_strategy;
 
 
 #endif /* not INFO_VARIABLES_H */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]