diff options
| author | Jim Blandy | 1992-01-14 08:05:08 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-01-14 08:05:08 +0000 |
| commit | efb859b44a15047011d1687933da6a31a43cc30a (patch) | |
| tree | 5495cd790f55c8b9dbde4190c959d026e9157f15 /src | |
| parent | 2798dedf7cb4bbeba6091c443dc64edf0953da18 (diff) | |
| download | emacs-efb859b44a15047011d1687933da6a31a43cc30a.tar.gz emacs-efb859b44a15047011d1687933da6a31a43cc30a.zip | |
*** empty log message ***
Diffstat (limited to 'src')
| -rw-r--r-- | src/callproc.c | 96 | ||||
| -rw-r--r-- | src/config.in | 131 | ||||
| -rw-r--r-- | src/dispnew.c | 107 | ||||
| -rw-r--r-- | src/lisp.h | 22 |
4 files changed, 162 insertions, 194 deletions
diff --git a/src/callproc.c b/src/callproc.c index 11b5c7c4089..e033a8bf018 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -61,12 +61,7 @@ Lisp_Object Vexec_path, Vexec_directory, Vdata_directory; | |||
| 61 | 61 | ||
| 62 | Lisp_Object Vshell_file_name; | 62 | Lisp_Object Vshell_file_name; |
| 63 | 63 | ||
| 64 | #ifndef MAINTAIN_ENVIRONMENT | ||
| 65 | /* List of strings to append to front of environment of | ||
| 66 | all subprocesses when they are started. */ | ||
| 67 | |||
| 68 | Lisp_Object Vprocess_environment; | 64 | Lisp_Object Vprocess_environment; |
| 69 | #endif | ||
| 70 | 65 | ||
| 71 | /* True iff we are about to fork off a synchronous process or if we | 66 | /* True iff we are about to fork off a synchronous process or if we |
| 72 | are waiting for it. */ | 67 | are waiting for it. */ |
| @@ -123,7 +118,7 @@ If you quit, the process is killed with SIGKILL.") | |||
| 123 | #endif | 118 | #endif |
| 124 | CHECK_STRING (args[0], 0); | 119 | CHECK_STRING (args[0], 0); |
| 125 | 120 | ||
| 126 | if (nargs <= 1 || NULL (args[1])) | 121 | if (nargs <= 1 || NILP (args[1])) |
| 127 | args[1] = build_string ("/dev/null"); | 122 | args[1] = build_string ("/dev/null"); |
| 128 | else | 123 | else |
| 129 | args[1] = Fexpand_file_name (args[1], current_buffer->directory); | 124 | args[1] = Fexpand_file_name (args[1], current_buffer->directory); |
| @@ -164,7 +159,7 @@ If you quit, the process is killed with SIGKILL.") | |||
| 164 | } | 159 | } |
| 165 | /* Search for program; barf if not found. */ | 160 | /* Search for program; barf if not found. */ |
| 166 | openp (Vexec_path, args[0], "", &path, 1); | 161 | openp (Vexec_path, args[0], "", &path, 1); |
| 167 | if (NULL (path)) | 162 | if (NILP (path)) |
| 168 | { | 163 | { |
| 169 | close (filefd); | 164 | close (filefd); |
| 170 | report_file_error ("Searching for program", Fcons (args[0], Qnil)); | 165 | report_file_error ("Searching for program", Fcons (args[0], Qnil)); |
| @@ -189,12 +184,7 @@ If you quit, the process is killed with SIGKILL.") | |||
| 189 | register int fd1 = fd[1]; | 184 | register int fd1 = fd[1]; |
| 190 | char **env; | 185 | char **env; |
| 191 | 186 | ||
| 192 | #ifdef MAINTAIN_ENVIRONMENT | ||
| 193 | env = (char **) alloca (size_of_current_environ ()); | ||
| 194 | get_current_environ (env); | ||
| 195 | #else | ||
| 196 | env = environ; | 187 | env = environ; |
| 197 | #endif /* MAINTAIN_ENVIRONMENT */ | ||
| 198 | 188 | ||
| 199 | #if 0 /* Some systems don't have sigblock. */ | 189 | #if 0 /* Some systems don't have sigblock. */ |
| 200 | mask = sigblock (sigmask (SIGCHLD)); | 190 | mask = sigblock (sigmask (SIGCHLD)); |
| @@ -260,9 +250,9 @@ If you quit, the process is killed with SIGKILL.") | |||
| 260 | while ((nread = read (fd[0], buf, sizeof buf)) > 0) | 250 | while ((nread = read (fd[0], buf, sizeof buf)) > 0) |
| 261 | { | 251 | { |
| 262 | immediate_quit = 0; | 252 | immediate_quit = 0; |
| 263 | if (!NULL (buffer)) | 253 | if (!NILP (buffer)) |
| 264 | insert (buf, nread); | 254 | insert (buf, nread); |
| 265 | if (!NULL (display) && INTERACTIVE) | 255 | if (!NILP (display) && INTERACTIVE) |
| 266 | redisplay_preserve_echo_area (); | 256 | redisplay_preserve_echo_area (); |
| 267 | immediate_quit = 1; | 257 | immediate_quit = 1; |
| 268 | QUIT; | 258 | QUIT; |
| @@ -324,7 +314,7 @@ If you quit, the process is killed with SIGKILL.") | |||
| 324 | Fwrite_region (start, end, filename_string, Qnil, Qlambda); | 314 | Fwrite_region (start, end, filename_string, Qnil, Qlambda); |
| 325 | record_unwind_protect (delete_temp_file, filename_string); | 315 | record_unwind_protect (delete_temp_file, filename_string); |
| 326 | 316 | ||
| 327 | if (!NULL (args[3])) | 317 | if (!NILP (args[3])) |
| 328 | Fdelete_region (start, end); | 318 | Fdelete_region (start, end); |
| 329 | 319 | ||
| 330 | args[3] = filename_string; | 320 | args[3] = filename_string; |
| @@ -387,7 +377,6 @@ child_setup (in, out, err, new_argv, env, set_pgrp) | |||
| 387 | Fcons (current_buffer->directory, Qnil)); | 377 | Fcons (current_buffer->directory, Qnil)); |
| 388 | } | 378 | } |
| 389 | 379 | ||
| 390 | #ifndef MAINTAIN_ENVIRONMENT | ||
| 391 | /* Set `env' to a vector of the strings in Vprocess_environment. */ | 380 | /* Set `env' to a vector of the strings in Vprocess_environment. */ |
| 392 | { | 381 | { |
| 393 | register Lisp_Object tem; | 382 | register Lisp_Object tem; |
| @@ -412,7 +401,6 @@ child_setup (in, out, err, new_argv, env, set_pgrp) | |||
| 412 | *new_env++ = (char *) XSTRING (XCONS (tem)->car)->data; | 401 | *new_env++ = (char *) XSTRING (XCONS (tem)->car)->data; |
| 413 | *new_env = 0; | 402 | *new_env = 0; |
| 414 | } | 403 | } |
| 415 | #endif /* Not MAINTAIN_ENVIRONMENT */ | ||
| 416 | 404 | ||
| 417 | close (0); | 405 | close (0); |
| 418 | close (1); | 406 | close (1); |
| @@ -442,6 +430,65 @@ child_setup (in, out, err, new_argv, env, set_pgrp) | |||
| 442 | _exit (1); | 430 | _exit (1); |
| 443 | } | 431 | } |
| 444 | 432 | ||
| 433 | static int | ||
| 434 | getenv_internal (var, varlen, value, valuelen) | ||
| 435 | char *var; | ||
| 436 | int varlen; | ||
| 437 | char **value; | ||
| 438 | int **valuelen; | ||
| 439 | { | ||
| 440 | Lisp_Object scan; | ||
| 441 | |||
| 442 | for (scan = Vprocess_environment; CONSP (scan); scan = XCONS (scan)->cdr) | ||
| 443 | { | ||
| 444 | Lisp_Object entry = XCONS (scan)->car; | ||
| 445 | |||
| 446 | if (XTYPE (entry) == Lisp_String | ||
| 447 | && XSTRING (entry)->size > varlen | ||
| 448 | && XSTRING (entry)->data[varlen] == '=' | ||
| 449 | && ! bcmp (XSTRING (entry)->data, var, varlen)) | ||
| 450 | { | ||
| 451 | *value = XSTRING (entry)->data + (varlen + 1); | ||
| 452 | *valuelen = XSTRING (entry)->size - (varlen + 1); | ||
| 453 | return 1; | ||
| 454 | } | ||
| 455 | } | ||
| 456 | |||
| 457 | return 0; | ||
| 458 | } | ||
| 459 | |||
| 460 | DEFUN ("getenv", Fgetenv, Sgetenv, 1, 2, 0, | ||
| 461 | "Return the value of environment variable VAR, as a string.\n\ | ||
| 462 | VAR should be a string. Value is nil if VAR is undefined in the environment.\n\ | ||
| 463 | This function consults the variable ``process-environment'' for its value.") | ||
| 464 | (var) | ||
| 465 | Lisp_Object var; | ||
| 466 | { | ||
| 467 | char *value; | ||
| 468 | int valuelen; | ||
| 469 | |||
| 470 | CHECK_STRING (var, 0); | ||
| 471 | if (getenv_internal (XSTRING (var)->data, XSTRING (var)->size, | ||
| 472 | &value, &valuelen)) | ||
| 473 | return make_string (value, valuelen); | ||
| 474 | else | ||
| 475 | return Qnil; | ||
| 476 | } | ||
| 477 | |||
| 478 | /* A version of getenv that consults process_environment, easily | ||
| 479 | callable from C. */ | ||
| 480 | char * | ||
| 481 | egetenv (var) | ||
| 482 | { | ||
| 483 | char *value; | ||
| 484 | int valuelen; | ||
| 485 | |||
| 486 | if (getenv_internal (var, strlen (var), &value, &valuelen)) | ||
| 487 | return value; | ||
| 488 | else | ||
| 489 | return 0; | ||
| 490 | } | ||
| 491 | |||
| 445 | #endif /* not VMS */ | 492 | #endif /* not VMS */ |
| 446 | 493 | ||
| 447 | init_callproc () | 494 | init_callproc () |
| @@ -477,13 +524,10 @@ init_callproc () | |||
| 477 | #ifdef VMS | 524 | #ifdef VMS |
| 478 | Vshell_file_name = build_string ("*dcl*"); | 525 | Vshell_file_name = build_string ("*dcl*"); |
| 479 | #else | 526 | #else |
| 480 | sh = (char *) egetenv ("SHELL"); | 527 | sh = (char *) getenv ("SHELL"); |
| 481 | Vshell_file_name = build_string (sh ? sh : "/bin/sh"); | 528 | Vshell_file_name = build_string (sh ? sh : "/bin/sh"); |
| 482 | #endif | 529 | #endif |
| 483 | 530 | ||
| 484 | #ifndef MAINTAIN_ENVIRONMENT | ||
| 485 | /* The equivalent of this operation was done | ||
| 486 | in init_environ in environ.c if MAINTAIN_ENVIRONMENT */ | ||
| 487 | Vprocess_environment = Qnil; | 531 | Vprocess_environment = Qnil; |
| 488 | #ifndef CANNOT_DUMP | 532 | #ifndef CANNOT_DUMP |
| 489 | if (initialized) | 533 | if (initialized) |
| @@ -491,7 +535,6 @@ init_callproc () | |||
| 491 | for (envp = environ; *envp; envp++) | 535 | for (envp = environ; *envp; envp++) |
| 492 | Vprocess_environment = Fcons (build_string (*envp), | 536 | Vprocess_environment = Fcons (build_string (*envp), |
| 493 | Vprocess_environment); | 537 | Vprocess_environment); |
| 494 | #endif /* MAINTAIN_ENVIRONMENT */ | ||
| 495 | } | 538 | } |
| 496 | 539 | ||
| 497 | syms_of_callproc () | 540 | syms_of_callproc () |
| @@ -512,14 +555,15 @@ especially executable programs intended for Emacs to invoke."); | |||
| 512 | "Directory of architecture-independent files that come with GNU Emacs,\n\ | 555 | "Directory of architecture-independent files that come with GNU Emacs,\n\ |
| 513 | intended for Emacs to use."); | 556 | intended for Emacs to use."); |
| 514 | 557 | ||
| 515 | #ifndef MAINTAIN_ENVIRONMENT | ||
| 516 | DEFVAR_LISP ("process-environment", &Vprocess_environment, | 558 | DEFVAR_LISP ("process-environment", &Vprocess_environment, |
| 517 | "List of strings to append to environment of subprocesses that are started.\n\ | 559 | "List of environment variables for subprocesses to inherit.\n\ |
| 518 | Each string should have the format ENVVARNAME=VALUE."); | 560 | Each element should be a string of the form ENVVARNAME=VALUE.\n\ |
| 519 | #endif | 561 | The environment which Emacs inherits is placed in this variable\n\ |
| 562 | when Emacs starts."); | ||
| 520 | 563 | ||
| 521 | #ifndef VMS | 564 | #ifndef VMS |
| 522 | defsubr (&Scall_process); | 565 | defsubr (&Scall_process); |
| 523 | #endif | 566 | #endif |
| 567 | defsubr (&Sgetenv); | ||
| 524 | defsubr (&Scall_process_region); | 568 | defsubr (&Scall_process_region); |
| 525 | } | 569 | } |
diff --git a/src/config.in b/src/config.in index 8ce2a9a0318..f4d53973939 100644 --- a/src/config.in +++ b/src/config.in | |||
| @@ -20,62 +20,21 @@ and this notice must be preserved on all copies. */ | |||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | /* The configuration script links system.h to a s- file that describes | ||
| 24 | the system type you are using. | ||
| 25 | See the file ../share-lib/MACHINES for a list of systems and | ||
| 26 | the names of the s- files to use for them. | ||
| 27 | See s-template.h for documentation on writing s- files. */ | ||
| 28 | #include "@opsystem@" | ||
| 29 | |||
| 30 | /* The configuration script links machine.h to a m- file that | ||
| 31 | describes the machine and system you use. | ||
| 32 | See the file ../share-lib/MACHINES for a list of machines and | ||
| 33 | the names of the m- files to use for them. | ||
| 34 | See m-template.h for info on what m- files should define. */ | ||
| 35 | #include "@machine@" | ||
| 36 | |||
| 37 | /* Load in the conversion definitions if this system | ||
| 38 | needs them and the source file being compiled has not | ||
| 39 | said to inhibit this. There should be no need for you | ||
| 40 | to alter these lines. */ | ||
| 41 | |||
| 42 | #ifdef SHORTNAMES | ||
| 43 | #ifndef NO_SHORTNAMES | ||
| 44 | #include "../shortnames/remap.h" | ||
| 45 | #endif /* not NO_SHORTNAMES */ | ||
| 46 | #endif /* SHORTNAMES */ | ||
| 47 | |||
| 48 | /* Define HAVE_X_WINDOWS if you want to use the X window system. */ | 23 | /* Define HAVE_X_WINDOWS if you want to use the X window system. */ |
| 49 | |||
| 50 | #ifndef HAVE_X_WINDOWS | ||
| 51 | /* #define HAVE_X_WINDOWS */ | 24 | /* #define HAVE_X_WINDOWS */ |
| 52 | #endif | ||
| 53 | 25 | ||
| 54 | /* Define HAVE_X11 if you want to use version 11 of X windows. | 26 | /* Define HAVE_X11 if you want to use version 11 of X windows. |
| 55 | Otherwise, Emacs expects to use version 10. */ | 27 | Otherwise, Emacs expects to use version 10. */ |
| 56 | |||
| 57 | #ifndef HAVE_X11 | ||
| 58 | /* #define HAVE_X11 */ | 28 | /* #define HAVE_X11 */ |
| 59 | #endif | ||
| 60 | 29 | ||
| 61 | /* Define HAVE_X_MENU if you want to use the X window menu system. | 30 | /* Define HAVE_X_MENU if you want to use the X window menu system. |
| 62 | This appears to work on some machines that support X | 31 | This appears to work on some machines that support X |
| 63 | and not on others. */ | 32 | and not on others. */ |
| 64 | |||
| 65 | #ifndef HAVE_X_MENU | ||
| 66 | /* #define HAVE_X_MENU */ | 33 | /* #define HAVE_X_MENU */ |
| 67 | #endif | ||
| 68 | 34 | ||
| 69 | /* Define `subprocesses' should be defined if you want to | 35 | /* If we're using any sort of window system, define MULTI_SCREEN. */ |
| 70 | have code for asynchronous subprocesses | 36 | #ifdef HAVE_X_WINDOWS |
| 71 | (as used in M-x compile and M-x shell). | 37 | #define MULTI_SCREEN |
| 72 | These do not work for some USG systems yet; | ||
| 73 | for the ones where they work, the s-*.h file defines this flag. */ | ||
| 74 | |||
| 75 | #ifndef VMS | ||
| 76 | #ifndef USG | ||
| 77 | /* #define subprocesses */ | ||
| 78 | #endif | ||
| 79 | #endif | 38 | #endif |
| 80 | 39 | ||
| 81 | /* Define USER_FULL_NAME to return a string | 40 | /* Define USER_FULL_NAME to return a string |
| @@ -100,50 +59,19 @@ and this notice must be preserved on all copies. */ | |||
| 100 | For this to take effect, you must install Emacs with setuid root. | 59 | For this to take effect, you must install Emacs with setuid root. |
| 101 | Emacs will change back to the users's own uid after setting | 60 | Emacs will change back to the users's own uid after setting |
| 102 | its priority. */ | 61 | its priority. */ |
| 103 | |||
| 104 | #ifndef HIGHPRI | ||
| 105 | /* #define HIGHPRI */ | 62 | /* #define HIGHPRI */ |
| 106 | #endif | ||
| 107 | 63 | ||
| 108 | /* Define LISP_FLOAT_TYPE if you want emacs to support floating-point | 64 | /* Define LISP_FLOAT_TYPE if you want emacs to support floating-point |
| 109 | numbers. */ | 65 | numbers. */ |
| 110 | |||
| 111 | #ifndef LISP_FLOAT_TYPE | ||
| 112 | /* #define LISP_FLOAT_TYPE */ | 66 | /* #define LISP_FLOAT_TYPE */ |
| 113 | #endif | ||
| 114 | 67 | ||
| 115 | /* Define GNU_MALLOC if you want to use the *new* GNU memory allocator. */ | 68 | /* Define GNU_MALLOC if you want to use the *new* GNU memory allocator. */ |
| 116 | |||
| 117 | #ifndef GNU_MALLOC | ||
| 118 | /* #define GNU_MALLOC */ | 69 | /* #define GNU_MALLOC */ |
| 119 | #endif | ||
| 120 | 70 | ||
| 121 | /* Define REL_ALLOC if you want to use the relocating allocator for | 71 | /* Define REL_ALLOC if you want to use the relocating allocator for |
| 122 | buffer space. */ | 72 | buffer space. */ |
| 123 | |||
| 124 | #ifndef REL_ALLOC | ||
| 125 | /* #define REL_ALLOC */ | 73 | /* #define REL_ALLOC */ |
| 126 | #endif | ||
| 127 | 74 | ||
| 128 | /* If we're using any sort of window system, define MULTI_SCREEN. */ | ||
| 129 | #ifdef HAVE_X_WINDOWS | ||
| 130 | #define MULTI_SCREEN | ||
| 131 | #endif | ||
| 132 | |||
| 133 | /* Define LD_SWITCH_SITE to contain any special flags your loader may | ||
| 134 | need. For instance, if you've defined HAVE_X_WINDOWS above and your | ||
| 135 | X libraries aren't in a place that your loader can find on its own, | ||
| 136 | you might want to add "-L/..." or something similar. */ | ||
| 137 | |||
| 138 | /* #define LD_SWITCH_SITE */ | ||
| 139 | |||
| 140 | /* Define C_SWITCH_SITE to contain any special flags your compiler may | ||
| 141 | need. For instance, if you've defined HAVE_X_WINDOWS above and your | ||
| 142 | X include files aren't in a place that your compiler can find on its | ||
| 143 | own, you might want to add "-I/..." or something similar. */ | ||
| 144 | |||
| 145 | /* #define C_SWITCH_SITE */ | ||
| 146 | |||
| 147 | /* Define this macro if you want to use 16-bit GLYPHs. Currently this | 75 | /* Define this macro if you want to use 16-bit GLYPHs. Currently this |
| 148 | option isn't terribly useful (the current distribution doesn't | 76 | option isn't terribly useful (the current distribution doesn't |
| 149 | support large characters in buffer text), so the configuration | 77 | support large characters in buffer text), so the configuration |
| @@ -165,12 +93,57 @@ and this notice must be preserved on all copies. */ | |||
| 165 | #define GLYPH unsigned char | 93 | #define GLYPH unsigned char |
| 166 | #endif | 94 | #endif |
| 167 | 95 | ||
| 96 | /* The configuration script links system.h to a s- file that describes | ||
| 97 | the system type you are using. | ||
| 98 | See the file ../share-lib/MACHINES for a list of systems and | ||
| 99 | the names of the s- files to use for them. | ||
| 100 | See s-template.h for documentation on writing s- files. */ | ||
| 101 | #include "@opsystem@" | ||
| 102 | |||
| 103 | /* The configuration script links machine.h to a m- file that | ||
| 104 | describes the machine and system you use. | ||
| 105 | See the file ../share-lib/MACHINES for a list of machines and | ||
| 106 | the names of the m- files to use for them. | ||
| 107 | See m-template.h for info on what m- files should define. */ | ||
| 108 | #include "@machine@" | ||
| 109 | |||
| 110 | /* Load in the conversion definitions if this system | ||
| 111 | needs them and the source file being compiled has not | ||
| 112 | said to inhibit this. There should be no need for you | ||
| 113 | to alter these lines. */ | ||
| 114 | |||
| 115 | #ifdef SHORTNAMES | ||
| 116 | #ifndef NO_SHORTNAMES | ||
| 117 | #include "../shortnames/remap.h" | ||
| 118 | #endif /* not NO_SHORTNAMES */ | ||
| 119 | #endif /* SHORTNAMES */ | ||
| 120 | |||
| 121 | /* Define `subprocesses' should be defined if you want to | ||
| 122 | have code for asynchronous subprocesses | ||
| 123 | (as used in M-x compile and M-x shell). | ||
| 124 | These do not work for some USG systems yet; | ||
| 125 | for the ones where they work, the s-*.h file defines this flag. */ | ||
| 126 | |||
| 127 | #ifndef VMS | ||
| 128 | #ifndef USG | ||
| 129 | /* #define subprocesses */ | ||
| 130 | #endif | ||
| 131 | #endif | ||
| 132 | |||
| 133 | /* Define LD_SWITCH_SITE to contain any special flags your loader may | ||
| 134 | need. For instance, if you've defined HAVE_X_WINDOWS above and your | ||
| 135 | X libraries aren't in a place that your loader can find on its own, | ||
| 136 | you might want to add "-L/..." or something similar. */ | ||
| 137 | /* #define LD_SWITCH_SITE */ | ||
| 138 | |||
| 139 | /* Define C_SWITCH_SITE to contain any special flags your compiler may | ||
| 140 | need. For instance, if you've defined HAVE_X_WINDOWS above and your | ||
| 141 | X include files aren't in a place that your compiler can find on its | ||
| 142 | own, you might want to add "-I/..." or something similar. */ | ||
| 143 | /* #define C_SWITCH_SITE */ | ||
| 144 | |||
| 168 | /* Define the return type of signal handlers if the s-xxx file | 145 | /* Define the return type of signal handlers if the s-xxx file |
| 169 | did not already do so. */ | 146 | did not already do so. */ |
| 170 | #ifndef SIGTYPE | 147 | #ifndef SIGTYPE |
| 171 | #ifdef __STDC__ | ||
| 172 | #define SIGTYPE void | 148 | #define SIGTYPE void |
| 173 | #else | ||
| 174 | #define SIGTYPE int | ||
| 175 | #endif | ||
| 176 | #endif | 149 | #endif |
diff --git a/src/dispnew.c b/src/dispnew.c index fce41838ce7..31e5590f35d 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -55,8 +55,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 55 | #undef SIGIO | 55 | #undef SIGIO |
| 56 | #endif | 56 | #endif |
| 57 | 57 | ||
| 58 | #undef NULL | ||
| 59 | |||
| 60 | #include "termchar.h" | 58 | #include "termchar.h" |
| 61 | #include "termopts.h" | 59 | #include "termopts.h" |
| 62 | #include "cm.h" | 60 | #include "cm.h" |
| @@ -183,7 +181,7 @@ DEFUN ("redraw-screen", Fredraw_screen, Sredraw_screen, 1, 1, 0, | |||
| 183 | { | 181 | { |
| 184 | SCREEN_PTR s; | 182 | SCREEN_PTR s; |
| 185 | 183 | ||
| 186 | CHECK_SCREEN (screen, 0); | 184 | CHECK_LIVE_SCREEN (screen, 0); |
| 187 | s = XSCREEN (screen); | 185 | s = XSCREEN (screen); |
| 188 | update_begin (s); | 186 | update_begin (s); |
| 189 | /* set_terminal_modes (); */ | 187 | /* set_terminal_modes (); */ |
| @@ -998,7 +996,8 @@ update_screen (s, force, inhibit_hairy_id) | |||
| 998 | if (!line_ins_del_ok) | 996 | if (!line_ins_del_ok) |
| 999 | inhibit_hairy_id = 1; | 997 | inhibit_hairy_id = 1; |
| 1000 | 998 | ||
| 1001 | /* Don't compute for i/d line if just want cursor motion. */ | 999 | /* See if any of the desired lines are enabled; don't compute for |
| 1000 | i/d line if just want cursor motion. */ | ||
| 1002 | for (i = 0; i < SCREEN_HEIGHT (s); i++) | 1001 | for (i = 0; i < SCREEN_HEIGHT (s); i++) |
| 1003 | if (desired_screen->enable[i]) | 1002 | if (desired_screen->enable[i]) |
| 1004 | break; | 1003 | break; |
| @@ -1211,75 +1210,41 @@ buffer_posn_from_coords (window, col, line) | |||
| 1211 | int window_left = XFASTINT (window->left); | 1210 | int window_left = XFASTINT (window->left); |
| 1212 | 1211 | ||
| 1213 | /* The actual width of the window is window->width less one for the | 1212 | /* The actual width of the window is window->width less one for the |
| 1214 | \ which ends wrapped lines, and less one if it's not the | 1213 | DISP_CONTINUE_GLYPH, and less one if it's not the rightmost |
| 1215 | rightmost window. */ | 1214 | window. */ |
| 1216 | int window_width = (XFASTINT (window->width) - 1 | 1215 | int window_width = (XFASTINT (window->width) - 1 |
| 1217 | - (XFASTINT (window->width) + window_left | 1216 | - (XFASTINT (window->width) + window_left |
| 1218 | != SCREEN_WIDTH (XSCREEN (window->screen)))); | 1217 | != SCREEN_WIDTH (XSCREEN (window->screen)))); |
| 1219 | 1218 | ||
| 1220 | /* The screen's list of buffer positions of line starts. */ | 1219 | int startp = marker_position (window->start); |
| 1221 | int *bufp = SCREEN_CURRENT_GLYPHS (XSCREEN (window->screen))->bufp; | ||
| 1222 | 1220 | ||
| 1223 | /* Since compute_motion will only operate on the current buffer, | 1221 | /* Since compute_motion will only operate on the current buffer, |
| 1224 | we need to save the old one and restore it when we're done. */ | 1222 | we need to save the old one and restore it when we're done. */ |
| 1225 | struct buffer *old_current_buffer = current_buffer; | 1223 | struct buffer *old_current_buffer = current_buffer; |
| 1226 | int posn; | 1224 | struct position *posn; |
| 1227 | 1225 | ||
| 1228 | current_buffer = XBUFFER (window->buffer); | 1226 | current_buffer = XBUFFER (window->buffer); |
| 1229 | 1227 | ||
| 1230 | { | 1228 | /* It would be nice if we could use SCREEN_CURRENT_GLYPHS (XSCREEN |
| 1231 | /* compute_motion will find the buffer position corresponding to a | 1229 | (window->screen))->bufp to avoid scanning from the very top of |
| 1232 | screen position, given a buffer position to start at and its | 1230 | the window, but it isn't maintained correctly, and I'm not even |
| 1233 | screen position, by scanning from the start to the goal. In | 1231 | sure I will keep it. */ |
| 1234 | order to make this faster, we need to choose a starting buffer | 1232 | posn = compute_motion (startp, 0, |
| 1235 | position with a known screen position as close to the goal as | 1233 | (window == XWINDOW (minibuf_window) && startp == 1 |
| 1236 | possible. | 1234 | ? minibuf_prompt_width : 0), |
| 1237 | 1235 | ZV, line, col - window_left, | |
| 1238 | The bufp array in the screen_glyphs structure gives the buffer | 1236 | window_width, XINT (window->hscroll), 0); |
| 1239 | position of the first character on each screen line. This | ||
| 1240 | would be a perfect starting location, except that there's no | ||
| 1241 | way to know if this character really starts flush with the | ||
| 1242 | beginning of the line or if it is being continued from the | ||
| 1243 | previous line; characters like ?\M-x display as \370 and can | ||
| 1244 | wrap off the end of one line onto the next. | ||
| 1245 | |||
| 1246 | So what we do is start on the target line, and scan upwards | ||
| 1247 | until we find a screen line that starts right after a newline | ||
| 1248 | in the buffer, or at the top of the window; both of these | ||
| 1249 | assure us that the character at bufp starts flush with the | ||
| 1250 | beginning of the line. */ | ||
| 1251 | int start_line; | ||
| 1252 | |||
| 1253 | #if 0 | ||
| 1254 | /* Unfortunately, the bufp array doesn't seem to be updated properly. */ | ||
| 1255 | |||
| 1256 | /* Only works for the leftmost window on a line. bufp is useless | ||
| 1257 | for the others. */ | ||
| 1258 | if (window_left == 0) | ||
| 1259 | { | ||
| 1260 | for (start_line = line; start_line > 0; start_line--) | ||
| 1261 | if (FETCH_CHAR (bufp[XFASTINT (window->top) + start_line]-1) | ||
| 1262 | == '\n') | ||
| 1263 | break; | ||
| 1264 | posn = bufp[XFASTINT (window->top) + start_line]; | ||
| 1265 | } | ||
| 1266 | else | ||
| 1267 | #endif | ||
| 1268 | { | ||
| 1269 | start_line = 0; | ||
| 1270 | posn = marker_position (window->start); | ||
| 1271 | } | ||
| 1272 | |||
| 1273 | posn | ||
| 1274 | = compute_motion (posn, start_line, window_left, | ||
| 1275 | ZV, line, col - window_left, | ||
| 1276 | window_width, XINT (window->hscroll), 0) | ||
| 1277 | ->bufpos; | ||
| 1278 | } | ||
| 1279 | 1237 | ||
| 1280 | current_buffer = old_current_buffer; | 1238 | current_buffer = old_current_buffer; |
| 1281 | 1239 | ||
| 1282 | return posn; | 1240 | /* compute_motion considers screen points past the end of a line |
| 1241 | to be *after* the newline, i.e. at the start of the next line. | ||
| 1242 | This is reasonable, but not really what we want. So if the | ||
| 1243 | result is on a line below LINE, back it up one character. */ | ||
| 1244 | if (posn->vpos > line) | ||
| 1245 | return posn->bufpos - 1; | ||
| 1246 | else | ||
| 1247 | return posn->bufpos; | ||
| 1283 | } | 1248 | } |
| 1284 | 1249 | ||
| 1285 | static int | 1250 | static int |
| @@ -1625,7 +1590,7 @@ FILE = nil means just close any termscript file currently open.") | |||
| 1625 | if (termscript != 0) fclose (termscript); | 1590 | if (termscript != 0) fclose (termscript); |
| 1626 | termscript = 0; | 1591 | termscript = 0; |
| 1627 | 1592 | ||
| 1628 | if (! NULL (file)) | 1593 | if (! NILP (file)) |
| 1629 | { | 1594 | { |
| 1630 | file = Fexpand_file_name (file, Qnil); | 1595 | file = Fexpand_file_name (file, Qnil); |
| 1631 | termscript = fopen (XSTRING (file)->data, "w"); | 1596 | termscript = fopen (XSTRING (file)->data, "w"); |
| @@ -1637,6 +1602,7 @@ FILE = nil means just close any termscript file currently open.") | |||
| 1637 | 1602 | ||
| 1638 | 1603 | ||
| 1639 | #ifdef SIGWINCH | 1604 | #ifdef SIGWINCH |
| 1605 | SIGTYPE | ||
| 1640 | window_change_signal () | 1606 | window_change_signal () |
| 1641 | { | 1607 | { |
| 1642 | int width, height; | 1608 | int width, height; |
| @@ -1659,7 +1625,7 @@ window_change_signal () | |||
| 1659 | { | 1625 | { |
| 1660 | SCREEN_PTR s = XSCREEN (XCONS (tail)->car); | 1626 | SCREEN_PTR s = XSCREEN (XCONS (tail)->car); |
| 1661 | 1627 | ||
| 1662 | if (s->output_method == output_termcap) | 1628 | if (SCREEN_IS_TERMCAP (s)) |
| 1663 | { | 1629 | { |
| 1664 | ++in_display; | 1630 | ++in_display; |
| 1665 | change_screen_size (s, height, width, 0); | 1631 | change_screen_size (s, height, width, 0); |
| @@ -1728,10 +1694,8 @@ change_screen_size (screen, newlength, newwidth, pretend) | |||
| 1728 | 1694 | ||
| 1729 | if (newlength && newlength != SCREEN_HEIGHT (screen)) | 1695 | if (newlength && newlength != SCREEN_HEIGHT (screen)) |
| 1730 | { | 1696 | { |
| 1731 | if (XSCREEN (WINDOW_SCREEN (XWINDOW (SCREEN_MINIBUF_WINDOW (screen)))) | 1697 | if (SCREEN_HAS_MINIBUF (screen) |
| 1732 | == screen | 1698 | && ! SCREEN_MINIBUF_ONLY_P (screen)) |
| 1733 | && ! EQ (SCREEN_MINIBUF_WINDOW (screen), | ||
| 1734 | SCREEN_ROOT_WINDOW (screen))) | ||
| 1735 | { | 1699 | { |
| 1736 | /* Screen has both root and minibuffer. */ | 1700 | /* Screen has both root and minibuffer. */ |
| 1737 | set_window_height (SCREEN_ROOT_WINDOW (screen), | 1701 | set_window_height (SCREEN_ROOT_WINDOW (screen), |
| @@ -1744,7 +1708,7 @@ change_screen_size (screen, newlength, newwidth, pretend) | |||
| 1744 | /* Screen has just one top-level window. */ | 1708 | /* Screen has just one top-level window. */ |
| 1745 | set_window_height (SCREEN_ROOT_WINDOW (screen), newlength, 0); | 1709 | set_window_height (SCREEN_ROOT_WINDOW (screen), newlength, 0); |
| 1746 | 1710 | ||
| 1747 | if (SCREEN_IS_TERMCAP (screen) == output_termcap && !pretend) | 1711 | if (SCREEN_IS_TERMCAP (screen) && !pretend) |
| 1748 | ScreenRows = newlength; | 1712 | ScreenRows = newlength; |
| 1749 | 1713 | ||
| 1750 | #if 0 | 1714 | #if 0 |
| @@ -1760,8 +1724,7 @@ change_screen_size (screen, newlength, newwidth, pretend) | |||
| 1760 | if (newwidth && newwidth != SCREEN_WIDTH (screen)) | 1724 | if (newwidth && newwidth != SCREEN_WIDTH (screen)) |
| 1761 | { | 1725 | { |
| 1762 | set_window_width (SCREEN_ROOT_WINDOW (screen), newwidth, 0); | 1726 | set_window_width (SCREEN_ROOT_WINDOW (screen), newwidth, 0); |
| 1763 | if (XSCREEN (WINDOW_SCREEN (XWINDOW (SCREEN_MINIBUF_WINDOW (screen)))) | 1727 | if (SCREEN_HAS_MINIBUF (screen)) |
| 1764 | == screen) | ||
| 1765 | set_window_width (SCREEN_MINIBUF_WINDOW (screen), newwidth, 0); | 1728 | set_window_width (SCREEN_MINIBUF_WINDOW (screen), newwidth, 0); |
| 1766 | SCREEN_WIDTH (screen) = newwidth; | 1729 | SCREEN_WIDTH (screen) = newwidth; |
| 1767 | 1730 | ||
| @@ -1809,7 +1772,7 @@ terminate any keyboard macro currently executing.") | |||
| 1809 | (arg) | 1772 | (arg) |
| 1810 | Lisp_Object arg; | 1773 | Lisp_Object arg; |
| 1811 | { | 1774 | { |
| 1812 | if (!NULL (arg)) | 1775 | if (!NILP (arg)) |
| 1813 | { | 1776 | { |
| 1814 | ring_bell (); | 1777 | ring_bell (); |
| 1815 | fflush (stdout); | 1778 | fflush (stdout); |
| @@ -1851,7 +1814,7 @@ Optional second arg non-nil means ARG is measured in milliseconds.\n\ | |||
| 1851 | if (sec <= 0) | 1814 | if (sec <= 0) |
| 1852 | return Qnil; | 1815 | return Qnil; |
| 1853 | 1816 | ||
| 1854 | if (!NULL (millisec)) | 1817 | if (!NILP (millisec)) |
| 1855 | { | 1818 | { |
| 1856 | #ifndef HAVE_TIMEVAL | 1819 | #ifndef HAVE_TIMEVAL |
| 1857 | error ("millisecond sit-for not supported on %s", SYSTEM_TYPE); | 1820 | error ("millisecond sit-for not supported on %s", SYSTEM_TYPE); |
| @@ -1941,7 +1904,7 @@ Value is t if waited the full time with no input arriving.") | |||
| 1941 | if (sec <= 0) | 1904 | if (sec <= 0) |
| 1942 | return Qt; | 1905 | return Qt; |
| 1943 | 1906 | ||
| 1944 | if (!NULL (millisec)) | 1907 | if (!NILP (millisec)) |
| 1945 | { | 1908 | { |
| 1946 | #ifndef HAVE_TIMEVAL | 1909 | #ifndef HAVE_TIMEVAL |
| 1947 | error ("millisecond sleep-for not supported on %s", SYSTEM_TYPE); | 1910 | error ("millisecond sleep-for not supported on %s", SYSTEM_TYPE); |
| @@ -2027,7 +1990,7 @@ init_display () | |||
| 2027 | system. */ | 1990 | system. */ |
| 2028 | 1991 | ||
| 2029 | #ifdef HAVE_X_WINDOWS | 1992 | #ifdef HAVE_X_WINDOWS |
| 2030 | if (!inhibit_window_system && (display_arg || egetenv ("DISPLAY"))) | 1993 | if (!inhibit_window_system && (display_arg || getenv ("DISPLAY"))) |
| 2031 | { | 1994 | { |
| 2032 | Vwindow_system = intern ("x"); | 1995 | Vwindow_system = intern ("x"); |
| 2033 | #ifdef HAVE_X11 | 1996 | #ifdef HAVE_X11 |
diff --git a/src/lisp.h b/src/lisp.h index 8ba14163f6d..1cbdd6efc90 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -509,14 +509,14 @@ typedef unsigned char UCHAR; | |||
| 509 | #ifdef NULL | 509 | #ifdef NULL |
| 510 | #undef NULL | 510 | #undef NULL |
| 511 | #endif | 511 | #endif |
| 512 | #define NULL(x) (XFASTINT (x) == XFASTINT (Qnil)) | 512 | #define NILP(x) (XFASTINT (x) == XFASTINT (Qnil)) |
| 513 | 513 | ||
| 514 | /* #define LISTP(x) (XTYPE ((x)) == Lisp_Cons)*/ | 514 | /* #define LISTP(x) (XTYPE ((x)) == Lisp_Cons)*/ |
| 515 | #define CONSP(x) (XTYPE ((x)) == Lisp_Cons) | 515 | #define CONSP(x) (XTYPE ((x)) == Lisp_Cons) |
| 516 | #define EQ(x, y) (XFASTINT (x) == XFASTINT (y)) | 516 | #define EQ(x, y) (XFASTINT (x) == XFASTINT (y)) |
| 517 | 517 | ||
| 518 | #define CHECK_LIST(x, i) \ | 518 | #define CHECK_LIST(x, i) \ |
| 519 | { if ((XTYPE ((x)) != Lisp_Cons) && !NULL (x)) x = wrong_type_argument (Qlistp, (x)); } | 519 | { if ((XTYPE ((x)) != Lisp_Cons) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); } |
| 520 | 520 | ||
| 521 | #define CHECK_STRING(x, i) \ | 521 | #define CHECK_STRING(x, i) \ |
| 522 | { if (XTYPE ((x)) != Lisp_String) x = wrong_type_argument (Qstringp, (x)); } | 522 | { if (XTYPE ((x)) != Lisp_String) x = wrong_type_argument (Qstringp, (x)); } |
| @@ -698,12 +698,12 @@ extern char *stack_bottom; | |||
| 698 | /* Check quit-flag and quit if it is non-nil. */ | 698 | /* Check quit-flag and quit if it is non-nil. */ |
| 699 | 699 | ||
| 700 | #define QUIT \ | 700 | #define QUIT \ |
| 701 | if (!NULL (Vquit_flag) && NULL (Vinhibit_quit)) \ | 701 | if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \ |
| 702 | { Vquit_flag = Qnil; Fsignal (Qquit, Qnil); } | 702 | { Vquit_flag = Qnil; Fsignal (Qquit, Qnil); } |
| 703 | 703 | ||
| 704 | /* Nonzero if ought to quit now. */ | 704 | /* Nonzero if ought to quit now. */ |
| 705 | 705 | ||
| 706 | #define QUITP (!NULL (Vquit_flag) && NULL (Vinhibit_quit)) | 706 | #define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) |
| 707 | 707 | ||
| 708 | /* 1 if CH is upper case. */ | 708 | /* 1 if CH is upper case. */ |
| 709 | 709 | ||
| @@ -1079,14 +1079,6 @@ extern Lisp_Object Fprocess_status (), Fkill_process (); | |||
| 1079 | /* defined in callproc.c */ | 1079 | /* defined in callproc.c */ |
| 1080 | extern Lisp_Object Vexec_path, Vexec_directory, Vdata_directory; | 1080 | extern Lisp_Object Vexec_path, Vexec_directory, Vdata_directory; |
| 1081 | 1081 | ||
| 1082 | #ifdef MAINTAIN_ENVIRONMENT | ||
| 1083 | /* defined in environ.c */ | ||
| 1084 | extern int size_of_current_environ (); | ||
| 1085 | extern void get_current_environ (); | ||
| 1086 | /* extern void current_environ (); */ | ||
| 1087 | extern Lisp_Object Fgetenv (); | ||
| 1088 | #endif /* MAINTAIN_ENVIRONMENT */ | ||
| 1089 | |||
| 1090 | /* defined in doc.c */ | 1082 | /* defined in doc.c */ |
| 1091 | extern Lisp_Object Vdoc_file_name; | 1083 | extern Lisp_Object Vdoc_file_name; |
| 1092 | extern Lisp_Object Fsubstitute_command_keys (); | 1084 | extern Lisp_Object Fsubstitute_command_keys (); |
| @@ -1110,8 +1102,4 @@ extern void debugger (); | |||
| 1110 | extern char *malloc (), *realloc (), *getenv (), *ctime (), *getwd (); | 1102 | extern char *malloc (), *realloc (), *getenv (), *ctime (), *getwd (); |
| 1111 | extern long *xmalloc (), *xrealloc (); | 1103 | extern long *xmalloc (), *xrealloc (); |
| 1112 | 1104 | ||
| 1113 | #ifdef MAINTAIN_ENVIRONMENT | 1105 | extern char *egetenv (); |
| 1114 | extern unsigned char *egetenv (); | ||
| 1115 | #else | ||
| 1116 | #define egetenv getenv | ||
| 1117 | #endif | ||