bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#57804: An infinite loop in a `fontify-region' function causes Emacs


From: Ihor Radchenko
Subject: bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely
Date: Thu, 15 Sep 2022 10:17:21 +0800

Eli Zaretskii <eliz@gnu.org> writes:

>> But like I said, three `C-g's without any idle time in between would be
>> the magical command to switch off font locking.  I think that's hard to
>> do accidentally in normal circumstances.
>
> There's nothing accidental about my typing several C-g in a row.  It
> just isn't related to any font-lock.

Org mode uses a similar method to catch rare edge cases and make users
report them. We make the user aware about possible reaction to multiple
C-g's using the following message:

`org-element--parse-buffer': Suppressed `\\[keyboard-quit]'. Press
`\\[keyboard-quit]' %d more times to force interruption.

The code goes like

(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-buffer': 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,
Org mode contributor,
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





reply via email to

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