summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2012-08-04 17:17:10 +0300
committerEli Zaretskii <eliz@gnu.org>2012-08-04 17:17:10 +0300
commit76151e2ce70d4c0fec8f3dfda62a92e0430528dc (patch)
tree82912651eaa2ddbcd79ffe7e46fb3018d9880ad8
parenta09508f27e7cda2817211ee33a9d55e5575da0a6 (diff)
downloademacs-76151e2ce70d4c0fec8f3dfda62a92e0430528dc.tar.gz
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.
-rw-r--r--nt/ChangeLog8
-rw-r--r--nt/paths.h15
-rw-r--r--src/ChangeLog28
-rw-r--r--src/callproc.c27
-rw-r--r--src/emacs.c35
-rw-r--r--src/lread.c4
-rw-r--r--src/w32.c51
-rw-r--r--src/w32.h1
8 files changed, 106 insertions, 63 deletions
diff --git a/nt/ChangeLog b/nt/ChangeLog
index 966407e5ed3..ffdfb5dcab2 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,11 @@
+2012-08-04 Eli Zaretskii <eliz@gnu.org>
+
+ * 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 <lekktu@gmail.com>
* config.nt: Sync with autogen/config.in.
diff --git a/nt/paths.h b/nt/paths.h
index d3a41e3c541..801d187646f 100644
--- a/nt/paths.h
+++ b/nt/paths.h
@@ -18,14 +18,18 @@ GNU General Public License for more details.
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 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
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 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* 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"
-
diff --git a/src/ChangeLog b/src/ChangeLog
index 3de5ad8b5ce..748ccf94004 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,33 @@
2012-08-04 Eli Zaretskii <eliz@gnu.org>
+ 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.
diff --git a/src/callproc.c b/src/callproc.c
index 5eabd689188..10a80168fb2 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1513,29 +1513,24 @@ egetenv (const char *var)
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
+ Vdata_directory = decode_env_path ("EMACSDATA",
#ifdef HAVE_NS
- : (etc_dir ? etc_dir : PATH_DATA)
-#else
- : PATH_DATA
+ etc_dir ? etc_dir :
#endif
- ));
- Vdoc_directory
- = Ffile_name_as_directory (build_string (doc_dir ? doc_dir
+ PATH_DATA);
+ Vdata_directory = Ffile_name_as_directory (Fcar (Vdata_directory));
+
+ Vdoc_directory = decode_env_path ("EMACSDOC",
#ifdef HAVE_NS
- : (etc_dir ? etc_dir : PATH_DOC)
-#else
- : PATH_DOC
+ 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 @@ init_callproc (void)
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 @@ init_callproc (void)
}
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)
diff --git a/src/emacs.c b/src/emacs.c
index 1f6f4a450b4..c99ed7c4b07 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -422,6 +422,16 @@ init_cmdargs (int argc, char **argv, int skip_args)
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 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
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 @@ decode_env_path (const char *evarname, const char *defalt)
{
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 @@ decode_env_path (const char *evarname, const char *defalt)
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 @@ decode_env_path (const char *evarname, const char *defalt)
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. */
diff --git a/src/lread.c b/src/lread.c
index a31810ce463..49fa93bc0dd 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4131,7 +4131,7 @@ init_lread (void)
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 @@ init_lread (void)
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;
diff --git a/src/w32.c b/src/w32.c
index 881e3b06efb..91f9f543add 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1709,17 +1709,19 @@ init_environment (char ** argv)
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 @@ init_environment (char ** argv)
}
}
- /* 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 @@ w32_delayed_load (Lisp_Object libraries, Lisp_Object library_id)
}
-static void
+void
check_windows_init_file (void)
{
/* A common indication that Emacs is not installed properly is when
@@ -6630,19 +6613,14 @@ check_windows_init_file (void)
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 @@ init_ntproc (void)
/* Reset the volume info cache. */
volume_cache = NULL;
}
-
- /* Check to see if Emacs has been installed correctly. */
- check_windows_init_file ();
}
/*
diff --git a/src/w32.h b/src/w32.h
index 2866cb2f34a..73d57a65a4a 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -140,6 +140,7 @@ extern void syms_of_w32menu (void);
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);