From: Eli Zaretskii Date: Mon, 21 Aug 2017 17:21:28 +0000 (+0300) Subject: Avoid losing the buffer restriction in flyspell-mode X-Git-Tag: emacs-26.0.90~382 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=80fccd4290ae134bd1b3d377f134bb9143b68b43;p=emacs.git Avoid losing the buffer restriction in flyspell-mode * src/intervals.c (get_local_map): Don't allow C-g to quit as long as we have the buffer widened, to make sure the restriction is preserved. (Bug#28161) --- diff --git a/src/intervals.c b/src/intervals.c index 0089ecb8dde..e65c22977ed 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -2153,6 +2153,7 @@ get_local_map (ptrdiff_t position, struct buffer *buffer, Lisp_Object type) { Lisp_Object prop, lispy_position, lispy_buffer; ptrdiff_t old_begv, old_zv, old_begv_byte, old_zv_byte; + ptrdiff_t count = SPECPDL_INDEX (); position = clip_to_bounds (BUF_BEGV (buffer), position, BUF_ZV (buffer)); @@ -2163,6 +2164,7 @@ get_local_map (ptrdiff_t position, struct buffer *buffer, Lisp_Object type) old_begv_byte = BUF_BEGV_BYTE (buffer); old_zv_byte = BUF_ZV_BYTE (buffer); + specbind (Qinhibit_quit, Qt); SET_BUF_BEGV_BOTH (buffer, BUF_BEG (buffer), BUF_BEG_BYTE (buffer)); SET_BUF_ZV_BOTH (buffer, BUF_Z (buffer), BUF_Z_BYTE (buffer)); @@ -2180,6 +2182,7 @@ get_local_map (ptrdiff_t position, struct buffer *buffer, Lisp_Object type) SET_BUF_BEGV_BOTH (buffer, old_begv, old_begv_byte); SET_BUF_ZV_BOTH (buffer, old_zv, old_zv_byte); + unbind_to (count, Qnil); /* Use the local map only if it is valid. */ prop = get_keymap (prop, 0, 0);