GNU bug report logs -
#77361
[PATCH] New user option to hide minor mode lighters
Previous Next
Reported by: Pengji Zhang <me <at> pengjiz.com>
Date: Sat, 29 Mar 2025 11:09:02 UTC
Severity: normal
Tags: patch
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #17 received at 77361 <at> debbugs.gnu.org (full text, mbox):
Daniel Mendler <mail <at> daniel-mendler.de> writes:
> Hello Pengji!
Hi Daniel!
> This is a good idea. I've used both minions and diminish and it is nice
> to have this functionality ootb. I have some concerns however regarding
> the frequent mode line recomputation during redisplay. Do you see a
> possibility to cache the computed minor mode menu and collapsed lighter?
> In any case, the computation should be as efficient as possible. For
> profiling I suggest to enable your new user option and then scroll
> repeatedly in order to force redisplays and mode line recomputations. If
> certain mode line functions appear prominently in the profile they are
> candidates for optimization, in order to reduce redisplay latency.
Thanks! I did not consider the performance issue much. How about
deferring the computation of the minor mode menu, the most costly part?
+ (unless (string= "" (format-mode-line `("" ,hidden)))
+ (let* ((menu
+ ;; FIXME: This is to defer the computation of the
+ ;; menu, but may not play well with touchscreen.
+ (lambda (e)
+ (interactive "@e")
+ (if-let* ((m (mode-line--make-lighter-menu hidden)))
+ (popup-menu m e)
+ (message "No menu available"))))
+ (keymap
+ (define-keymap
+ :parent mode-line-minor-mode-keymap
+ "<mode-line> <down-mouse-1>" menu
+ "<mode-line> <mouse-2>" #'describe-mode)))
+ `(:propertize ,(if (char-displayable-p ?…) " …" " ...")
+ mouse-face mode-line-highlight
+ help-echo "Hidden minor modes\n\
+mouse-1: Display hidden minor modes\n\
+mouse-2: Show help for enabled minor modes\n\
+mouse-3: Toggle minor modes"
+ local-map ,keymap)))
Still we need to split 'minor-mode-alist' and do some other work, but my
profiling showed that there was little impact to the performance.
Pengji
This bug report was last modified 14 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.