From unknown Fri Jun 20 20:10:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77361: [PATCH] New user option to hide minor mode lighters Resent-From: Pengji Zhang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Mar 2025 11:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 77361 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 77361@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17432464955833 (code B ref -1); Sat, 29 Mar 2025 11:09:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Mar 2025 11:08:15 +0000 Received: from localhost ([127.0.0.1]:57161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tyU2w-0001W0-97 for submit@debbugs.gnu.org; Sat, 29 Mar 2025 07:08:15 -0400 Received: from lists.gnu.org ([2001:470:142::17]:47148) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tyU2t-0001Vd-CM for submit@debbugs.gnu.org; Sat, 29 Mar 2025 07:08:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tyU2f-000428-4I for bug-gnu-emacs@gnu.org; Sat, 29 Mar 2025 07:08:01 -0400 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tyU2c-00023Y-1b for bug-gnu-emacs@gnu.org; Sat, 29 Mar 2025 07:07:56 -0400 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id F1D611383C3A for ; Sat, 29 Mar 2025 07:07:49 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Sat, 29 Mar 2025 07:07:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengjiz.com; h= cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1743246469; x=1743332869; bh=UlJUDNc8Q7RgcWxhcvmRVPd3tHsd/0/C KSOzvDgP0dU=; b=eYUC04gjFeo9ynSV9tvtBhYwRPXl1MD6frsnoj8l2qgv0RSf Q3eZfv6/rl+RFUm7SYDgoBhSX2ue1rg042qR83VtofGwRbmxnynsOR8XZT747IIf vWCvn83fwy4TyDVrhc1o53FniAB39B3+0LRMN0MZFHuiiMAvAwL87clUA/gyWCjl M3DjARUYlu12GvfrQaVIC+XLwgmCMTYV6SGROxNArJye3LSuUoYwJTYhEfJyYBra nEWSY3n8akIWJ/OnHVOo2sEZjGYlTtcdf9gY+wq6mL0x4sM8Bap2/cBZVrj/Zi+M mOrPEvSLGmTSUTGJFe1j0fToEaGO9/RBjG3o7w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1743246469; x= 1743332869; bh=UlJUDNc8Q7RgcWxhcvmRVPd3tHsd/0/CKSOzvDgP0dU=; b=O DbtiC7Nfh+dJYHdqFcZXD7GmZlVLMOOF1CaQNNSXRcTyYbljzAWrq38K7qnglUlM 9EchxO1AiMT6BJFzArlnBdEqw0AzCIQFPE5Xlv//h7JUBZv1g7VER8Q+jV+EKNd5 5xeAPxOQO0PvgmgQAZqUqvB60DfUo1smmp27XcyhmfhuVmf9Qz6xVWbYrcH/8ePF d34sA212uOl4fqDZyS0s/ToPYZ5EUf7IFh2zfy9JDK/Ei6VsNH3gKDxdl076WM8k 5e2Vz+gTIJPX/JJ9L5kDEY9L2Ub0B0RZohVo/1EmTsezhes+HiGigA2hc+PDBYPe sFLAOTizF5tVN0K/rvNfA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddujeegtdduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvf fufffkgggtsehmtderredttddtnecuhfhrohhmpefrvghnghhjihcukghhrghnghcuoehm vgesphgvnhhgjhhiiidrtghomheqnecuggftrfgrthhtvghrnhepiefgkefgffduheeife elkeekgfettdfhueekffdtheffkedttdehjeegleehheehnecuffhomhgrihhnpehgihht hhhusgdrtghomhdpghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpehmvgesphgvnhhgjhhiiidrtghomhdpnhgspghrtghpthht ohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepsghughdqghhnuhdqvghmrg gtshesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i16614472:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 29 Mar 2025 07:07:49 -0400 (EDT) From: Pengji Zhang Date: Sat, 29 Mar 2025 19:07:40 +0800 Message-ID: <8734ewhz7n.fsf@pengjiz.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=103.168.172.145; envelope-from=me@pengjiz.com; helo=fout-a2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) --=-=-= Content-Type: text/plain Hello, The attached patch adds a new user option to hide some minor mode lighters on the mode line (by collapsing them into a menu), which is to shorten the mode line and prioritize important information when many minor modes are on. There exist a few packages that solve the problem. To name a few: - diminish[1] and delight[2]. Both offer a way to change the minor mode lighters by modifying 'minor-mode-alist'. To hide a minor mode lighter, one may change it to nil. - minions[3], which partially inspired this patch. It replaces minor mode lighters by a menu to toggle all minor modes. This patch is different from those solutions in two aspects: - Unlike diminish or delight, one can still see the lighters by clicking the button, instead of hiding them permanently. Besides, this patch is compatible with those two packages. - Unlike minions, this patch focuses on *lighters* for *enabled* minor modes. The menu contains only lighters, making it a more space efficient replacement for lighters on mode line, instead of a way to manage minor modes like minions. So I hope this patch is still useful given the existing similar solutions. Please let me know what you think. Thanks! Pengji [1] https://github.com/myrjola/diminish.el [2] https://elpa.gnu.org/packages/delight.html [3] https://github.com/tarsius/minions --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-New-user-option-to-hide-minor-mode-lighters.patch Content-Transfer-Encoding: quoted-printable >From c1e27606247761c31cec3d363714875c74b30277 Mon Sep 17 00:00:00 2001 From: Pengji Zhang Date: Sat, 29 Mar 2025 19:04:58 +0800 Subject: [PATCH] New user option to hide minor mode lighters * lisp/bindings.el (mode-line-collapse-minor-modes): New user option. (mode-line-minor-modes): New variable to hold mode line constructs for minor modes. (mode-line-modes): Use the new variable 'mode-line-minor-modes', and adjust the order of elements so the indicator for hidden minor modes is shown towards the end. (mode-line--make-lighter-menu): New helper function to generate the menu for hidden minor modes. (mode-line--minor-modes): New helper function to computer mode line constructs for minor mode lighters. * doc/lispref/modes.texi (Mode Line Basics): Document the new user option. * etc/NEWS (Note): Annouce the new user option. --- doc/lispref/modes.texi | 12 ++++ etc/NEWS | 9 +++ lisp/bindings.el | 122 ++++++++++++++++++++++++++++++++++++++--- 3 files changed, 136 insertions(+), 7 deletions(-) diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 788d98fdf20..23c363be12c 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -2163,6 +2163,18 @@ Mode Line Basics variable can be buffer-local to only compress mode-lines in certain buffers. =20 +@vindex mode-line-collapse-minor-modes + To further ``compress'' the mode line, you may customize the +@code{mode-line-collapse-minor-modes} option to a non-@code{nil} value, +and Emacs will hide some minor mode indicators on the mode line by +collapsing them into a single clickable button. The option can also be +a list of symbols to select minor modes indicators to hide or show. If +the list starts with the symbol @code{not}, it specifies minor modes to +show, otherwise it means minor modes to hide. For example, setting it +to @code{(not flymake-mode)} makes only the indicator for Flymake mode +shown, and setting it to @code{(eldoc-mode)} hides only the indicator +for ElDoc mode. + @node Mode Line Data @subsection The Data Structure of the Mode Line @cindex mode line construct diff --git a/etc/NEWS b/etc/NEWS index 1bd2fd6d486..8b7dfa0ee04 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -316,6 +316,15 @@ This will inhibit implied resizing while a new frame i= s made and can be useful on tiling window managers where the initial frame size should be specified by external means. =20 +** Mode Line + ++++ +*** New user option 'mode-line-collapse-minor-modes'. +If non-nil, minor mode lighters on the mode line are collapsed into a +single button. It could also be a list to specify minor mode lighters +to hide or show. The default value is nil, which retains the previous +behavior of showing all minor mode lighters. + ** Tab Bars and Tab Lines =20 --- diff --git a/lisp/bindings.el b/lisp/bindings.el index 9707ce4b474..a32e3d58dc7 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -429,6 +429,120 @@ bindings--sort-menu-keymap (bindings--menu-item-string (cdr-safe b)))))) (nconc (make-sparse-keymap prompt) bindings))) =20 +(defcustom mode-line-collapse-minor-modes nil + "Minor modes for which mode line lighters are hidden. +Hidden lighters are collapsed into one. + +The value could be a list (MODES ...) which means to collapse lighters +only for MODES, or a list (not MODES ...) which means to collapse all +lighters for minor modes not in MODES. Other non-nil values make all +lighters hidden." + :type '(choice (const :tag "No modes" nil) + (repeat :tag "Modes" symbol) + (cons :tag "All modes except" + (const not) (repeat symbol)) + (const :tag "All modes" t)) + :group 'mode-line) + +(defvar mode-line-minor-modes '(:eval (mode-line--minor-modes)) + "Mode line construct for minor mode lighters.") +;;;###autoload +(put 'mode-line-minor-modes 'risky-local-variable t) + +(defun mode-line--make-lighter-menu (alist) + "Return a menu keymap for minor mode lighters in ALIST. +ALIST should be in the same format as `minor-mode-alist'. + +Return nil if no lighters in ALIST should be visible, for example, there +are no active minor modes or non-empty lighters." + (let ((menu (make-sparse-keymap "Minor Modes")) + (empty t)) + (dolist (item alist) + (when-let* ((variable (car item)) + ((and (boundp variable) + (symbol-value variable))) + (lighter (format-mode-line `("" ,@(cdr-safe item)))) + ((not (string=3D lighter ""))) + (toggle (or (get variable :minor-mode-function) variable= )) + ;; Follow the format in `mouse-minor-mode-menu' + (name (format "%s - %s" lighter + (capitalize + (string-replace + "-" " " (symbol-name toggle)))))) + (when (eq ? (aref name 0)) + (setq name (substring name 1))) + (let* ((map (cdr-safe (assq variable minor-mode-map-alist))) + (mm-menu (and (keymapp map) + (keymap-lookup map "")))) + (setq mm-menu + (cond (mm-menu (mouse-menu-non-singleton mm-menu)) + ((fboundp toggle) + (define-keymap :name name + "" (list 'menu-item + "Help for minor mode" + (lambda () (interactive) + (describe-function toggle))) + "" (list 'menu-item + "Turn off minor mode" + toggle))) + ;; No menu and not a minor mode function, so just + ;; display the label without a sub-menu. + (t nil))) + (keymap-set menu (format "<%s>" toggle) + (list 'menu-item name mm-menu)) + (setq empty nil)))) + (and (not empty) menu))) + +(defun mode-line--minor-modes () + "Compute mode line constructs for minor mode lighters." + (let (visible hidden) + (cond + ((not mode-line-collapse-minor-modes) + (setq visible minor-mode-alist + hidden nil)) + ((eq 'not (car-safe mode-line-collapse-minor-modes)) + (let ((modes (cdr mode-line-collapse-minor-modes))) + (dolist (item minor-mode-alist) + (if (memq (car item) modes) + (push item visible) + (push item hidden))) + (setq visible (nreverse visible) + hidden (nreverse hidden)))) + ((listp mode-line-collapse-minor-modes) + (let ((modes mode-line-collapse-minor-modes)) + (dolist (item minor-mode-alist) + (if (memq (car item) modes) + (push item hidden) + (push item visible))) + (setq visible (nreverse visible) + hidden (nreverse hidden)))) + (t (setq visible nil + hidden minor-mode-alist))) + (list "" + `(:propertize ("" ,visible) + mouse-face mode-line-highlight + help-echo "Minor mode\n\ +mouse-1: Display minor mode menu\n\ +mouse-2: Show help for minor mode\n\ +mouse-3: Toggle minor modes" + local-map ,mode-line-minor-mode-keymap) + (when-let* ((menu (mode-line--make-lighter-menu hidden)) + (menu-binding (list 'menu-item "Display" menu + :filter #'bindings--sort-menu-ke= ymap)) + (toggle-binding (list 'menu-item "Toggle" mode-line-= mode-menu + :fitler #'bindings--sort-menu-= keymap)) + (keymap (define-keymap + " " menu-binding + " " #'describe-mode + " " toggle-bindin= g))) + `(:propertize ,(if (char-displayable-p ?=E2=80=A6) " =E2=80=A6= " " ...") + 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))))) + (defvar mode-line-major-mode-keymap (let ((map (make-sparse-keymap))) (define-key map [mode-line down-mouse-1] @@ -466,17 +580,11 @@ mode-line-modes mouse-face mode-line-highlight local-map ,mode-line-major-mode-keymap) '("" mode-line-process) - `(:propertize ("" minor-mode-alist) - mouse-face mode-line-highlight - help-echo "Minor mode\n\ -mouse-1: Display minor mode menu\n\ -mouse-2: Show help for minor mode\n\ -mouse-3: Toggle minor modes" - local-map ,mode-line-minor-mode-keymap) (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer" 'mouse-face 'mode-line-highlight 'local-map (make-mode-line-mouse-map 'mouse-2 #'mode-line-widen)) + '("" mode-line-minor-modes) ")" (propertize "%]" 'help-echo recursive-edit-help-echo) " ")) --=20 2.49.0 --=-=-=-- From unknown Fri Jun 20 20:10:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77361: [PATCH] New user option to hide minor mode lighters Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Apr 2025 09:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77361 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Pengji Zhang Cc: 77361@debbugs.gnu.org Received: via spool by 77361-submit@debbugs.gnu.org id=B77361.174384384824257 (code B ref 77361); Sat, 05 Apr 2025 09:05:02 +0000 Received: (at 77361) by debbugs.gnu.org; 5 Apr 2025 09:04:08 +0000 Received: from localhost ([127.0.0.1]:41499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u0zRf-0006JB-K4 for submit@debbugs.gnu.org; Sat, 05 Apr 2025 05:04:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45680) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u0zRd-0006IV-9K for 77361@debbugs.gnu.org; Sat, 05 Apr 2025 05:04:05 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u0zRN-0006iP-BL; Sat, 05 Apr 2025 05:03:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Azsxb/dnSeE3AwYbdwl+ioVJh1iWeawg0YkeSYXu/cE=; b=rOpo8Vi4HrH+ gRmIuPN8TBZ/IXDUeamXEd12wVYyDClKZHnFcxTqKRM8g+bmhdDPy+ASIQDRHRoSRTkb1xGkwVIw/ VxEQpKW/csxesNkl4LydFSfLmKeU45AYQcs73pMf/Gaxs9gif8/XebomKSPToXT0/0HfuAD9Ald77 /VqxPyCPu1u1NbD6fWeGRsmKU5etr9o9hu2g1QfTPm/gyOiOQ7ZqMpAezUVUpYOi9QvCHlR/YgAOU w6Chr4q0wZf73VIgCkc8qvhegtWPRmvv/kfaV03IJSSJS8MRNwAFZFtquE6ZnnPbV2kTcJDrwrBme 5X14jv92KJKfE5cTzzkexg==; Date: Sat, 05 Apr 2025 12:03:43 +0300 Message-Id: <86zfgvvv2o.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <8734ewhz7n.fsf@pengjiz.com> (message from Pengji Zhang on Sat, 29 Mar 2025 19:07:40 +0800) References: <8734ewhz7n.fsf@pengjiz.com> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Pengji Zhang > Date: Sat, 29 Mar 2025 19:07:40 +0800 > > The attached patch adds a new user option to hide some minor mode > lighters on the mode line (by collapsing them into a menu), which is to > shorten the mode line and prioritize important information when many > minor modes are on. > > There exist a few packages that solve the problem. To name a few: > > - diminish[1] and delight[2]. Both offer a way to change the minor mode > lighters by modifying 'minor-mode-alist'. To hide a minor mode > lighter, one may change it to nil. > > - minions[3], which partially inspired this patch. It replaces minor > mode lighters by a menu to toggle all minor modes. > > This patch is different from those solutions in two aspects: > > - Unlike diminish or delight, one can still see the lighters by clicking > the button, instead of hiding them permanently. Besides, this patch is > compatible with those two packages. > > - Unlike minions, this patch focuses on *lighters* for *enabled* minor > modes. The menu contains only lighters, making it a more space > efficient replacement for lighters on mode line, instead of a way to > manage minor modes like minions. > > So I hope this patch is still useful given the existing similar > solutions. > > Please let me know what you think. Thanks! Thanks, some comments below. > >From c1e27606247761c31cec3d363714875c74b30277 Mon Sep 17 00:00:00 2001 > From: Pengji Zhang > Date: Sat, 29 Mar 2025 19:04:58 +0800 > Subject: [PATCH] New user option to hide minor mode lighters > > * lisp/bindings.el (mode-line-collapse-minor-modes): New user > option. > (mode-line-minor-modes): New variable to hold mode line > constructs for minor modes. > (mode-line-modes): Use the new variable 'mode-line-minor-modes', > and adjust the order of elements so the indicator for hidden > minor modes is shown towards the end. > (mode-line--make-lighter-menu): New helper function to generate > the menu for hidden minor modes. > (mode-line--minor-modes): New helper function to computer mode > line constructs for minor mode lighters. > > * doc/lispref/modes.texi (Mode Line Basics): Document the new > user option. > * etc/NEWS (Note): Annouce the new user option. Please in future submissions of the patch mention the bug number in the log message. > --- a/doc/lispref/modes.texi > +++ b/doc/lispref/modes.texi > @@ -2163,6 +2163,18 @@ Mode Line Basics > variable can be buffer-local to only compress mode-lines in certain > buffers. > > +@vindex mode-line-collapse-minor-modes > + To further ``compress'' the mode line, you may customize the > +@code{mode-line-collapse-minor-modes} option to a non-@code{nil} value, > +and Emacs will hide some minor mode indicators on the mode line by > +collapsing them into a single clickable button. The option can also be > +a list of symbols to select minor modes indicators to hide or show. If > +the list starts with the symbol @code{not}, it specifies minor modes to > +show, otherwise it means minor modes to hide. For example, setting it > +to @code{(not flymake-mode)} makes only the indicator for Flymake mode > +shown, and setting it to @code{(eldoc-mode)} hides only the indicator > +for ElDoc mode. I think this text and the preceding paragraph should be moved to the Emacs user manual, into the "Optional Mode Line" node. These are user-facing features, so their place is not in the ELisp Reference manual. For the user manual, the above description of the possible values of mode-line-collapse-minor-modes is too detailed. I suggest to have there only the first sentence, and then refer to the doc string for the various alternative forms of the value. > ++++ > +*** New user option 'mode-line-collapse-minor-modes'. > +If non-nil, minor mode lighters on the mode line are collapsed into a > +single button. It could also be a list to specify minor mode lighters ^^^^^^^^^^^^^^^^^^^^^^^ "The value could also be a list..." > +(defcustom mode-line-collapse-minor-modes nil > + "Minor modes for which mode line lighters are hidden. > +Hidden lighters are collapsed into one. > + > +The value could be a list (MODES ...) which means to collapse lighters > +only for MODES, or a list (not MODES ...) which means to collapse all > +lighters for minor modes not in MODES. Other non-nil values make all > +lighters hidden." > + :type '(choice (const :tag "No modes" nil) > + (repeat :tag "Modes" symbol) > + (cons :tag "All modes except" > + (const not) (repeat symbol)) > + (const :tag "All modes" t)) > + :group 'mode-line) The :version tag is missing. From unknown Fri Jun 20 20:10:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77361: [PATCH] New user option to hide minor mode lighters, [PATCH] New user option to hide minor mode lighters Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Apr 2025 11:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77361 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Pengji Zhang Cc: 77361@debbugs.gnu.org Received: via spool by 77361-submit@debbugs.gnu.org id=B77361.174385352432676 (code B ref 77361); Sat, 05 Apr 2025 11:46:02 +0000 Received: (at 77361) by debbugs.gnu.org; 5 Apr 2025 11:45:24 +0000 Received: from localhost ([127.0.0.1]:41801 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u11xj-0008Uy-OX for submit@debbugs.gnu.org; Sat, 05 Apr 2025 07:45:24 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:51687 helo=mail.qxqx.de) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u11xg-0008Ub-8U for 77361@debbugs.gnu.org; Sat, 05 Apr 2025 07:45:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=QviDJxDWJEBjkW1IcIcuC2IW0jHXkydmK+nAwxqDQck=; b=nJK/voTpY+xnGOMz/YwytobIhB 4tZAOrd7y4/6n+W8P7N9P+s5NRlfIueDzBkt4t/kbNpIspRxhF+gEF+uDMv68O6eSG3Kayft7bsJ9 tG0bYrcYK1qqFG4WC5H7FxKQA1wsDOHLJTUDHYNvHxZNvxTs9vL3kAEjLhED/Rw8g8jo=; From: Daniel Mendler In-Reply-To: <8734ewhz7n.fsf@pengjiz.com> (Pengji Zhang's message of "Sat, 29 Mar 2025 19:07:40 +0800") References: <8734ewhz7n.fsf@pengjiz.com> Date: Sat, 05 Apr 2025 13:45:10 +0200 Message-ID: <87tt72ess9.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hello Pengji! Pengji Zhang writes: > The attached patch adds a new user option to hide some minor mode > lighters on the mode line (by collapsing them into a menu), which is to > shorten the mode line and prioritize important information when many > minor modes are on. > > There exist a few packages that solve the problem. To name a few: > > - diminish[1] and delight[2]. Both offer a way to change the minor mode > lighters by modifying 'minor-mode-alist'. To hide a minor mode > lighter, one may change it to nil. > > - minions[3], which partially inspired this patch. It replaces minor > mode lighters by a menu to toggle all minor modes. > > This patch is different from those solutions in two aspects: > > - Unlike diminish or delight, one can still see the lighters by clicking > the button, instead of hiding them permanently. Besides, this patch is > compatible with those two packages. > > - Unlike minions, this patch focuses on *lighters* for *enabled* minor > modes. The menu contains only lighters, making it a more space > efficient replacement for lighters on mode line, instead of a way to > manage minor modes like minions. > > So I hope this patch is still useful given the existing similar > solutions. > > Please let me know what you think. Thanks! 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. Daniel From unknown Fri Jun 20 20:10:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77361: [PATCH] New user option to hide minor mode lighters Resent-From: Pengji Zhang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Apr 2025 08:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77361 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 77361@debbugs.gnu.org Received: via spool by 77361-submit@debbugs.gnu.org id=B77361.17439267209359 (code B ref 77361); Sun, 06 Apr 2025 08:06:02 +0000 Received: (at 77361) by debbugs.gnu.org; 6 Apr 2025 08:05:20 +0000 Received: from localhost ([127.0.0.1]:45963 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u1L0J-0002Qs-9s for submit@debbugs.gnu.org; Sun, 06 Apr 2025 04:05:20 -0400 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]:40995) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u1L0G-0002Pt-Sm for 77361@debbugs.gnu.org; Sun, 06 Apr 2025 04:05:18 -0400 Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id 3B83F13801EE; Sun, 6 Apr 2025 04:05:11 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Sun, 06 Apr 2025 04:05:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengjiz.com; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1743926711; x=1744013111; bh=ymu+xvAFGE YQp98EYMuaW8Uj4r8CxqOislPW/7c26Xc=; b=hEHz6t7yqKhgY5RKIUSZMQXn9K 7n/NaCmyeo6YcT4cuClKzuAF82Y3zWVGNHx186nDYpNjlxq5zOu8fXVuyqPy2A9Q tZQlzW/X+ilP2wWkUf1VhkScW4/vRdpN0EoSI9q3dw7Ec/PX5qxz2s6PmUNnhd3y kpky6VbkhtC9hABVEXdS57ZPfN41bxxpVSCUo7w/XRz6HIxBvWJeVTe0tEAcfesY I5TYqUtRNJFzYpRNq0tpGDjABPk8Qh3dvAh9WQ7+LKKdJjwKc7Fa6Njp0VRJNHBV z5KVmVphV2qHbzkQhRVOdfo/K4D9uTw22NlpCPSd+z4JfMX2JqO/ZW3g+zcA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1743926711; x=1744013111; bh=ymu+xvAFGEYQp98EYMuaW8Uj4r8CxqOislP W/7c26Xc=; b=YWdrMRaDvlpNG2+1f4D6wdCO9cn5yx4OpxWx1V3Q9htoZ9h8P0R wrNa1o5JAEzg4M34ef/BTqYTQdkmai1klp8+pUX6YJISJroxDCqCyEmvcIdf+qSL S0Cy6CHR+2DkFWH/PedR+wJWhKdK0UqIjySaLXEFP4lfY/ePTqGHZn92BZDlkP3D gxjHSgCLhCHw5pMzwYUDfTOyIq7XlA5p7b7B7ni2D1JfmK/upBrb0zr9ODwyUP6K AzvQiT2BXw+GU9M7j+JYJyO/00MtqFMd7rp6kcjQT/hB9wPDbK8TpSlwOBzuXUN3 rEQ32jIlo/mFjtLpVlGHANo22uc7kcGkNOg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduleeijeehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephffvvefujghffffkgggtsehmtderredttddt necuhfhrohhmpefrvghnghhjihcukghhrghnghcuoehmvgesphgvnhhgjhhiiidrtghomh eqnecuggftrfgrthhtvghrnhepieffgfeiueelgfejjeeivdelheffffeuieeihffhffev jeeuhfegvdfhkefgleeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepmhgvsehpvghnghhjihiirdgtohhmpdhnsggprhgtphhtthhopedvpdhm ohguvgepshhmthhpohhuthdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrghdprhgtph htthhopeejjeefieduseguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i16614472:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 6 Apr 2025 04:05:09 -0400 (EDT) From: Pengji Zhang In-Reply-To: <86zfgvvv2o.fsf@gnu.org> References: <8734ewhz7n.fsf@pengjiz.com> <86zfgvvv2o.fsf@gnu.org> Date: Sun, 06 Apr 2025 16:05:00 +0800 Message-ID: <87tt71k95f.fsf@pengjiz.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: > Please in future submissions of the patch mention the bug number in > the log message. Thanks for the review! Bug number added in the updated patch. >> --- a/doc/lispref/modes.texi >> +++ b/doc/lispref/modes.texi >> @@ -2163,6 +2163,18 @@ Mode Line Basics >> variable can be buffer-local to only compress mode-lines in certain >> buffers. >> >> +@vindex mode-line-collapse-minor-modes >> + To further ``compress'' the mode line, you may customize the >> +@code{mode-line-collapse-minor-modes} option to a non-@code{nil} value, >> +and Emacs will hide some minor mode indicators on the mode line by >> +collapsing them into a single clickable button. The option can also be >> +a list of symbols to select minor modes indicators to hide or show. If >> +the list starts with the symbol @code{not}, it specifies minor modes to >> +show, otherwise it means minor modes to hide. For example, setting it >> +to @code{(not flymake-mode)} makes only the indicator for Flymake mode >> +shown, and setting it to @code{(eldoc-mode)} hides only the indicator >> +for ElDoc mode. > > I think this text and the preceding paragraph should be moved to the > Emacs user manual, into the "Optional Mode Line" node. These are > user-facing features, so their place is not in the ELisp Reference > manual. > > For the user manual, the above description of the possible values of > mode-line-collapse-minor-modes is too detailed. I suggest to have > there only the first sentence, and then refer to the doc string for > the various alternative forms of the value. I have moved the paragraph for 'mode-line-compact' to the "Optional Mode Line" node, and added the first sentence for 'mode-line-collapse-minor-modes' to that paragraph. >> ++++ >> +*** New user option 'mode-line-collapse-minor-modes'. >> +If non-nil, minor mode lighters on the mode line are collapsed into a >> +single button. It could also be a list to specify minor mode lighters > ^^^^^^^^^^^^^^^^^^^^^^^ > "The value could also be a list..." Fixed. >> +(defcustom mode-line-collapse-minor-modes nil >> + "Minor modes for which mode line lighters are hidden. >> +Hidden lighters are collapsed into one. >> + >> +The value could be a list (MODES ...) which means to collapse lighters >> +only for MODES, or a list (not MODES ...) which means to collapse all >> +lighters for minor modes not in MODES. Other non-nil values make all >> +lighters hidden." >> + :type '(choice (const :tag "No modes" nil) >> + (repeat :tag "Modes" symbol) >> + (cons :tag "All modes except" >> + (const not) (repeat symbol)) >> + (const :tag "All modes" t)) >> + :group 'mode-line) > > The :version tag is missing. Added. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-New-user-option-to-hide-minor-mode-lighters-bug-7736.patch Content-Transfer-Encoding: quoted-printable >From ff653f559b9cd984f584756741b7b52815befe8d Mon Sep 17 00:00:00 2001 From: Pengji Zhang Date: Sat, 29 Mar 2025 19:04:58 +0800 Subject: [PATCH] New user option to hide minor mode lighters (bug#77361) * lisp/bindings.el (mode-line-collapse-minor-modes): New user option. (mode-line-minor-modes): New variable to hold mode line constructs for minor modes. (mode-line--make-lighter-menu): New helper function to generate the menu for hidden minor modes. (mode-line--minor-modes): New helper function to computer mode line constructs for minor mode lighters. (mode-line-modes): Use the new variable 'mode-line-minor-modes', and adjust the order of elements so the indicator for hidden minor modes is shown towards the end. * doc/lispref/modes.texi (Mode Line Basics): Move the paragraph for 'mode-line-compact' from here... * doc/emacs/display.texi (Optional Mode Line): ...to here, and document the new user option. * etc/NEWS: Annouce the new user option. --- doc/emacs/display.texi | 15 +++++ doc/lispref/modes.texi | 11 ---- etc/NEWS | 9 +++ lisp/bindings.el | 128 ++++++++++++++++++++++++++++++++++++++--- 4 files changed, 145 insertions(+), 18 deletions(-) diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index 520d3289f2d..ad496b5b1cd 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1811,6 +1811,21 @@ Optional Mode Line @code{eol-mnemonic-dos}, @code{eol-mnemonic-mac}, and @code{eol-mnemonic-undecided} to the strings you prefer. =20 +@vindex mode-line-compact +@vindex mode-line-collapse-minor-modes + Some modes put a lot of data in the mode line, pushing elements at the +end of the mode line off to the right. Emacs can ``compress'' the mode +line if the @code{mode-line-compact} variable is non-@code{nil} by +turning stretches of spaces into a single space. If this variable is +@code{long}, this is only done when the mode line is wider than the +currently selected window. (This computation is approximate, based on +the number of characters, and not their displayed width.) This variable +can be buffer-local to only compress mode-lines in certain buffers. To +further ``compress'' the mode line, you may customize the +@code{mode-line-collapse-minor-modes} option to a non-@code{nil} value, +and Emacs will hide some minor mode indicators on the mode line by +collapsing them into a single clickable button. + @node Text Display @section How Text Is Displayed @cindex characters (in text) diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 788d98fdf20..0dd73fe17a8 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -2152,17 +2152,6 @@ Mode Line Basics @end lisp @end defun =20 -@vindex mode-line-compact - Some modes put a lot of data in the mode line, pushing elements at -the end of the mode line off to the right. Emacs can ``compress'' the -mode line if the @code{mode-line-compact} variable is non-@code{nil} -by turning stretches of spaces into a single space. If this variable -is @code{long}, this is only done when the mode line is wider than the -currently selected window. (This computation is approximate, based on -the number of characters, and not their displayed width.) This -variable can be buffer-local to only compress mode-lines in certain -buffers. - @node Mode Line Data @subsection The Data Structure of the Mode Line @cindex mode line construct diff --git a/etc/NEWS b/etc/NEWS index 35e6edcd712..939dc748f54 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -322,6 +322,15 @@ This will inhibit implied resizing while a new frame i= s made and can be useful on tiling window managers where the initial frame size should be specified by external means. =20 +** Mode Line + ++++ +*** New user option 'mode-line-collapse-minor-modes'. +If non-nil, minor mode lighters on the mode line are collapsed into a +single button. The value could also be a list to specify minor mode +lighters to hide or show. The default value is nil, which retains the +previous behavior of showing all minor mode lighters. + ** Tab Bars and Tab Lines =20 --- diff --git a/lisp/bindings.el b/lisp/bindings.el index 9707ce4b474..2d6e1579e10 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -429,6 +429,126 @@ bindings--sort-menu-keymap (bindings--menu-item-string (cdr-safe b)))))) (nconc (make-sparse-keymap prompt) bindings))) =20 +(defcustom mode-line-collapse-minor-modes nil + "Minor modes for which mode line lighters are hidden. +Hidden lighters are collapsed into one. + +The value could be a list (MODES ...) which means to collapse lighters +only for MODES, or a list (not MODES ...) which means to collapse all +lighters for minor modes not in MODES. Other non-nil values make all +lighters hidden." + :type '(choice (const :tag "No modes" nil) + (repeat :tag "Modes" symbol) + (cons :tag "All modes except" + (const not) (repeat symbol)) + (const :tag "All modes" t)) + :group 'mode-line + :version "31.1") + +(defvar mode-line-minor-modes '(:eval (mode-line--minor-modes)) + "Mode line construct for minor mode lighters.") +;;;###autoload +(put 'mode-line-minor-modes 'risky-local-variable t) + +(defun mode-line--make-lighter-menu (alist) + "Return a menu keymap for minor mode lighters in ALIST. +ALIST should be in the same format as `minor-mode-alist'. + +Return nil if no lighters in ALIST should be visible, for example, there +are no active minor modes or non-empty lighters." + (let ((menu (make-sparse-keymap "Minor Modes")) + (empty t)) + (dolist (item alist) + (when-let* ((variable (car item)) + ((and (boundp variable) + (symbol-value variable))) + (lighter (format-mode-line `("" ,@(cdr-safe item)))) + ((not (string=3D lighter ""))) + (toggle (or (get variable :minor-mode-function) variable= )) + ;; Follow the format in `mouse-minor-mode-menu' + (name (format "%s - %s" lighter + (capitalize + (string-replace + "-" " " (symbol-name toggle)))))) + (when (eq ? (aref name 0)) + (setq name (substring name 1))) + (let* ((map (cdr-safe (assq variable minor-mode-map-alist))) + (mm-menu (and (keymapp map) + (keymap-lookup map "")))) + (setq mm-menu + (cond (mm-menu (mouse-menu-non-singleton mm-menu)) + ((fboundp toggle) + (define-keymap :name name + "" (list 'menu-item + "Help for minor mode" + (lambda () (interactive) + (describe-function toggle))) + "" (list 'menu-item + "Turn off minor mode" + toggle))) + ;; No menu and not a minor mode function, so just + ;; display the label without a sub-menu. + (t nil))) + (keymap-set menu (format "<%s>" toggle) + (list 'menu-item name mm-menu)) + (setq empty nil)))) + (and (not empty) menu))) + +(defun mode-line--minor-modes () + "Compute mode line constructs for minor mode lighters." + (let (visible hidden) + (cond + ((not mode-line-collapse-minor-modes) + (setq visible minor-mode-alist + hidden nil)) + ((eq 'not (car-safe mode-line-collapse-minor-modes)) + (let ((modes (cdr mode-line-collapse-minor-modes))) + (dolist (item minor-mode-alist) + (if (memq (car item) modes) + (push item visible) + (push item hidden))) + (setq visible (nreverse visible) + hidden (nreverse hidden)))) + ((listp mode-line-collapse-minor-modes) + (let ((modes mode-line-collapse-minor-modes)) + (dolist (item minor-mode-alist) + (if (memq (car item) modes) + (push item hidden) + (push item visible))) + (setq visible (nreverse visible) + hidden (nreverse hidden)))) + (t (setq visible nil + hidden minor-mode-alist))) + (list "" + `(:propertize ("" ,visible) + mouse-face mode-line-highlight + help-echo "Minor mode\n\ +mouse-1: Display minor mode menu\n\ +mouse-2: Show help for minor mode\n\ +mouse-3: Toggle minor modes" + local-map ,mode-line-minor-mode-keymap) + (unless (string=3D "" (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 + " " menu + " " #'describe-mode))) + `(:propertize ,(if (char-displayable-p ?=E2=80=A6) " =E2=80= =A6" " ...") + 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)))))) + (defvar mode-line-major-mode-keymap (let ((map (make-sparse-keymap))) (define-key map [mode-line down-mouse-1] @@ -466,17 +586,11 @@ mode-line-modes mouse-face mode-line-highlight local-map ,mode-line-major-mode-keymap) '("" mode-line-process) - `(:propertize ("" minor-mode-alist) - mouse-face mode-line-highlight - help-echo "Minor mode\n\ -mouse-1: Display minor mode menu\n\ -mouse-2: Show help for minor mode\n\ -mouse-3: Toggle minor modes" - local-map ,mode-line-minor-mode-keymap) (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer" 'mouse-face 'mode-line-highlight 'local-map (make-mode-line-mouse-map 'mouse-2 #'mode-line-widen)) + '("" mode-line-minor-modes) ")" (propertize "%]" 'help-echo recursive-edit-help-echo) " ")) --=20 2.49.0 --=-=-=-- From unknown Fri Jun 20 20:10:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77361: [PATCH] New user option to hide minor mode lighters Resent-From: Pengji Zhang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Apr 2025 08:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77361 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Daniel Mendler Cc: 77361@debbugs.gnu.org Received: via spool by 77361-submit@debbugs.gnu.org id=B77361.174392748711407 (code B ref 77361); Sun, 06 Apr 2025 08:19:01 +0000 Received: (at 77361) by debbugs.gnu.org; 6 Apr 2025 08:18:07 +0000 Received: from localhost ([127.0.0.1]:45974 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u1LCh-0002xu-9t for submit@debbugs.gnu.org; Sun, 06 Apr 2025 04:18:07 -0400 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]:45535) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u1LCe-0002xJ-GM for 77361@debbugs.gnu.org; Sun, 06 Apr 2025 04:18:05 -0400 Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.phl.internal (Postfix) with ESMTP id 9B88D138016D; Sun, 6 Apr 2025 04:17:58 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Sun, 06 Apr 2025 04:17:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengjiz.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1743927478; x=1744013878; bh=MueqhZ06ASzWUfHgDghWw7wqflpE7CCsNr3WZjPDZ3A=; b= DRIuBHhosRRz+ZCP2cNA9mzWoKbLN8RvmhI2E3YR42WOkAsh//SsBDC07FwtS9lf Dd0kE35ZKSvI9EHsPBhWRz1uyMZZbhORxw7oblOvq+SlvfKY/s4OyVTkUuIOmwy6 SwNW17pjPtvpZ6v1eqZu8xRkiXj/fQyw+YgQTqehkGgBsDEmcfX8XrGPXg57sTi8 kXDL0Q4nj+Q5+MFNbaJhJBz9tBS/LRTx26pff0vijz/hFJafb9ex6xA1XxDrXVXO cJnGXxqV0XBNDysi8OMhSDdW1QN/aQW5zmL2HUL3gy3aLHg2u6ju7z/w+NSrfLpQ yfZQGy+aWJVmGto0esnYSA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1743927478; x= 1744013878; bh=MueqhZ06ASzWUfHgDghWw7wqflpE7CCsNr3WZjPDZ3A=; b=d ciSJOM4KSBWSd82NCCRqwbz77mkAFAE6dCda/PUiQaczjKdb6FV8JMClyjNwdo1J vc+tJtFOsRKbahxMZVcdRCcD1s9iRrqvzDTQ3FjfWHjm5vZU2NSEdHw/8C7tAT/A HS7aGuqeZCQ9nC3VL1tz3sm2gmkcy6EOkJIzFmIeXuVq//X+O21QdQUGAbOkbEVS gMQqEiVbC54qbLdAtLd5EKytcTcbW8uS8d92UkP3Qw0x4ZmLt+riwksHIXahIYNn A/xfy5WdQAeXgGotmqmS7Hgel3pSB0qtq4SxJ7x9TKnv8McbATBMEC7W8g56ZAfD dOke02lo/Rh0lP3FWnUBg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduleeijeejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvf evufgjfhffkfggtgfgsehtqhertddttdejnecuhfhrohhmpefrvghnghhjihcukghhrghn ghcuoehmvgesphgvnhhgjhhiiidrtghomheqnecuggftrfgrthhtvghrnhepffejudelhe fhieehgeehkeeuudetfeektddtvdegkeegffeljeeukeegfeejfeeinecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgvsehpvghnghhjihiird gtohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthho pehmrghilhesuggrnhhivghlqdhmvghnughlvghrrdguvgdprhgtphhtthhopeejjeefie duseguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i16614472:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 6 Apr 2025 04:17:57 -0400 (EDT) From: Pengji Zhang In-Reply-To: <87tt72ess9.fsf@daniel-mendler.de> References: <8734ewhz7n.fsf@pengjiz.com> <87tt72ess9.fsf@daniel-mendler.de> Date: Sun, 06 Apr 2025 16:17:54 +0800 Message-ID: <87r025k8jx.fsf@pengjiz.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Daniel Mendler 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=3D "" (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 + " " menu + " " #'describe-mode))) + `(:propertize ,(if (char-displayable-p ?=E2=80=A6) " =E2=80= =A6" " ...") + 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 From unknown Fri Jun 20 20:10:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77361: [PATCH] New user option to hide minor mode lighters Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Apr 2025 08:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77361 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Pengji Zhang Cc: 77361@debbugs.gnu.org Received: via spool by 77361-submit@debbugs.gnu.org id=B77361.174392884315648 (code B ref 77361); Sun, 06 Apr 2025 08:41:02 +0000 Received: (at 77361) by debbugs.gnu.org; 6 Apr 2025 08:40:43 +0000 Received: from localhost ([127.0.0.1]:46006 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u1LYY-00044J-LQ for submit@debbugs.gnu.org; Sun, 06 Apr 2025 04:40:42 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:40423 helo=mail.qxqx.de) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u1LYV-00043w-Rt for 77361@debbugs.gnu.org; Sun, 06 Apr 2025 04:40:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=XlqGT5lbYYdbe6KauIHJJMKRRYLGdmcLHEkhm0w0fMs=; b=om0XTuyhZG3JUHq8mdVqBXbmKv kGEVlhBDkkcctyz2Nn6FQTjFjv7iTlb30z6vO76htDLj69QvZKKzHFpvkXSu78oBqT2IbXB+73wM0 3hZgYhzNbVCWfVyuRqIz4lHYcQCLpgzcXm/nuqCKEVGNMDmOeadqD6j3F8wycI6udCOI=; From: Daniel Mendler In-Reply-To: <87r025k8jx.fsf@pengjiz.com> (Pengji Zhang's message of "Sun, 06 Apr 2025 16:17:54 +0800") References: <8734ewhz7n.fsf@pengjiz.com> <87tt72ess9.fsf@daniel-mendler.de> <87r025k8jx.fsf@pengjiz.com> Date: Sun, 06 Apr 2025 10:40:32 +0200 Message-ID: <87tt71r8cf.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Pengji Zhang writes: > Daniel Mendler 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? Deferring the menu computation sounds like a good idea, in particular since the menu is only accessed rarely. The repeated recomputation of the mode line elements itself should be fine. > 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. Thanks for checking. Daniel From unknown Fri Jun 20 20:10:18 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Pengji Zhang Subject: bug#77361: closed (Re: bug#77361: [PATCH] New user option to hide minor mode lighters) Message-ID: References: <865xj8la8m.fsf@gnu.org> <8734ewhz7n.fsf@pengjiz.com> X-Gnu-PR-Message: they-closed 77361 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 77361@debbugs.gnu.org Date: Sun, 13 Apr 2025 08:48:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1744534082-6535-1" This is a multi-part message in MIME format... ------------=_1744534082-6535-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #77361: [PATCH] New user option to hide minor mode lighters which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 77361@debbugs.gnu.org. --=20 77361: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D77361 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1744534082-6535-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 77361-done) by debbugs.gnu.org; 13 Apr 2025 08:47:02 +0000 Received: from localhost ([127.0.0.1]:38338 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u3szU-0001Zb-Ph for submit@debbugs.gnu.org; Sun, 13 Apr 2025 04:47:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39058) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u3szS-0001Yc-7p for 77361-done@debbugs.gnu.org; Sun, 13 Apr 2025 04:46:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3szL-0003yq-4z; Sun, 13 Apr 2025 04:46:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=jHJdGTzcxVWv8iUi/04HE3TRaEJEUJFn2ts4t8qrUTU=; b=OzN9+Vi/NJ65 DX131+VhMZdQ9/RQvO6raM5kQ5YhhuhjkWDz+G6l90TSwCPay1jxqKhYWnkJ+VJ5CTRgK4MKs02fI fF42aMdyd2TspfFTDlDieDECG/jcrdL6GUDptbxvgoW2n1K2FxE2B/g6tnqmKNmCjkFV6UWMuiPSn guPYsUQyttXGef+UYON3FxUKQ8vtghvBzr7JRdVbXVGeyAHWzypVlxkvYxv4u3QtnmjEHcuCHSjcN nug6hkZidLnqpO6RNR+imwmZYetyw7U3xa4ouxGHWAPWno1CrMFmkSrMGfvHaiEkgzt0jVN25dpLA u1rSrBeKgJZuCSuQzvBkXg==; Date: Sun, 13 Apr 2025 11:46:33 +0300 Message-Id: <865xj8la8m.fsf@gnu.org> From: Eli Zaretskii To: Pengji Zhang In-Reply-To: <87tt71k95f.fsf@pengjiz.com> (message from Pengji Zhang on Sun, 06 Apr 2025 16:05:00 +0800) Subject: Re: bug#77361: [PATCH] New user option to hide minor mode lighters References: <8734ewhz7n.fsf@pengjiz.com> <86zfgvvv2o.fsf@gnu.org> <87tt71k95f.fsf@pengjiz.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 77361-done Cc: 77361-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Pengji Zhang > Cc: 77361@debbugs.gnu.org > Date: Sun, 06 Apr 2025 16:05:00 +0800 > > Eli Zaretskii writes: > > > Please in future submissions of the patch mention the bug number in > > the log message. > > Thanks for the review! Bug number added in the updated patch. > > >> --- a/doc/lispref/modes.texi > >> +++ b/doc/lispref/modes.texi > >> @@ -2163,6 +2163,18 @@ Mode Line Basics > >> variable can be buffer-local to only compress mode-lines in certain > >> buffers. > >> > >> +@vindex mode-line-collapse-minor-modes > >> + To further ``compress'' the mode line, you may customize the > >> +@code{mode-line-collapse-minor-modes} option to a non-@code{nil} value, > >> +and Emacs will hide some minor mode indicators on the mode line by > >> +collapsing them into a single clickable button. The option can also be > >> +a list of symbols to select minor modes indicators to hide or show. If > >> +the list starts with the symbol @code{not}, it specifies minor modes to > >> +show, otherwise it means minor modes to hide. For example, setting it > >> +to @code{(not flymake-mode)} makes only the indicator for Flymake mode > >> +shown, and setting it to @code{(eldoc-mode)} hides only the indicator > >> +for ElDoc mode. > > > > I think this text and the preceding paragraph should be moved to the > > Emacs user manual, into the "Optional Mode Line" node. These are > > user-facing features, so their place is not in the ELisp Reference > > manual. > > > > For the user manual, the above description of the possible values of > > mode-line-collapse-minor-modes is too detailed. I suggest to have > > there only the first sentence, and then refer to the doc string for > > the various alternative forms of the value. > > I have moved the paragraph for 'mode-line-compact' to the "Optional Mode > Line" node, and added the first sentence for > 'mode-line-collapse-minor-modes' to that paragraph. > > >> ++++ > >> +*** New user option 'mode-line-collapse-minor-modes'. > >> +If non-nil, minor mode lighters on the mode line are collapsed into a > >> +single button. It could also be a list to specify minor mode lighters > > ^^^^^^^^^^^^^^^^^^^^^^^ > > "The value could also be a list..." > > Fixed. > > >> +(defcustom mode-line-collapse-minor-modes nil > >> + "Minor modes for which mode line lighters are hidden. > >> +Hidden lighters are collapsed into one. > >> + > >> +The value could be a list (MODES ...) which means to collapse lighters > >> +only for MODES, or a list (not MODES ...) which means to collapse all > >> +lighters for minor modes not in MODES. Other non-nil values make all > >> +lighters hidden." > >> + :type '(choice (const :tag "No modes" nil) > >> + (repeat :tag "Modes" symbol) > >> + (cons :tag "All modes except" > >> + (const not) (repeat symbol)) > >> + (const :tag "All modes" t)) > >> + :group 'mode-line) > > > > The :version tag is missing. > > Added. Thanks, now installed on the master branch, and closing the bug. ------------=_1744534082-6535-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 29 Mar 2025 11:08:15 +0000 Received: from localhost ([127.0.0.1]:57161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tyU2w-0001W0-97 for submit@debbugs.gnu.org; Sat, 29 Mar 2025 07:08:15 -0400 Received: from lists.gnu.org ([2001:470:142::17]:47148) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tyU2t-0001Vd-CM for submit@debbugs.gnu.org; Sat, 29 Mar 2025 07:08:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tyU2f-000428-4I for bug-gnu-emacs@gnu.org; Sat, 29 Mar 2025 07:08:01 -0400 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tyU2c-00023Y-1b for bug-gnu-emacs@gnu.org; Sat, 29 Mar 2025 07:07:56 -0400 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id F1D611383C3A for ; Sat, 29 Mar 2025 07:07:49 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Sat, 29 Mar 2025 07:07:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengjiz.com; h= cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3; t=1743246469; x=1743332869; bh=UlJUDNc8Q7RgcWxhcvmRVPd3tHsd/0/C KSOzvDgP0dU=; b=eYUC04gjFeo9ynSV9tvtBhYwRPXl1MD6frsnoj8l2qgv0RSf Q3eZfv6/rl+RFUm7SYDgoBhSX2ue1rg042qR83VtofGwRbmxnynsOR8XZT747IIf vWCvn83fwy4TyDVrhc1o53FniAB39B3+0LRMN0MZFHuiiMAvAwL87clUA/gyWCjl M3DjARUYlu12GvfrQaVIC+XLwgmCMTYV6SGROxNArJye3LSuUoYwJTYhEfJyYBra nEWSY3n8akIWJ/OnHVOo2sEZjGYlTtcdf9gY+wq6mL0x4sM8Bap2/cBZVrj/Zi+M mOrPEvSLGmTSUTGJFe1j0fToEaGO9/RBjG3o7w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1743246469; x= 1743332869; bh=UlJUDNc8Q7RgcWxhcvmRVPd3tHsd/0/CKSOzvDgP0dU=; b=O DbtiC7Nfh+dJYHdqFcZXD7GmZlVLMOOF1CaQNNSXRcTyYbljzAWrq38K7qnglUlM 9EchxO1AiMT6BJFzArlnBdEqw0AzCIQFPE5Xlv//h7JUBZv1g7VER8Q+jV+EKNd5 5xeAPxOQO0PvgmgQAZqUqvB60DfUo1smmp27XcyhmfhuVmf9Qz6xVWbYrcH/8ePF d34sA212uOl4fqDZyS0s/ToPYZ5EUf7IFh2zfy9JDK/Ei6VsNH3gKDxdl076WM8k 5e2Vz+gTIJPX/JJ9L5kDEY9L2Ub0B0RZohVo/1EmTsezhes+HiGigA2hc+PDBYPe sFLAOTizF5tVN0K/rvNfA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddujeegtdduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvf fufffkgggtsehmtderredttddtnecuhfhrohhmpefrvghnghhjihcukghhrghnghcuoehm vgesphgvnhhgjhhiiidrtghomheqnecuggftrfgrthhtvghrnhepiefgkefgffduheeife elkeekgfettdfhueekffdtheffkedttdehjeegleehheehnecuffhomhgrihhnpehgihht hhhusgdrtghomhdpghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpehmvgesphgvnhhgjhhiiidrtghomhdpnhgspghrtghpthht ohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepsghughdqghhnuhdqvghmrg gtshesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i16614472:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 29 Mar 2025 07:07:49 -0400 (EDT) From: Pengji Zhang To: bug-gnu-emacs@gnu.org Subject: [PATCH] New user option to hide minor mode lighters Date: Sat, 29 Mar 2025 19:07:40 +0800 Message-ID: <8734ewhz7n.fsf@pengjiz.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=103.168.172.145; envelope-from=me@pengjiz.com; helo=fout-a2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) --=-=-= Content-Type: text/plain Hello, The attached patch adds a new user option to hide some minor mode lighters on the mode line (by collapsing them into a menu), which is to shorten the mode line and prioritize important information when many minor modes are on. There exist a few packages that solve the problem. To name a few: - diminish[1] and delight[2]. Both offer a way to change the minor mode lighters by modifying 'minor-mode-alist'. To hide a minor mode lighter, one may change it to nil. - minions[3], which partially inspired this patch. It replaces minor mode lighters by a menu to toggle all minor modes. This patch is different from those solutions in two aspects: - Unlike diminish or delight, one can still see the lighters by clicking the button, instead of hiding them permanently. Besides, this patch is compatible with those two packages. - Unlike minions, this patch focuses on *lighters* for *enabled* minor modes. The menu contains only lighters, making it a more space efficient replacement for lighters on mode line, instead of a way to manage minor modes like minions. So I hope this patch is still useful given the existing similar solutions. Please let me know what you think. Thanks! Pengji [1] https://github.com/myrjola/diminish.el [2] https://elpa.gnu.org/packages/delight.html [3] https://github.com/tarsius/minions --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-New-user-option-to-hide-minor-mode-lighters.patch Content-Transfer-Encoding: quoted-printable >From c1e27606247761c31cec3d363714875c74b30277 Mon Sep 17 00:00:00 2001 From: Pengji Zhang Date: Sat, 29 Mar 2025 19:04:58 +0800 Subject: [PATCH] New user option to hide minor mode lighters * lisp/bindings.el (mode-line-collapse-minor-modes): New user option. (mode-line-minor-modes): New variable to hold mode line constructs for minor modes. (mode-line-modes): Use the new variable 'mode-line-minor-modes', and adjust the order of elements so the indicator for hidden minor modes is shown towards the end. (mode-line--make-lighter-menu): New helper function to generate the menu for hidden minor modes. (mode-line--minor-modes): New helper function to computer mode line constructs for minor mode lighters. * doc/lispref/modes.texi (Mode Line Basics): Document the new user option. * etc/NEWS (Note): Annouce the new user option. --- doc/lispref/modes.texi | 12 ++++ etc/NEWS | 9 +++ lisp/bindings.el | 122 ++++++++++++++++++++++++++++++++++++++--- 3 files changed, 136 insertions(+), 7 deletions(-) diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 788d98fdf20..23c363be12c 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -2163,6 +2163,18 @@ Mode Line Basics variable can be buffer-local to only compress mode-lines in certain buffers. =20 +@vindex mode-line-collapse-minor-modes + To further ``compress'' the mode line, you may customize the +@code{mode-line-collapse-minor-modes} option to a non-@code{nil} value, +and Emacs will hide some minor mode indicators on the mode line by +collapsing them into a single clickable button. The option can also be +a list of symbols to select minor modes indicators to hide or show. If +the list starts with the symbol @code{not}, it specifies minor modes to +show, otherwise it means minor modes to hide. For example, setting it +to @code{(not flymake-mode)} makes only the indicator for Flymake mode +shown, and setting it to @code{(eldoc-mode)} hides only the indicator +for ElDoc mode. + @node Mode Line Data @subsection The Data Structure of the Mode Line @cindex mode line construct diff --git a/etc/NEWS b/etc/NEWS index 1bd2fd6d486..8b7dfa0ee04 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -316,6 +316,15 @@ This will inhibit implied resizing while a new frame i= s made and can be useful on tiling window managers where the initial frame size should be specified by external means. =20 +** Mode Line + ++++ +*** New user option 'mode-line-collapse-minor-modes'. +If non-nil, minor mode lighters on the mode line are collapsed into a +single button. It could also be a list to specify minor mode lighters +to hide or show. The default value is nil, which retains the previous +behavior of showing all minor mode lighters. + ** Tab Bars and Tab Lines =20 --- diff --git a/lisp/bindings.el b/lisp/bindings.el index 9707ce4b474..a32e3d58dc7 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -429,6 +429,120 @@ bindings--sort-menu-keymap (bindings--menu-item-string (cdr-safe b)))))) (nconc (make-sparse-keymap prompt) bindings))) =20 +(defcustom mode-line-collapse-minor-modes nil + "Minor modes for which mode line lighters are hidden. +Hidden lighters are collapsed into one. + +The value could be a list (MODES ...) which means to collapse lighters +only for MODES, or a list (not MODES ...) which means to collapse all +lighters for minor modes not in MODES. Other non-nil values make all +lighters hidden." + :type '(choice (const :tag "No modes" nil) + (repeat :tag "Modes" symbol) + (cons :tag "All modes except" + (const not) (repeat symbol)) + (const :tag "All modes" t)) + :group 'mode-line) + +(defvar mode-line-minor-modes '(:eval (mode-line--minor-modes)) + "Mode line construct for minor mode lighters.") +;;;###autoload +(put 'mode-line-minor-modes 'risky-local-variable t) + +(defun mode-line--make-lighter-menu (alist) + "Return a menu keymap for minor mode lighters in ALIST. +ALIST should be in the same format as `minor-mode-alist'. + +Return nil if no lighters in ALIST should be visible, for example, there +are no active minor modes or non-empty lighters." + (let ((menu (make-sparse-keymap "Minor Modes")) + (empty t)) + (dolist (item alist) + (when-let* ((variable (car item)) + ((and (boundp variable) + (symbol-value variable))) + (lighter (format-mode-line `("" ,@(cdr-safe item)))) + ((not (string=3D lighter ""))) + (toggle (or (get variable :minor-mode-function) variable= )) + ;; Follow the format in `mouse-minor-mode-menu' + (name (format "%s - %s" lighter + (capitalize + (string-replace + "-" " " (symbol-name toggle)))))) + (when (eq ? (aref name 0)) + (setq name (substring name 1))) + (let* ((map (cdr-safe (assq variable minor-mode-map-alist))) + (mm-menu (and (keymapp map) + (keymap-lookup map "")))) + (setq mm-menu + (cond (mm-menu (mouse-menu-non-singleton mm-menu)) + ((fboundp toggle) + (define-keymap :name name + "" (list 'menu-item + "Help for minor mode" + (lambda () (interactive) + (describe-function toggle))) + "" (list 'menu-item + "Turn off minor mode" + toggle))) + ;; No menu and not a minor mode function, so just + ;; display the label without a sub-menu. + (t nil))) + (keymap-set menu (format "<%s>" toggle) + (list 'menu-item name mm-menu)) + (setq empty nil)))) + (and (not empty) menu))) + +(defun mode-line--minor-modes () + "Compute mode line constructs for minor mode lighters." + (let (visible hidden) + (cond + ((not mode-line-collapse-minor-modes) + (setq visible minor-mode-alist + hidden nil)) + ((eq 'not (car-safe mode-line-collapse-minor-modes)) + (let ((modes (cdr mode-line-collapse-minor-modes))) + (dolist (item minor-mode-alist) + (if (memq (car item) modes) + (push item visible) + (push item hidden))) + (setq visible (nreverse visible) + hidden (nreverse hidden)))) + ((listp mode-line-collapse-minor-modes) + (let ((modes mode-line-collapse-minor-modes)) + (dolist (item minor-mode-alist) + (if (memq (car item) modes) + (push item hidden) + (push item visible))) + (setq visible (nreverse visible) + hidden (nreverse hidden)))) + (t (setq visible nil + hidden minor-mode-alist))) + (list "" + `(:propertize ("" ,visible) + mouse-face mode-line-highlight + help-echo "Minor mode\n\ +mouse-1: Display minor mode menu\n\ +mouse-2: Show help for minor mode\n\ +mouse-3: Toggle minor modes" + local-map ,mode-line-minor-mode-keymap) + (when-let* ((menu (mode-line--make-lighter-menu hidden)) + (menu-binding (list 'menu-item "Display" menu + :filter #'bindings--sort-menu-ke= ymap)) + (toggle-binding (list 'menu-item "Toggle" mode-line-= mode-menu + :fitler #'bindings--sort-menu-= keymap)) + (keymap (define-keymap + " " menu-binding + " " #'describe-mode + " " toggle-bindin= g))) + `(:propertize ,(if (char-displayable-p ?=E2=80=A6) " =E2=80=A6= " " ...") + 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))))) + (defvar mode-line-major-mode-keymap (let ((map (make-sparse-keymap))) (define-key map [mode-line down-mouse-1] @@ -466,17 +580,11 @@ mode-line-modes mouse-face mode-line-highlight local-map ,mode-line-major-mode-keymap) '("" mode-line-process) - `(:propertize ("" minor-mode-alist) - mouse-face mode-line-highlight - help-echo "Minor mode\n\ -mouse-1: Display minor mode menu\n\ -mouse-2: Show help for minor mode\n\ -mouse-3: Toggle minor modes" - local-map ,mode-line-minor-mode-keymap) (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer" 'mouse-face 'mode-line-highlight 'local-map (make-mode-line-mouse-map 'mouse-2 #'mode-line-widen)) + '("" mode-line-minor-modes) ")" (propertize "%]" 'help-echo recursive-edit-help-echo) " ")) --=20 2.49.0 --=-=-=-- ------------=_1744534082-6535-1-- From unknown Fri Jun 20 20:10:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77361: [PATCH] New user option to hide minor mode lighters Resent-From: Pengji Zhang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Apr 2025 04:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77361 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Jonas Bernoulli Cc: 77361@debbugs.gnu.org Received: via spool by 77361-submit@debbugs.gnu.org id=B77361.17450370682704 (code B ref 77361); Sat, 19 Apr 2025 04:32:01 +0000 Received: (at 77361) by debbugs.gnu.org; 19 Apr 2025 04:31:08 +0000 Received: from localhost ([127.0.0.1]:55117 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u5zr6-0000gv-LX for submit@debbugs.gnu.org; Sat, 19 Apr 2025 00:31:07 -0400 Received: from fout-b3-smtp.messagingengine.com ([202.12.124.146]:46661) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u5zr0-0000em-9E for 77361@debbugs.gnu.org; Sat, 19 Apr 2025 00:31:02 -0400 Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfout.stl.internal (Postfix) with ESMTP id 1165411402EF; Sat, 19 Apr 2025 00:30:52 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Sat, 19 Apr 2025 00:30:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengjiz.com; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1745037051; x=1745123451; bh=izkCti22hm qbPH2GWSj018AUwcbZyGkC1fdtmHHrixY=; b=Q699A4kO07B+iJ+AhgWAU7wSB/ KAnnRmS0Vq9PpsNbJ7K/ve1bvQbyqLDV/lKvo0vXfDj99GzqNsFQkrjFckS34H4E Yh0Aym6Dnx1RwHpD6pUTc80CCEu/llhgtV19y5zTcMLq0GjbLXwT1Eoz6CL/ecs3 vOWP40ebt/NkQJiitWkhz4vuaZbUvLabPBOzIXPdDbhOA0VSX8D46o0m6/KrhnoN UuPq5+Q7+C9G0mykR1OUtenQ3RwCADBI6y+E6hzWx9gv/j5ixjcaiAsxUu8si0xP aqbBy7xWvo+EWCMXSbBD2DWaV/Peo7y0Ju5+RtsJxO30cBBAphpqpK0w4wcA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1745037051; x=1745123451; bh=izkCti22hmqbPH2GWSj018AUwcbZyGkC1fd tmHHrixY=; b=C5ZOhcZ8yrnErKQQl7jXmIg/30SZU6bmMgvr0sm85tSNKaAqNUy e1PN95sCOngfUjX/RQsibeI9kxVrsp/XQHbT3ObyhvdfAAlmLDDm53rDiNYtbudK 8Xv1mFUHgCTywIvAJiTCXDovHqdnL4oUQ+bpRPtHAz63GR3OWTYxX7yh59UuF3do QEcU3GryFlh/qo/KJXbfmVrR1F0XiLkVWEoUNDT9NvU0wezq4aXii3haR1v3h6Ia P0hOKY5JE/5Zl0yCTGlc9rPIhM8R3Ma93oMk3oedJqDYLFKcv/52k1bC+RZuHiqg tzkpuaR90eQfwd8ov4fC267paUpAh0HDXzg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvfeegtdejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephffvvefujghffffkgggtsehmtderredttdej necuhfhrohhmpefrvghnghhjihcukghhrghnghcuoehmvgesphgvnhhgjhhiiidrtghomh eqnecuggftrfgrthhtvghrnhepkeevieekgfeiudeuvefgieevfeejhfffkefhgeegfedt geektdegueejffdugeetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepmhgvsehpvghnghhjihiirdgtohhmpdhnsggprhgtphhtthhopedvpdhm ohguvgepshhmthhpohhuthdprhgtphhtthhopehjohhnrghssegsvghrnhhouhhlrdhlih dprhgtphhtthhopeejjeefieduseguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i16614472:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 19 Apr 2025 00:30:50 -0400 (EDT) From: Pengji Zhang In-Reply-To: <87zfgh90us.fsf@bernoul.li> References: <8734ewhz7n.fsf@pengjiz.com> <87zfgh90us.fsf@bernoul.li> Date: Sat, 19 Apr 2025 12:30:42 +0800 Message-ID: <87plh84vt9.fsf@pengjiz.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable (Cc'ing the bug tracker thread in case others would like to chime in.) Hello Jonas, Jonas Bernoulli writes: > Pengji Zhang writes: > >> - Unlike minions, this patch focuses on *lighters* for *enabled* minor >> modes. The menu contains only lighters, making it a more space >> efficient replacement for lighters on mode line, instead of a way to >> manage minor modes like minions. > > As the author of minions I am going to stick with that, but even then > the addition of `mode-line-minor-modes' is beneficial. Minions can > now just modify this trivial element instead of the much more complex > `mode-line-modes', which lead to a lot of duplication (or alternatively > fragile patching of the built-in value). Thanks! Good to know it is useful to minions as well. > Unfortunately one still has to modify `mode-line-modes' to remove the > parens around the modes. IMO these are just unnecessary noise if one > uses minions or the new mode-line-collapse-minor-modes. > > Messages =E2=80=A6 > > is good enough for me, I can see how one might want parens if showing > enabled minor-modes directly in the mode-line > > (Messages foobar schalala other modes here) > > So I would like to suggest the addition of something like: > > (defcustom mode-line-modes-delimiters '("(" . ")") > "Strings placed near the edges of `mode-line-modes'." > :type '(choice (const :tag "No delimiters") > (cons (string :tag "Opening string") > (string :tag "Closing string"))) > :group 'mode-line > :version "31.1") > > used like so > > (defvar mode-line-modes > ... > - "(" > + '(:eval (car mode-line-modes-delimiters)) > ... > - ")" > + '(:eval (cdr mode-line-modes-delimiters)) Just my two cents -- I do think that it is good to make the delimiters customizable. > Additionally you might want to consider making the menu string > customizable instead of using > > (if (char-displayable-p ?=E2=80=A6) " =E2=80=A6" " ...") That makes sense. Please find the attached patch. > Cheers, > Jonas Regards, Pengji --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-Make-lighter-customizable-for-collapsed-minor-modes-.patch Content-Transfer-Encoding: quoted-printable >From 656f03f48b2af0afab1e20ea3f13b2a007bc2bb8 Mon Sep 17 00:00:00 2001 From: Pengji Zhang Date: Sat, 19 Apr 2025 12:04:36 +0800 Subject: [PATCH] Make lighter customizable for collapsed minor modes (bug#77361) * lisp/bindings.el (mode-line-collapsed-minor-modes-lighter): New option for the collapsed lighter of minor modes. (mode-line-collapse-minor-modes): Mention that the collapsed lighter could be customized. (mode-line--minor-modes): Use the new option. * etc/NEWS: Announce the new option. --- etc/NEWS | 5 +++++ lisp/bindings.el | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 98f8e703013..ac06b214499 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -334,6 +334,11 @@ single button. The value could also be a list to spec= ify minor mode lighters to hide or show. The default value is nil, which retains the previous behavior of showing all minor mode lighters. =20 +--- +*** New user option 'mode-line-collapsed-minor-modes-lighter'. +The value should be a string to speficify the mode line lighter for +collapsed minor modes. + ** Tab Bars and Tab Lines =20 --- diff --git a/lisp/bindings.el b/lisp/bindings.el index 2d6e1579e10..9be467a421e 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -431,7 +431,8 @@ bindings--sort-menu-keymap =20 (defcustom mode-line-collapse-minor-modes nil "Minor modes for which mode line lighters are hidden. -Hidden lighters are collapsed into one. +Hidden lighters are collapsed into one, which is customizable via option +`mode-line-collapsed-minor-modes-lighter'. =20 The value could be a list (MODES ...) which means to collapse lighters only for MODES, or a list (not MODES ...) which means to collapse all @@ -445,6 +446,15 @@ mode-line-collapse-minor-modes :group 'mode-line :version "31.1") =20 +(defcustom mode-line-collapsed-minor-modes-lighter + (if (char-displayable-p ?=E2=80=A6) " =E2=80=A6" " ...") + "Lighter for collapsed minor modes. +This is effective only when `mode-line-collapse-minor-modes' is non-nil." + :type 'string + :initialize #'custom-initialize-delay + :group 'mode-line + :version "31.1") + (defvar mode-line-minor-modes '(:eval (mode-line--minor-modes)) "Mode line construct for minor mode lighters.") ;;;###autoload @@ -541,7 +551,7 @@ mode-line--minor-modes :parent mode-line-minor-mode-keymap " " menu " " #'describe-mode))) - `(:propertize ,(if (char-displayable-p ?=E2=80=A6) " =E2=80= =A6" " ...") + `(:propertize mode-line-collapsed-minor-modes-lighter mouse-face mode-line-highlight help-echo "Hidden minor modes\n\ mouse-1: Display hidden minor modes\n\ --=20 2.49.0 --=-=-=-- From unknown Fri Jun 20 20:10:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77361: [PATCH] New user option to hide minor mode lighters Resent-From: Sean Whitton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Apr 2025 10:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77361 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Pengji Zhang Cc: Jonas Bernoulli , 77361@debbugs.gnu.org Received: via spool by 77361-submit@debbugs.gnu.org id=B77361.174505734932119 (code B ref 77361); Sat, 19 Apr 2025 10:10:01 +0000 Received: (at 77361) by debbugs.gnu.org; 19 Apr 2025 10:09:09 +0000 Received: from localhost ([127.0.0.1]:58393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u658E-0008Ll-VG for submit@debbugs.gnu.org; Sat, 19 Apr 2025 06:09:08 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:55186) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u658A-0008JZ-7m for 77361@debbugs.gnu.org; Sat, 19 Apr 2025 06:09:03 -0400 DKIM-Signature: a=rsa-sha256; b=VsCbKJmLa6V+wZb51s79T700Er+W9QOdYzLliQQV/Tec01duXKLJAhFvDLNYZqKAoonkxfj7PltTDYX+nVCxJvik5G7c3QwyqPWLYHh8XwaVFHYStdJpGJ3hofGp+ctIe2gUUWg9BY5JFoeM1z1xsfvqMxdCuby7wIxPrnlfjSMnO14dPeCUq/vE0/4bcoczEtSr4aazgOBL9BYUoXpLY5mXk/0hQTsxNO6naxlkh+j4I84L6w/mPe/h5s/nVJGMkOnqGXPBcDbuzYy2aQbJpAu+xwnN2FX/YTt4Bqa1huJ6rTYELeO6PUB0DuYJ3p4xRXlD6NHnfz6t47iuc7G5nQ==; s=purelymail3; d=spwhitton.name; v=1; bh=sivaDvxCXE0hJLaZXTuAUXch/YWCYtX0iFn+LDp8aNc=; h=Received:Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=ElEQ0mC1kW4kEi5UiiiZzO3yr6NXbFTv8WzHFpgnuTkw0nfU61s6mugbCJrlpRoxdBH3pFu9ifwoJeRWc7TkguObIc4NMxLkWu5Gr4J4S7vU2DSdHgLMIEASMDL4OSBEGt6rGQ47KJ7YbhmC8FzdJbeso0zFJKP4JJLoxhH1rcJ68JCNnbrHB7ylfdz4rQVAtI77W47zEWtCwL0B7tDLCYvkm2/bh/eMCeGmPWbnyC6clZSZAsqObDS9ZTlprmkcEiDdzFEoJT/6gZEXFFeHdXgCW+lH+HXybaxL3em8n739Mgs9ZMCWhNlGf7re/Xuvpz+sNkmLySGL2h+6t7bYsQ==; s=purelymail3; d=purelymail.com; v=1; bh=sivaDvxCXE0hJLaZXTuAUXch/YWCYtX0iFn+LDp8aNc=; h=Feedback-ID:Received:Received:From:To:Subject:Date; Feedback-ID: 20115:3760:null:purelymail X-Pm-Original-To: 77361@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id 1481642298; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sat, 19 Apr 2025 10:08:49 +0000 (UTC) Received: by melete.silentflame.com (Postfix, from userid 1000) id 9C41A7F28DF; Sat, 19 Apr 2025 18:08:44 +0800 (CST) From: Sean Whitton In-Reply-To: <87plh84vt9.fsf@pengjiz.com> References: <8734ewhz7n.fsf@pengjiz.com> <87zfgh90us.fsf@bernoul.li> <87plh84vt9.fsf@pengjiz.com> Date: Sat, 19 Apr 2025 18:08:44 +0800 Message-ID: <87ldrwjwer.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Pengji, Thanks. Making this customizable sounds good. A couple of comments on your patch: - It doesn't make sense to add an additional NEWS entry because the whole feature will be new in this release. So you can delete that part of your patch. - Ideally the name of the variable would start with mode-line-collapse- instead of mode-line-collapsed- in order to match the existing one. May I suggest mode-line-collapse-minor-modes-to ? Or mode-line-collapse-minor-modes-to-char ? Or could we get away with just one variable? mode-line-collapse-major-modes can be the string to use; a value of 't' means to use =E2=80=A6. Possibly renaming it to mode-line-collapse-major-modes-to-char. --=20 Sean Whitton From unknown Fri Jun 20 20:10:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77361: [PATCH] New user option to hide minor mode lighters Resent-From: Sean Whitton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Apr 2025 11:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77361 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Pengji Zhang Cc: Jonas Bernoulli , 77361@debbugs.gnu.org Received: via spool by 77361-submit@debbugs.gnu.org id=B77361.174566803921180 (code B ref 77361); Sat, 26 Apr 2025 11:48:01 +0000 Received: (at 77361) by debbugs.gnu.org; 26 Apr 2025 11:47:19 +0000 Received: from localhost ([127.0.0.1]:58908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u8e07-0005VX-9E for submit@debbugs.gnu.org; Sat, 26 Apr 2025 07:47:19 -0400 Received: from sendmail.purelymail.com ([34.202.193.197]:40082) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u8e04-0005V3-7u for 77361@debbugs.gnu.org; Sat, 26 Apr 2025 07:47:17 -0400 DKIM-Signature: a=rsa-sha256; b=b1/xJvvc6ve+rtn1NkoFzwoIkk7o/J9+ZE7v2GmnQYlGhCBRnHsf4gjnXF9swr7TKsXzKHjb24u9WcBo8gNRxjKaewKiBlyRGf79gulPY4y95NegbSPKAzAVbNf/2IUNlWIlubCb2LN3dKGoxOJHXBy8MkZTZkB1in8stCPzkiG3FqisCASjwbl8OxqaGFTF1YokJAhiWD9oAetnCIWAPnh5sDMvswgNnAFUMtXXmU+9dJyM7j5etmceg65mYCGGELa1+RM0TXH8587FrB8eqDHLTkE8PDrZkMB86KbCP2pm1zJ6TNb6ON+ANcXh+VtdsvBndmWRDx4VMBshCHJPog==; s=purelymail1; d=spwhitton.name; v=1; bh=O53jsiRzPzie8IK2JvVYyBBCtZMBgJxPwu1Vtex13nw=; h=Received:Received:From:To:Subject:Date; DKIM-Signature: a=rsa-sha256; b=Kgs9jJZFef9A23mCjx2zIICU89D1v+GpCm/kgAGhD/rChi0D6eHYgV0Mincxrhz9nLigidu4kJ0tJqyePzZWhwU4JmvMaSU5CYdPsn7Ld5CkT48OpO5yc/EvQYEWKtnNVgFxZURMmKykSacgct7S2EZhpuPcKQSB59xXN7XcryTkuuoaYTuleG2y6XcVwwFfrBfI/3AgilQyXwsiZ9e5uNSGedMaFAAflQ8GFNbJbkvvp6hNKPcGH8WYf5W/Piy4KDF5meGxWw+mpIhGwuFIyy7oNwRi0shcNR1o0j5zObagfDPEPL39bNJS4HNXyvh8bW3P6BoV5nogRyOT21HftQ==; s=purelymail1; d=purelymail.com; v=1; bh=O53jsiRzPzie8IK2JvVYyBBCtZMBgJxPwu1Vtex13nw=; h=Feedback-ID:Received:Received:From:To:Subject:Date; Feedback-ID: 20115:3760:null:purelymail X-Pm-Original-To: 77361@debbugs.gnu.org Received: by smtp.purelymail.com (Purelymail SMTP) with ESMTPSA id -1582983647; (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sat, 26 Apr 2025 11:47:05 +0000 (UTC) Received: by melete.silentflame.com (Postfix, from userid 1000) id 20B3E7E3C29; Sat, 26 Apr 2025 19:47:01 +0800 (CST) From: Sean Whitton In-Reply-To: <87ldrwjwer.fsf@melete.silentflame.com> References: <8734ewhz7n.fsf@pengjiz.com> <87zfgh90us.fsf@bernoul.li> <87plh84vt9.fsf@pengjiz.com> <87ldrwjwer.fsf@melete.silentflame.com> Date: Sat, 26 Apr 2025 19:47:01 +0800 Message-ID: <87ikmrjgay.fsf@melete.silentflame.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, On Sat 19 Apr 2025 at 06:08pm +08, Sean Whitton wrote: > Hello Pengji, > > Thanks. Making this customizable sounds good. > > A couple of comments on your patch: > > - It doesn't make sense to add an additional NEWS entry because the > whole feature will be new in this release. So you can delete that > part of your patch. > > - Ideally the name of the variable would start with mode-line-collapse- > instead of mode-line-collapsed- in order to match the existing one. > > May I suggest mode-line-collapse-minor-modes-to ? I've installed it using this name. Thanks again. -- Sean Whitton From unknown Fri Jun 20 20:10:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#77361: [PATCH] New user option to hide minor mode lighters Resent-From: Pengji Zhang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 May 2025 03:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77361 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Sean Whitton Cc: 77361@debbugs.gnu.org Received: via spool by 77361-submit@debbugs.gnu.org id=B77361.174641512532603 (code B ref 77361); Mon, 05 May 2025 03:19:01 +0000 Received: (at 77361) by debbugs.gnu.org; 5 May 2025 03:18:45 +0000 Received: from localhost ([127.0.0.1]:36664 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uBmLs-0008Tg-Fr for submit@debbugs.gnu.org; Sun, 04 May 2025 23:18:45 -0400 Received: from fout-a6-smtp.messagingengine.com ([103.168.172.149]:52739) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uBmLn-0008SK-1P for 77361@debbugs.gnu.org; Sun, 04 May 2025 23:18:41 -0400 Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id 637CC13801D8; Sun, 4 May 2025 23:18:33 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Sun, 04 May 2025 23:18:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengjiz.com; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1746415113; x=1746501513; bh=LlXwiVNZWW MPyExncBeYCh07nSK/DTJg01soW4DlU3U=; b=RAkUFRJ51E/ymtoUz4mHLReT/U WaqQlaSGmxBAYOrBVzWiK7wtLlcG2gB+Wi9+O9RbsxIYQDB5Y8OJF/I4Qv5jlj/f uQF0HTXokHD8cLXzlf/IU4gAef5i8f/A1KRuHqHeAxLIGGG8EMc2H4AuTn16xW7u MdhEaw9OhSLSzFUpG7sHhHGmQnP7PHPL7elsjeeEWeJXhDEnRex05ZNN29UrfClQ z7hxep8K76nlwQyQYEDMx0eqxFjMStLUz/jNI6rTCESUxSOwDbpZfSfBdag3K5CF gEZHx1aiPpa7D+cKo5PTy/8JcpDuFQYCoIJB3UC+jxLRVB3IS8/2EBXX3q7g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1746415113; x=1746501513; bh=LlXwiVNZWWMPyExncBeYCh07nSK/DTJg01s oW4DlU3U=; b=i2wmbCzWgzjmmFCcTd8pOqouqP5E/6YqOsfQ3KFyriyAnbqcfdS 33rv6oOf71meEupJHsp7mHJOhAQflKxLMm9Sl6T3kYs+P2D+JQ9Hb53r2LX73ruZ /JBQsznKxAha8VVLEYJ5ZhTugfIPmgoumnkpcAUighk0orCzW1SGZxBWWiZwa33O wSc4h1WhYmL0d9aWr6qFy4P8SI6xfz/4I1EbYApBgVver1xt6bugxlI0duJFmjR7 bGQ15lvMJ4xnIuMS9hwWUEpu7UiueBe3P81Dysygkncp6QIGe074eXN+2eRjpwi5 C2FS/4SauoAf/EV0mJ/SFA8brhVRr4/TnRg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvjeelleelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhephffvvefujghffffkgggtsehttdertddttddt necuhfhrohhmpefrvghnghhjihcukghhrghnghcuoehmvgesphgvnhhgjhhiiidrtghomh eqnecuggftrfgrthhtvghrnhepgeefieeivddukeeitdegudeftdevtdeuteeifffhvdeh ffetgfeijeeileelheegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepmhgvsehpvghnghhjihiirdgtohhmpdhnsggprhgtphhtthhopedvpdhm ohguvgepshhmthhpohhuthdprhgtphhtthhopehsphifhhhithhtohhnsehsphifhhhith htohhnrdhnrghmvgdprhgtphhtthhopeejjeefieduseguvggssghughhsrdhgnhhurdho rhhg X-ME-Proxy: Feedback-ID: i16614472:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 4 May 2025 23:18:31 -0400 (EDT) From: Pengji Zhang In-Reply-To: <87ikmrjgay.fsf@melete.silentflame.com> References: <8734ewhz7n.fsf@pengjiz.com> <87zfgh90us.fsf@bernoul.li> <87plh84vt9.fsf@pengjiz.com> <87ldrwjwer.fsf@melete.silentflame.com> <87ikmrjgay.fsf@melete.silentflame.com> Date: Mon, 05 May 2025 11:18:27 +0800 Message-ID: <87plgnbv98.fsf@pengjiz.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Sean Whitton writes: > Hello, > > On Sat 19 Apr 2025 at 06:08pm +08, Sean Whitton wrote: > >> Hello Pengji, >> >> Thanks. Making this customizable sounds good. >> >> A couple of comments on your patch: >> >> - It doesn't make sense to add an additional NEWS entry because the >> whole feature will be new in this release. So you can delete that >> part of your patch. >> >> - Ideally the name of the variable would start with mode-line-collapse- >> instead of mode-line-collapsed- in order to match the existing one. >> >> May I suggest mode-line-collapse-minor-modes-to ? > > I've installed it using this name. Thanks again. Sorry for the late reply. I got a bit busy with my day job. I like this name, and thanks for installing it! As for merging the two variables into one, I guess you might have noticed it, it is not easy to do. 'mode-line-collapse-minor-modes' could take a list of symbols to select modes to hide, in which case I could not find a clear way to specify the lighter string. Best, Pengji