emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 33be500 1/3: Remove immediate_quit.


From: Paul Eggert
Subject: [Emacs-diffs] master 33be500 1/3: Remove immediate_quit.
Date: Wed, 1 Feb 2017 23:23:24 +0000 (UTC)

branch: master
commit 33be50037c2b4cdb002538534e9915c6bad253b7
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Remove immediate_quit.
    
    The old code that sets and clears immediate_quit was
    ineffective except when Emacs is running in terminal mode, and
    has problematic race conditions anyway, so remove it.  This
    will introduce some hangs when Emacs runs in terminal mode,
    and these hangs should be fixed in followup patches.
    * src/keyboard.c (immediate_quit): Remove.  All uses removed.
---
 admin/notes/multi-tty |    5 ++---
 src/bytecode.c        |    4 ----
 src/callproc.c        |    8 +-------
 src/dired.c           |    3 ---
 src/editfns.c         |    9 ++-------
 src/eval.c            |    2 --
 src/fileio.c          |   19 -------------------
 src/fns.c             |   42 ++++++++----------------------------------
 src/indent.c          |    2 --
 src/keyboard.c        |   45 +++++++--------------------------------------
 src/lisp.h            |    8 --------
 src/process.c         |   10 +---------
 src/regex.c           |   10 ++++------
 src/search.c          |   33 ++-------------------------------
 src/syntax.c          |   30 ++----------------------------
 src/w32fns.c          |   11 +----------
 src/window.c          |    2 --
 17 files changed, 30 insertions(+), 213 deletions(-)

diff --git a/admin/notes/multi-tty b/admin/notes/multi-tty
index b58180e..d0096ad 100644
--- a/admin/notes/multi-tty
+++ b/admin/notes/multi-tty
@@ -1239,9 +1239,8 @@ DIARY OF CHANGES
    (Update: OK, it all seems so easy now (NOT).  Input could be done
    synchronously (with wait_reading_process_input), or asynchronously
    by SIGIO or polling (SIGALRM).  C-g either sets the Vquit_flag,
-   signals a 'quit condition (when immediate_quit), or throws to
-   'getcjmp' when Emacs was waiting for input when the C-g event
-   arrived.)
+   signals a 'quit condition, or throws to 'getcjmp' when Emacs was
+   waiting for input when the C-g event arrived.)
 
 -- Replace wrong_kboard_jmpbuf with a special return value of
    read_char.  It is absurd that we use setjmp/longjmp just to return
diff --git a/src/bytecode.c b/src/bytecode.c
index 499fb88..ed58d18 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -842,10 +842,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
            Lisp_Object v2 = POP, v1 = TOP;
            CHECK_NUMBER (v1);
            EMACS_INT n = XINT (v1);
-           immediate_quit = true;
            while (--n >= 0 && CONSP (v2))
              v2 = XCDR (v2);
-           immediate_quit = false;
            TOP = CAR (v2);
            NEXT;
          }
@@ -1276,10 +1274,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
                Lisp_Object v2 = POP, v1 = TOP;
                CHECK_NUMBER (v2);
                EMACS_INT n = XINT (v2);
-               immediate_quit = true;
                while (--n >= 0 && CONSP (v1))
                  v1 = XCDR (v1);
-               immediate_quit = false;
                TOP = CAR (v1);
              }
            else
diff --git a/src/callproc.c b/src/callproc.c
index 301ccf3..85674bb 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -198,11 +198,9 @@ call_process_cleanup (Lisp_Object buffer)
     {
       kill (-synch_process_pid, SIGINT);
       message1 ("Waiting for process to die...(type C-g again to kill it 
instantly)");
-      immediate_quit = true;
       maybe_quit ();
       wait_for_termination (synch_process_pid, 0, 1);
       synch_process_pid = 0;
-      immediate_quit = false;
       message1 ("Waiting for process to die...done");
     }
 #endif /* !MSDOS */
@@ -726,7 +724,6 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
       process_coding.src_multibyte = 0;
     }
 
-  immediate_quit = true;
   maybe_quit ();
 
   if (0 <= fd0)
@@ -769,7 +766,6 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
            }
 
          /* Now NREAD is the total amount of data in the buffer.  */
-         immediate_quit = false;
 
          if (!nread)
            ;
@@ -842,7 +838,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
                 we should have already detected a coding system.  */
              display_on_the_fly = true;
            }
-         immediate_quit = true;
+
          maybe_quit ();
        }
     give_up: ;
@@ -860,8 +856,6 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
   wait_for_termination (pid, &status, fd0 < 0);
 #endif
 
-  immediate_quit = false;
-
   /* Don't kill any children that the subprocess may have left behind
      when exiting.  */
   synch_process_pid = 0;
diff --git a/src/dired.c b/src/dired.c
index 52e81fb..5ea00fb 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -248,14 +248,11 @@ directory_files_internal (Lisp_Object directory, 
Lisp_Object full,
 
       /* Now that we have unwind_protect in place, we might as well
         allow matching to be interrupted.  */
-      immediate_quit = true;
       maybe_quit ();
 
       bool wanted = (NILP (match)
                     || re_search (bufp, SSDATA (name), len, 0, len, 0) >= 0);
 
-      immediate_quit = false;
-
       if (wanted)
        {
          if (!NILP (full))
diff --git a/src/editfns.c b/src/editfns.c
index 82c6abb..b605437 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3053,7 +3053,6 @@ determines whether case is significant or ignored.  */)
   i2 = begp2;
   i1_byte = buf_charpos_to_bytepos (bp1, i1);
   i2_byte = buf_charpos_to_bytepos (bp2, i2);
-  immediate_quit = true;
 
   while (i1 < endp1 && i2 < endp2)
     {
@@ -3092,17 +3091,13 @@ determines whether case is significant or ignored.  */)
          c1 = char_table_translate (trt, c1);
          c2 = char_table_translate (trt, c2);
        }
+
       if (c1 != c2)
-       {
-         immediate_quit = false;
-         return make_number (c1 < c2 ? -1 - chars : chars + 1);
-       }
+       return make_number (c1 < c2 ? -1 - chars : chars + 1);
 
       chars++;
     }
 
-  immediate_quit = false;
-
   /* The strings match as far as they go.
      If one is shorter, that one is less.  */
   if (chars < endp1 - begp1)
diff --git a/src/eval.c b/src/eval.c
index 62d4af1..844879d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1131,7 +1131,6 @@ unwind_to_catch (struct handler *catch, Lisp_Object value)
   /* Restore certain special C variables.  */
   set_poll_suppress_count (catch->poll_suppress_count);
   unblock_input_to (catch->interrupt_input_blocked);
-  immediate_quit = false;
 
   do
     {
@@ -1517,7 +1516,6 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object 
data, bool keyboard_quit)
   Lisp_Object clause = Qnil;
   struct handler *h;
 
-  immediate_quit = false;
   if (gc_in_progress || waiting_for_input)
     emacs_abort ();
 
diff --git a/src/fileio.c b/src/fileio.c
index a46cfc7..a109737 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1960,9 +1960,7 @@ permissions.  */)
       report_file_error ("Copying permissions to", newname);
     }
 #else /* not WINDOWSNT */
-  immediate_quit = true;
   ifd = emacs_open (SSDATA (encoded_file), O_RDONLY, 0);
-  immediate_quit = false;
 
   if (ifd < 0)
     report_file_error ("Opening input file", file);
@@ -2024,7 +2022,6 @@ permissions.  */)
        oldsize = out_st.st_size;
     }
 
-  immediate_quit = true;
   maybe_quit ();
 
   if (clone_file (ofd, ifd))
@@ -2047,8 +2044,6 @@ permissions.  */)
   if (newsize < oldsize && ftruncate (ofd, newsize) != 0)
     report_file_error ("Truncating output file", newname);
 
-  immediate_quit = false;
-
 #ifndef MSDOS
   /* Preserve the original file permissions, and if requested, also its
      owner and group.  */
@@ -3403,13 +3398,11 @@ read_non_regular (Lisp_Object state)
 {
   int nbytes;
 
-  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 = false;
   /* Fast recycle this object for the likely next call.  */
   free_misc (state);
   return make_number (nbytes);
@@ -3868,7 +3861,6 @@ by calling `format-decode', which see.  */)
            report_file_error ("Setting file position", orig_filename);
        }
 
-      immediate_quit = true;
       maybe_quit ();
       /* Count how many chars at the start of the file
         match the text at the beginning of the buffer.  */
@@ -3907,7 +3899,6 @@ by calling `format-decode', which see.  */)
          if (bufpos != nread)
            break;
        }
-      immediate_quit = false;
       /* If the file matches the buffer completely,
         there's no need to replace anything.  */
       if (same_at_start - BEGV_BYTE == end_offset - beg_offset)
@@ -3919,7 +3910,6 @@ by calling `format-decode', which see.  */)
          del_range_1 (same_at_start, same_at_end, 0, 0);
          goto handled;
        }
-      immediate_quit = true;
       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
@@ -3977,7 +3967,6 @@ by calling `format-decode', which see.  */)
          if (nread == 0)
            break;
        }
-      immediate_quit = false;
 
       if (! giveup_match_end)
        {
@@ -4075,11 +4064,9 @@ by calling `format-decode', which see.  */)
             quitting while reading a huge file.  */
 
          /* Allow quitting out of the actual I/O.  */
-         immediate_quit = true;
          maybe_quit ();
          this = emacs_read (fd, read_buf + unprocessed,
                             READ_BUF_SIZE - unprocessed);
-         immediate_quit = false;
 
          if (this <= 0)
            break;
@@ -4294,13 +4281,11 @@ by calling `format-decode', which see.  */)
            /* 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 = true;
            maybe_quit ();
            this = emacs_read (fd,
                               ((char *) BEG_ADDR + PT_BYTE - BEG_BYTE
                                + inserted),
                               trytry);
-           immediate_quit = false;
          }
 
        if (this <= 0)
@@ -5002,8 +4987,6 @@ write_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object filename,
        }
     }
 
-  immediate_quit = true;
-
   if (STRINGP (start))
     ok = a_write (desc, start, 0, SCHARS (start), &annotations, &coding);
   else if (XINT (start) != XINT (end))
@@ -5026,8 +5009,6 @@ write_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object filename,
       save_errno = errno;
     }
 
-  immediate_quit = false;
-
   /* fsync is not crucial for temporary files.  Nor for auto-save
      files, since they might lose some work anyway.  */
   if (open_and_close_file && !auto_saving && !write_region_inhibit_fsync)
diff --git a/src/fns.c b/src/fns.c
index 136a219..444339c 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1361,18 +1361,15 @@ DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0,
   CHECK_NUMBER (n);
   EMACS_INT num = XINT (n);
   Lisp_Object tail = list;
-  immediate_quit = true;
   for (EMACS_INT i = 0; i < num; i++)
     {
       if (! CONSP (tail))
        {
-         immediate_quit = false;
          CHECK_LIST_END (tail, list);
          return Qnil;
        }
       tail = XCDR (tail);
     }
-  immediate_quit = false;
   return tail;
 }
 
@@ -1419,17 +1416,12 @@ DEFUN ("memq", Fmemq, Smemq, 2, 2, 0,
 The value is actually the tail of LIST whose car is ELT.  */)
   (Lisp_Object elt, Lisp_Object list)
 {
-  immediate_quit = true;
   Lisp_Object tail;
   for (tail = list; CONSP (tail); tail = XCDR (tail))
     {
       if (EQ (XCAR (tail), elt))
-       {
-         immediate_quit = false;
-         return tail;
-       }
+       return tail;
     }
-  immediate_quit = false;
   CHECK_LIST_END (tail, list);
   return Qnil;
 }
@@ -1442,18 +1434,13 @@ The value is actually the tail of LIST whose car is 
ELT.  */)
   if (!FLOATP (elt))
     return Fmemq (elt, list);
 
-  immediate_quit = true;
   Lisp_Object tail;
   for (tail = list; CONSP (tail); tail = XCDR (tail))
     {
       Lisp_Object tem = XCAR (tail);
       if (FLOATP (tem) && internal_equal (elt, tem, 0, 0, Qnil))
-       {
-         immediate_quit = false;
-         return tail;
-       }
+       return tail;
     }
-  immediate_quit = false;
   CHECK_LIST_END (tail, list);
   return Qnil;
 }
@@ -1464,15 +1451,12 @@ The value is actually the first element of LIST whose 
car is KEY.
 Elements of LIST that are not conses are ignored.  */)
   (Lisp_Object key, Lisp_Object list)
 {
-  immediate_quit = true;
   Lisp_Object tail;
   for (tail = list; CONSP (tail); tail = XCDR (tail))
-    if (CONSP (XCAR (tail)) && EQ (XCAR (XCAR (tail)), key))
-      {
-       immediate_quit = false;
+    {
+      if (CONSP (XCAR (tail)) && EQ (XCAR (XCAR (tail)), key))
        return XCAR (tail);
-      }
-  immediate_quit = false;
+    }
   CHECK_LIST_END (tail, list);
   return Qnil;
 }
@@ -1529,15 +1513,12 @@ DEFUN ("rassq", Frassq, Srassq, 2, 2, 0,
 The value is actually the first element of LIST whose cdr is KEY.  */)
   (Lisp_Object key, Lisp_Object list)
 {
-  immediate_quit = true;
   Lisp_Object tail;
   for (tail = list; CONSP (tail); tail = XCDR (tail))
-    if (CONSP (XCAR (tail)) && EQ (XCDR (XCAR (tail)), key))
-      {
-       immediate_quit = false;
+    {
+      if (CONSP (XCAR (tail)) && EQ (XCDR (XCAR (tail)), key))
        return XCAR (tail);
-      }
-  immediate_quit = false;
+    }
   CHECK_LIST_END (tail, list);
   return Qnil;
 }
@@ -2077,21 +2058,18 @@ use `(setq x (plist-put x prop val))' to be sure to use 
the new value.
 The PLIST is modified by side effects.  */)
   (Lisp_Object plist, Lisp_Object prop, Lisp_Object val)
 {
-  immediate_quit = true;
   Lisp_Object prev = Qnil;
   for (Lisp_Object tail = plist; CONSP (tail) && CONSP (XCDR (tail));
        tail = XCDR (XCDR (tail)))
     {
       if (EQ (prop, XCAR (tail)))
        {
-         immediate_quit = false;
          Fsetcar (XCDR (tail), val);
          return plist;
        }
 
       prev = tail;
     }
-  immediate_quit = false;
   Lisp_Object newcell
     = Fcons (prop, Fcons (val, NILP (prev) ? plist : XCDR (XCDR (prev))));
   if (NILP (prev))
@@ -2442,7 +2420,6 @@ usage: (nconc &rest LISTS)  */)
 
       CHECK_CONS (tem);
 
-      immediate_quit = true;
       Lisp_Object tail;
       do
        {
@@ -2451,7 +2428,6 @@ usage: (nconc &rest LISTS)  */)
        }
       while (CONSP (tem));
 
-      immediate_quit = false;
       rarely_quit (&quit_count);
 
       tem = args[argnum + 1];
@@ -2874,13 +2850,11 @@ property and a property with the value nil.
 The value is actually the tail of PLIST whose car is PROP.  */)
   (Lisp_Object plist, Lisp_Object prop)
 {
-  immediate_quit = true;
   while (CONSP (plist) && !EQ (XCAR (plist), prop))
     {
       plist = XCDR (plist);
       plist = CDR (plist);
     }
-  immediate_quit = false;
   return plist;
 }
 
diff --git a/src/indent.c b/src/indent.c
index 23951a1..33f709c 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1200,7 +1200,6 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, 
EMACS_INT fromvpos,
     continuation_glyph_width = 0;  /* In the fringe.  */
 #endif
 
-  immediate_quit = true;
   maybe_quit ();
 
   /* It's just impossible to be too paranoid here.  */
@@ -1694,7 +1693,6 @@ compute_motion (ptrdiff_t from, ptrdiff_t frombyte, 
EMACS_INT fromvpos,
   /* Nonzero if have just continued a line */
   val_compute_motion.contin = (contin_hpos && prev_hpos == 0);
 
-  immediate_quit = false;
   return &val_compute_motion;
 }
 
diff --git a/src/keyboard.c b/src/keyboard.c
index 0c04d95..317669d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -169,9 +169,6 @@ struct kboard *echo_kboard;
 
 Lisp_Object echo_message_buffer;
 
-/* True means C-g should cause immediate error-signal.  */
-bool immediate_quit;
-
 /* Character that causes a quit.  Normally C-g.
 
    If we are running on an ordinary terminal, this must be an ordinary
@@ -3584,16 +3581,7 @@ kbd_buffer_store_buffered_event (union 
buffered_input_event *event,
      as input, set quit-flag to cause an interrupt.  */
   if (!NILP (Vthrow_on_input)
       && NILP (Fmemq (ignore_event, Vwhile_no_input_ignore_events)))
-    {
-      Vquit_flag = Vthrow_on_input;
-      /* If we're inside a function that wants immediate quits,
-        do it now.  */
-      if (immediate_quit && NILP (Vinhibit_quit))
-       {
-         immediate_quit = false;
-         maybe_quit ();
-       }
-    }
+    Vquit_flag = Vthrow_on_input;
 }
 
 
@@ -10445,30 +10433,12 @@ handle_interrupt (bool in_signal_handler)
     }
   else
     {
-      /* If executing a function that wants to be interrupted out of
-        and the user has not deferred quitting by binding `inhibit-quit'
-        then quit right away.  */
-      if (immediate_quit && NILP (Vinhibit_quit) && !waiting_for_input)
-       {
-         struct gl_state_s saved;
-
-         immediate_quit = false;
-         pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
-         saved = gl_state;
-         quit ();
-         gl_state = saved;
-       }
-      else
-        { /* Else request quit when it's safe.  */
-         int count = NILP (Vquit_flag) ? 1 : force_quit_count + 1;
-         force_quit_count = count;
-         if (count == 3)
-            {
-              immediate_quit = true;
-              Vinhibit_quit = Qnil;
-            }
-          Vquit_flag = Qt;
-        }
+      /* Request quit when it's safe.  */
+      int count = NILP (Vquit_flag) ? 1 : force_quit_count + 1;
+      force_quit_count = count;
+      if (count == 3)
+       Vinhibit_quit = Qnil;
+      Vquit_flag = Qt;
     }
 
   pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
@@ -10907,7 +10877,6 @@ init_keyboard (void)
 {
   /* This is correct before outermost invocation of the editor loop.  */
   command_loop_level = -1;
-  immediate_quit = false;
   quit_char = Ctl ('g');
   Vunread_command_events = Qnil;
   timer_idleness_start_time = invalid_timespec ();
diff --git a/src/lisp.h b/src/lisp.h
index 58e2288..a18e4da 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3131,11 +3131,6 @@ extern Lisp_Object memory_signal_data;
    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.
 
@@ -4348,9 +4343,6 @@ extern char my_edata[];
 extern char my_endbss[];
 extern char *my_endbss_static;
 
-/* True means ^G can quit instantly.  */
-extern bool immediate_quit;
-
 extern void *xmalloc (size_t) ATTRIBUTE_MALLOC_SIZE ((1));
 extern void *xzalloc (size_t) ATTRIBUTE_MALLOC_SIZE ((1));
 extern void *xrealloc (void *, size_t) ATTRIBUTE_ALLOC_SIZE ((2));
diff --git a/src/process.c b/src/process.c
index dbd4358..434a395 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3431,7 +3431,6 @@ connect_network_socket (Lisp_Object proc, Lisp_Object 
addrinfos,
          break;
        }
 
-      immediate_quit = true;
       maybe_quit ();
 
       ret = connect (s, sa, addrlen);
@@ -3439,8 +3438,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object 
addrinfos,
 
       if (ret == 0 || xerrno == EISCONN)
        {
-         /* The unwind-protect will be discarded afterwards.
-            Likewise for immediate_quit.  */
+         /* The unwind-protect will be discarded afterwards.  */
          break;
        }
 
@@ -3481,8 +3479,6 @@ connect_network_socket (Lisp_Object proc, Lisp_Object 
addrinfos,
        }
 #endif /* !WINDOWSNT */
 
-      immediate_quit = false;
-
       /* Discard the unwind protect closing S.  */
       specpdl_ptr = specpdl + count;
       emacs_close (s);
@@ -3539,8 +3535,6 @@ connect_network_socket (Lisp_Object proc, Lisp_Object 
addrinfos,
 #endif
     }
 
-  immediate_quit = false;
-
   if (s < 0)
     {
       /* If non-blocking got this far - and failed - assume non-blocking is
@@ -4012,7 +4006,6 @@ usage: (make-network-process &rest ARGS)  */)
       struct addrinfo *res, *lres;
       int ret;
 
-      immediate_quit = true;
       maybe_quit ();
 
       struct addrinfo hints;
@@ -4034,7 +4027,6 @@ usage: (make-network-process &rest ARGS)  */)
 #else
        error ("%s/%s getaddrinfo error %d", SSDATA (host), portstring, ret);
 #endif
-      immediate_quit = false;
 
       for (lres = res; lres; lres = lres->ai_next)
        addrinfos = Fcons (conv_addrinfo_to_lisp (lres), addrinfos);
diff --git a/src/regex.c b/src/regex.c
index f6e67af..796f868 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -1728,10 +1728,8 @@ typedef struct
 
 /* Explicit quit checking is needed for Emacs, which uses polling to
    process input events.  */
-#ifdef emacs
-# define IMMEDIATE_QUIT_CHECK (immediate_quit ? maybe_quit () : (void) 0)
-#else
-# define IMMEDIATE_QUIT_CHECK ((void) 0)
+#ifndef emacs
+static void maybe_quit (void) {}
 #endif
 
 /* Structure to manage work area for range table.  */
@@ -5820,7 +5818,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
const_re_char *string1,
        /* Unconditionally jump (without popping any failure points).  */
        case jump:
        unconditional_jump:
-         IMMEDIATE_QUIT_CHECK;
+         maybe_quit ();
          EXTRACT_NUMBER_AND_INCR (mcnt, p);    /* Get the amount to jump.  */
          DEBUG_PRINT ("EXECUTING jump %d ", mcnt);
          p += mcnt;                            /* Do the jump.  */
@@ -6168,7 +6166,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
const_re_char *string1,
 
     /* We goto here if a matching operation fails. */
     fail:
-      IMMEDIATE_QUIT_CHECK;
+      maybe_quit ();
       if (!FAIL_STACK_EMPTY ())
        {
          re_char *str, *pat;
diff --git a/src/search.c b/src/search.c
index f54f44c..ed9c12c 100644
--- a/src/search.c
+++ b/src/search.c
@@ -277,7 +277,6 @@ looking_at_1 (Lisp_Object string, bool posix)
                          !NILP (BVAR (current_buffer, 
enable_multibyte_characters)));
 
   /* Do a pending quit right away, to avoid paradoxical behavior */
-  immediate_quit = true;
   maybe_quit ();
 
   /* Get pointers and sizes of the two strings
@@ -311,7 +310,6 @@ looking_at_1 (Lisp_Object string, bool posix)
                  (NILP (Vinhibit_changing_match_data)
                   ? &search_regs : NULL),
                  ZV_BYTE - BEGV_BYTE);
-  immediate_quit = false;
 #ifdef REL_ALLOC
   r_alloc_inhibit_buffer_relocation (0);
 #endif
@@ -399,7 +397,6 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, 
Lisp_Object start,
                           ? BVAR (current_buffer, case_canon_table) : Qnil),
                          posix,
                          STRING_MULTIBYTE (string));
-  immediate_quit = true;
   re_match_object = string;
 
   val = re_search (bufp, SSDATA (string),
@@ -407,7 +404,6 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, 
Lisp_Object start,
                   SBYTES (string) - pos_byte,
                   (NILP (Vinhibit_changing_match_data)
                    ? &search_regs : NULL));
-  immediate_quit = false;
 
   /* Set last_thing_searched only when match data is changed.  */
   if (NILP (Vinhibit_changing_match_data))
@@ -471,13 +467,11 @@ fast_string_match_internal (Lisp_Object regexp, 
Lisp_Object string,
 
   bufp = compile_pattern (regexp, 0, table,
                          0, STRING_MULTIBYTE (string));
-  immediate_quit = true;
   re_match_object = string;
 
   val = re_search (bufp, SSDATA (string),
                   SBYTES (string), 0,
                   SBYTES (string), 0);
-  immediate_quit = false;
   return val;
 }
 
@@ -498,9 +492,7 @@ fast_c_string_match_ignore_case (Lisp_Object regexp,
   bufp = compile_pattern (regexp, 0,
                          Vascii_canon_table, 0,
                          0);
-  immediate_quit = true;
   val = re_search (bufp, string, len, 0, len, 0);
-  immediate_quit = false;
   return val;
 }
 
@@ -561,7 +553,6 @@ fast_looking_at (Lisp_Object regexp, ptrdiff_t pos, 
ptrdiff_t pos_byte,
     }
 
   buf = compile_pattern (regexp, 0, Qnil, 0, multibyte);
-  immediate_quit = true;
 #ifdef REL_ALLOC
   /* Prevent ralloc.c from relocating the current buffer while
      searching it.  */
@@ -572,7 +563,6 @@ fast_looking_at (Lisp_Object regexp, ptrdiff_t pos, 
ptrdiff_t pos_byte,
 #ifdef REL_ALLOC
   r_alloc_inhibit_buffer_relocation (0);
 #endif
-  immediate_quit = false;
 
   return len;
 }
@@ -649,7 +639,7 @@ newline_cache_on_off (struct buffer *buf)
    If BYTEPOS is not NULL, set *BYTEPOS to the byte position corresponding
    to the returned character position.
 
-   If ALLOW_QUIT, set immediate_quit.  That's good to do
+   If ALLOW_QUIT, check for quitting.  That's good to do
    except when inside redisplay.  */
 
 ptrdiff_t
@@ -685,8 +675,6 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
   if (shortage != 0)
     *shortage = 0;
 
-  immediate_quit = allow_quit;
-
   if (count > 0)
     while (start != end)
       {
@@ -704,7 +692,6 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
             ptrdiff_t next_change;
            int result = 1;
 
-            immediate_quit = false;
             while (start < end && result)
              {
                ptrdiff_t lim1;
@@ -757,7 +744,6 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
                start_byte = end_byte;
                break;
              }
-            immediate_quit = allow_quit;
 
             /* START should never be after END.  */
             if (start_byte > ceiling_byte)
@@ -810,7 +796,6 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
 
              if (--count == 0)
                {
-                 immediate_quit = false;
                  if (bytepos)
                    *bytepos = lim_byte + next;
                  return BYTE_TO_CHAR (lim_byte + next);
@@ -833,7 +818,6 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
             ptrdiff_t next_change;
            int result = 1;
 
-            immediate_quit = false;
             while (start > end && result)
              {
                ptrdiff_t lim1;
@@ -870,7 +854,6 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
                start_byte = end_byte;
                break;
              }
-            immediate_quit = allow_quit;
 
             /* Start should never be at or before end.  */
             if (start_byte <= ceiling_byte)
@@ -918,7 +901,6 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
 
              if (++count >= 0)
                {
-                 immediate_quit = false;
                  if (bytepos)
                    *bytepos = ceiling_byte + prev + 1;
                  return BYTE_TO_CHAR (ceiling_byte + prev + 1);
@@ -930,7 +912,6 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
         }
       }
 
-  immediate_quit = false;
   if (shortage)
     *shortage = count * direction;
   if (bytepos)
@@ -954,7 +935,7 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
    the number of line boundaries left unfound, and position at
    the limit we bumped up against.
 
-   If ALLOW_QUIT, set immediate_quit.  That's good to do
+   If ALLOW_QUIT, check for quitting.  That's good to do
    except in special cases.  */
 
 ptrdiff_t
@@ -1197,9 +1178,6 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, 
ptrdiff_t pos_byte,
                              trt, posix,
                              !NILP (BVAR (current_buffer, 
enable_multibyte_characters)));
 
-      immediate_quit = true;   /* Quit immediately if user types ^G,
-                                  because letting this function finish
-                                  can take too long. */
       maybe_quit ();           /* Do a pending quit right away,
                                   to avoid paradoxical behavior */
       /* Get pointers and sizes of the two strings
@@ -1268,7 +1246,6 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, 
ptrdiff_t pos_byte,
            }
          else
            {
-             immediate_quit = false;
 #ifdef REL_ALLOC
               r_alloc_inhibit_buffer_relocation (0);
 #endif
@@ -1313,7 +1290,6 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, 
ptrdiff_t pos_byte,
            }
          else
            {
-             immediate_quit = false;
 #ifdef REL_ALLOC
               r_alloc_inhibit_buffer_relocation (0);
 #endif
@@ -1321,7 +1297,6 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, 
ptrdiff_t pos_byte,
            }
          n--;
        }
-      immediate_quit = false;
 #ifdef REL_ALLOC
       r_alloc_inhibit_buffer_relocation (0);
 #endif
@@ -3231,8 +3206,6 @@ find_newline1 (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
   if (shortage != 0)
     *shortage = 0;
 
-  immediate_quit = allow_quit;
-
   if (count > 0)
     while (start != end)
       {
@@ -3275,7 +3248,6 @@ find_newline1 (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
 
              if (--count == 0)
                {
-                 immediate_quit = false;
                  if (bytepos)
                    *bytepos = lim_byte + next;
                  return BYTE_TO_CHAR (lim_byte + next);
@@ -3287,7 +3259,6 @@ find_newline1 (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
         }
       }
 
-  immediate_quit = false;
   if (shortage)
     *shortage = count;
   if (bytepos)
diff --git a/src/syntax.c b/src/syntax.c
index f9e4093..e713922 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1426,7 +1426,6 @@ scan_words (register ptrdiff_t from, register EMACS_INT 
count)
   int ch0, ch1;
   Lisp_Object func, pos;
 
-  immediate_quit = true;
   maybe_quit ();
 
   SETUP_SYNTAX_TABLE (from, count);
@@ -1436,10 +1435,7 @@ scan_words (register ptrdiff_t from, register EMACS_INT 
count)
       while (1)
        {
          if (from == end)
-           {
-             immediate_quit = false;
-             return 0;
-           }
+           return 0;
          UPDATE_SYNTAX_TABLE_FORWARD (from);
          ch0 = FETCH_CHAR_AS_MULTIBYTE (from_byte);
          code = SYNTAX (ch0);
@@ -1486,10 +1482,7 @@ scan_words (register ptrdiff_t from, register EMACS_INT 
count)
       while (1)
        {
          if (from == beg)
-           {
-             immediate_quit = false;
-             return 0;
-           }
+           return 0;
          DEC_BOTH (from, from_byte);
          UPDATE_SYNTAX_TABLE_BACKWARD (from);
          ch1 = FETCH_CHAR_AS_MULTIBYTE (from_byte);
@@ -1536,8 +1529,6 @@ scan_words (register ptrdiff_t from, register EMACS_INT 
count)
       count++;
     }
 
-  immediate_quit = false;
-
   return from;
 }
 
@@ -1921,7 +1912,6 @@ skip_chars (bool forwardp, Lisp_Object string, 
Lisp_Object lim,
        stop = (pos >= GPT && GPT > XINT (lim)) ? GAP_END_ADDR : endp;
       }
 
-    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.
@@ -2064,7 +2054,6 @@ skip_chars (bool forwardp, Lisp_Object string, 
Lisp_Object lim,
       }
 
     SET_PT_BOTH (pos, pos_byte);
-    immediate_quit = false;
 
     SAFE_FREE ();
     return make_number (PT - start_point);
@@ -2138,7 +2127,6 @@ skip_syntaxes (bool forwardp, Lisp_Object string, 
Lisp_Object lim)
     ptrdiff_t pos_byte = PT_BYTE;
     unsigned char *p, *endp, *stop;
 
-    immediate_quit = true;
     SETUP_SYNTAX_TABLE (pos, forwardp ? 1 : -1);
 
     if (forwardp)
@@ -2224,7 +2212,6 @@ skip_syntaxes (bool forwardp, Lisp_Object string, 
Lisp_Object lim)
 
   done:
     SET_PT_BOTH (pos, pos_byte);
-    immediate_quit = false;
 
     return make_number (PT - start_point);
   }
@@ -2412,7 +2399,6 @@ between them, return t; otherwise return nil.  */)
   count1 = XINT (count);
   stop = count1 > 0 ? ZV : BEGV;
 
-  immediate_quit = true;
   maybe_quit ();
 
   from = PT;
@@ -2429,7 +2415,6 @@ between them, return t; otherwise return nil.  */)
          if (from == stop)
            {
              SET_PT_BOTH (from, from_byte);
-             immediate_quit = false;
              return Qnil;
            }
          c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
@@ -2463,7 +2448,6 @@ between them, return t; otherwise return nil.  */)
        comstyle = ST_COMMENT_STYLE;
       else if (code != Scomment)
        {
-         immediate_quit = false;
          DEC_BOTH (from, from_byte);
          SET_PT_BOTH (from, from_byte);
          return Qnil;
@@ -2474,7 +2458,6 @@ between them, return t; otherwise return nil.  */)
       from = out_charpos; from_byte = out_bytepos;
       if (!found)
        {
-         immediate_quit = false;
          SET_PT_BOTH (from, from_byte);
          return Qnil;
        }
@@ -2494,7 +2477,6 @@ between them, return t; otherwise return nil.  */)
          if (from <= stop)
            {
              SET_PT_BOTH (BEGV, BEGV_BYTE);
-             immediate_quit = false;
              return Qnil;
            }
 
@@ -2587,7 +2569,6 @@ between them, return t; otherwise return nil.  */)
          else if (code != Swhitespace || quoted)
            {
            leave:
-             immediate_quit = false;
              INC_BOTH (from, from_byte);
              SET_PT_BOTH (from, from_byte);
              return Qnil;
@@ -2598,7 +2579,6 @@ between them, return t; otherwise return nil.  */)
     }
 
   SET_PT_BOTH (from, from_byte);
-  immediate_quit = false;
   return Qt;
 }
 
@@ -2640,7 +2620,6 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT 
depth, bool sexpflag)
 
   from_byte = CHAR_TO_BYTE (from);
 
-  immediate_quit = true;
   maybe_quit ();
 
   SETUP_SYNTAX_TABLE (from, count);
@@ -2801,7 +2780,6 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT 
depth, bool sexpflag)
       if (depth)
        goto lose;
 
-      immediate_quit = false;
       return Qnil;
 
       /* End of object reached */
@@ -2984,7 +2962,6 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT 
depth, bool sexpflag)
       if (depth)
        goto lose;
 
-      immediate_quit = false;
       return Qnil;
 
     done2:
@@ -2992,7 +2969,6 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT 
depth, bool sexpflag)
     }
 
 
-  immediate_quit = false;
   XSETFASTINT (val, from);
   return val;
 
@@ -3173,7 +3149,6 @@ do { prev_from = from;                            \
        UPDATE_SYNTAX_TABLE_FORWARD (from);     \
   } while (0)
 
-  immediate_quit = true;
   maybe_quit ();
 
   depth = state->depth;
@@ -3432,7 +3407,6 @@ do { prev_from = from;                            \
                                 state->levelstarts);
   state->prev_syntax = (SYNTAX_FLAGS_COMSTARTEND_FIRST (prev_from_syntax)
                         || state->quoted) ? prev_from_syntax : Smax;
-  immediate_quit = false;
 }
 
 /* Convert a (lisp) parse state to the internal form used in
diff --git a/src/w32fns.c b/src/w32fns.c
index 6a576fc..1b628b0 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -3168,16 +3168,7 @@ signal_user_input (void)
       Vquit_flag = Vthrow_on_input;
       /* 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
-      /* If we're inside a function that wants immediate quits,
-        do it now.  */
-      if (immediate_quit && NILP (Vinhibit_quit))
-       {
-         immediate_quit = false;
-         maybe_quit ();
-       }
-#endif
+        rightfully barfs.  */
     }
 }
 
diff --git a/src/window.c b/src/window.c
index 71a82b5..bc3f488 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4770,7 +4770,6 @@ window_scroll (Lisp_Object window, EMACS_INT n, bool 
whole, bool noerror)
 {
   ptrdiff_t count = SPECPDL_INDEX ();
 
-  immediate_quit = true;
   n = clip_to_bounds (INT_MIN, n, INT_MAX);
 
   wset_redisplay (XWINDOW (window));
@@ -4789,7 +4788,6 @@ window_scroll (Lisp_Object window, EMACS_INT n, bool 
whole, bool noerror)
 
   /* Bug#15957.  */
   XWINDOW (window)->window_end_valid = false;
-  immediate_quit = false;
 }
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]