all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#23026: 25.0.92; menu-bar bug?
@ 2016-03-16  5:38 Leo Liu
  2016-03-16 15:36 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Leo Liu @ 2016-03-16  5:38 UTC (permalink / raw)
  To: 23026

[-- Attachment #1: Type: text/plain, Size: 412 bytes --]


1. Start a GUI emacs with -q
2. load the attached t.el file
3. M-x test
4. look at the menu-bar and notice there is `Test' menu
5. mouse-click the first line and notice `Test' is gone
6. mouse-click the second line so that `Test' reappears
7. C-p to move to first line and notice `Test' doesn't disappear

The difference between 5 and 7 is puzzling. Is this a bug? How to make
the two behave consistently?

Leo

[-- Attachment #2: t.el --]
[-- Type: application/emacs-lisp, Size: 430 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#23026: 25.0.92; menu-bar bug?
  2016-03-16  5:38 bug#23026: 25.0.92; menu-bar bug? Leo Liu
@ 2016-03-16 15:36 ` Eli Zaretskii
  2016-03-17  3:26   ` Leo Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2016-03-16 15:36 UTC (permalink / raw)
  To: Leo Liu; +Cc: 23026

> From: Leo Liu <sdl.web@gmail.com>
> Date: Wed, 16 Mar 2016 13:38:20 +0800
> 
> 1. Start a GUI emacs with -q
> 2. load the attached t.el file
> 3. M-x test
> 4. look at the menu-bar and notice there is `Test' menu
> 5. mouse-click the first line and notice `Test' is gone
> 6. mouse-click the second line so that `Test' reappears
> 7. C-p to move to first line and notice `Test' doesn't disappear
> 
> The difference between 5 and 7 is puzzling. Is this a bug?

No, it's a redisplay optimization: Emacs doesn't redraw the menu bar
when all that's changed is cursor position.  In 99.999% of cases,
cursor motion doesn't require any changes in the menu-bar items, so
redrawing the menu bar after each movement of point would just slow
down cursor motion and cause annoying flickering of the menu bar.
Therefore, we don't do it.  I'm not sure I understand what's special
about this use case that we'd want to disable this optimization.

By contrast, a mouse click potentially activates/deactivates the mark
and extends or removes the region highlight, so many redisplay
optimizations are disabled when we process the click -- it isn't just
moving point.

> How to make the two behave consistently?

By "consistently" I believe you mean you'd like the menu bar updated
when point moves via keyboard commands, yes?  If so, you should force
a more thorough redisplay, e.g. by calling force-mode-line-update,
when point moves in a way that requires a change in the menu bar.  How
exactly to do that depends on your real-life use case -- it could be a
post-command-hook, or a special binding in the keymap which you put in
the property, or a function in cursor-sensor-functions property, or
something else.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#23026: 25.0.92; menu-bar bug?
  2016-03-16 15:36 ` Eli Zaretskii
@ 2016-03-17  3:26   ` Leo Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Leo Liu @ 2016-03-17  3:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 23026-done

On 2016-03-16 17:36 +0200, Eli Zaretskii wrote:
> No, it's a redisplay optimization: Emacs doesn't redraw the menu bar
> when all that's changed is cursor position.  In 99.999% of cases,
> cursor motion doesn't require any changes in the menu-bar items, so
> redrawing the menu bar after each movement of point would just slow
> down cursor motion and cause annoying flickering of the menu bar.
> Therefore, we don't do it.  I'm not sure I understand what's special
> about this use case that we'd want to disable this optimization.
>
> By contrast, a mouse click potentially activates/deactivates the mark
> and extends or removes the region highlight, so many redisplay
> optimizations are disabled when we process the click -- it isn't just
> moving point.

Make sense and thanks for the info.

>> How to make the two behave consistently?
>
> By "consistently" I believe you mean you'd like the menu bar updated
> when point moves via keyboard commands, yes?  If so, you should force
> a more thorough redisplay, e.g. by calling force-mode-line-update,
> when point moves in a way that requires a change in the menu bar.  How
> exactly to do that depends on your real-life use case -- it could be a
> post-command-hook, or a special binding in the keymap which you put in
> the property, or a function in cursor-sensor-functions property, or
> something else.

Thanks.

Leo





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-17  3:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-16  5:38 bug#23026: 25.0.92; menu-bar bug? Leo Liu
2016-03-16 15:36 ` Eli Zaretskii
2016-03-17  3:26   ` Leo Liu

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.