aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32.c
diff options
context:
space:
mode:
authorEli Zaretskii2012-08-04 17:17:10 +0300
committerEli Zaretskii2012-08-04 17:17:10 +0300
commit76151e2ce70d4c0fec8f3dfda62a92e0430528dc (patch)
tree82912651eaa2ddbcd79ffe7e46fb3018d9880ad8 /src/w32.c
parenta09508f27e7cda2817211ee33a9d55e5575da0a6 (diff)
downloademacs-76151e2ce70d4c0fec8f3dfda62a92e0430528dc.tar.gz
emacs-76151e2ce70d4c0fec8f3dfda62a92e0430528dc.zip
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.
Diffstat (limited to 'src/w32.c')
-rw-r--r--src/w32.c51
1 files changed, 13 insertions, 38 deletions
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)
1709 char * def_value; 1709 char * def_value;
1710 } dflt_envvars[] = 1710 } dflt_envvars[] =
1711 { 1711 {
1712 /* If the default value is NULL, we will use the value from the
1713 outside environment or the Registry, but will not push the
1714 variable into the Emacs environment if it is defined neither
1715 in the Registry nor in the outside environment. */
1712 {"HOME", "C:/"}, 1716 {"HOME", "C:/"},
1713 {"PRELOAD_WINSOCK", NULL}, 1717 {"PRELOAD_WINSOCK", NULL},
1714 {"emacs_dir", "C:/emacs"}, 1718 {"emacs_dir", "C:/emacs"},
1715 {"EMACSLOADPATH", "%emacs_dir%/site-lisp;%emacs_dir%/../site-lisp;%emacs_dir%/lisp;%emacs_dir%/leim"}, 1719 {"EMACSLOADPATH", NULL},
1716 {"SHELL", "%emacs_dir%/bin/cmdproxy.exe"}, 1720 {"SHELL", "%emacs_dir%/bin/cmdproxy.exe"},
1717 {"EMACSDATA", "%emacs_dir%/etc"}, 1721 {"EMACSDATA", NULL},
1718 {"EMACSPATH", "%emacs_dir%/bin"}, 1722 {"EMACSPATH", NULL},
1719 /* We no longer set INFOPATH because Info-default-directory-list 1723 {"INFOPATH", NULL},
1720 is then ignored. */ 1724 {"EMACSDOC", NULL},
1721 /* {"INFOPATH", "%emacs_dir%/info"}, */
1722 {"EMACSDOC", "%emacs_dir%/etc"},
1723 {"TERM", "cmd"}, 1725 {"TERM", "cmd"},
1724 {"LANG", NULL}, 1726 {"LANG", NULL},
1725 }; 1727 };
@@ -1777,29 +1779,10 @@ init_environment (char ** argv)
1777 } 1779 }
1778 } 1780 }
1779 1781
1780 /* When Emacs is invoked with --no-site-lisp, we must remove the
1781 site-lisp directories from the default value of EMACSLOADPATH.
1782 This assumes that the site-lisp entries are at the front, and
1783 that additional entries do exist. */
1784 if (no_site_lisp)
1785 {
1786 for (i = 0; i < N_ENV_VARS; i++)
1787 {
1788 if (strcmp (env_vars[i].name, "EMACSLOADPATH") == 0)
1789 {
1790 char *site;
1791 while ((site = strstr (env_vars[i].def_value, "site-lisp")))
1792 env_vars[i].def_value = strchr (site, ';') + 1;
1793 break;
1794 }
1795 }
1796 }
1797
1798#define SET_ENV_BUF_SIZE (4 * MAX_PATH) /* to cover EMACSLOADPATH */ 1782#define SET_ENV_BUF_SIZE (4 * MAX_PATH) /* to cover EMACSLOADPATH */
1799 1783
1800 /* Treat emacs_dir specially: set it unconditionally based on our 1784 /* Treat emacs_dir specially: set it unconditionally based on our
1801 location, if it appears that we are running from the bin subdir 1785 location. */
1802 of a standard installation. */
1803 { 1786 {
1804 char *p; 1787 char *p;
1805 char modname[MAX_PATH]; 1788 char modname[MAX_PATH];
@@ -6618,7 +6601,7 @@ w32_delayed_load (Lisp_Object libraries, Lisp_Object library_id)
6618} 6601}
6619 6602
6620 6603
6621static void 6604void
6622check_windows_init_file (void) 6605check_windows_init_file (void)
6623{ 6606{
6624 /* A common indication that Emacs is not installed properly is when 6607 /* A common indication that Emacs is not installed properly is when
@@ -6630,19 +6613,14 @@ check_windows_init_file (void)
6630 loadup.el. */ 6613 loadup.el. */
6631 && NILP (Vpurify_flag)) 6614 && NILP (Vpurify_flag))
6632 { 6615 {
6633 Lisp_Object objs[2];
6634 Lisp_Object full_load_path;
6635 Lisp_Object init_file; 6616 Lisp_Object init_file;
6636 int fd; 6617 int fd;
6637 6618
6638 objs[0] = Vload_path;
6639 objs[1] = decode_env_path (0, (getenv ("EMACSLOADPATH")));
6640 full_load_path = Fappend (2, objs);
6641 init_file = build_string ("term/w32-win"); 6619 init_file = build_string ("term/w32-win");
6642 fd = openp (full_load_path, init_file, Fget_load_suffixes (), NULL, Qnil); 6620 fd = openp (Vload_path, init_file, Fget_load_suffixes (), NULL, Qnil);
6643 if (fd < 0) 6621 if (fd < 0)
6644 { 6622 {
6645 Lisp_Object load_path_print = Fprin1_to_string (full_load_path, Qnil); 6623 Lisp_Object load_path_print = Fprin1_to_string (Vload_path, Qnil);
6646 char *init_file_name = SDATA (init_file); 6624 char *init_file_name = SDATA (init_file);
6647 char *load_path = SDATA (load_path_print); 6625 char *load_path = SDATA (load_path_print);
6648 char *buffer = alloca (1024 6626 char *buffer = alloca (1024
@@ -6781,9 +6759,6 @@ init_ntproc (void)
6781 /* Reset the volume info cache. */ 6759 /* Reset the volume info cache. */
6782 volume_cache = NULL; 6760 volume_cache = NULL;
6783 } 6761 }
6784
6785 /* Check to see if Emacs has been installed correctly. */
6786 check_windows_init_file ();
6787} 6762}
6788 6763
6789/* 6764/*