emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109429: Fix bug #11959 with startup


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109429: Fix bug #11959 with startup warnings on MS-Windows about ../site-lisp.
Date: Sat, 04 Aug 2012 17:17:10 +0300
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109429
fixes bug: http://debbugs.gnu.org/11959
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2012-08-04 17:17:10 +0300
message:
  Fix bug #11959 with startup warnings on MS-Windows about ../site-lisp.
  
   src/w32.c (init_environment): Change the default values of many
   environment variables in dflt_envvars[] to NULL, to avoid pushing
   them into environment when they were not already defined.  Remove
   the code that deletes site-lisp subdirectories from the default
   value of EMACSLOADPATH, as it is no longer needed.
   (check_windows_init_file): Now external, not static.  Use
   Vload_path as is, without adding anything, as this function is now
   called when Vload_path is already set up.
   src/w32.h (check_windows_init_file): Add prototype.
   src/emacs.c (init_cmdargs) [WINDOWSNT]: When running from the build
   directory, ignore the /*/i386/ tail in Vinvocation_directory, for
   compatibility with Posix platforms.
   (main): Move the call to check_windows_init_file to here from
   w32.c.
   (decode_env_path) [WINDOWSNT]: Expand the %emacs_dir%/ prefix, if
   any, in the DEFALT argument into the root of the Emacs build or
   installation tree, as appropriate.
   src/callproc.c (init_callproc_1): Call decode_env_path instead of
   doing its equivalent by hand.
   (init_callproc): Replace DOS_NT condition with MSDOS, thus letting
   the code that sets Vexec_path run on MS-Windows.
   src/lread.c (init_lread): Add comments to #ifdef's.
  
   nt/paths.h (PATH_LOADSEARCH, PATH_SITELOADSEARCH, PATH_EXEC)
   (PATH_DATA, PATH_DOC): Replace dummy directory names with
   directories relative to %emacs_dir%.
   (PATH_EXEC): Add lib-src/oo-spd/i386 and lib-src/oo/i386, to cater
   to the use case of running un-installed Emacs.
modified:
  nt/ChangeLog
  nt/paths.h
  src/ChangeLog
  src/callproc.c
  src/emacs.c
  src/lread.c
  src/w32.c
  src/w32.h
=== modified file 'nt/ChangeLog'
--- a/nt/ChangeLog      2012-08-03 12:16:40 +0000
+++ b/nt/ChangeLog      2012-08-04 14:17:10 +0000
@@ -1,3 +1,11 @@
+2012-08-04  Eli Zaretskii  <address@hidden>
+
+       * paths.h (PATH_LOADSEARCH, PATH_SITELOADSEARCH, PATH_EXEC)
+       (PATH_DATA, PATH_DOC): Replace dummy directory names with
+       directories relative to %emacs_dir%.
+       (PATH_EXEC): Add lib-src/oo-spd/i386 and lib-src/oo/i386, to cater
+       to the use case of running un-installed Emacs.
+
 2012-08-03  Juanma Barranquero  <address@hidden>
 
        * config.nt: Sync with autogen/config.in.

=== modified file 'nt/paths.h'
--- a/nt/paths.h        2012-06-30 21:10:50 +0000
+++ b/nt/paths.h        2012-08-04 14:17:10 +0000
@@ -18,14 +18,18 @@
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* Relative file names in this file that begin with "%emacs_dir%/" are
+   treated specially by decode_env_path: they are expanded relative to
+   the value of the emacs_dir environment variable, which points to
+   the root of the Emacs tree.  */
 
 /* The default search path for Lisp function "load".
    Together with PATH_SITELOADSEARCH, this sets load-path.  */
 /* #define PATH_LOADSEARCH "/usr/local/lib/emacs/lisp" */
-#define PATH_LOADSEARCH "C:/emacs/lisp"
+#define PATH_LOADSEARCH "%emacs_dir%/lisp;%emacs_dir%/leim"
 
 /* Like PATH_LOADSEARCH, but contains the non-standard pieces.  */
-#define PATH_SITELOADSEARCH "C:/emacs/site-lisp"
+#define PATH_SITELOADSEARCH "%emacs_dir%/site-lisp;%emacs_dir%/../site-lisp"
 
 /* Like PATH_LOADSEARCH, but used only when Emacs is dumping.  This
    path is usually identical to PATH_LOADSEARCH except that the entry
@@ -39,13 +43,13 @@
    variable exec-directory.  exec-directory is used for finding
    executables and other architecture-dependent files.  */
 /* #define PATH_EXEC "/usr/local/lib/emacs/etc" */
-#define PATH_EXEC "C:/emacs/bin"
+#define PATH_EXEC 
"%emacs_dir%/bin;%emacs_dir%/lib-src/oo-spd/i386;%emacs_dir%/lib-src/oo/i386"
 
 /* Where Emacs should look for its architecture-independent data
    files, like the NEWS file.  The lisp variable data-directory
    is set to this value.  */
 /* #define PATH_DATA "/usr/local/lib/emacs/data" */
-#define PATH_DATA "C:/emacs/data"
+#define PATH_DATA "%emacs_dir%/etc"
 
 /* Where Emacs should look for X bitmap files.
    The lisp variable x-bitmap-file-path is set based on this value.  */
@@ -53,11 +57,10 @@
 
 /* Where Emacs should look for its docstring file.  The lisp variable
    doc-directory is set to this value.  */
-#define PATH_DOC "C:/emacs/etc"
+#define PATH_DOC "%emacs_dir%/etc"
 
 /* Where the configuration process believes the info tree lives.  The
    lisp variable configure-info-directory gets its value from this
    macro, and is then used to set the Info-default-directory-list.  */
 /* #define PATH_INFO "/usr/local/info" */
 #define PATH_INFO "C:/emacs/info"
-

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-08-04 08:58:33 +0000
+++ b/src/ChangeLog     2012-08-04 14:17:10 +0000
@@ -1,5 +1,33 @@
 2012-08-04  Eli Zaretskii  <address@hidden>
 
+       Fix startup warnings about ../site-lisp on MS-Windows.  (Bug#11959)
+       * w32.c (init_environment): Change the default values of many
+       environment variables in dflt_envvars[] to NULL, to avoid pushing
+       them into environment when they were not already defined.  Remove
+       the code that deletes site-lisp subdirectories from the default
+       value of EMACSLOADPATH, as it is no longer needed.
+       (check_windows_init_file): Now external, not static.  Use
+       Vload_path as is, without adding anything, as this function is now
+       called when Vload_path is already set up.
+
+       * w32.h (check_windows_init_file): Add prototype.
+
+       * emacs.c (init_cmdargs) [WINDOWSNT]: When running from the build
+       directory, ignore the /*/i386/ tail in Vinvocation_directory, for
+       compatibility with Posix platforms.
+       (main): Move the call to check_windows_init_file to here from
+       w32.c.
+       (decode_env_path) [WINDOWSNT]: Expand the %emacs_dir%/ prefix, if
+       any, in the DEFALT argument into the root of the Emacs build or
+       installation tree, as appropriate.
+
+       * callproc.c (init_callproc_1): Call decode_env_path instead of
+       doing its equivalent by hand.
+       (init_callproc): Replace DOS_NT condition with MSDOS, thus letting
+       the code that sets Vexec_path run on MS-Windows.
+
+       * lread.c (init_lread): Add comments to #ifdef's.
+
        * msdos.c (dos_set_window_size, IT_update_begin)
        (IT_frame_up_to_date, IT_set_frame_parameters): Use FVAR and WVAR
        instead of direct references.

=== modified file 'src/callproc.c'
--- a/src/callproc.c    2012-08-03 23:36:11 +0000
+++ b/src/callproc.c    2012-08-04 14:17:10 +0000
@@ -1513,29 +1513,24 @@
 void
 init_callproc_1 (void)
 {
-  char *data_dir = egetenv ("EMACSDATA");
-  char *doc_dir = egetenv ("EMACSDOC");
 #ifdef HAVE_NS
   const char *etc_dir = ns_etc_directory ();
   const char *path_exec = ns_exec_path ();
 #endif
 
-  Vdata_directory
-    = Ffile_name_as_directory (build_string (data_dir ? data_dir
-#ifdef HAVE_NS
-                                             : (etc_dir ? etc_dir : PATH_DATA)
-#else
-                                             : PATH_DATA
-#endif
-                                             ));
-  Vdoc_directory
-    = Ffile_name_as_directory (build_string (doc_dir ? doc_dir
-#ifdef HAVE_NS
-                                             : (etc_dir ? etc_dir : PATH_DOC)
-#else
-                                             : PATH_DOC
-#endif
-                                             ));
+  Vdata_directory = decode_env_path ("EMACSDATA",
+#ifdef HAVE_NS
+                                             etc_dir ? etc_dir :
+#endif
+                                             PATH_DATA);
+  Vdata_directory = Ffile_name_as_directory (Fcar (Vdata_directory));
+
+  Vdoc_directory = decode_env_path ("EMACSDOC",
+#ifdef HAVE_NS
+                                             etc_dir ? etc_dir :
+#endif
+                                             PATH_DOC);
+  Vdoc_directory = Ffile_name_as_directory (Fcar (Vdoc_directory));
 
   /* Check the EMACSPATH environment variable, defaulting to the
      PATH_EXEC path from epaths.h.  */
@@ -1576,7 +1571,7 @@
       Lisp_Object tem;
       tem = Fexpand_file_name (build_string ("lib-src"),
                               Vinstallation_directory);
-#ifndef DOS_NT
+#ifndef MSDOS
          /* MSDOS uses wrapped binaries, so don't do this.  */
       if (NILP (Fmember (tem, Vexec_path)))
        {
@@ -1593,7 +1588,7 @@
        }
 
       Vexec_directory = Ffile_name_as_directory (tem);
-#endif /* not DOS_NT */
+#endif /* not MSDOS */
 
       /* Maybe use ../etc as well as ../lib-src.  */
       if (data_dir == 0)

=== modified file 'src/emacs.c'
--- a/src/emacs.c       2012-08-02 06:43:13 +0000
+++ b/src/emacs.c       2012-08-04 14:17:10 +0000
@@ -422,6 +422,16 @@
   if (!NILP (Vinvocation_directory))
     {
       dir = Vinvocation_directory;
+#ifdef WINDOWSNT
+      /* If we are running from the build directory, set DIR to the
+        src subdirectory of the Emacs tree, like on Posix
+        platforms.  */
+      if (SBYTES (dir) > sizeof ("/i386/") - 1
+         && 0 == strcmp (SSDATA (dir) + SBYTES (dir) - sizeof ("/i386/") + 1,
+                         "/i386/"))
+       dir = Fexpand_file_name (build_string ("../.."), dir);
+#else  /* !WINDOWSNT */
+#endif
       name = Fexpand_file_name (Vinvocation_name, dir);
       while (1)
        {
@@ -1434,6 +1444,10 @@
 
   init_callproc ();    /* Must follow init_cmdargs but not init_sys_modes.  */
   init_lread ();
+#ifdef WINDOWSNT
+  /* Check to see if Emacs has been installed correctly.  */
+  check_windows_init_file ();
+#endif
 
   /* Intern the names of all standard functions and variables;
      define standard keys.  */
@@ -2228,6 +2242,12 @@
 {
   const char *path, *p;
   Lisp_Object lpath, element, tem;
+  int defaulted = 0;
+#ifdef WINDOWSNT
+  const char *emacs_dir = egetenv ("emacs_dir");
+  static const char *emacs_dir_env = "%emacs_dir%/";
+  const size_t emacs_dir_len = strlen (emacs_dir_env);
+#endif
 
   /* It's okay to use getenv here, because this function is only used
      to initialize variables when Emacs starts up, and isn't called
@@ -2237,7 +2257,10 @@
   else
     path = 0;
   if (!path)
-    path = defalt;
+    {
+      path = defalt;
+      defaulted = 1;
+    }
 #ifdef DOS_NT
   /* Ensure values from the environment use the proper directory separator.  */
   if (path)
@@ -2256,6 +2279,16 @@
        p = path + strlen (path);
       element = (p - path ? make_string (path, p - path)
                 : build_string ("."));
+#ifdef WINDOWSNT
+      /* Relative file names in the default path are interpreted as
+        being relative to $emacs_dir.  */
+      if (emacs_dir && defaulted
+         && strncmp (path, emacs_dir_env, emacs_dir_len) == 0)
+       element = Fexpand_file_name (Fsubstring (element,
+                                                make_number (emacs_dir_len),
+                                                Qnil),
+                                    build_string (emacs_dir));
+#endif
 
       /* Add /: to the front of the name
         if it would otherwise be treated as magic.  */

=== modified file 'src/lread.c'
--- a/src/lread.c       2012-08-03 23:36:11 +0000
+++ b/src/lread.c       2012-08-04 14:17:10 +0000
@@ -4131,7 +4131,7 @@
       sitelisp = decode_env_path (0, PATH_SITELOADSEARCH);
       if (! NILP (sitelisp)) Vload_path = nconc2 (sitelisp, Vload_path);
     }
-#else
+#else  /* !CANNOT_DUMP */
   if (NILP (Vpurify_flag))
     {
       normal = PATH_LOADSEARCH;
@@ -4293,7 +4293,7 @@
          be missing unless something went extremely (and improbably)
          wrong, in which case the build will fail in obvious ways.  */
     }
-#endif  /* CANNOT_DUMP */
+#endif  /* !CANNOT_DUMP */
 
   Vvalues = Qnil;
 

=== modified file 'src/w32.c'
--- a/src/w32.c 2012-08-03 10:23:30 +0000
+++ b/src/w32.c 2012-08-04 14:17:10 +0000
@@ -1709,17 +1709,19 @@
       char * def_value;
     } dflt_envvars[] =
     {
+      /* If the default value is NULL, we will use the value from the
+        outside environment or the Registry, but will not push the
+        variable into the Emacs environment if it is defined neither
+        in the Registry nor in the outside environment.  */
       {"HOME", "C:/"},
       {"PRELOAD_WINSOCK", NULL},
       {"emacs_dir", "C:/emacs"},
-      {"EMACSLOADPATH", 
"%emacs_dir%/site-lisp;%emacs_dir%/../site-lisp;%emacs_dir%/lisp;%emacs_dir%/leim"},
+      {"EMACSLOADPATH", NULL},
       {"SHELL", "%emacs_dir%/bin/cmdproxy.exe"},
-      {"EMACSDATA", "%emacs_dir%/etc"},
-      {"EMACSPATH", "%emacs_dir%/bin"},
-      /* We no longer set INFOPATH because Info-default-directory-list
-        is then ignored.  */
-      /*  {"INFOPATH", "%emacs_dir%/info"},  */
-      {"EMACSDOC", "%emacs_dir%/etc"},
+      {"EMACSDATA", NULL},
+      {"EMACSPATH", NULL},
+      {"INFOPATH", NULL},
+      {"EMACSDOC", NULL},
       {"TERM", "cmd"},
       {"LANG", NULL},
     };
@@ -1777,29 +1779,10 @@
         }
     }
 
-  /* When Emacs is invoked with --no-site-lisp, we must remove the
-     site-lisp directories from the default value of EMACSLOADPATH.
-     This assumes that the site-lisp entries are at the front, and
-     that additional entries do exist.  */
-  if (no_site_lisp)
-    {
-      for (i = 0; i < N_ENV_VARS; i++)
-        {
-          if (strcmp (env_vars[i].name, "EMACSLOADPATH") == 0)
-            {
-              char *site;
-              while ((site = strstr (env_vars[i].def_value, "site-lisp")))
-                env_vars[i].def_value = strchr (site, ';') + 1;
-              break;
-            }
-        }
-    }
-
 #define SET_ENV_BUF_SIZE (4 * MAX_PATH)        /* to cover EMACSLOADPATH */
 
     /* Treat emacs_dir specially: set it unconditionally based on our
-       location, if it appears that we are running from the bin subdir
-       of a standard installation.  */
+       location.  */
     {
       char *p;
       char modname[MAX_PATH];
@@ -6618,7 +6601,7 @@
 }
 
 
-static void
+void
 check_windows_init_file (void)
 {
   /* A common indication that Emacs is not installed properly is when
@@ -6630,19 +6613,14 @@
         loadup.el.  */
       && NILP (Vpurify_flag))
     {
-      Lisp_Object objs[2];
-      Lisp_Object full_load_path;
       Lisp_Object init_file;
       int fd;
 
-      objs[0] = Vload_path;
-      objs[1] = decode_env_path (0, (getenv ("EMACSLOADPATH")));
-      full_load_path = Fappend (2, objs);
       init_file = build_string ("term/w32-win");
-      fd = openp (full_load_path, init_file, Fget_load_suffixes (), NULL, 
Qnil);
+      fd = openp (Vload_path, init_file, Fget_load_suffixes (), NULL, Qnil);
       if (fd < 0)
        {
-         Lisp_Object load_path_print = Fprin1_to_string (full_load_path, Qnil);
+         Lisp_Object load_path_print = Fprin1_to_string (Vload_path, Qnil);
          char *init_file_name = SDATA (init_file);
          char *load_path = SDATA (load_path_print);
          char *buffer = alloca (1024
@@ -6781,9 +6759,6 @@
     /* Reset the volume info cache.  */
     volume_cache = NULL;
   }
-
-  /* Check to see if Emacs has been installed correctly.  */
-  check_windows_init_file ();
 }
 
 /*

=== modified file 'src/w32.h'
--- a/src/w32.h 2012-01-19 07:21:25 +0000
+++ b/src/w32.h 2012-08-04 14:17:10 +0000
@@ -140,6 +140,7 @@
 extern void globals_of_w32menu (void);
 extern void syms_of_fontset (void);
 extern void syms_of_w32font (void);
+extern void check_windows_init_file (void);
 
 extern int _sys_read_ahead (int fd);
 extern int _sys_wait_accept (int fd);


reply via email to

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