GNU bug report logs - #20445
excessive redisplay / echo area resizing during byte-compilation

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Mon, 27 Apr 2015 21:32:02 UTC

Severity: normal

Found in version 25.0.50

Done: Artur Malabarba <bruce.connor.am <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 20445 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 20445 <at> debbugs.gnu.org
Subject: Re: bug#20445: excessive redisplay / echo area resizing
 during	byte-compilation
Date: Tue, 28 Apr 2015 18:13:25 +0300
> From: Glenn Morris <rgm <at> gnu.org>
> Date: Mon, 27 Apr 2015 17:31:28 -0400
> 
> Does not happen with M-x byte-recompile-file.

If you invoke byte-compile-file like this:

  M-: (byte-compile-file "org.el") RET

then it flickers exactly like with the menu-bar invocation.  Which is
expected, since the menu bar invokes emacs-lisp-byte-compile, which
does this:

  (defun emacs-lisp-byte-compile ()
    "Byte compile the file containing the current buffer."
    (interactive)
    (if buffer-file-name
	(byte-compile-file buffer-file-name)
      (error "The buffer must be saved in a file first")))

The difference between "M-x byte-compile-file" and the invocation via
M-: seems to be due to this trick in bytecomp.el:

  (defun byte-compile--message (format &rest args)
    "Like `message', except sometimes don't print to minibuffer.
  If the variable `byte-compile--interactive' is nil, the message
  is not displayed on the minibuffer."
    (apply #'message format args)
    (unless byte-compile--interactive
      (message nil)))

And indeed, if I invoke byte-compile-file like this:

  M-: (let ((byte-compile--interactive t)) (byte-compile-file "org.el")) RET

the flickering goes away.

Now to the source of the flickering: it's the resizing of the echo
area that causes that.  We have this code in echo_area_display:

      window_height_changed_p = display_echo_area (w);
      [...]
	  if (window_height_changed_p <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	      /* Don't do this if Emacs is shutting down.  Redisplay
	         needs to run hooks.  */
	      && !NILP (Vrun_hooks))
	    {
	      /* Must update other windows.  Likewise as in other
		 cases, don't let this update be interrupted by
		 pending input.  */
	      ptrdiff_t count = SPECPDL_INDEX ();
	      specbind (Qredisplay_dont_pause, Qt);
	      windows_or_buffers_changed = 44;  <<<<<<<<<<<<<<<<<<<<<<
	      redisplay_internal ();

And a non-zero value of windows_or_buffers_changed causes a thorough
redisplay, including, for example, the mode lines, the menu bar and
the scroll bars.

If I set resize-mini-windows to nil, the flickering disappears.

I think what causes the frequent resizes of the echo area are those
calls to (message nil) in byte-compile--message.  Perhaps avoiding
that would resolve the issue.

Otherwise, I guess I'll have to say that this is the display engine
"functioning as designed".

> Does not happen with 24.5, even with the menu-bar.

The trick with byte-compile--message and byte-compile--interactive is
new on master, it didn't exist in Emacs 24.




This bug report was last modified 10 years and 86 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.