There’s no longer need to have QUIT stand for a slug of C statements.
Use the more-obvious function-call syntax instead.
Also, use true and false when setting immediate_quit.
These changes should not affect the generated machine code.
* src/lisp.h (QUIT): Remove. All uses replaced by maybe_quit.
if (!NILP (val))
break;
args = XCDR (args);
- QUIT;
+ maybe_quit ();
@}
@end group
occur via calls to @code{eval_sub} or @code{Feval}, either directly or
indirectly.
-@cindex @code{QUIT}, use in Lisp primitives
- Note the call to the @code{QUIT} macro inside the loop: this macro
+@cindex @code{maybe_quit}, use in Lisp primitives
+ Note the call to @code{maybe_quit} inside the loop: this function
checks whether the user pressed @kbd{C-g}, and if so, aborts the
processing. You should do that in any loop that can potentially
require a large number of iterations; in this case, the list of
handle SIGINT stop nopass
After this 'handle' command, SIGINT will return control to GDB. If
-you want the C-g to cause a QUIT within Emacs as well, omit the 'nopass'.
+you want the C-g to cause a quit within Emacs as well, omit the 'nopass'.
See the GDB manual for more details about signal handling and the
'handle' command.
(unwind-protect
(progn
(sit-for 2)
- (identity 1) ; this forces a call to QUIT; in bytecode.c.
+ (identity 1) ; This forces a call to maybe_quit in bytecode.c.
(setq okay t))
(progn
(delete-region savemax (point-max))
\f
;; This executes C-g typed while Emacs is waiting for a command.
;; Quitting out of a program does not go through here;
-;; that happens in the QUIT macro at the C code level.
+;; that happens in the maybe_quit function at the C code level.
(defun keyboard-quit ()
"Signal a `quit' condition.
During execution of Lisp code, this character causes a quit directly.
for (EMACS_INT size = XFASTINT (length); 0 < size; size--)
{
val = Fcons (init, val);
- QUIT;
+ maybe_quit ();
}
return val;
}
/* Like Fassoc, but use Fstring_equal to compare
- (which ignores text properties),
- and don't ever QUIT. */
+ (which ignores text properties), and don't ever quit. */
static Lisp_Object
-assoc_ignore_text_properties (register Lisp_Object key, Lisp_Object list)
+assoc_ignore_text_properties (Lisp_Object key, Lisp_Object list)
{
- register Lisp_Object tail;
+ Lisp_Object tail;
for (tail = list; CONSP (tail); tail = XCDR (tail))
{
- register Lisp_Object elt, tem;
- elt = XCAR (tail);
- tem = Fstring_equal (Fcar (elt), key);
- if (!NILP (tem))
+ Lisp_Object elt = XCAR (tail);
+ if (!NILP (Fstring_equal (Fcar (elt), key)))
return elt;
}
return Qnil;
{
quitcounter = 1;
maybe_gc ();
- QUIT;
+ maybe_quit ();
}
pc += op;
NEXT;
}
unbind_to (speccount, Qnil);
- QUIT;
+ maybe_quit ();
args[0] = Qfuncall_interactively;
args[1] = function;
{
kill (-synch_process_pid, SIGINT);
message1 ("Waiting for process to die...(type C-g again to kill it instantly)");
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
wait_for_termination (synch_process_pid, 0, 1);
synch_process_pid = 0;
- immediate_quit = 0;
+ immediate_quit = false;
message1 ("Waiting for process to die...done");
}
#endif /* !MSDOS */
process_coding.src_multibyte = 0;
}
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
if (0 <= fd0)
{
}
/* Now NREAD is the total amount of data in the buffer. */
- immediate_quit = 0;
+ immediate_quit = false;
if (!nread)
;
display_on_the_fly = true;
}
immediate_quit = true;
- QUIT;
+ maybe_quit ();
}
give_up: ;
wait_for_termination (pid, &status, fd0 < 0);
#endif
- immediate_quit = 0;
+ immediate_quit = false;
/* Don't kill any children that the subprocess may have left behind
when exiting. */
: 0);
ccl_driver (&ccl, NULL, NULL, 0, 0, Qnil);
- QUIT;
+ maybe_quit ();
if (ccl.status != CCL_STAT_SUCCESS)
error ("Error in CCL program at %dth code", ccl.ic);
decompressed = avail_out - stream.avail_out;
insert_from_gap (decompressed, decompressed, 0);
unwind_data.nbytes += decompressed;
- QUIT;
+ maybe_quit ();
}
while (inflate_status == Z_OK);
#endif
report_file_error ("Reading directory", dirname);
}
- QUIT;
+ maybe_quit ();
}
}
/* Now that we have unwind_protect in place, we might as well
allow matching to be interrupted. */
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
bool wanted = (NILP (match)
|| re_search (bufp, SSDATA (name), len, 0, len, 0) >= 0);
- immediate_quit = 0;
+ immediate_quit = false;
if (wanted)
{
ptrdiff_t len = dirent_namelen (dp);
bool canexclude = 0;
- QUIT;
+ maybe_quit ();
if (len < SCHARS (encoded_file)
|| (scmp (dp->d_name, SSDATA (encoded_file),
SCHARS (encoded_file))
string[i] = str[i % len];
while (n > stringlen)
{
- QUIT;
+ maybe_quit ();
if (!NILP (inherit))
insert_and_inherit (string, stringlen);
else
for (varlist = XCAR (args); CONSP (varlist); varlist = XCDR (varlist))
{
- QUIT;
+ maybe_quit ();
elt = XCAR (varlist);
if (SYMBOLP (elt))
for (argnum = 0; CONSP (varlist); varlist = XCDR (varlist))
{
- QUIT;
+ maybe_quit ();
elt = XCAR (varlist);
if (SYMBOLP (elt))
temps [argnum++] = Qnil;
body = XCDR (args);
while (!NILP (eval_sub (test)))
{
- QUIT;
+ maybe_quit ();
prog_ignore (body);
}
until we get a symbol that is not an alias. */
while (SYMBOLP (def))
{
- QUIT;
+ maybe_quit ();
sym = def;
tem = Fassq (sym, environment);
if (NILP (tem))
/* Restore certain special C variables. */
set_poll_suppress_count (catch->poll_suppress_count);
unblock_input_to (catch->interrupt_input_blocked);
- immediate_quit = 0;
+ immediate_quit = false;
do
{
Lisp_Object string;
Lisp_Object real_error_symbol
= (NILP (error_symbol) ? Fcar (data) : error_symbol);
- register Lisp_Object clause = Qnil;
+ Lisp_Object clause = Qnil;
struct handler *h;
- immediate_quit = 0;
+ immediate_quit = false;
if (gc_in_progress || waiting_for_input)
emacs_abort ();
if (!CONSP (form))
return form;
- QUIT;
+ maybe_quit ();
maybe_gc ();
Lisp_Object val;
ptrdiff_t count;
- QUIT;
+ maybe_quit ();
if (++lisp_eval_depth > max_lisp_eval_depth)
{
bool previous_optional_or_rest = false;
for (; CONSP (syms_left); syms_left = XCDR (syms_left))
{
- QUIT;
+ maybe_quit ();
next = XCAR (syms_left);
if (!SYMBOLP (next))
}
}
- QUIT;
+ maybe_quit ();
}
return result;
}
report_file_error ("Copying permissions to", newname);
}
#else /* not WINDOWSNT */
- immediate_quit = 1;
+ immediate_quit = true;
ifd = emacs_open (SSDATA (encoded_file), O_RDONLY, 0);
- immediate_quit = 0;
+ immediate_quit = false;
if (ifd < 0)
report_file_error ("Opening input file", file);
oldsize = out_st.st_size;
}
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
if (clone_file (ofd, ifd))
newsize = st.st_size;
if (newsize < oldsize && ftruncate (ofd, newsize) != 0)
report_file_error ("Truncating output file", newname);
- immediate_quit = 0;
+ immediate_quit = false;
#ifndef MSDOS
/* Preserve the original file permissions, and if requested, also its
{
int nbytes;
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
nbytes = emacs_read (XSAVE_INTEGER (state, 0),
((char *) BEG_ADDR + PT_BYTE - BEG_BYTE
+ XSAVE_INTEGER (state, 1)),
XSAVE_INTEGER (state, 2));
- immediate_quit = 0;
+ immediate_quit = false;
/* Fast recycle this object for the likely next call. */
free_misc (state);
return make_number (nbytes);
report_file_error ("Setting file position", orig_filename);
}
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
/* Count how many chars at the start of the file
match the text at the beginning of the buffer. */
while (1)
goto handled;
}
immediate_quit = true;
- QUIT;
+ maybe_quit ();
/* Count how many chars at the end of the file
match the text at the end of the buffer. But, if we have
already found that decoding is necessary, don't waste time. */
if (nread == 0)
break;
}
- immediate_quit = 0;
+ immediate_quit = false;
if (! giveup_match_end)
{
quitting while reading a huge file. */
/* Allow quitting out of the actual I/O. */
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
this = emacs_read (fd, read_buf + unprocessed,
READ_BUF_SIZE - unprocessed);
- immediate_quit = 0;
+ immediate_quit = false;
if (this <= 0)
break;
/* Allow quitting out of the actual I/O. We don't make text
part of the buffer until all the reading is done, so a C-g
here doesn't do any harm. */
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
this = emacs_read (fd,
((char *) BEG_ADDR + PT_BYTE - BEG_BYTE
+ inserted),
trytry);
- immediate_quit = 0;
+ immediate_quit = false;
}
if (this <= 0)
}
}
- QUIT;
+ maybe_quit ();
p = XCDR (p);
}
}
}
- immediate_quit = 1;
+ immediate_quit = true;
if (STRINGP (start))
ok = a_write (desc, start, 0, SCHARS (start), &annotations, &coding);
save_errno = errno;
}
- immediate_quit = 0;
+ immediate_quit = false;
/* fsync is not crucial for temporary files. Nor for auto-save
files, since they might lose some work anyway. */
/* readlinkat saw a non-symlink, but emacs_open saw a symlink.
The former must have been removed and replaced by the latter.
Try again. */
- QUIT;
+ maybe_quit ();
}
return nbytes;
rarely_quit (unsigned short int *quit_count)
{
if (! (++*quit_count & (QUIT_COUNT_HEURISTIC - 1)))
- QUIT;
+ maybe_quit ();
}
/* Random data-structure functions. */
{
if (MOST_POSITIVE_FIXNUM < i)
error ("List too long");
- QUIT;
+ maybe_quit ();
}
sequence = XCDR (sequence);
}
halftail = XCDR (halftail);
if ((lolen & (QUIT_COUNT_HEURISTIC - 1)) == 0)
{
- QUIT;
+ maybe_quit ();
if (lolen == 0)
hilen += UINTMAX_MAX + 1.0;
}
{
ret = gnutls_handshake (state);
emacs_gnutls_handle_error (state, ret);
- QUIT;
+ maybe_quit ();
}
while (ret < 0
&& gnutls_error_is_fatal (ret) == 0
continuation_glyph_width = 0; /* In the fringe. */
#endif
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
/* It's just impossible to be too paranoid here. */
eassert (from == BYTE_TO_CHAR (frombyte) && frombyte == CHAR_TO_BYTE (from));
/* Nonzero if have just continued a line */
val_compute_motion.contin = (contin_hpos && prev_hpos == 0);
- immediate_quit = 0;
+ immediate_quit = false;
return &val_compute_motion;
}
Change BYTEPOS to be where we have actually moved the gap to.
Note that this cannot happen when we are called to make the
gap larger or smaller, since make_gap_larger and
- make_gap_smaller prevent QUIT by setting inhibit-quit. */
+ make_gap_smaller set inhibit-quit. */
if (QUITP)
{
bytepos = new_s1;
GPT = charpos;
eassert (charpos <= bytepos);
if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
- QUIT;
+ maybe_quit ();
}
/* Move the gap to a position greater than the current GPT.
Change BYTEPOS to be where we have actually moved the gap to.
Note that this cannot happen when we are called to make the
gap larger or smaller, since make_gap_larger and
- make_gap_smaller prevent QUIT by setting inhibit-quit. */
+ make_gap_smaller set inhibit-quit. */
if (QUITP)
{
bytepos = new_s1;
GPT_BYTE = bytepos;
eassert (charpos <= bytepos);
if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
- QUIT;
+ maybe_quit ();
}
\f
/* If the selected window's old pointm is adjacent or covered by the
enlarge_buffer_text (current_buffer, nbytes_added);
- /* Prevent quitting in gap_left. We cannot allow a QUIT there,
+ /* Prevent quitting in gap_left. We cannot allow a quit there,
because that would leave the buffer text in an inconsistent
state, with 2 gap holes instead of just one. */
tem = Vinhibit_quit;
if (GAP_SIZE - nbytes_removed < GAP_BYTES_MIN)
nbytes_removed = GAP_SIZE - GAP_BYTES_MIN;
- /* Prevent quitting in gap_right. We cannot allow a QUIT there,
+ /* Prevent quitting in gap_right. We cannot allow a quit there,
because that would leave the buffer text in an inconsistent
state, with 2 gap holes instead of just one. */
tem = Vinhibit_quit;
volatile int interrupt_input_blocked;
/* True means an input interrupt or alarm signal has arrived.
- The QUIT macro checks this. */
+ The maybe_quit function checks this. */
volatile bool pending_signals;
#define KBD_BUFFER_SIZE 4096
if (!NILP (Vquit_flag))
{
Vexecuting_kbd_macro = Qt;
- QUIT; /* Make some noise. */
+ maybe_quit (); /* Make some noise. */
/* Will return since macro now empty. */
}
}
if (immediate_quit && NILP (Vinhibit_quit))
{
immediate_quit = false;
- QUIT;
+ maybe_quit ();
}
}
}
USE_SAFE_ALLOCA;
/* In order to build the menus, we need to call the keymap
- accessors. They all call QUIT. But this function is called
+ accessors. They all call maybe_quit. But this function is called
during redisplay, during which a quit is fatal. So inhibit
quitting while building the menus.
We do this instead of specbind because (1) errors will clear it anyway
*nitems = 0;
/* In order to build the menus, we need to call the keymap
- accessors. They all call QUIT. But this function is called
+ accessors. They all call maybe_quit. But this function is called
during redisplay, during which a quit is fatal. So inhibit
quitting while building the menus. We do this instead of
specbind because (1) errors will clear it anyway and (2) this
if (!NILP (prompt))
CHECK_STRING (prompt);
- QUIT;
+ maybe_quit ();
specbind (Qinput_method_exit_on_first_char,
(NILP (cmd_loop) ? Qt : Qnil));
if (i == -1)
{
Vquit_flag = Qt;
- QUIT;
+ maybe_quit ();
}
return unbind_to (count,
If we have a frame on the controlling tty, we assume that the
SIGINT was generated by C-g, so we call handle_interrupt.
- Otherwise, tell QUIT to kill Emacs. */
+ Otherwise, tell maybe_quit to kill Emacs. */
static void
handle_interrupt_signal (int sig)
{
/* If there are no frames there, let's pretend that we are a
well-behaving UN*X program and quit. We must not call Lisp
- in a signal handler, so tell QUIT to exit when it is
+ in a signal handler, so tell maybe_quit to exit when it is
safe. */
Vquit_flag = Qkill_emacs;
}
retval = Fcons (Qkeymap, Fcons (retval, retval_tail));
}
}
- QUIT;
+ maybe_quit ();
}
return EQ (Qunbound, retval) ? get_keyelt (t_binding, autoload) : retval;
should be inserted before it. */
goto keymap_end;
- QUIT;
+ maybe_quit ();
}
keymap_end:
if (!CONSP (keymap))
return make_number (idx);
- QUIT;
+ maybe_quit ();
}
}
non-ascii prefixes like `C-down-mouse-2'. */
continue;
- QUIT;
+ maybe_quit ();
data.definition = definition;
data.noindirect = noindirect;
for (tail = map; CONSP (tail); tail = XCDR (tail))
{
- QUIT;
+ maybe_quit ();
if (VECTORP (XCAR (tail))
|| CHAR_TABLE_P (XCAR (tail)))
int range_beg, range_end;
Lisp_Object val;
- QUIT;
+ maybe_quit ();
if (i == stop)
{
extern Lisp_Object memory_signal_data;
-/* Check quit-flag and quit if it is non-nil.
- Typing C-g does not directly cause a quit; it only sets Vquit_flag.
- So the program needs to do QUIT at times when it is safe to quit.
- Every loop that might run for a long time or might not exit
- ought to do QUIT at least once, at a safe place.
- Unless that is impossible, of course.
- But it is very desirable to avoid creating loops where QUIT is impossible.
-
- Exception: if you set immediate_quit to true,
- then the handler that responds to the C-g does the quit itself.
- This is a good thing to do around a loop that has no side effects
- and (in particular) cannot call arbitrary Lisp code.
+/* Check quit-flag and quit if it is non-nil. Typing C-g does not
+ directly cause a quit; it only sets Vquit_flag. So the program
+ needs to call maybe_quit at times when it is safe to quit. Every
+ loop that might run for a long time or might not exit ought to call
+ maybe_quit at least once, at a safe place. Unless that is
+ impossible, of course. But it is very desirable to avoid creating
+ loops where maybe_quit is impossible.
+
+ Exception: if you set immediate_quit, the handler that responds to
+ the C-g does the quit itself. This is a good thing to do around a
+ loop that has no side effects and (in particular) cannot call
+ arbitrary Lisp code.
If quit-flag is set to `kill-emacs' the SIGINT handler has received
a request to exit Emacs when it is safe to do.
When not quitting, process any pending signals. */
extern void maybe_quit (void);
-#define QUIT maybe_quit ()
/* True if ought to quit now. */
while (c == EOF && ferror (instream) && errno == EINTR)
{
unblock_input ();
- QUIT;
+ maybe_quit ();
block_input ();
clearerr (instream);
c = getc (instream);
Fcons (newelt, XCDR (tem))));
tem2 = XCDR (tem2);
- QUIT;
+ maybe_quit ();
}
}
}
else
prev = tail;
tail = XCDR (tail);
- QUIT;
+ maybe_quit ();
}
/* If we're loading an entire file, cons the new assoc onto the
executing_kbd_macro_iterations = ++success_count;
- QUIT;
+ maybe_quit ();
}
while (--repeat
&& (STRINGP (Vexecuting_kbd_macro) || VECTORP (Vexecuting_kbd_macro)));
case_fold);
if (EQ (tem, Qt))
return elt;
- QUIT;
+ maybe_quit ();
}
return Qnil;
}
unsigned char str[MAX_MULTIBYTE_LENGTH];
int len = CHAR_STRING (ch, str);
- QUIT;
+ maybe_quit ();
if (NILP (fun))
{
max (sizeof " . #" + INT_STRLEN_BOUND (printmax_t),
40))];
- QUIT;
+ maybe_quit ();
/* Detect circularities and truncate them. */
if (NILP (Vprint_circle))
FETCH_STRING_CHAR_ADVANCE (c, obj, i, i_byte);
- QUIT;
+ maybe_quit ();
if (multibyte
? (CHAR_BYTE8_P (c) && (c = CHAR_TO_BYTE8 (c), true))
/* Here, we must convert each multi-byte form to the
corresponding character code before handing it to PRINTCHAR. */
FETCH_STRING_CHAR_ADVANCE (c, name, i, i_byte);
- QUIT;
+ maybe_quit ();
if (escapeflag)
{
for (i = 0; i < size_in_chars; i++)
{
- QUIT;
+ maybe_quit ();
c = bool_vector_uchar_data (obj)[i];
if (c == '\n' && print_escape_newlines)
print_c_string ("\\n", printcharfun);
break;
}
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
ret = connect (s, sa, addrlen);
xerrno = errno;
retry_select:
FD_ZERO (&fdset);
FD_SET (s, &fdset);
- QUIT;
+ maybe_quit ();
sc = pselect (s + 1, NULL, &fdset, NULL, NULL, NULL);
if (sc == -1)
{
}
#endif /* !WINDOWSNT */
- immediate_quit = 0;
+ immediate_quit = false;
/* Discard the unwind protect closing S. */
specpdl_ptr = specpdl + count;
#endif
}
- immediate_quit = 0;
+ immediate_quit = false;
if (s < 0)
{
struct addrinfo *res, *lres;
int ret;
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
struct addrinfo hints;
memset (&hints, 0, sizeof hints);
#else
error ("%s/%s getaddrinfo error %d", SSDATA (host), portstring, ret);
#endif
- immediate_quit = 0;
+ immediate_quit = false;
for (lres = res; lres; lres = lres->ai_next)
addrinfos = Fcons (conv_addrinfo_to_lisp (lres), addrinfos);
since we want to return C-g as an input character.
Otherwise, do pending quit if requested. */
if (read_kbd >= 0)
- QUIT;
+ maybe_quit ();
else if (pending_signals)
process_pending_signals ();
{
/* Prevent input_pending from remaining set if we quit. */
clear_input_pending ();
- QUIT;
+ maybe_quit ();
}
return got_some_output;
since we want to return C-g as an input character.
Otherwise, do pending quit if requested. */
if (read_kbd >= 0)
- QUIT;
+ maybe_quit ();
/* Exit now if the cell we're waiting for became non-nil. */
if (! NILP (wait_for_cell) && ! NILP (XCAR (wait_for_cell)))
some global flag so that some Elisp code can offload its
data elsewhere, so as to avoid the eviction code.
There are 2 ways to do that, AFAICT:
- - Set a flag checked in QUIT, such that QUIT can then call
- Fprofiler_cpu_log and stash the full log for later use.
+ - Set a flag checked in maybe_quit, such that maybe_quit can then
+ call Fprofiler_cpu_log and stash the full log for later use.
- Set a flag check in post-gc-hook, so that Elisp code can call
profiler-cpu-log. That gives us more flexibility since that
Elisp code can then do all kinds of fun stuff like write
/* Explicit quit checking is needed for Emacs, which uses polling to
process input events. */
#ifdef emacs
-# define IMMEDIATE_QUIT_CHECK \
- do { \
- if (immediate_quit) QUIT; \
- } while (0)
+# define IMMEDIATE_QUIT_CHECK (immediate_quit ? maybe_quit () : (void) 0)
#else
-# define IMMEDIATE_QUIT_CHECK ((void)0)
+# define IMMEDIATE_QUIT_CHECK ((void) 0)
#endif
\f
/* Structure to manage work area for range table. */
posix,
!NILP (BVAR (current_buffer, enable_multibyte_characters)));
- immediate_quit = 1;
- QUIT; /* Do a pending quit right away, to avoid paradoxical behavior */
+ /* Do a pending quit right away, to avoid paradoxical behavior */
+ immediate_quit = true;
+ maybe_quit ();
/* Get pointers and sizes of the two strings
that make up the visible portion of the buffer. */
(NILP (Vinhibit_changing_match_data)
? &search_regs : NULL),
ZV_BYTE - BEGV_BYTE);
- immediate_quit = 0;
+ immediate_quit = false;
#ifdef REL_ALLOC
r_alloc_inhibit_buffer_relocation (0);
#endif
? BVAR (current_buffer, case_canon_table) : Qnil),
posix,
STRING_MULTIBYTE (string));
- immediate_quit = 1;
+ immediate_quit = true;
re_match_object = string;
val = re_search (bufp, SSDATA (string),
SBYTES (string) - pos_byte,
(NILP (Vinhibit_changing_match_data)
? &search_regs : NULL));
- immediate_quit = 0;
+ immediate_quit = false;
/* Set last_thing_searched only when match data is changed. */
if (NILP (Vinhibit_changing_match_data))
bufp = compile_pattern (regexp, 0, table,
0, STRING_MULTIBYTE (string));
- immediate_quit = 1;
+ immediate_quit = true;
re_match_object = string;
val = re_search (bufp, SSDATA (string),
SBYTES (string), 0,
SBYTES (string), 0);
- immediate_quit = 0;
+ immediate_quit = false;
return val;
}
bufp = compile_pattern (regexp, 0,
Vascii_canon_table, 0,
0);
- immediate_quit = 1;
+ immediate_quit = true;
val = re_search (bufp, string, len, 0, len, 0);
- immediate_quit = 0;
+ immediate_quit = false;
return val;
}
}
buf = compile_pattern (regexp, 0, Qnil, 0, multibyte);
- immediate_quit = 1;
+ immediate_quit = true;
#ifdef REL_ALLOC
/* Prevent ralloc.c from relocating the current buffer while
searching it. */
#ifdef REL_ALLOC
r_alloc_inhibit_buffer_relocation (0);
#endif
- immediate_quit = 0;
+ immediate_quit = false;
return len;
}
ptrdiff_t next_change;
int result = 1;
- immediate_quit = 0;
+ immediate_quit = false;
while (start < end && result)
{
ptrdiff_t lim1;
if (--count == 0)
{
- immediate_quit = 0;
+ immediate_quit = false;
if (bytepos)
*bytepos = lim_byte + next;
return BYTE_TO_CHAR (lim_byte + next);
ptrdiff_t next_change;
int result = 1;
- immediate_quit = 0;
+ immediate_quit = false;
while (start > end && result)
{
ptrdiff_t lim1;
if (++count >= 0)
{
- immediate_quit = 0;
+ immediate_quit = false;
if (bytepos)
*bytepos = ceiling_byte + prev + 1;
return BYTE_TO_CHAR (ceiling_byte + prev + 1);
}
}
- immediate_quit = 0;
+ immediate_quit = false;
if (shortage)
*shortage = count * direction;
if (bytepos)
trt, posix,
!NILP (BVAR (current_buffer, enable_multibyte_characters)));
- immediate_quit = 1; /* Quit immediately if user types ^G,
+ immediate_quit = true; /* Quit immediately if user types ^G,
because letting this function finish
can take too long. */
- QUIT; /* Do a pending quit right away,
+ maybe_quit (); /* Do a pending quit right away,
to avoid paradoxical behavior */
/* Get pointers and sizes of the two strings
that make up the visible portion of the buffer. */
}
else
{
- immediate_quit = 0;
+ immediate_quit = false;
#ifdef REL_ALLOC
r_alloc_inhibit_buffer_relocation (0);
#endif
}
else
{
- immediate_quit = 0;
+ immediate_quit = false;
#ifdef REL_ALLOC
r_alloc_inhibit_buffer_relocation (0);
#endif
}
n--;
}
- immediate_quit = 0;
+ immediate_quit = false;
#ifdef REL_ALLOC
r_alloc_inhibit_buffer_relocation (0);
#endif
< 0)
return (n * (0 - direction));
/* First we do the part we can by pointers (maybe nothing) */
- QUIT;
+ maybe_quit ();
pat = base_pat;
limit = pos_byte - dirlen + direction;
if (direction > 0)
if (--count == 0)
{
- immediate_quit = 0;
+ immediate_quit = false;
if (bytepos)
*bytepos = lim_byte + next;
return BYTE_TO_CHAR (lim_byte + next);
}
}
- immediate_quit = 0;
+ immediate_quit = false;
if (shortage)
*shortage = count;
if (bytepos)
int ch0, ch1;
Lisp_Object func, pos;
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
SETUP_SYNTAX_TABLE (from, count);
{
if (from == end)
{
- immediate_quit = 0;
+ immediate_quit = false;
return 0;
}
UPDATE_SYNTAX_TABLE_FORWARD (from);
{
if (from == beg)
{
- immediate_quit = 0;
+ immediate_quit = false;
return 0;
}
DEC_BOTH (from, from_byte);
count++;
}
- immediate_quit = 0;
+ immediate_quit = false;
return from;
}
stop = (pos >= GPT && GPT > XINT (lim)) ? GAP_END_ADDR : endp;
}
- immediate_quit = 1;
+ immediate_quit = true;
/* This code may look up syntax tables using functions that rely on the
gl_state object. To make sure this object is not out of date,
let's initialize it manually.
}
SET_PT_BOTH (pos, pos_byte);
- immediate_quit = 0;
+ immediate_quit = false;
SAFE_FREE ();
return make_number (PT - start_point);
ptrdiff_t pos_byte = PT_BYTE;
unsigned char *p, *endp, *stop;
- immediate_quit = 1;
+ immediate_quit = true;
SETUP_SYNTAX_TABLE (pos, forwardp ? 1 : -1);
if (forwardp)
done:
SET_PT_BOTH (pos, pos_byte);
- immediate_quit = 0;
+ immediate_quit = false;
return make_number (PT - start_point);
}
count1 = XINT (count);
stop = count1 > 0 ? ZV : BEGV;
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
from = PT;
from_byte = PT_BYTE;
if (from == stop)
{
SET_PT_BOTH (from, from_byte);
- immediate_quit = 0;
+ immediate_quit = false;
return Qnil;
}
c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
comstyle = ST_COMMENT_STYLE;
else if (code != Scomment)
{
- immediate_quit = 0;
+ immediate_quit = false;
DEC_BOTH (from, from_byte);
SET_PT_BOTH (from, from_byte);
return Qnil;
from = out_charpos; from_byte = out_bytepos;
if (!found)
{
- immediate_quit = 0;
+ immediate_quit = false;
SET_PT_BOTH (from, from_byte);
return Qnil;
}
if (from <= stop)
{
SET_PT_BOTH (BEGV, BEGV_BYTE);
- immediate_quit = 0;
+ immediate_quit = false;
return Qnil;
}
else if (code != Swhitespace || quoted)
{
leave:
- immediate_quit = 0;
+ immediate_quit = false;
INC_BOTH (from, from_byte);
SET_PT_BOTH (from, from_byte);
return Qnil;
}
SET_PT_BOTH (from, from_byte);
- immediate_quit = 0;
+ immediate_quit = false;
return Qt;
}
\f
from_byte = CHAR_TO_BYTE (from);
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
SETUP_SYNTAX_TABLE (from, count);
while (count > 0)
if (depth)
goto lose;
- immediate_quit = 0;
+ immediate_quit = false;
return Qnil;
/* End of object reached */
if (depth)
goto lose;
- immediate_quit = 0;
+ immediate_quit = false;
return Qnil;
done2:
}
- immediate_quit = 0;
+ immediate_quit = false;
XSETFASTINT (val, from);
return val;
UPDATE_SYNTAX_TABLE_FORWARD (from); \
} while (0)
- immediate_quit = 1;
- QUIT;
+ immediate_quit = true;
+ maybe_quit ();
depth = state->depth;
start_quoted = state->quoted;
state->levelstarts);
state->prev_syntax = (SYNTAX_FLAGS_COMSTARTEND_FIRST (prev_from_syntax)
|| state->quoted) ? prev_from_syntax : Smax;
- immediate_quit = 0;
+ immediate_quit = false;
}
/* Convert a (lisp) parse state to the internal form used in
if (errno != EINTR)
emacs_abort ();
- /* Note: the MS-Windows emulation of waitpid calls QUIT
+ /* Note: the MS-Windows emulation of waitpid calls maybe_quit
internally. */
if (interruptible)
- QUIT;
+ maybe_quit ();
}
/* If successful and status is requested, tell wait_reading_process_output
oflags |= O_BINARY;
oflags |= O_CLOEXEC;
while ((fd = open (file, oflags, mode)) < 0 && errno == EINTR)
- QUIT;
+ maybe_quit ();
if (! O_CLOEXEC && 0 <= fd)
fcntl (fd, F_SETFD, FD_CLOEXEC);
return fd;
while ((rtnval = read (fildes, buf, nbyte)) == -1
&& (errno == EINTR))
- QUIT;
+ maybe_quit ();
return (rtnval);
}
{
if (errno == EINTR)
{
- /* I originally used `QUIT' but that might cause files to
+ /* I originally used maybe_quit but that might cause files to
be truncated if you hit C-g in the middle of it. --Stef */
if (process_signals && pending_signals)
process_pending_signals ();
if (! CONSP (tail))
error ("Odd length text property list");
tail = XCDR (tail);
- QUIT;
+ maybe_quit ();
}
while (CONSP (tail));
break;
}
- QUIT;
+ maybe_quit ();
}
unblock_input ();
if (!NILP (Vthrow_on_input))
{
Vquit_flag = Vthrow_on_input;
- /* Doing a QUIT from this thread is a bad idea, since this
+ /* Calling maybe_quit from this thread is a bad idea, since this
unwinds the stack of the Lisp thread, and the Windows runtime
rightfully barfs. Disabled. */
#if 0
do it now. */
if (immediate_quit && NILP (Vinhibit_quit))
{
- immediate_quit = 0;
- QUIT;
+ immediate_quit = false;
+ maybe_quit ();
}
#endif
}
Lisp_Object descriptor = make_pointer_integer (desc);
/* This is called from the input queue handling code, inside a
- critical section, so we cannot possibly QUIT if watch_list is not
+ critical section, so we cannot possibly quit if watch_list is not
in the right condition. */
return NILP (watch_list) ? Qnil : assoc_no_quit (descriptor, watch_list);
}
do
{
- QUIT;
+ maybe_quit ();
active = WaitForMultipleObjects (nh, wait_hnd, FALSE, timeout_ms);
} while (active == WAIT_TIMEOUT && !dont_wait);
bset_last_selected_window (XBUFFER (w->contents), window);
record_and_return:
- /* record_buffer can run QUIT, so make sure it is run only after we have
- re-established the invariant between selected_window and selected_frame,
- otherwise the temporary broken invariant might "escape" (bug#14161). */
+ /* record_buffer can call maybe_quit, so make sure it is run only
+ after we have re-established the invariant between
+ selected_window and selected_frame, otherwise the temporary
+ broken invariant might "escape" (Bug#14161). */
if (NILP (norecord))
{
w->use_time = ++window_select_count;
else
prev = tail;
tail = XCDR (tail);
- QUIT;
+ maybe_quit ();
}
/* Not found--return unchanged LIST. */
Fcons (selection_data, dpyinfo->terminal->Vselection_alist));
/* If we already owned the selection, remove the old selection
- data. Don't use Fdelq as that may QUIT. */
+ data. Don't use Fdelq as that may quit. */
if (!NILP (prev_value))
{
/* We know it's not the CAR, so it's easy. */
&& local_selection_time > changed_owner_time)
return;
- /* Otherwise, really clear. Don't use Fdelq as that may QUIT;. */
+ /* Otherwise, really clear. Don't use Fdelq as that may quit. */
Vselection_alist = dpyinfo->terminal->Vselection_alist;
if (EQ (local_selection_data, CAR (Vselection_alist)))
Vselection_alist = XCDR (Vselection_alist);
(*surface_set_size_func) (surface, width, height);
unblock_input ();
- QUIT;
+ maybe_quit ();
block_input ();
}