diff options
| author | Richard M. Stallman | 1996-10-04 05:08:44 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-10-04 05:08:44 +0000 |
| commit | 213d0b1f8bbaba95ef61bf50ebc1dc63bb4f532f (patch) | |
| tree | b1505d5bc8ffa2011fa50ef4a5ed2f6e7cfccb7e | |
| parent | 477c388f4ba4ccafb6dff77ea4db97bf7fcc9df5 (diff) | |
| download | emacs-213d0b1f8bbaba95ef61bf50ebc1dc63bb4f532f.tar.gz emacs-213d0b1f8bbaba95ef61bf50ebc1dc63bb4f532f.zip | |
(decode_env_path): Add /: to dir names that could be magic.
(init_cmdargs): Add /: to argv[0] if it could be magic.
| -rw-r--r-- | src/emacs.c | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/src/emacs.c b/src/emacs.c index f5dcaf06c66..2bb7ff2038b 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -91,6 +91,8 @@ Lisp_Object Vsystem_configuration; | |||
| 91 | for use when reporting bugs. */ | 91 | for use when reporting bugs. */ |
| 92 | Lisp_Object Vsystem_configuration_options; | 92 | Lisp_Object Vsystem_configuration_options; |
| 93 | 93 | ||
| 94 | Lisp_Object Qfile_name_handler_alist; | ||
| 95 | |||
| 94 | /* If non-zero, emacs should not attempt to use an window-specific code, | 96 | /* If non-zero, emacs should not attempt to use an window-specific code, |
| 95 | but instead should use the virtual terminal under which it was started */ | 97 | but instead should use the virtual terminal under which it was started */ |
| 96 | int inhibit_window_system; | 98 | int inhibit_window_system; |
| @@ -210,13 +212,24 @@ init_cmdargs (argc, argv, skip_args) | |||
| 210 | int skip_args; | 212 | int skip_args; |
| 211 | { | 213 | { |
| 212 | register int i; | 214 | register int i; |
| 213 | Lisp_Object name, dir; | 215 | Lisp_Object name, dir, tem; |
| 216 | int count = specpdl_ptr - specpdl; | ||
| 217 | Lisp_Object raw_name; | ||
| 214 | 218 | ||
| 215 | initial_argv = argv; | 219 | initial_argv = argv; |
| 216 | initial_argc = argc; | 220 | initial_argc = argc; |
| 217 | 221 | ||
| 218 | Vinvocation_name = Ffile_name_nondirectory (build_string (argv[0])); | 222 | raw_name = build_string (argv[0]); |
| 219 | Vinvocation_directory = Ffile_name_directory (build_string (argv[0])); | 223 | |
| 224 | /* Add /: to the front of the name | ||
| 225 | if it would otherwise be treated as magic. */ | ||
| 226 | tem = Ffind_file_name_handler (raw_name, Qt); | ||
| 227 | if (! NILP (tem)) | ||
| 228 | raw_name = concat2 (build_string ("/:"), raw_name); | ||
| 229 | |||
| 230 | Vinvocation_name = Ffile_name_nondirectory (raw_name); | ||
| 231 | Vinvocation_directory = Ffile_name_directory (raw_name); | ||
| 232 | |||
| 220 | /* If we got no directory in argv[0], search PATH to find where | 233 | /* If we got no directory in argv[0], search PATH to find where |
| 221 | Emacs actually came from. */ | 234 | Emacs actually came from. */ |
| 222 | if (NILP (Vinvocation_directory)) | 235 | if (NILP (Vinvocation_directory)) |
| @@ -225,12 +238,20 @@ init_cmdargs (argc, argv, skip_args) | |||
| 225 | int yes = openp (Vexec_path, Vinvocation_name, | 238 | int yes = openp (Vexec_path, Vinvocation_name, |
| 226 | EXEC_SUFFIXES, &found, 1); | 239 | EXEC_SUFFIXES, &found, 1); |
| 227 | if (yes == 1) | 240 | if (yes == 1) |
| 228 | Vinvocation_directory = Ffile_name_directory (found); | 241 | { |
| 242 | /* Add /: to the front of the name | ||
| 243 | if it would otherwise be treated as magic. */ | ||
| 244 | tem = Ffind_file_name_handler (found, Qt); | ||
| 245 | if (! NILP (tem)) | ||
| 246 | found = concat2 (build_string ("/:"), found); | ||
| 247 | Vinvocation_directory = Ffile_name_directory (found); | ||
| 248 | } | ||
| 229 | } | 249 | } |
| 230 | 250 | ||
| 231 | if (!NILP (Vinvocation_directory) | 251 | if (!NILP (Vinvocation_directory) |
| 232 | && NILP (Ffile_name_absolute_p (Vinvocation_directory))) | 252 | && NILP (Ffile_name_absolute_p (Vinvocation_directory))) |
| 233 | /* Emacs was started with relative path, like ./emacs */ | 253 | /* Emacs was started with relative path, like ./emacs. |
| 254 | Make it absolute. */ | ||
| 234 | Vinvocation_directory = Fexpand_file_name (Vinvocation_directory, Qnil); | 255 | Vinvocation_directory = Fexpand_file_name (Vinvocation_directory, Qnil); |
| 235 | 256 | ||
| 236 | Vinstallation_directory = Qnil; | 257 | Vinstallation_directory = Qnil; |
| @@ -298,6 +319,8 @@ init_cmdargs (argc, argv, skip_args) | |||
| 298 | Vcommand_line_args | 319 | Vcommand_line_args |
| 299 | = Fcons (build_string (argv[i]), Vcommand_line_args); | 320 | = Fcons (build_string (argv[i]), Vcommand_line_args); |
| 300 | } | 321 | } |
| 322 | |||
| 323 | unbind_to (count, Qnil); | ||
| 301 | } | 324 | } |
| 302 | 325 | ||
| 303 | DEFUN ("invocation-name", Finvocation_name, Sinvocation_name, 0, 0, 0, | 326 | DEFUN ("invocation-name", Finvocation_name, Sinvocation_name, 0, 0, 0, |
| @@ -1466,8 +1489,7 @@ decode_env_path (evarname, defalt) | |||
| 1466 | char *evarname, *defalt; | 1489 | char *evarname, *defalt; |
| 1467 | { | 1490 | { |
| 1468 | register char *path, *p; | 1491 | register char *path, *p; |
| 1469 | 1492 | Lisp_Object lpath, element, tem; | |
| 1470 | Lisp_Object lpath; | ||
| 1471 | 1493 | ||
| 1472 | /* It's okay to use getenv here, because this function is only used | 1494 | /* It's okay to use getenv here, because this function is only used |
| 1473 | to initialize variables when Emacs starts up, and isn't called | 1495 | to initialize variables when Emacs starts up, and isn't called |
| @@ -1483,9 +1505,16 @@ decode_env_path (evarname, defalt) | |||
| 1483 | { | 1505 | { |
| 1484 | p = index (path, SEPCHAR); | 1506 | p = index (path, SEPCHAR); |
| 1485 | if (!p) p = path + strlen (path); | 1507 | if (!p) p = path + strlen (path); |
| 1486 | lpath = Fcons (p - path ? make_string (path, p - path) | 1508 | element = (p - path ? make_string (path, p - path) |
| 1487 | : build_string ("."), | 1509 | : build_string (".")); |
| 1488 | lpath); | 1510 | |
| 1511 | /* Add /: to the front of the name | ||
| 1512 | if it would otherwise be treated as magic. */ | ||
| 1513 | tem = Ffind_file_name_handler (element, Qt); | ||
| 1514 | if (! NILP (tem)) | ||
| 1515 | element = concat2 (build_string ("/:"), element); | ||
| 1516 | |||
| 1517 | lpath = Fcons (element, lpath); | ||
| 1489 | if (*p) | 1518 | if (*p) |
| 1490 | path = p + 1; | 1519 | path = p + 1; |
| 1491 | else | 1520 | else |
| @@ -1496,6 +1525,9 @@ decode_env_path (evarname, defalt) | |||
| 1496 | 1525 | ||
| 1497 | syms_of_emacs () | 1526 | syms_of_emacs () |
| 1498 | { | 1527 | { |
| 1528 | Qfile_name_handler_alist = intern ("file-name-handler-alist"); | ||
| 1529 | staticpro (&Qfile_name_handler_alist); | ||
| 1530 | |||
| 1499 | #ifndef CANNOT_DUMP | 1531 | #ifndef CANNOT_DUMP |
| 1500 | #ifdef HAVE_SHM | 1532 | #ifdef HAVE_SHM |
| 1501 | defsubr (&Sdump_emacs_data); | 1533 | defsubr (&Sdump_emacs_data); |