diff options
| author | Eli Zaretskii | 2013-04-15 16:39:41 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-04-15 16:39:41 +0300 |
| commit | 7d9fb4de782c3ff316c6ffc26f6ea291be2f653b (patch) | |
| tree | 384f50c67bf57e887e0e2c33dbb0c807ceccda5d | |
| parent | eb7a410c147507ffdf0e84d163a014acb82b19a2 (diff) | |
| download | emacs-7d9fb4de782c3ff316c6ffc26f6ea291be2f653b.tar.gz emacs-7d9fb4de782c3ff316c6ffc26f6ea291be2f653b.zip | |
Fixed problems with default paths and with shell-file-name.
| -rw-r--r-- | nt/Makefile.in | 2 | ||||
| -rw-r--r-- | nt/addpm.c | 17 | ||||
| -rw-r--r-- | nt/makefile.w32-in | 2 | ||||
| -rw-r--r-- | src/w32.c | 67 |
4 files changed, 82 insertions, 6 deletions
diff --git a/nt/Makefile.in b/nt/Makefile.in index 0f7b3463d42..7085a5c0595 100644 --- a/nt/Makefile.in +++ b/nt/Makefile.in | |||
| @@ -195,7 +195,7 @@ TAGS: ${EXE_FILES:${EXEEXT}=.c} | |||
| 195 | addsection${EXEEXT}: ${srcdir}/addsection.c | 195 | addsection${EXEEXT}: ${srcdir}/addsection.c |
| 196 | $(CC) ${ALL_CFLAGS} ${srcdir}/addsection.c -o addsection${EXEEXT} | 196 | $(CC) ${ALL_CFLAGS} ${srcdir}/addsection.c -o addsection${EXEEXT} |
| 197 | 197 | ||
| 198 | addpm${EXEEXT}: ${srcdir}/addpm.c | 198 | addpm${EXEEXT}: ${srcdir}/addpm.c ${srcdir}/../src/epaths.h |
| 199 | $(CC) ${ALL_CFLAGS} ${srcdir}/addpm.c $(LIBS_ADDPM) -o addpm${EXEEXT} | 199 | $(CC) ${ALL_CFLAGS} ${srcdir}/addpm.c $(LIBS_ADDPM) -o addpm${EXEEXT} |
| 200 | 200 | ||
| 201 | ddeclient${EXEEXT}: ${srcdir}/ddeclient.c | 201 | ddeclient${EXEEXT}: ${srcdir}/ddeclient.c |
diff --git a/nt/addpm.c b/nt/addpm.c index 688e0167334..48c77821c8c 100644 --- a/nt/addpm.c +++ b/nt/addpm.c | |||
| @@ -50,6 +50,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 50 | #include <shlobj.h> | 50 | #include <shlobj.h> |
| 51 | #include <ddeml.h> | 51 | #include <ddeml.h> |
| 52 | 52 | ||
| 53 | #ifndef OLD_PATHS | ||
| 54 | #include "../src/epaths.h" | ||
| 55 | #endif | ||
| 56 | |||
| 53 | HDDEDATA CALLBACK | 57 | HDDEDATA CALLBACK |
| 54 | DdeCallback (UINT uType, UINT uFmt, HCONV hconv, | 58 | DdeCallback (UINT uType, UINT uFmt, HCONV hconv, |
| 55 | HSZ hsz1, HSZ hsz2, HDDEDATA hdata, | 59 | HSZ hsz1, HSZ hsz2, HDDEDATA hdata, |
| @@ -76,6 +80,7 @@ static struct entry | |||
| 76 | } | 80 | } |
| 77 | env_vars[] = | 81 | env_vars[] = |
| 78 | { | 82 | { |
| 83 | #ifdef OLD_PATHS | ||
| 79 | {"emacs_dir", NULL}, | 84 | {"emacs_dir", NULL}, |
| 80 | {"EMACSLOADPATH", "%emacs_dir%/site-lisp;%emacs_dir%/../site-lisp;%emacs_dir%/lisp;%emacs_dir%/leim"}, | 85 | {"EMACSLOADPATH", "%emacs_dir%/site-lisp;%emacs_dir%/../site-lisp;%emacs_dir%/lisp;%emacs_dir%/leim"}, |
| 81 | {"SHELL", "%emacs_dir%/bin/cmdproxy.exe"}, | 86 | {"SHELL", "%emacs_dir%/bin/cmdproxy.exe"}, |
| @@ -86,6 +91,18 @@ env_vars[] = | |||
| 86 | /* {"INFOPATH", "%emacs_dir%/info"}, */ | 91 | /* {"INFOPATH", "%emacs_dir%/info"}, */ |
| 87 | {"EMACSDOC", "%emacs_dir%/etc"}, | 92 | {"EMACSDOC", "%emacs_dir%/etc"}, |
| 88 | {"TERM", "cmd"} | 93 | {"TERM", "cmd"} |
| 94 | #else /* !OLD_PATHS */ | ||
| 95 | {"emacs_dir", NULL}, | ||
| 96 | {"EMACSLOADPATH", PATH_SITELOADSEARCH ";" PATH_LOADSEARCH}, | ||
| 97 | {"SHELL", PATH_EXEC "/cmdproxy.exe"}, | ||
| 98 | {"EMACSDATA", PATH_DATA}, | ||
| 99 | {"EMACSPATH", PATH_EXEC}, | ||
| 100 | /* We no longer set INFOPATH because Info-default-directory-list | ||
| 101 | is then ignored. */ | ||
| 102 | /* {"INFOPATH", "%emacs_dir%/info"}, */ | ||
| 103 | {"EMACSDOC", PATH_DOC}, | ||
| 104 | {"TERM", "cmd"} | ||
| 105 | #endif | ||
| 89 | }; | 106 | }; |
| 90 | 107 | ||
| 91 | BOOL | 108 | BOOL |
diff --git a/nt/makefile.w32-in b/nt/makefile.w32-in index d3e1c8e2228..0c2f6324188 100644 --- a/nt/makefile.w32-in +++ b/nt/makefile.w32-in | |||
| @@ -29,6 +29,8 @@ TMP_DIST_DIR = emacs-$(VERSION) | |||
| 29 | TRES = $(BLD)/emacs.res | 29 | TRES = $(BLD)/emacs.res |
| 30 | CLIENTRES = $(BLD)/emacsclient.res | 30 | CLIENTRES = $(BLD)/emacsclient.res |
| 31 | 31 | ||
| 32 | LOCAL_FLAGS = -DOLD_PATHS=1 | ||
| 33 | |||
| 32 | XMFLAGS = | 34 | XMFLAGS = |
| 33 | 35 | ||
| 34 | ALL = $(BLD)/addpm.exe $(BLD)/ddeclient.exe $(BLD)/runemacs.exe \ | 36 | ALL = $(BLD)/addpm.exe $(BLD)/ddeclient.exe $(BLD)/runemacs.exe \ |
| @@ -65,6 +65,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 65 | #undef localtime | 65 | #undef localtime |
| 66 | 66 | ||
| 67 | #include "lisp.h" | 67 | #include "lisp.h" |
| 68 | #include "epaths.h" /* for SHELL */ | ||
| 68 | 69 | ||
| 69 | #include <pwd.h> | 70 | #include <pwd.h> |
| 70 | #include <grp.h> | 71 | #include <grp.h> |
| @@ -2018,7 +2019,7 @@ init_environment (char ** argv) | |||
| 2018 | {"PRELOAD_WINSOCK", NULL}, | 2019 | {"PRELOAD_WINSOCK", NULL}, |
| 2019 | {"emacs_dir", "C:/emacs"}, | 2020 | {"emacs_dir", "C:/emacs"}, |
| 2020 | {"EMACSLOADPATH", NULL}, | 2021 | {"EMACSLOADPATH", NULL}, |
| 2021 | {"SHELL", "%emacs_dir%/bin/cmdproxy.exe"}, | 2022 | {"SHELL", "cmdproxy.exe"}, /* perhaps it is somewhere on PATH */ |
| 2022 | {"EMACSDATA", NULL}, | 2023 | {"EMACSDATA", NULL}, |
| 2023 | {"EMACSPATH", NULL}, | 2024 | {"EMACSPATH", NULL}, |
| 2024 | {"INFOPATH", NULL}, | 2025 | {"INFOPATH", NULL}, |
| @@ -2094,9 +2095,12 @@ init_environment (char ** argv) | |||
| 2094 | emacs_abort (); | 2095 | emacs_abort (); |
| 2095 | *p = 0; | 2096 | *p = 0; |
| 2096 | 2097 | ||
| 2097 | if ((p = _mbsrchr (modname, '\\')) && xstrcasecmp (p, "\\bin") == 0) | 2098 | if ((p = _mbsrchr (modname, '\\')) |
| 2099 | /* From bin means installed Emacs, from src means uninstalled. */ | ||
| 2100 | && (xstrcasecmp (p, "\\bin") == 0 || xstrcasecmp (p, "\\src") == 0)) | ||
| 2098 | { | 2101 | { |
| 2099 | char buf[SET_ENV_BUF_SIZE]; | 2102 | char buf[SET_ENV_BUF_SIZE]; |
| 2103 | int within_build_tree = xstrcasecmp (p, "\\src") == 0; | ||
| 2100 | 2104 | ||
| 2101 | *p = 0; | 2105 | *p = 0; |
| 2102 | for (p = modname; *p; p = CharNext (p)) | 2106 | for (p = modname; *p; p = CharNext (p)) |
| @@ -2104,6 +2108,15 @@ init_environment (char ** argv) | |||
| 2104 | 2108 | ||
| 2105 | _snprintf (buf, sizeof (buf)-1, "emacs_dir=%s", modname); | 2109 | _snprintf (buf, sizeof (buf)-1, "emacs_dir=%s", modname); |
| 2106 | _putenv (strdup (buf)); | 2110 | _putenv (strdup (buf)); |
| 2111 | /* If we are running from the Posix-like build tree, define | ||
| 2112 | SHELL to point to our own cmdproxy. The loop below will | ||
| 2113 | then disregard PATH_EXEC and the default value. */ | ||
| 2114 | if (within_build_tree) | ||
| 2115 | { | ||
| 2116 | _snprintf (buf, sizeof (buf) - 1, | ||
| 2117 | "SHELL=%s/nt/cmdproxy.exe", modname); | ||
| 2118 | _putenv (strdup (buf)); | ||
| 2119 | } | ||
| 2107 | } | 2120 | } |
| 2108 | /* Handle running emacs from the build directory: src/oo-spd/i386/ */ | 2121 | /* Handle running emacs from the build directory: src/oo-spd/i386/ */ |
| 2109 | 2122 | ||
| @@ -2139,16 +2152,60 @@ init_environment (char ** argv) | |||
| 2139 | if (!getenv (env_vars[i].name)) | 2152 | if (!getenv (env_vars[i].name)) |
| 2140 | { | 2153 | { |
| 2141 | int dont_free = 0; | 2154 | int dont_free = 0; |
| 2155 | char bufc[SET_ENV_BUF_SIZE]; | ||
| 2142 | 2156 | ||
| 2143 | if ((lpval = w32_get_resource (env_vars[i].name, &dwType)) == NULL | 2157 | if ((lpval = w32_get_resource (env_vars[i].name, &dwType)) == NULL |
| 2144 | /* Also ignore empty environment variables. */ | 2158 | /* Also ignore empty environment variables. */ |
| 2145 | || *lpval == 0) | 2159 | || *lpval == 0) |
| 2146 | { | 2160 | { |
| 2147 | xfree (lpval); | 2161 | xfree (lpval); |
| 2148 | lpval = env_vars[i].def_value; | ||
| 2149 | dwType = REG_EXPAND_SZ; | ||
| 2150 | dont_free = 1; | 2162 | dont_free = 1; |
| 2151 | if (!strcmp (env_vars[i].name, "HOME") && !appdata) | 2163 | if (strcmp (env_vars[i].name, "SHELL") == 0) |
| 2164 | { | ||
| 2165 | /* Look for cmdproxy.exe in every directory in | ||
| 2166 | PATH_EXEC. FIXME: This does not find cmdproxy | ||
| 2167 | in nt/ when we run uninstalled. */ | ||
| 2168 | char fname[MAX_PATH]; | ||
| 2169 | const char *pstart = PATH_EXEC, *pend; | ||
| 2170 | |||
| 2171 | do { | ||
| 2172 | pend = _mbschr (pstart, ';'); | ||
| 2173 | if (!pend) | ||
| 2174 | pend = pstart + strlen (pstart); | ||
| 2175 | /* Be defensive against series of ;;; characters. */ | ||
| 2176 | if (pend > pstart) | ||
| 2177 | { | ||
| 2178 | strncpy (fname, pstart, pend - pstart); | ||
| 2179 | fname[pend - pstart] = '/'; | ||
| 2180 | strcpy (&fname[pend - pstart + 1], "cmdproxy.exe"); | ||
| 2181 | ExpandEnvironmentStrings ((LPSTR) fname, bufc, | ||
| 2182 | sizeof (bufc)); | ||
| 2183 | if (check_existing (bufc)) | ||
| 2184 | { | ||
| 2185 | lpval = bufc; | ||
| 2186 | dwType = REG_SZ; | ||
| 2187 | break; | ||
| 2188 | } | ||
| 2189 | } | ||
| 2190 | if (*pend) | ||
| 2191 | pstart = pend + 1; | ||
| 2192 | else | ||
| 2193 | pstart = pend; | ||
| 2194 | if (!*pstart) | ||
| 2195 | { | ||
| 2196 | /* If not found in any directory, use the | ||
| 2197 | default as the last resort. */ | ||
| 2198 | lpval = env_vars[i].def_value; | ||
| 2199 | dwType = REG_EXPAND_SZ; | ||
| 2200 | } | ||
| 2201 | } while (*pstart); | ||
| 2202 | } | ||
| 2203 | else | ||
| 2204 | { | ||
| 2205 | lpval = env_vars[i].def_value; | ||
| 2206 | dwType = REG_EXPAND_SZ; | ||
| 2207 | } | ||
| 2208 | if (strcmp (env_vars[i].name, "HOME") == 0 && !appdata) | ||
| 2152 | Vdelayed_warnings_list | 2209 | Vdelayed_warnings_list |
| 2153 | = Fcons (listn (CONSTYPE_HEAP, 2, | 2210 | = Fcons (listn (CONSTYPE_HEAP, 2, |
| 2154 | intern ("initialization"), | 2211 | intern ("initialization"), |