Subject: bug#78737: sit-for behavior changes when byte-compiled

From: Ihor Radchenko <[email-masked]>
Date: Sat, 14 Jun 2025 08:47:41 +0000

Eli Zaretskii <[email-masked]> writes:

>> I'm asking mostly because this feature isn't documented in trouble.texi.
>> The emergency escape (= emergency exit) feature is well-documented but I
>> fear that won't help most users, terminal frames being rare these days.
>
> I would like to see the emergency exit feature work on GUI frames as
> well, if that's feasible.

+1
FYI, I independently re-implemented (without knowing) a similar feature
for Org mode (see `org-element--cache-interrupt-C-g' and
`org-element--cache-interrupt-C-g-max-count' in org-element.el)
Note that it is an example when Elisp code needs some cleanup if
emergency exit is requested:

(when (and inhibit-quit org-element--cache-interrupt-C-g quit-flag)
               (when quit-flag
	         (cl-incf org-element--cache-interrupt-C-g-count)
                 (setq quit-flag nil))
               (when (>= org-element--cache-interrupt-C-g-count
                         org-element--cache-interrupt-C-g-max-count)
                 (setq quit-flag t)
                 (setq org-element--cache-interrupt-C-g-count 0)
                 (org-element-cache-reset)
                 (error "org-element: Parsing aborted by user.  Cache has been cleared.
If you observe Emacs hangs frequently, please report this to Org mode mailing list (M-x org-submit-bug-report)"))
               (message (substitute-command-keys
                         "`org-element--parse-to': Suppressed `\\[keyboard-quit]'.  Press `\\[keyboard-quit]' %d more times to force interruption.")
                        (- org-element--cache-interrupt-C-g-max-count
                           org-element--cache-interrupt-C-g-count)))

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>