|
0 |
Upstream patch to implement follow remain strategy
|
|
1 |
Respective changelogs:
|
|
2 |
2015-08-05 Gavin Smith <gavinsmith0123@gmail.com>
|
|
3 |
|
|
4 |
* info/variables.c (info_variables): New user variable
|
|
5 |
"follow-strategy".
|
|
6 |
* info/nodes.c (info_get_node_with_defaults): If
|
|
7 |
follow-strategy=remain (the default), try to remain within the
|
|
8 |
same directory as the node we're coming from.
|
|
9 |
|
|
10 |
To disable it, set the "follow-strategy" variable to "path" in .infokey.
|
|
11 |
---
|
|
12 |
info/nodes.c | 36 ++++++++++++++++++++++++++++++++++--
|
|
13 |
info/variables.c | 6 ++++++
|
|
14 |
info/variables.h | 1 +
|
|
15 |
3 files changed, 41 insertions(+), 2 deletions(-)
|
|
16 |
|
|
17 |
--- texinfo.orig/info/nodes.c
|
|
18 |
+++ texinfo/info/nodes.c
|
|
19 |
@@ -895,6 +895,11 @@
|
|
20 |
return i - binding->start;
|
|
21 |
}
|
|
22 |
|
|
23 |
+#define FOLLOW_REMAIN 0
|
|
24 |
+#define FOLLOW_PATH 1
|
|
25 |
+
|
|
26 |
+int follow_strategy;
|
|
27 |
+
|
|
28 |
/* Return a pointer to a NODE structure for the Info node (FILENAME)NODENAME,
|
|
29 |
using DEFAULTS for defaults. If DEFAULTS is null, the defaults are:
|
|
30 |
- If FILENAME is NULL, `dir' is used.
|
|
31 |
@@ -928,8 +933,35 @@
|
|
32 |
goto cleanup_and_exit;
|
|
33 |
}
|
|
34 |
|
|
35 |
- /* Find the correct info file, or give up. */
|
|
36 |
- file_buffer = info_find_file (filename);
|
|
37 |
+
|
|
38 |
+ if (follow_strategy == FOLLOW_REMAIN
|
|
39 |
+ && defaults && defaults->fullpath)
|
|
40 |
+ {
|
|
41 |
+ /* Find the directory in the filename for defaults, and look in
|
|
42 |
+ that directory first. */
|
|
43 |
+ char *file_in_same_dir;
|
|
44 |
+ char saved_char, *p;
|
|
45 |
+
|
|
46 |
+ p = defaults->fullpath + strlen (defaults->fullpath);
|
|
47 |
+ while (p > defaults->fullpath && !IS_SLASH (*p))
|
|
48 |
+ p--;
|
|
49 |
+
|
|
50 |
+ if (p > defaults->fullpath)
|
|
51 |
+ {
|
|
52 |
+ saved_char = *p;
|
|
53 |
+ *p = 0;
|
|
54 |
+
|
|
55 |
+ file_in_same_dir = info_add_extension (defaults->fullpath,
|
|
56 |
+ filename, 0);
|
|
57 |
+ if (file_in_same_dir)
|
|
58 |
+ file_buffer = info_find_file (file_in_same_dir);
|
|
59 |
+ free (file_in_same_dir);
|
|
60 |
+ *p = saved_char;
|
|
61 |
+ }
|
|
62 |
+ }
|
|
63 |
+
|
|
64 |
+ if (!file_buffer)
|
|
65 |
+ file_buffer = info_find_file (filename);
|
|
66 |
|
|
67 |
if (file_buffer)
|
|
68 |
{
|
|
69 |
--- texinfo.orig/info/variables.c
|
|
70 |
+++ texinfo/info/variables.c
|
|
71 |
@@ -36,6 +36,8 @@
|
|
72 |
|
|
73 |
static char *mouse_choices[] = { "Off", "normal-tracking", NULL };
|
|
74 |
|
|
75 |
+static char *follow_strategy_choices[] = { "remain", "path", NULL };
|
|
76 |
+
|
|
77 |
/* Choices used by the completer when reading a value for the user-visible
|
|
78 |
variable "scroll-behaviour". */
|
|
79 |
static char *info_scroll_choices[] = { "Continuous", "Next Only",
|
|
80 |
@@ -124,6 +126,10 @@
|
|
81 |
N_("Method to use to track mouse events"),
|
|
82 |
&mouse_protocol, (char **)mouse_choices },
|
|
83 |
|
|
84 |
+ { "follow-strategy",
|
|
85 |
+ N_("Method to use to track mouse events"),
|
|
86 |
+ &follow_strategy, (char **)follow_strategy_choices },
|
|
87 |
+
|
|
88 |
{ NULL }
|
|
89 |
};
|
|
90 |
|
|
91 |
--- texinfo.orig/info/variables.h
|
|
92 |
+++ texinfo/info/variables.h
|
|
93 |
@@ -82,6 +82,7 @@
|
|
94 |
extern int key_time;
|
|
95 |
extern int highlight_searches_p;
|
|
96 |
extern int mouse_protocol;
|
|
97 |
+extern int follow_strategy;
|
|
98 |
|
|
99 |
|
|
100 |
#endif /* not INFO_VARIABLES_H */
|