diff options
| author | Eli Zaretskii | 2012-08-04 17:17:10 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2012-08-04 17:17:10 +0300 |
| commit | 76151e2ce70d4c0fec8f3dfda62a92e0430528dc (patch) | |
| tree | 82912651eaa2ddbcd79ffe7e46fb3018d9880ad8 /src | |
| parent | a09508f27e7cda2817211ee33a9d55e5575da0a6 (diff) | |
| download | emacs-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')
| -rw-r--r-- | src/ChangeLog | 28 | ||||
| -rw-r--r-- | src/callproc.c | 27 | ||||
| -rw-r--r-- | src/emacs.c | 35 | ||||
| -rw-r--r-- | src/lread.c | 4 | ||||
| -rw-r--r-- | src/w32.c | 51 | ||||
| -rw-r--r-- | src/w32.h | 1 |
6 files changed, 89 insertions, 57 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3de5ad8b5ce..748ccf94004 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,33 @@ | |||
| 1 | 2012-08-04 Eli Zaretskii <eliz@gnu.org> | 1 | 2012-08-04 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | Fix startup warnings about ../site-lisp on MS-Windows. (Bug#11959) | ||
| 4 | * w32.c (init_environment): Change the default values of many | ||
| 5 | environment variables in dflt_envvars[] to NULL, to avoid pushing | ||
| 6 | them into environment when they were not already defined. Remove | ||
| 7 | the code that deletes site-lisp subdirectories from the default | ||
| 8 | value of EMACSLOADPATH, as it is no longer needed. | ||
| 9 | (check_windows_init_file): Now external, not static. Use | ||
| 10 | Vload_path as is, without adding anything, as this function is now | ||
| 11 | called when Vload_path is already set up. | ||
| 12 | |||
| 13 | * w32.h (check_windows_init_file): Add prototype. | ||
| 14 | |||
| 15 | * emacs.c (init_cmdargs) [WINDOWSNT]: When running from the build | ||
| 16 | directory, ignore the /*/i386/ tail in Vinvocation_directory, for | ||
| 17 | compatibility with Posix platforms. | ||
| 18 | (main): Move the call to check_windows_init_file to here from | ||
| 19 | w32.c. | ||
| 20 | (decode_env_path) [WINDOWSNT]: Expand the %emacs_dir%/ prefix, if | ||
| 21 | any, in the DEFALT argument into the root of the Emacs build or | ||
| 22 | installation tree, as appropriate. | ||
| 23 | |||
| 24 | * callproc.c (init_callproc_1): Call decode_env_path instead of | ||
| 25 | doing its equivalent by hand. | ||
| 26 | (init_callproc): Replace DOS_NT condition with MSDOS, thus letting | ||
| 27 | the code that sets Vexec_path run on MS-Windows. | ||
| 28 | |||
| 29 | * lread.c (init_lread): Add comments to #ifdef's. | ||
| 30 | |||
| 3 | * msdos.c (dos_set_window_size, IT_update_begin) | 31 | * msdos.c (dos_set_window_size, IT_update_begin) |
| 4 | (IT_frame_up_to_date, IT_set_frame_parameters): Use FVAR and WVAR | 32 | (IT_frame_up_to_date, IT_set_frame_parameters): Use FVAR and WVAR |
| 5 | instead of direct references. | 33 | 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) | |||
| 1513 | void | 1513 | void |
| 1514 | init_callproc_1 (void) | 1514 | init_callproc_1 (void) |
| 1515 | { | 1515 | { |
| 1516 | char *data_dir = egetenv ("EMACSDATA"); | ||
| 1517 | char *doc_dir = egetenv ("EMACSDOC"); | ||
| 1518 | #ifdef HAVE_NS | 1516 | #ifdef HAVE_NS |
| 1519 | const char *etc_dir = ns_etc_directory (); | 1517 | const char *etc_dir = ns_etc_directory (); |
| 1520 | const char *path_exec = ns_exec_path (); | 1518 | const char *path_exec = ns_exec_path (); |
| 1521 | #endif | 1519 | #endif |
| 1522 | 1520 | ||
| 1523 | Vdata_directory | 1521 | Vdata_directory = decode_env_path ("EMACSDATA", |
| 1524 | = Ffile_name_as_directory (build_string (data_dir ? data_dir | ||
| 1525 | #ifdef HAVE_NS | 1522 | #ifdef HAVE_NS |
| 1526 | : (etc_dir ? etc_dir : PATH_DATA) | 1523 | etc_dir ? etc_dir : |
| 1527 | #else | ||
| 1528 | : PATH_DATA | ||
| 1529 | #endif | 1524 | #endif |
| 1530 | )); | 1525 | PATH_DATA); |
| 1531 | Vdoc_directory | 1526 | Vdata_directory = Ffile_name_as_directory (Fcar (Vdata_directory)); |
| 1532 | = Ffile_name_as_directory (build_string (doc_dir ? doc_dir | 1527 | |
| 1528 | Vdoc_directory = decode_env_path ("EMACSDOC", | ||
| 1533 | #ifdef HAVE_NS | 1529 | #ifdef HAVE_NS |
| 1534 | : (etc_dir ? etc_dir : PATH_DOC) | 1530 | etc_dir ? etc_dir : |
| 1535 | #else | ||
| 1536 | : PATH_DOC | ||
| 1537 | #endif | 1531 | #endif |
| 1538 | )); | 1532 | PATH_DOC); |
| 1533 | Vdoc_directory = Ffile_name_as_directory (Fcar (Vdoc_directory)); | ||
| 1539 | 1534 | ||
| 1540 | /* Check the EMACSPATH environment variable, defaulting to the | 1535 | /* Check the EMACSPATH environment variable, defaulting to the |
| 1541 | PATH_EXEC path from epaths.h. */ | 1536 | PATH_EXEC path from epaths.h. */ |
| @@ -1576,7 +1571,7 @@ init_callproc (void) | |||
| 1576 | Lisp_Object tem; | 1571 | Lisp_Object tem; |
| 1577 | tem = Fexpand_file_name (build_string ("lib-src"), | 1572 | tem = Fexpand_file_name (build_string ("lib-src"), |
| 1578 | Vinstallation_directory); | 1573 | Vinstallation_directory); |
| 1579 | #ifndef DOS_NT | 1574 | #ifndef MSDOS |
| 1580 | /* MSDOS uses wrapped binaries, so don't do this. */ | 1575 | /* MSDOS uses wrapped binaries, so don't do this. */ |
| 1581 | if (NILP (Fmember (tem, Vexec_path))) | 1576 | if (NILP (Fmember (tem, Vexec_path))) |
| 1582 | { | 1577 | { |
| @@ -1593,7 +1588,7 @@ init_callproc (void) | |||
| 1593 | } | 1588 | } |
| 1594 | 1589 | ||
| 1595 | Vexec_directory = Ffile_name_as_directory (tem); | 1590 | Vexec_directory = Ffile_name_as_directory (tem); |
| 1596 | #endif /* not DOS_NT */ | 1591 | #endif /* not MSDOS */ |
| 1597 | 1592 | ||
| 1598 | /* Maybe use ../etc as well as ../lib-src. */ | 1593 | /* Maybe use ../etc as well as ../lib-src. */ |
| 1599 | if (data_dir == 0) | 1594 | 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) | |||
| 422 | if (!NILP (Vinvocation_directory)) | 422 | if (!NILP (Vinvocation_directory)) |
| 423 | { | 423 | { |
| 424 | dir = Vinvocation_directory; | 424 | dir = Vinvocation_directory; |
| 425 | #ifdef WINDOWSNT | ||
| 426 | /* If we are running from the build directory, set DIR to the | ||
| 427 | src subdirectory of the Emacs tree, like on Posix | ||
| 428 | platforms. */ | ||
| 429 | if (SBYTES (dir) > sizeof ("/i386/") - 1 | ||
| 430 | && 0 == strcmp (SSDATA (dir) + SBYTES (dir) - sizeof ("/i386/") + 1, | ||
| 431 | "/i386/")) | ||
| 432 | dir = Fexpand_file_name (build_string ("../.."), dir); | ||
| 433 | #else /* !WINDOWSNT */ | ||
| 434 | #endif | ||
| 425 | name = Fexpand_file_name (Vinvocation_name, dir); | 435 | name = Fexpand_file_name (Vinvocation_name, dir); |
| 426 | while (1) | 436 | while (1) |
| 427 | { | 437 | { |
| @@ -1434,6 +1444,10 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1434 | 1444 | ||
| 1435 | init_callproc (); /* Must follow init_cmdargs but not init_sys_modes. */ | 1445 | init_callproc (); /* Must follow init_cmdargs but not init_sys_modes. */ |
| 1436 | init_lread (); | 1446 | init_lread (); |
| 1447 | #ifdef WINDOWSNT | ||
| 1448 | /* Check to see if Emacs has been installed correctly. */ | ||
| 1449 | check_windows_init_file (); | ||
| 1450 | #endif | ||
| 1437 | 1451 | ||
| 1438 | /* Intern the names of all standard functions and variables; | 1452 | /* Intern the names of all standard functions and variables; |
| 1439 | define standard keys. */ | 1453 | define standard keys. */ |
| @@ -2228,6 +2242,12 @@ decode_env_path (const char *evarname, const char *defalt) | |||
| 2228 | { | 2242 | { |
| 2229 | const char *path, *p; | 2243 | const char *path, *p; |
| 2230 | Lisp_Object lpath, element, tem; | 2244 | Lisp_Object lpath, element, tem; |
| 2245 | int defaulted = 0; | ||
| 2246 | #ifdef WINDOWSNT | ||
| 2247 | const char *emacs_dir = egetenv ("emacs_dir"); | ||
| 2248 | static const char *emacs_dir_env = "%emacs_dir%/"; | ||
| 2249 | const size_t emacs_dir_len = strlen (emacs_dir_env); | ||
| 2250 | #endif | ||
| 2231 | 2251 | ||
| 2232 | /* It's okay to use getenv here, because this function is only used | 2252 | /* It's okay to use getenv here, because this function is only used |
| 2233 | to initialize variables when Emacs starts up, and isn't called | 2253 | to initialize variables when Emacs starts up, and isn't called |
| @@ -2237,7 +2257,10 @@ decode_env_path (const char *evarname, const char *defalt) | |||
| 2237 | else | 2257 | else |
| 2238 | path = 0; | 2258 | path = 0; |
| 2239 | if (!path) | 2259 | if (!path) |
| 2240 | path = defalt; | 2260 | { |
| 2261 | path = defalt; | ||
| 2262 | defaulted = 1; | ||
| 2263 | } | ||
| 2241 | #ifdef DOS_NT | 2264 | #ifdef DOS_NT |
| 2242 | /* Ensure values from the environment use the proper directory separator. */ | 2265 | /* Ensure values from the environment use the proper directory separator. */ |
| 2243 | if (path) | 2266 | if (path) |
| @@ -2256,6 +2279,16 @@ decode_env_path (const char *evarname, const char *defalt) | |||
| 2256 | p = path + strlen (path); | 2279 | p = path + strlen (path); |
| 2257 | element = (p - path ? make_string (path, p - path) | 2280 | element = (p - path ? make_string (path, p - path) |
| 2258 | : build_string (".")); | 2281 | : build_string (".")); |
| 2282 | #ifdef WINDOWSNT | ||
| 2283 | /* Relative file names in the default path are interpreted as | ||
| 2284 | being relative to $emacs_dir. */ | ||
| 2285 | if (emacs_dir && defaulted | ||
| 2286 | && strncmp (path, emacs_dir_env, emacs_dir_len) == 0) | ||
| 2287 | element = Fexpand_file_name (Fsubstring (element, | ||
| 2288 | make_number (emacs_dir_len), | ||
| 2289 | Qnil), | ||
| 2290 | build_string (emacs_dir)); | ||
| 2291 | #endif | ||
| 2259 | 2292 | ||
| 2260 | /* Add /: to the front of the name | 2293 | /* Add /: to the front of the name |
| 2261 | if it would otherwise be treated as magic. */ | 2294 | 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) | |||
| 4131 | sitelisp = decode_env_path (0, PATH_SITELOADSEARCH); | 4131 | sitelisp = decode_env_path (0, PATH_SITELOADSEARCH); |
| 4132 | if (! NILP (sitelisp)) Vload_path = nconc2 (sitelisp, Vload_path); | 4132 | if (! NILP (sitelisp)) Vload_path = nconc2 (sitelisp, Vload_path); |
| 4133 | } | 4133 | } |
| 4134 | #else | 4134 | #else /* !CANNOT_DUMP */ |
| 4135 | if (NILP (Vpurify_flag)) | 4135 | if (NILP (Vpurify_flag)) |
| 4136 | { | 4136 | { |
| 4137 | normal = PATH_LOADSEARCH; | 4137 | normal = PATH_LOADSEARCH; |
| @@ -4293,7 +4293,7 @@ init_lread (void) | |||
| 4293 | be missing unless something went extremely (and improbably) | 4293 | be missing unless something went extremely (and improbably) |
| 4294 | wrong, in which case the build will fail in obvious ways. */ | 4294 | wrong, in which case the build will fail in obvious ways. */ |
| 4295 | } | 4295 | } |
| 4296 | #endif /* CANNOT_DUMP */ | 4296 | #endif /* !CANNOT_DUMP */ |
| 4297 | 4297 | ||
| 4298 | Vvalues = Qnil; | 4298 | Vvalues = Qnil; |
| 4299 | 4299 | ||
| @@ -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 | ||
| 6621 | static void | 6604 | void |
| 6622 | check_windows_init_file (void) | 6605 | check_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 | /* |
| @@ -140,6 +140,7 @@ extern void syms_of_w32menu (void); | |||
| 140 | extern void globals_of_w32menu (void); | 140 | extern void globals_of_w32menu (void); |
| 141 | extern void syms_of_fontset (void); | 141 | extern void syms_of_fontset (void); |
| 142 | extern void syms_of_w32font (void); | 142 | extern void syms_of_w32font (void); |
| 143 | extern void check_windows_init_file (void); | ||
| 143 | 144 | ||
| 144 | extern int _sys_read_ahead (int fd); | 145 | extern int _sys_read_ahead (int fd); |
| 145 | extern int _sys_wait_accept (int fd); | 146 | extern int _sys_wait_accept (int fd); |