1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-28 08:11:05 -08:00

*** empty log message ***

This commit is contained in:
Jim Blandy 1992-05-19 05:22:52 +00:00
parent 7fa788da36
commit f76475ad8a
5 changed files with 122 additions and 86 deletions

View file

@ -170,7 +170,7 @@ write_c_args (out, buf, minargs, maxargs)
/* Print the C arguments as they would appear in Elisp; /* Print the C arguments as they would appear in Elisp;
print underscores as hyphens. */ print underscores as hyphens. */
if (c == '_') if (c == '_')
putc ('-'); putc ('-', out);
else else
putc (c, out); putc (c, out);
} }

View file

@ -118,7 +118,7 @@ directory name of the directory where the `.emacs' file was looked for.")
(if (not (eq system-type 'vax-vms)) (if (not (eq system-type 'vax-vms))
(mapcar (function (mapcar (function
(lambda (var) (lambda (var)
(let ((value (getev var))) (let ((value (getenv var)))
(if (and value (if (and value
(< (length value) (length default-directory)) (< (length value) (length default-directory))
(equal (file-attributes default-directory) (equal (file-attributes default-directory)

View file

@ -1780,14 +1780,14 @@ DEFUN ("sleep-for", Fsleep_for, Ssleep_for, 1, 2, 0,
"Pause, without updating display, for ARG seconds.\n\ "Pause, without updating display, for ARG seconds.\n\
Optional second arg non-nil means ARG is measured in milliseconds.\n\ Optional second arg non-nil means ARG is measured in milliseconds.\n\
\(Not all operating systems support milliseconds.)") \(Not all operating systems support milliseconds.)")
(n, millisec) (arg, millisec)
Lisp_Object n, millisec; Lisp_Object arg, millisec;
{ {
int usec = 0; int usec = 0;
int sec; int sec;
CHECK_NUMBER (n, 0); CHECK_NUMBER (arg, 0);
sec = XINT (n); sec = XINT (arg);
if (sec <= 0) if (sec <= 0)
return Qnil; return Qnil;
@ -1801,7 +1801,12 @@ Optional second arg non-nil means ARG is measured in milliseconds.\n\
#endif #endif
} }
wait_reading_process_input (sec, usec, 0, 0); {
Lisp_Object zero;
XFASTINT (zero) = 0;
wait_reading_process_input (sec, usec, zero, 0);
}
#if 0 /* No wait_reading_process_input */ #if 0 /* No wait_reading_process_input */
immediate_quit = 1; immediate_quit = 1;
@ -1837,45 +1842,31 @@ Optional second arg non-nil means ARG is measured in milliseconds.\n\
return Qnil; return Qnil;
} }
DEFUN ("sit-for", Fsit_for, Ssit_for, 1, 3, 0, /* This is just like wait_reading_process_input, except that
"Perform redisplay, then wait for ARG seconds or until input is available.\n\ it does the redisplay.
Optional second arg non-nil means ARG counts in milliseconds.\n\
Optional third arg non-nil means don't redisplay, just wait for input.\n\
Redisplay is preempted as always if input arrives, and does not happen\n\
if input is available before it starts.\n\
Value is t if waited the full time with no input arriving.")
(n, millisec, nodisp)
Lisp_Object n, millisec, nodisp;
{
int usec = 0;
int sec;
CHECK_NUMBER (n, 0); It's also just like Fsit_for, except that it can be used for
waiting for input as well. */
Lisp_Object
sit_for (sec, usec, reading, display)
int sec, usec, reading, display;
{
Lisp_Object read_kbd;
if (detect_input_pending ()) if (detect_input_pending ())
return Qnil; return Qnil;
if (EQ (nodisp, Qnil)) if (display)
redisplay_preserve_echo_area (); redisplay_preserve_echo_area ();
sec = XINT (n);
if (sec <= 0)
return Qt;
if (!NILP (millisec))
{
#ifndef EMACS_HAS_USECS
error ("millisecond sleep-for not supported on %s", SYSTEM_TYPE);
#else
usec = sec % 1000 * 1000;
sec /= 1000;
#endif
}
#ifdef SIGIO #ifdef SIGIO
gobble_input (); gobble_input ();
#endif /* SIGIO */ #endif
wait_reading_process_input (sec, usec, 1, 1);
XSET (read_kbd, Lisp_Int, reading ? -1 : 1);
wait_reading_process_input (sec, usec, read_kbd, display);
#if 0 /* No wait_reading_process_input available. */ #if 0 /* No wait_reading_process_input available. */
immediate_quit = 1; immediate_quit = 1;
@ -1883,7 +1874,7 @@ Value is t if waited the full time with no input arriving.")
waitchannels = 1; waitchannels = 1;
#ifdef VMS #ifdef VMS
input_wait_timeout (XINT (n)); input_wait_timeout (XINT (arg));
#else /* not VMS */ #else /* not VMS */
#ifndef HAVE_TIMEVAL #ifndef HAVE_TIMEVAL
timeout_sec = sec; timeout_sec = sec;
@ -1901,18 +1892,54 @@ Value is t if waited the full time with no input arriving.")
return detect_input_pending () ? Qnil : Qt; return detect_input_pending () ? Qnil : Qt;
} }
DEFUN ("sit-for", Fsit_for, Ssit_for, 1, 3, 0,
"Perform redisplay, then wait for ARG seconds or until input is available.\n\
Optional second arg non-nil means ARG counts in milliseconds.\n\
Optional third arg non-nil means don't redisplay, just wait for input.\n\
Redisplay is preempted as always if input arrives, and does not happen\n\
if input is available before it starts.\n\
Value is t if waited the full time with no input arriving.")
(arg, millisec, nodisp)
Lisp_Object arg, millisec, nodisp;
{
int usec = 0;
int sec = 0;
CHECK_NUMBER (arg, 0);
sec = XINT (arg);
if (sec <= 0)
return Qt;
if (!NILP (millisec))
{
#ifndef EMACS_HAS_USECS
error ("millisecond sit-for not supported on %s", SYSTEM_TYPE);
#else
usec = (sec % 1000) * 1000;
sec /= 1000;
#endif
}
return sit_for (sec, usec, 0, NILP (nodisp));
}
DEFUN ("sleep-for-millisecs", Fsleep_for_millisecs, Ssleep_for_millisecs, DEFUN ("sleep-for-millisecs", Fsleep_for_millisecs, Ssleep_for_millisecs,
1, 1, 0, 1, 1, 0,
"Pause, without updating display, for ARG milliseconds.") "Pause, without updating display, for ARG milliseconds.")
(n) (arg)
Lisp_Object n; Lisp_Object arg;
{ {
Lisp_Object zero;
#ifndef EMACS_HAS_USECS #ifndef EMACS_HAS_USECS
error ("sleep-for-millisecs not supported on %s", SYSTEM_TYPE); error ("sleep-for-millisecs not supported on %s", SYSTEM_TYPE);
#else #else
CHECK_NUMBER (n, 0); CHECK_NUMBER (arg, 0);
wait_reading_process_input (XINT (n) / 1000, XINT (n) % 1000 * 1000,
0, 0); XFASTINT (zero) = 0;
wait_reading_process_input (XINT (arg) / 1000, XINT (arg) % 1000 * 1000,
zero, 0);
return Qnil; return Qnil;
#endif /* EMACS_HAS_USECS */ #endif /* EMACS_HAS_USECS */
} }

View file

@ -1148,7 +1148,7 @@ read_char (commandflag)
} }
/* Save outer setjmp data, in case called recursively. */ /* Save outer setjmp data, in case called recursively. */
bcopy (getcjmp, save_jump, sizeof getcjmp); save_getcjmp (save_jump);
stop_polling (); stop_polling ();
@ -1162,8 +1162,6 @@ read_char (commandflag)
XSET (Vlast_event_screen, Lisp_Screen, selected_screen); XSET (Vlast_event_screen, Lisp_Screen, selected_screen);
#endif #endif
clear_waiting_for_input ();
goto non_reread; goto non_reread;
} }
@ -1182,7 +1180,7 @@ read_char (commandflag)
{ {
Lisp_Object tem0; Lisp_Object tem0;
tem0 = Fsit_for (make_number (echo_keystrokes), Qnil, Qt); tem0 = sit_for (echo_keystrokes, 0, 1, 1);
if (EQ (tem0, Qt)) if (EQ (tem0, Qt))
echo (); echo ();
} }
@ -1223,7 +1221,7 @@ read_char (commandflag)
{ {
Lisp_Object tem0; Lisp_Object tem0;
int delay = delay_level * XFASTINT (Vauto_save_timeout) / 4; int delay = delay_level * XFASTINT (Vauto_save_timeout) / 4;
tem0 = Fsit_for (make_number (delay), Qnil, Qt); tem0 = sit_for (delay, 0, 1, 1);
if (EQ (tem0, Qt)) if (EQ (tem0, Qt))
{ {
jmp_buf temp; jmp_buf temp;
@ -1263,7 +1261,7 @@ read_char (commandflag)
non_reread: non_reread:
bcopy (save_jump, getcjmp, sizeof getcjmp); restore_getcjmp (save_jump);
start_polling (); start_polling ();
@ -1590,7 +1588,10 @@ kbd_buffer_get_event ()
#endif /* SIGIO */ #endif /* SIGIO */
if (EVENT_QUEUES_EMPTY) if (EVENT_QUEUES_EMPTY)
{ {
wait_reading_process_input (0, 0, -1, 1); Lisp_Object minus_one;
XSET (minus_one, Lisp_Int, -1);
wait_reading_process_input (0, 0, minus_one, 1);
if (!interrupt_input && EVENT_QUEUES_EMPTY) if (!interrupt_input && EVENT_QUEUES_EMPTY)
{ {
@ -3330,7 +3331,7 @@ quit_throw_to_read_char ()
quit_error_check (); quit_error_check ();
sigfree (); sigfree ();
/* Prevent another signal from doing this before we finish. */ /* Prevent another signal from doing this before we finish. */
waiting_for_input = 0; clear_waiting_for_input ();
input_pending = 0; input_pending = 0;
#if 0 #if 0

View file

@ -1587,10 +1587,11 @@ Return non-nil iff we received any output before the timeout expired.")
seconds = 0; seconds = 0;
} }
if (NILP (proc))
XFASTINT (proc) = 0;
return return
(wait_reading_process_input (seconds, useconds, (wait_reading_process_input (seconds, useconds, proc, 0)
(NILP (proc)
? XPROCESS (get_process (proc)) : 0), 0)
? Qt : Qnil); ? Qt : Qnil);
} }
@ -1610,14 +1611,14 @@ static int waiting_for_user_input_p;
zero for no limit, or zero for no limit, or
-1 means gobble data immediately available but don't wait for any. -1 means gobble data immediately available but don't wait for any.
read_kbd is: read_kbd is a lisp value:
0 to ignore keyboard input, or 0 to ignore keyboard input, or
1 to return when input is available, or 1 to return when input is available, or
-1 means caller will actually read the input, so don't throw to -1 means caller will actually read the input, so don't throw to
the quit handler, or the quit handler, or
a pointer to a struct Lisp_Process, meaning wait until something a process object, meaning wait until something arrives from that
arrives from that process. The return value is true iff we read process. The return value is true iff we read some input from
some input from that process. that process.
do_display != 0 means redisplay should be done to show subprocess do_display != 0 means redisplay should be done to show subprocess
output that arrives. output that arrives.
@ -1628,7 +1629,9 @@ static int waiting_for_user_input_p;
Otherwise, return true iff we recieved input from any process. */ Otherwise, return true iff we recieved input from any process. */
wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
int time_limit, microsecs, read_kbd, do_display; int time_limit, microsecs;
Lisp_Object read_kbd;
int do_display;
{ {
register int channel, nfds, m; register int channel, nfds, m;
static SELECT_TYPE Available; static SELECT_TYPE Available;
@ -1642,15 +1645,16 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
FD_ZERO (&Available); FD_ZERO (&Available);
/* Detect when read_kbd is really the address of a Lisp_Process. */ /* If read_kbd is a process to watch, set wait_proc and wait_channel
if (read_kbd > 10 || read_kbd < -1) accordingly. */
if (XTYPE (read_kbd) == Lisp_Process)
{ {
wait_proc = (struct Lisp_Process *) read_kbd; wait_proc = XPROCESS (read_kbd);
wait_channel = XFASTINT (wait_proc->infd); wait_channel = XFASTINT (wait_proc->infd);
read_kbd = 0; XFASTINT (read_kbd) = 0;
} }
waiting_for_user_input_p = read_kbd; waiting_for_user_input_p = XINT (read_kbd);
/* Since we may need to wait several times, /* Since we may need to wait several times,
compute the absolute time to return at. */ compute the absolute time to return at. */
@ -1666,7 +1670,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
/* If calling from keyboard input, do not quit /* If calling from keyboard input, do not quit
since we want to return C-g as an input character. since we want to return C-g as an input character.
Otherwise, do pending quit if requested. */ Otherwise, do pending quit if requested. */
if (read_kbd >= 0) if (XINT (read_kbd) >= 0)
QUIT; QUIT;
/* If status of something has changed, and no input is available, /* If status of something has changed, and no input is available,
@ -1710,13 +1714,13 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
/* Cause C-g and alarm signals to take immediate action, /* Cause C-g and alarm signals to take immediate action,
and cause input available signals to zero out timeout */ and cause input available signals to zero out timeout */
if (read_kbd < 0) if (XINT (read_kbd) < 0)
set_waiting_for_input (&timeout); set_waiting_for_input (&timeout);
/* Wait till there is something to do */ /* Wait till there is something to do */
Available = input_wait_mask; Available = input_wait_mask;
if (!read_kbd) if (! XINT (read_kbd))
FD_CLR (0, &Available); FD_CLR (0, &Available);
/* If screen size has changed or the window is newly mapped, /* If screen size has changed or the window is newly mapped,
@ -1726,7 +1730,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
if (screen_garbaged) if (screen_garbaged)
redisplay_preserve_echo_area (); redisplay_preserve_echo_area ();
if (read_kbd && detect_input_pending ()) if (XINT (read_kbd) && detect_input_pending ())
nfds = 0; nfds = 0;
else else
nfds = select (MAXDESC, &Available, 0, 0, &timeout); nfds = select (MAXDESC, &Available, 0, 0, &timeout);
@ -1779,7 +1783,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
/* If there is any, return immediately /* If there is any, return immediately
to give it higher priority than subprocesses */ to give it higher priority than subprocesses */
if (read_kbd && detect_input_pending ()) if (XINT (read_kbd) && detect_input_pending ())
break; break;
#ifdef SIGIO #ifdef SIGIO
@ -1789,9 +1793,9 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
but select says there is input. */ but select says there is input. */
/* /*
if (read_kbd && interrupt_input && (Available & fileno (stdin))) if (XINT (read_kbd) && interrupt_input && (Available & fileno (stdin)))
*/ */
if (read_kbd && interrupt_input && (FD_ISSET (fileno (stdin), &Available))) if (XINT (read_kbd) && interrupt_input && (FD_ISSET (fileno (stdin), &Available)))
kill (0, SIGIO); kill (0, SIGIO);
#endif #endif
@ -1810,7 +1814,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
/* If checking input just got us a size-change event from X, /* If checking input just got us a size-change event from X,
obey it now if we should. */ obey it now if we should. */
if (read_kbd) if (XINT (read_kbd))
do_pending_window_change (); do_pending_window_change ();
/* Check for data from a process or a command channel */ /* Check for data from a process or a command channel */
@ -1921,7 +1925,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
/* If calling from keyboard input, do not quit /* If calling from keyboard input, do not quit
since we want to return C-g as an input character. since we want to return C-g as an input character.
Otherwise, do pending quit if requested. */ Otherwise, do pending quit if requested. */
if (read_kbd >= 0) if (XINT (read_kbd) >= 0)
{ {
/* Prevent input_pending from remaining set if we quit. */ /* Prevent input_pending from remaining set if we quit. */
clear_input_pending (); clear_input_pending ();
@ -2134,7 +2138,12 @@ send_process (proc, buf, len)
/* Allow input from processes between bursts of sending. /* Allow input from processes between bursts of sending.
Otherwise things may get stopped up. */ Otherwise things may get stopped up. */
if (len > 0) if (len > 0)
wait_reading_process_input (-1, 0, 0, 0); {
Lisp_Object zero;
XFASTINT (zero) = 0;
wait_reading_process_input (-1, 0, zero, 0);
}
} }
#endif #endif
else else
@ -2901,7 +2910,7 @@ extern int screen_garbaged;
zero for no limit, or zero for no limit, or
-1 means gobble data immediately available but don't wait for any. -1 means gobble data immediately available but don't wait for any.
read_kbd is: read_kbd is a Lisp_Object:
0 to ignore keyboard input, or 0 to ignore keyboard input, or
1 to return when input is available, or 1 to return when input is available, or
-1 means caller will actually read the input, so don't throw to -1 means caller will actually read the input, so don't throw to
@ -2912,14 +2921,13 @@ extern int screen_garbaged;
do_display != 0 means redisplay should be done to show subprocess do_display != 0 means redisplay should be done to show subprocess
output that arrives. This version of the function ignores it. output that arrives. This version of the function ignores it.
If read_kbd is a pointer to a struct Lisp_Process, then the Return true iff we recieved input from any process. */
function returns true iff we received input from that process
before the timeout elapsed.
Otherwise, return true iff we recieved input from any process. */
int int
wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
int time_limit, microsecs, read_kbd, do_display; int time_limit, microsecs;
Lisp_Object read_kbd;
int do_display;
{ {
EMACS_TIME end_time, timeout, *timeout_p; EMACS_TIME end_time, timeout, *timeout_p;
int waitchannels; int waitchannels;
@ -2952,12 +2960,12 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
{ {
int nfds; int nfds;
waitchannels = read_kbd ? 1 : 0; waitchannels = XINT (read_kbd) ? 1 : 0;
/* If calling from keyboard input, do not quit /* If calling from keyboard input, do not quit
since we want to return C-g as an input character. since we want to return C-g as an input character.
Otherwise, do pending quit if requested. */ Otherwise, do pending quit if requested. */
if (read_kbd >= 0) if (XINT (read_kbd) >= 0)
QUIT; QUIT;
if (timeout_p) if (timeout_p)
@ -2970,7 +2978,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
/* Cause C-g and alarm signals to take immediate action, /* Cause C-g and alarm signals to take immediate action,
and cause input available signals to zero out timeout. */ and cause input available signals to zero out timeout. */
if (read_kbd < 0) if (XINT (read_kbd) < 0)
set_waiting_for_input (&timeout); set_waiting_for_input (&timeout);
/* If a screen has been newly mapped and needs updating, /* If a screen has been newly mapped and needs updating,
@ -2978,7 +2986,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
if (screen_garbaged) if (screen_garbaged)
redisplay_preserve_echo_area (); redisplay_preserve_echo_area ();
if (read_kbd && detect_input_pending ()) if (XINT (read_kbd) && detect_input_pending ())
nfds = 0; nfds = 0;
else else
nfds = select (1, &waitchannels, 0, 0, timeout_p); nfds = select (1, &waitchannels, 0, 0, timeout_p);
@ -3001,7 +3009,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
/* System sometimes fails to deliver SIGIO. */ /* System sometimes fails to deliver SIGIO. */
kill (getpid (), SIGIO); kill (getpid (), SIGIO);
#endif #endif
if (read_kbd && interrupt_input && (waitchannels & 1)) if (XINT (read_kbd) && interrupt_input && (waitchannels & 1))
kill (0, SIGIO); kill (0, SIGIO);
/* If we have timed out (nfds == 0) or found some input (nfds > 0), /* If we have timed out (nfds == 0) or found some input (nfds > 0),