Subject: bug#33784: 27.0.50; some case c-backward-token-2 takes cpu more and emacs hang

From: Alan Mackenzie <[email-masked]>
Date: 18 Dec 2018 17:47:16 -0000

Hello, xh.

In article <[email-masked]> you wrote:
> [-- text/plain, encoding 7bit, charset: UTF-8, 117 lines --]

> follow case:

> (let ((str "#define SLOGE(...)\n
> ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, LOG_TAG,\n
> __VA_ARGS__))"))
> (with-temp-buffer
> (delay-mode-hooks (funcall 'c++-mode))
> (insert str)
> (font-lock-ensure)
> (buffer-string)
> )
> )

> execute up code, emacs will hang

Yes.  The problem here is the (font-lock-ensure).  This is being called
even though font-lock-mode is disabled.  I think there should be a check
for this in font-lock-ensure, but there isn't.

So, yes, we have a bug here.  Thanks for taking the trouble to report
it.

Incidentally, the temporary buffer created by with-temp-buffer never has
font-lock-mode enabled, and font-lock-mode is spiked so that it cannot
be enabled in such a buffer.  I don't know why.  Attempting to enable it
fails silently, which is probably another bug.

Incidentally[2], the delay-mode-hooks in your recipe has nothing to do
with the problem.

> In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
> of 2018-12-18 built on xhyang-ThinkPad-T470p
> Repository revision: 1691a51094d35ac4b2c311fa407c6b77eea7a105
> Repository branch: master
> Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
> System Description: Ubuntu 16.04.3 LTS

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).