texinfo-commits
[Top][All Lists]
Advanced

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

[5430] New variable infopath-no-defaults


From: Gavin D. Smith
Subject: [5430] New variable infopath-no-defaults
Date: Sat, 05 Apr 2014 17:04:58 +0000

Revision: 5430
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5430
Author:   gavin
Date:     2014-04-05 17:04:55 +0000 (Sat, 05 Apr 2014)
Log Message:
-----------
New variable infopath-no-defaults

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/Makefile.am
    trunk/info/info.c
    trunk/info/infopath.c
    trunk/info/variables.c
    trunk/info/variables.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-04-05 16:29:56 UTC (rev 5429)
+++ trunk/ChangeLog     2014-04-05 17:04:55 UTC (rev 5430)
@@ -1,5 +1,18 @@
 2014-04-05  Gavin Smith  <address@hidden>
 
+       * Makefile.am: Condense AM_CPPFLAGS definition slightly.
+       * info.c (main): Make --directory options build up infopath
+       in the order they were specified.  Call infopath_init after
+       options are read instead of before.
+       
+       * infopath.c, variables.c (info_variables, infopath_no_defaults_p):
+       New variable for user, info-no-defaults.
+       
+       * infopath.c (infopath_init): Do not include $infodir and
+       $datadir/info in search path if info-no-defaults=On.
+
+2014-04-05  Gavin Smith  <address@hidden>
+
         * session.c (initialize_terminal_and_keymaps, initialize_info_session):
         Function split out.
         * info.c (main): Call initialize_terminal_and_keymaps before

Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am      2014-04-05 16:29:56 UTC (rev 5429)
+++ trunk/info/Makefile.am      2014-04-05 17:04:55 UTC (rev 5430)
@@ -18,17 +18,14 @@
 bin_PROGRAMS = ginfo infokey
 transform = s/ginfo/info/; $(program_transform_name)
 
-localedir = $(datadir)/locale
-infodir2 = $(datadir)/info
+AM_CPPFLAGS =                                   \
+  -I$(top_srcdir)                               \
+  -I$(top_srcdir)/gnulib/lib                    \
+  -I$(top_builddir)/gnulib/lib                  \
+  -DLOCALEDIR=\"$(datadir)/locale\"             \
+  -DINFODIR=\"$(infodir)\"                      \
+  -DINFODIR2=\"$(datadir)/info\"
 
-AM_CPPFLAGS =                                  \
-  -I$(top_srcdir)                              \
-  -I$(top_srcdir)/gnulib/lib                   \
-  -I$(top_builddir)/gnulib/lib                 \
-  -DLOCALEDIR=\"$(localedir)\"                         \
-  -DINFODIR=\"$(infodir)\"                     \
-  -DINFODIR2=\"$(infodir2)\"
-
 LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(TERMLIBS) $(LIBINTL)
 infokey_LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(LIBINTL)
 

Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c   2014-04-05 16:29:56 UTC (rev 5429)
+++ trunk/info/info.c   2014-04-05 17:04:55 UTC (rev 5430)
@@ -520,7 +520,6 @@
 #endif
 
   init_messages ();
-  infopath_init ();
   while (1)
     {
       int option_character;
@@ -548,7 +547,7 @@
          
           /* User wants to add a directory. */
         case 'd':
-          infopath_add (optarg, INFOPATH_PREPEND);
+          infopath_add (optarg, INFOPATH_APPEND);
           break;
 
           /* User is specifying a particular node. */
@@ -724,6 +723,10 @@
   /* Load custom key mappings and variable settings */
   initialize_terminal_and_keymaps ();
 
+  /* Add extra search directories to any already specified with
+     --directory. */
+  infopath_init ();
+
   if (all_matches_p)
     return all_files (user_filename, argc, argv);
 

Modified: trunk/info/infopath.c
===================================================================
--- trunk/info/infopath.c       2014-04-05 16:29:56 UTC (rev 5429)
+++ trunk/info/infopath.c       2014-04-05 17:04:55 UTC (rev 5430)
@@ -21,6 +21,9 @@
 #include "info.h"
 #include "filesys.h"
 
+/* Exclude default file search directories. */
+int infopath_no_defaults_p;
+
 /* The path on which we look for info files. */
 static char *infopath_base = NULL;
 /* Allocated size of infopath_base. */
@@ -86,38 +89,40 @@
 infopath_init ()
 {
   /* Initialize INFOPATH.
-     The hardwired default settings (filesy.h) are the lowest priority.
+     Highest priority is the environment variable, if set
      Then comes the user's INFODIR from the Makefile.
-     Highest priority is the environment variable, if set.  */
+     The hardwired default settings (filesys.h) are the lowest priority. */
   char *path_from_env = getenv ("INFOPATH");
 
   if (path_from_env)
     {
+      infopath_add (path_from_env, INFOPATH_APPEND);
+    }
+
+  if (!infopath_no_defaults_p)
+    {
+#ifdef INFODIR /* $infodir, set by configure script in Makefile */
+      infopath_add (INFODIR, INFOPATH_APPEND);
+#ifdef INFODIR2 /* $datadir/info, which could be different. */
+      if (!STREQ (INFODIR, INFODIR2))
+        infopath_add (INFODIR2, INFOPATH_APPEND);
+#endif /* INFODIR2 */
+#endif /* INFODIR */
+    }
+
+  if (!path_from_env)
+    infopath_add (DEFAULT_INFOPATH, INFOPATH_APPEND);
+  else
+    { 
+      /* Only insert default path if there is a trailing : on INFOPATH. */
+
       unsigned len = strlen (path_from_env);
-      /* Trailing : on INFOPATH means insert the default path.  */
       if (len && path_from_env[len - 1] == PATH_SEP[0])
        {
          path_from_env[len - 1] = 0;
-         infopath_add (DEFAULT_INFOPATH, INFOPATH_PREPEND);
+         infopath_add (DEFAULT_INFOPATH, INFOPATH_APPEND);
        }
-#ifdef INFODIR /* from the Makefile */
-      infopath_add (INFODIR, INFOPATH_PREPEND);
-#endif
-      infopath_add (path_from_env, INFOPATH_PREPEND);
     }
-  else
-    {
-      infopath_add (DEFAULT_INFOPATH, INFOPATH_PREPEND);
-#ifdef INFODIR /* from the Makefile */
-      infopath_add (INFODIR, INFOPATH_PREPEND);
-#endif
-#ifdef INFODIR2 /* from the Makefile, too */
-#  ifdef INFODIR
-      if (!STREQ (INFODIR, INFODIR2))
-#  endif
-       infopath_add (INFODIR2, INFOPATH_PREPEND);
-#endif
-    }
 }
 
 char *

Modified: trunk/info/variables.c
===================================================================
--- trunk/info/variables.c      2014-04-05 16:29:56 UTC (rev 5429)
+++ trunk/info/variables.c      2014-04-05 17:04:55 UTC (rev 5430)
@@ -89,6 +89,11 @@
   { "search-skip-screen",
       N_("Skip current window when searching"),
     &search_skip_screen_p, (char **)on_off_choices },
+
+  { "infopath-no-defaults",
+      N_("Exclude default directories from file search path"),
+    &infopath_no_defaults_p, (char **)on_off_choices },
+
   { NULL }
 };
 

Modified: trunk/info/variables.h
===================================================================
--- trunk/info/variables.h      2014-04-05 16:29:56 UTC (rev 5429)
+++ trunk/info/variables.h      2014-04-05 17:04:55 UTC (rev 5430)
@@ -63,5 +63,6 @@
 extern int scroll_last_node;
 extern int min_search_length;
 extern int search_skip_screen_p;
+extern int infopath_no_defaults_p;
 
 #endif /* not INFO_VARIABLES_H */




reply via email to

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