X-Loop: help-debbugs@HIDDEN Subject: bug#78881: [PATCH] New command 'toggle-mode-line-visibility' Resent-From: Elijah Gabe =?UTF-8?Q?P=C3=A9rez?= <eg642616@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Mon, 23 Jun 2025 19:22:01 +0000 Resent-Message-ID: <handler.78881.B.175070646729807 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 78881 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 78881 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.175070646729807 (code B ref -1); Mon, 23 Jun 2025 19:22:01 +0000 Received: (at submit) by debbugs.gnu.org; 23 Jun 2025 19:21:07 +0000 Received: from localhost ([127.0.0.1]:57888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uTmj4-0007kX-0c for submit <at> debbugs.gnu.org; Mon, 23 Jun 2025 15:21:07 -0400 Received: from lists.gnu.org ([2001:470:142::17]:59504) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>) id 1uTmiz-0007hw-4E for submit <at> debbugs.gnu.org; Mon, 23 Jun 2025 15:21:03 -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 <eg642616@HIDDEN>) id 1uTmio-0007E2-NH for bug-gnu-emacs@HIDDEN; Mon, 23 Jun 2025 15:20:52 -0400 Received: from mail-oi1-x241.google.com ([2607:f8b0:4864:20::241]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <eg642616@HIDDEN>) id 1uTmim-0006cU-KA for bug-gnu-emacs@HIDDEN; Mon, 23 Jun 2025 15:20:50 -0400 Received: by mail-oi1-x241.google.com with SMTP id 5614622812f47-40af40aee93so101833b6e.0 for <bug-gnu-emacs@HIDDEN>; Mon, 23 Jun 2025 12:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750706446; x=1751311246; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=g2eVY16lgv0pChcbeBk80g4287qOvAKY1mPLPXUEPMk=; b=UvoseClBOsUsnHFb7VLHXlbCUp/peRSHBRPClt9E5Kk4k37PhUYyLbguXJZabbPyJB UA0jD4vY2OU1kbRBNQMjdN011AMeBda9sIC7vn/BLkadidvsORC6qvS6i5vJJqub2s0w BxggQBxby8aJdPts6C8F+EetO7qVV5E53/7QhXHctGavwVXt6VNPki83eMeih4OH6NNW 6tXlBGlD6l/eRMcbFdZpwZJ39CuYRXqM66UDoanawsbC5frrUtr1DPNJ/vbNw2rl39Yr vbHRbOD5+AAQOS/AYW7bDdlaCNH6MzAtIkHt+6qyACLPFX347GSpfClC84hx9Y/XV5v/ kvHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750706446; x=1751311246; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=g2eVY16lgv0pChcbeBk80g4287qOvAKY1mPLPXUEPMk=; b=NcHUherBHOYmEUoBmgzHSMkEX22HlnzFjC4poclJUZjYY5bgjc2fLEKPT6fcH9WlpV FrfoTBpdif2XHLe8rlKi6eopG6SNwsHEcZ2vTPZYfnIY88BOWf232aI0waSXOSEZlWus WU3HVIzJtecxsVOENx9JGdiZmlfrhC3G35JAFUfPhXzfLM8IhEVaoKtV9oNZYNf1w5ks T8FiQVApN+uZgarwiZAnnR2KrgPMgx+lP0TD/nxnVIFnvUzH5gwyqgqKcUalVFtY9n/G S4Erb74GYuLMWJcs6nMenKK8IUsQZ0kwUiesyXYF9P2cD/c0su7sS6+amulHke7CU8Ep 61xA== X-Gm-Message-State: AOJu0YyvXA0ZXoq60xjZJBRAacO1Q+pUd3g/WPWklE36j+xA2k3qgHmX NVcCfyOAvgxhViZSBwWH1c1Ny92be2ZuzbQA1q1SY3S5lvP0IPtx8P9oD/C6T+o1 X-Gm-Gg: ASbGncvsfq/QtzV96zELCO4tElfrcRsbXZ/xMhDH9IVFopvmKr4Px/30G9jxSNOo6uG 5ndTLq/OoxzdAAA1/L1EZWoslnioiix/xiYcD7yWeferp+xnX2wC9WRbUABxJUflQoWKJ9FcOJF 3EGBQlESUjqIe5pib+WDcF7llAro0WP6RyxI/EQ3G//22TdusM9XR3FWdBzr4XmvpZPHtRh0VLN bPFWklbAAaBGlstYwstGgXFIYChLu9ZUGX8cjDFLth2mK3ze49rUsO65K/XE1OhknfaH4dxmuVS b0vdkecTKtawfIl7hgzeYiRyK2xSbQ== X-Google-Smtp-Source: AGHT+IFXZ6TF1NRB+AZi452cVb6heDGKSCO2ZPW/QMXVsSQxdKBpD3JZ+V7yAkAPITpvHiiV7izRHQ== X-Received: by 2002:a05:6808:220b:b0:402:862:93ae with SMTP id 5614622812f47-40ac6f526ebmr10524796b6e.16.1750706446313; Mon, 23 Jun 2025 12:20:46 -0700 (PDT) Received: from fedora ([2806:10ae:e:b56a::1]) by smtp.gmail.com with ESMTPSA id 5614622812f47-40ac6d11bacsm1516980b6e.35.2025.06.23.12.20.45 for <bug-gnu-emacs@HIDDEN> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jun 2025 12:20:45 -0700 (PDT) From: Elijah Gabe =?UTF-8?Q?P=C3=A9rez?= <eg642616@HIDDEN> Date: Mon, 23 Jun 2025 13:20:44 -0600 Message-ID: <8734bqz2lv.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::241; envelope-from=eg642616@HIDDEN; helo=mail-oi1-x241.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Tags: patch This new command allows toggle the mode line visibility in the current buffer. The mode line keeps hidden from each major mode change, avoiding having to run this command many times. Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (eg642616[at]gmail.com) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (eg642616[at]gmail.com) 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.2 (/) --=-=-= Content-Type: text/plain Tags: patch This new command allows toggle the mode line visibility in the current buffer. The mode line keeps hidden from each major mode change, avoiding having to run this command many times. This is based/inspired by `hide-mode-line-mode` (from MELPA), but unlike latter one, this is a rewrite which uses a command instead a minor mode and I'm interested in including this in Emacs :^). --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-New-command-toggle-mode-line-visibility.patch From a3c36ce32da275a6213e28a8feb3abe1b27ba87a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616@HIDDEN> Date: Mon, 23 Jun 2025 12:50:28 -0600 Subject: [PATCH] New command 'toggle-mode-line-visibility' This new command allows toggle the mode line visibility in the current buffer. (Bug#) * etc/NEWS: Announce changes. * lisp/bindings.el (toggle-mode-line--buf-state): New buffer local variable. (toggle-mode-line-visibility): New command. (disable-mode-line): New function. --- etc/NEWS | 8 ++++++++ lisp/bindings.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 6f3d28d0e03..c9de3feae63 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -346,6 +346,14 @@ This option allows changing or removing the delimiters shown around the major mode and list of minor modes in the mode line. The default retains the existing behavior of inserting parentheses. +--- +*** New command 'toggle-mode-line-visibility'. +This command toggles the mode line visibility in current buffer, if the +current buffer displays a mode line, this will temporally hide it until +'toggle-mode-line-visibility' is called again. Otherwise, if the +current buffer does not have a mode line by default, this will display +one. + ** Tab Bars and Tab Lines --- diff --git a/lisp/bindings.el b/lisp/bindings.el index 8b021a05ce2..6c7d47dcd4a 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -56,6 +56,52 @@ mode-line-widen (widen) (force-mode-line-update))) +;; Variable used by `toggle-mode-line-visibility' for +;; store mode-line value in current buffer. +(defvar-local toggle-mode-line--buf-state) + +(defun toggle-mode-line-visibility (&optional hide-only) + "Toggle mode line visibility in current buffer. +If current buffer displays a mode line, temporally hide it until +`toggle-mode-line-visibility' is called again. Otherwise, display one +if the buffer does not have a mode line by default. + +The mode line is hidden from every major mode change in current buffer. + +If HIDE-ONLY is non-nil, only hide the mode-line." + (interactive "^P") + (if mode-line-format + (progn + ;; Hook to prevent the mode line from being displayed again at + ;; each change of major mode. + (add-hook 'after-change-major-mode-hook #'disable-mode-line nil t) + (setq toggle-mode-line--buf-state + (buffer-local-set-state mode-line-format nil))) + + (unless hide-only + (remove-hook 'after-change-major-mode-hook #'disable-mode-line t) + (setq toggle-mode-line--buf-state + (buffer-local-restore-state toggle-mode-line--buf-state)) + + ;; Display a mode line if buffer does not have one by default. + (unless mode-line-format + (setq-local mode-line-format (default-value 'mode-line-format))) + + ;; Update mode line. + (when (called-interactively-p 'any) + (force-mode-line-update))))) + +;; NOTE: This function is intended to be used in hooks. +(defun disable-mode-line () + "Hide the mode-line in current buffer. +The mode line is hidden from every major mode change in current buffer. + +See `toggle-mode-line-visibility'." + (toggle-mode-line-visibility 'hide)) + +(put 'toggle-mode-line--buf-state 'permanent-local t) +(put 'disable-mode-line 'permanent-local-hook t) + (defvar mode-line-input-method-map (let ((map (make-sparse-keymap))) (define-key map [mode-line mouse-2] -- 2.49.0 --=-=-= Content-Type: text/plain -- - E.G via GNU Emacs and Org. --=-=-=--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Elijah Gabe =?UTF-8?Q?P=C3=A9rez?= <eg642616@HIDDEN> Subject: bug#78881: Acknowledgement ([PATCH] New command 'toggle-mode-line-visibility') Message-ID: <handler.78881.B.175070646729807.ack <at> debbugs.gnu.org> References: <8734bqz2lv.fsf@HIDDEN> X-Gnu-PR-Message: ack 78881 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 78881 <at> debbugs.gnu.org Date: Mon, 23 Jun 2025 19:22:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 78881 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 78881: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D78881 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#78881: [PATCH] New command 'toggle-mode-line-visibility' Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Tue, 24 Jun 2025 11:19:01 +0000 Resent-Message-ID: <handler.78881.B78881.17507639105791 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 78881 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Elijah Gabe =?UTF-8?Q?P=C3=A9rez?= <eg642616@HIDDEN> Cc: 78881 <at> debbugs.gnu.org Received: via spool by 78881-submit <at> debbugs.gnu.org id=B78881.17507639105791 (code B ref 78881); Tue, 24 Jun 2025 11:19:01 +0000 Received: (at 78881) by debbugs.gnu.org; 24 Jun 2025 11:18:30 +0000 Received: from localhost ([127.0.0.1]:41337 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uU1fZ-0001VJ-Ma for submit <at> debbugs.gnu.org; Tue, 24 Jun 2025 07:18:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34586) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uU1fX-0001UO-1P for 78881 <at> debbugs.gnu.org; Tue, 24 Jun 2025 07:18:27 -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 <eliz@HIDDEN>) id 1uU1fK-00088W-0V; Tue, 24 Jun 2025 07:18:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=h9b6cy+HDa7O9LnRD6kgqntzFFn24wp8sibQabTZCgc=; b=ixXCfwSgrpuTDPPv09qX vc8u84Kg4jfxZJz4kLV9LDgKNoxjsL1tbQ9EA4pM1TKm0TfpmgCmx9sLCn7K1YgPlfVNrTQzTvjfB 6Fm8RPfr/W7TGNz3frfJ4BuDRp+LHfmlNkA1vMfulGtSuMSZUXiiETYuno4o/veBKcwmOT9bF5PEf uXA//7FeNrh54uO1LbgNYbnz3D8TPPeViQEOe2vm/J69+OcBjKfLE4xMR8HrZOxwvFMqZzK/UMtVl f4ciQUA0AHeU53xXaMxMjPqOJ5t8mPPM+yeVPU8vONb5hTE0MekJB3SSZ/GmlmSVt65WdYQBa5Ax4 sJvX/tgDN1aIIg==; Date: Tue, 24 Jun 2025 14:18:11 +0300 Message-Id: <86zfdxe6bw.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <8734bqz2lv.fsf@HIDDEN> (message from Elijah Gabe =?UTF-8?Q?P=C3=A9rez?= on Mon, 23 Jun 2025 13:20:44 -0600) References: <8734bqz2lv.fsf@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Elijah Gabe Pérez <eg642616@HIDDEN> > Date: Mon, 23 Jun 2025 13:20:44 -0600 > > This new command allows toggle the mode line visibility in the current > buffer. > > The mode line keeps hidden from each major mode change, avoiding having > to run this command many times. > > This is based/inspired by `hide-mode-line-mode` (from MELPA), but unlike > latter one, this is a rewrite which uses a command instead a minor mode > and I'm interested in including this in Emacs :^). Thanks. I think the idea of a minor mode is better. Our experience is that many toggle commands end up being minor modes. One advantage of a minor mode is that the ways of turning a mode on/off and toggling it are automagically done for you, and they are all uniformly familiar to users. > --- a/etc/NEWS > +++ b/etc/NEWS > @@ -346,6 +346,14 @@ This option allows changing or removing the delimiters shown around > the major mode and list of minor modes in the mode line. The default > retains the existing behavior of inserting parentheses. > > +--- > +*** New command 'toggle-mode-line-visibility'. > +This command toggles the mode line visibility in current buffer, if the > +current buffer displays a mode line, this will temporally hide it until > +'toggle-mode-line-visibility' is called again. Otherwise, if the > +current buffer does not have a mode line by default, this will display > +one. This feature must be described in the user manual, so please add the necessary changes for that (and mark the NEWS entry with "+++"). > +(defun toggle-mode-line-visibility (&optional hide-only) > + "Toggle mode line visibility in current buffer. > +If current buffer displays a mode line, temporally hide it until ^^^^^^^^^^ "temporarily" > +The mode line is hidden from every major mode change in current buffer. This sentence confused me. What did you mean to say here? > +If HIDE-ONLY is non-nil, only hide the mode-line." What is the difference between "only hide" and the other situation? Please clarify. > +;; NOTE: This function is intended to be used in hooks. > +(defun disable-mode-line () If you make this a minor mode, you won't need two functions, one will do. Thanks.
X-Loop: help-debbugs@HIDDEN Subject: bug#78881: [PATCH] New command 'toggle-mode-line-visibility' Resent-From: Elijah Gabe =?UTF-8?Q?P=C3=A9rez?= <eg642616@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Tue, 24 Jun 2025 17:05:02 +0000 Resent-Message-ID: <handler.78881.B78881.175078468724774 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 78881 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii <eliz@HIDDEN> Cc: 78881 <at> debbugs.gnu.org Received: via spool by 78881-submit <at> debbugs.gnu.org id=B78881.175078468724774 (code B ref 78881); Tue, 24 Jun 2025 17:05:02 +0000 Received: (at 78881) by debbugs.gnu.org; 24 Jun 2025 17:04:47 +0000 Received: from localhost ([127.0.0.1]:47114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uU74g-0006RS-Vl for submit <at> debbugs.gnu.org; Tue, 24 Jun 2025 13:04:47 -0400 Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343]:49290) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>) id 1uU74e-0006Qw-6h for 78881 <at> debbugs.gnu.org; Tue, 24 Jun 2025 13:04:45 -0400 Received: by mail-ot1-x343.google.com with SMTP id 46e09a7af769-73a8d0e3822so379373a34.2 for <78881 <at> debbugs.gnu.org>; Tue, 24 Jun 2025 10:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750784678; x=1751389478; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=3VsOx/F6ows3yrjr86g9U8ICKllJKDBwOlk/XEO5p8w=; b=egq5WDrNNiO38b2zFRErkL4pVE1X3W/HjXWe/V2f7gsKX/6IqQaUYdmt8gmyeLN+1M BAHNV9aLGRz1kwxxrP6GcBoccsprqa+M/AMdsO32VMPHLviGG1Bf1264JWCkvHtPu7rE mssgbhduvSc+c8t4waK+soQ3YBx+lSSntMgcoI3g2BgZZjjzqZjn9UjiZtH0d9n8k2yy NH9lQWZ7xx0DX8Te2CqSCidbmeGPni2OuE24NSzoTic5aiVPDgokPaX7QE3taYW1MMcv jmRRditS9zpZnn7AI764jcAKMzopIg8nPq+4NuJm1dA47t7VXsX3tmpRo+2KDNbeiEB9 27lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750784678; x=1751389478; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3VsOx/F6ows3yrjr86g9U8ICKllJKDBwOlk/XEO5p8w=; b=oLVgrcrT9M+bKEu45xuTYPKVHBOz9GOKHbITxEo/10RbWzwzZZfGqdFTmoU31q3MaU ZJ5mYH/VUoBL+J4gYhca6YtVED7eaxvugJE/FlZqKl5cx++XsLJ+4dXr2yGSOspijC4l KMwOK+SrLaMUA6Rh618pc/WxBL/GB3cRUfNnAvX/6U0cCTslU8bDiV/fOUiymbyz7gDT dcYV2JkC2gajJ9n8OUaaQYeavbjDitwb9EKqQjCS5Xt75KX9AP1jEB9uWj03Ow0Tqnwv rZvfqGyJNYTMjtLwNCg9PDv3FnIvtdKV0bQq7VRTB5wtcXQ8s3qCuFzfGNDdi8j716x4 Ru1w== X-Gm-Message-State: AOJu0YyuCgtNoxJKdXJKbNc3W5vmuR1r5PnQh4vtFyMaWVPt4X6d1aDS tdCiroWWEdMiJH+F64SHGVa4CwYZKEQrag45TyKzOeDFwQfLM117+0FcqJaXoxnr X-Gm-Gg: ASbGnct8jAR8DYst8UsO4SDQM3z7Wdo/BvT0xakNhiVHLR9kF+UbfYOe5F5Pw02NcSs qKubPojsL5dO/qkysTEY+s7Kv8l1iwXSmL//nuhbRBTBZZq9ZRNoBolvK8IC7EbbJZZC2oBqepf oIgA1Rou4p3rbFvCc/1zkZoGmgm2gv9QtD5P8qEAbdIM5Pe+4iNXR0RCL5fHaQN3QiEUODDfOYv OO63e0VHTk31939gID2voDgyF4TndYNP+sPCOS4CcvPl8v7+xX1i9o6LFLxcI7VrCzBoFgmYmGB b+uSVzs0B/2mKouK1T4qk8AFJTH6mktIWdNyStAl X-Google-Smtp-Source: AGHT+IEKJBNzbQsH6CZLRmNBVklepSIrWh7eksOrJAQG+QSVNodnPU1imyjbVCCSu45R6fCVCkGcgQ== X-Received: by 2002:a05:6830:2814:b0:72b:9316:d596 with SMTP id 46e09a7af769-73a91c0fa67mr12983803a34.3.1750784677771; Tue, 24 Jun 2025 10:04:37 -0700 (PDT) Received: from fedora ([2806:10ae:e:b56a::1]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-73a90b33a43sm1916969a34.29.2025.06.24.10.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jun 2025 10:04:37 -0700 (PDT) From: Elijah Gabe =?UTF-8?Q?P=C3=A9rez?= <eg642616@HIDDEN> In-Reply-To: <86zfdxe6bw.fsf@HIDDEN> References: <8734bqz2lv.fsf@HIDDEN> <86zfdxe6bw.fsf@HIDDEN> Date: Tue, 24 Jun 2025 11:04:35 -0600 Message-ID: <874iw5f4v0.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.7 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii <eliz@HIDDEN> writes: >> From: Elijah Gabe P=C3=A9rez <eg642616@HIDDEN> >> Date: Mon, 23 Jun 2025 13:20:44 -0600 >>=20 >> This new command allows toggle the mode line visibility in the current >> buffer. >>=20 >> The mode line keeps hidden from each major mode change, avoiding having >> to run this command many times. >>=20 >> This is based/inspired by `hide-mode-line-mode` (from MELPA), but unlike >> latter one, this is a rewrite which uses a command instead a minor mode >> and I'm interested in including this in Emacs :^). > > Thanks. I think the idea of a minor mode is better. Our experience > is that many toggle commands end up being minor modes. One advantage > of a minor mode is that the ways of turning a mode on/off and toggling > it are automagically done for you, and they are all uniformly familiar > to users. I agree, but the problem with making this command a minor mode is that it have to check whether the minor mode variable is non-nil for display/hide the mode-line (AFAIU), this brings problems because if a buffer by default does not show the mode line, one would have to execute the command twice to display it. This would also create 2 variables of which I do not see much use: the minor mode hook and minor mode variable. Anyway, I changed it to a minor mode, but I am not very convinced of the result. >> --- a/etc/NEWS >> +++ b/etc/NEWS >> @@ -346,6 +346,14 @@ This option allows changing or removing the delimit= ers shown around >> the major mode and list of minor modes in the mode line. The default >> retains the existing behavior of inserting parentheses. >>=20=20 >> +--- >> +*** New command 'toggle-mode-line-visibility'. >> +This command toggles the mode line visibility in current buffer, if the >> +current buffer displays a mode line, this will temporally hide it until >> +'toggle-mode-line-visibility' is called again. Otherwise, if the >> +current buffer does not have a mode line by default, this will display >> +one. > > This feature must be described in the user manual, so please add the > necessary changes for that (and mark the NEWS entry with "+++"). Sure, but I'm not sure in which section of the manual I must document it, maybe in "Optional Mode Line Features" from "emacs" manual? >> +The mode line is hidden from every major mode change in current buffer. > > This sentence confused me. What did you mean to say here? e.g. If you call `toggle-mode-line-visibility` in the scratch buffer and later call `text-mode` in the same buffer, the mode line will become visible again, which is not convenient since this command is meant to enable/disable the mode line per buffer, not per major mode. >> +If HIDE-ONLY is non-nil, only hide the mode-line." > > What is the difference between "only hide" and the other situation? > Please clarify. It was only for internal use of the command, for ensure that the mode line is hidden because this command can display it if the mode line is already hidden, that's why `disable-mode-line` existed. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-New-command-toggle-mode-line-visibility.patch From 67cfb180079d761dbe08dd66a9eab64fe29e4d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616@HIDDEN> Date: Mon, 23 Jun 2025 12:50:28 -0600 Subject: [PATCH] New command 'toggle-mode-line-visibility' This new command allows toggle the mode line visibility in the current buffer. (Bug#78881) * etc/NEWS: Announce changes. * lisp/bindings.el (toggle-mode-line--buf-state): New buffer local variable. (toggle-mode-line-visibility): New minor mode. (toggle-mode-line--hide): New function. --- etc/NEWS | 8 ++++++++ lisp/bindings.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index f7aebdf538f..59c77f3abb0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -346,6 +346,14 @@ This option allows changing or removing the delimiters shown around the major mode and list of minor modes in the mode line. The default retains the existing behavior of inserting parentheses. +--- +*** New command 'toggle-mode-line-visibility'. +This command toggles the mode line visibility in current buffer, if the +current buffer displays a mode line, this will temporarily hide it until +'toggle-mode-line-visibility' is called again. Otherwise, if the +current buffer does not have a mode line by default, this will display +one. + ** Tab Bars and Tab Lines --- diff --git a/lisp/bindings.el b/lisp/bindings.el index 8b021a05ce2..e6e78c18dac 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -56,6 +56,52 @@ mode-line-widen (widen) (force-mode-line-update))) +;; Variable used by `toggle-mode-line-visibility' for +;; store mode-line value in current buffer. +(defvar-local toggle-mode-line--buf-state) + +(defun toggle-mode-line--hide () + "Function used in command `toggle-mode-line-visibility' to hide the mode line." + (when mode-line-format + (setq toggle-mode-line--buf-state + (buffer-local-set-state mode-line-format nil)))) + +(define-minor-mode toggle-mode-line-visibility + "Toggle mode line visibility in current buffer. +If current buffer displays a mode line, temporarily hide it until +command `toggle-mode-line-visibility' is called again. Otherwise, +display one if the buffer does not have a mode line by default. + +The mode line is hidden from every major mode change in current buffer." + :init-value nil + ;; Since this is a toggle command, ensure if we must display or hide + ;; the mode line according to `mode-line-format' value + (if mode-line-format + (progn + ;; Hook to prevent the mode line from being displayed again at + ;; each change of major mode. + ;; We cannot use `toggle-mode-line-visibility' in this hook + ;; since it will not ensure the mode line keeps hidden + (add-hook 'after-change-major-mode-hook #'toggle-mode-line--hide nil t) + (toggle-mode-line--hide)) + + (remove-hook 'after-change-major-mode-hook #'toggle-mode-line--hide t) + + (when toggle-mode-line--buf-state + (setq toggle-mode-line--buf-state + (buffer-local-restore-state toggle-mode-line--buf-state))) + + ;; Display a mode line if buffer does not have one by default + (unless mode-line-format + (setq-local mode-line-format (default-value 'mode-line-format))) + + ;; Update mode line + (when (called-interactively-p 'any) + (force-mode-line-update)))) + +(put 'toggle-mode-line--buf-state 'permanent-local t) +(put 'toggle-mode-line--hide 'permanent-local-hook t) + (defvar mode-line-input-method-map (let ((map (make-sparse-keymap))) (define-key map [mode-line mouse-2] -- 2.49.0 --=-=-= Content-Type: text/plain -- - E.G via GNU Emacs and Org. --=-=-=--
X-Loop: help-debbugs@HIDDEN Subject: bug#78881: [PATCH] New command 'toggle-mode-line-visibility' Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Wed, 25 Jun 2025 11:10:02 +0000 Resent-Message-ID: <handler.78881.B78881.175084974922626 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 78881 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Elijah Gabe =?UTF-8?Q?P=C3=A9rez?= <eg642616@HIDDEN> Cc: 78881 <at> debbugs.gnu.org Received: via spool by 78881-submit <at> debbugs.gnu.org id=B78881.175084974922626 (code B ref 78881); Wed, 25 Jun 2025 11:10:02 +0000 Received: (at 78881) by debbugs.gnu.org; 25 Jun 2025 11:09:09 +0000 Received: from localhost ([127.0.0.1]:60997 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uUO04-0005sp-Ck for submit <at> debbugs.gnu.org; Wed, 25 Jun 2025 07:09:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59818) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uUO00-0005rf-Pm for 78881 <at> debbugs.gnu.org; Wed, 25 Jun 2025 07:09: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 <eliz@HIDDEN>) id 1uUNzv-0003XF-Dv; Wed, 25 Jun 2025 07:08:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=YSJsxACOJ6WYk0D6lPvtdOJeECaInii/wSHKHotogRw=; b=TGMOB9S4NPXclJf9Cv6e ALAAQD5XzzbYWlt8DzHlxz2DA1RqXfvoPk33nFj6GYJhIkkgXZc9qRZ1M+lgVRDLeBvwFtf5qQhIM gkdSkth+Nu5HMMdZIaYIFKdZ/qnbLJeWkE8mU8Qro7ZGf+TphtEYLUPp820SgJ/PAgMGOBabJ//hN IZbNcgHHPy/AZvxZmX9+4oQelyZ0fdWXkdBD5wb9545ZadO+mBdoKD0uh5KlBXbWXYDGYML97M3Tv 11XghLHm9tvqOZpW79GV2wUnSanW2TNvjcLPhnHb/9NHQOuRNftRZQmJSzi1Ii1rw4/TSgbe6qh6v 5kK4P7/HgEMC4Q==; Date: Wed, 25 Jun 2025 14:08:49 +0300 Message-Id: <86bjqcdqny.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <874iw5f4v0.fsf@HIDDEN> (message from Elijah Gabe =?UTF-8?Q?P=C3=A9rez?= on Tue, 24 Jun 2025 11:04:35 -0600) References: <8734bqz2lv.fsf@HIDDEN> <86zfdxe6bw.fsf@HIDDEN> <874iw5f4v0.fsf@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Elijah Gabe Pérez <eg642616@HIDDEN> > Cc: 78881 <at> debbugs.gnu.org > Date: Tue, 24 Jun 2025 11:04:35 -0600 > > > Thanks. I think the idea of a minor mode is better. Our experience > > is that many toggle commands end up being minor modes. One advantage > > of a minor mode is that the ways of turning a mode on/off and toggling > > it are automagically done for you, and they are all uniformly familiar > > to users. > > I agree, but the problem with making this command a minor mode is that > it have to check whether the minor mode variable is non-nil for > display/hide the mode-line (AFAIU), this brings problems because if a > buffer by default does not show the mode line, one would have to execute > the command twice to display it. I don't understand why you'd need to invoke the command twice. > This would also create 2 variables of which I do not see much use: the > minor mode hook and minor mode variable. Isn't that so with every minor mode we have? > >> +--- > >> +*** New command 'toggle-mode-line-visibility'. > >> +This command toggles the mode line visibility in current buffer, if the > >> +current buffer displays a mode line, this will temporally hide it until > >> +'toggle-mode-line-visibility' is called again. Otherwise, if the > >> +current buffer does not have a mode line by default, this will display > >> +one. > > > > This feature must be described in the user manual, so please add the > > necessary changes for that (and mark the NEWS entry with "+++"). > > Sure, but I'm not sure in which section of the manual I must document > it, maybe in "Optional Mode Line Features" from "emacs" manual? Yes, that's the right place. > >> +The mode line is hidden from every major mode change in current buffer. > > > > This sentence confused me. What did you mean to say here? > > e.g. If you call `toggle-mode-line-visibility` in the scratch buffer and > later call `text-mode` in the same buffer, the mode line will become > visible again, which is not convenient since this command is meant to > enable/disable the mode line per buffer, not per major mode. So you want to say this: Changing the major mode will not display the hidden mode line. Or maybe simply remove this part: why would someone assume that another major mode will override this? If they won't expect that, you don't have to explain that it won't happen. > +(define-minor-mode toggle-mode-line-visibility > + "Toggle mode line visibility in current buffer. I don't see why "toggle" should be in the name. How about mode-line-invisible-mode ? or hide-mode-line-mode ? Thanks.
X-Loop: help-debbugs@HIDDEN Subject: bug#78881: [PATCH] New command 'toggle-mode-line-visibility' Resent-From: Elijah Gabe =?UTF-8?Q?P=C3=A9rez?= <eg642616@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Wed, 25 Jun 2025 19:01:05 +0000 Resent-Message-ID: <handler.78881.B78881.17508780525366 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 78881 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii <eliz@HIDDEN> Cc: 78881 <at> debbugs.gnu.org Received: via spool by 78881-submit <at> debbugs.gnu.org id=B78881.17508780525366 (code B ref 78881); Wed, 25 Jun 2025 19:01:05 +0000 Received: (at 78881) by debbugs.gnu.org; 25 Jun 2025 19:00:52 +0000 Received: from localhost ([127.0.0.1]:39490 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uUVMV-0001LS-5A for submit <at> debbugs.gnu.org; Wed, 25 Jun 2025 15:00:51 -0400 Received: from mail-ot1-x341.google.com ([2607:f8b0:4864:20::341]:52464) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <eg642616@HIDDEN>) id 1uUVMS-000146-7V for 78881 <at> debbugs.gnu.org; Wed, 25 Jun 2025 15:00:45 -0400 Received: by mail-ot1-x341.google.com with SMTP id 46e09a7af769-73a9c5ccfcdso64490a34.0 for <78881 <at> debbugs.gnu.org>; Wed, 25 Jun 2025 12:00:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750878038; x=1751482838; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=sfxuq8MFX7XkE9YvUXZX1TVFF/QUWlbNxd60L1qU+nM=; b=SBcOIBQYdyApM4r7KEWE/UDhNbVrP8R83IfqubxrBViCFKQTSzfjKX+R+TWwxBQd25 UFLDVZPbhlOnSFuXAh7CBeOgUeOknrEOgOeB0vgglw53cpiTLHInc3oVEVGiDGFxkaGu Z621j4gG8fQ1/Nnz+/LYgKO1pwECN3p4gyrhYimVYDs8DjEpOxgTL4JH8jjVM1/BS3Mw wZtc+orvwcPCRXg+lvstgzAn+CbAgzSv5HikzcqsNceybUGYwUgHK1eNw3fCKaRFDpsW uhOdFBWlLYo3TwXjmeiyb3kenZO7h0/Yc87r5EBlFYmXWczd9CiuuAmj8iipOgCyiQON Itgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750878038; x=1751482838; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sfxuq8MFX7XkE9YvUXZX1TVFF/QUWlbNxd60L1qU+nM=; b=ZU89YSZJuKn4mC9uLV1RLPfQ/F/LdzWPz02usLpv4nkGflAAJEPlse3GU2gzPDdNgy vXCLu1lh8AVWjVycfC7UwoRSf6h730SbySi8IM5x6O7R1d/yaHbUWMMQzlupz4GDaAcK hbOlJTQmF24oSJ3gOb+Juqf51On4sOIGzl0xjHv0Y+aanwSt+CprJpYEbIXnyGcg5N2H OxAA8LFbjcUIMBmkHQRcHgMhr0rrGDKpb99O1F+cLK2Y8UVenx/x/LTrJfD3ah2v+xnW er1sKDkdUFICmkfTh8GUPgCBmk17n9pl5n5m0ocSM7ZlXwISslRR0VphllqOGFqawwkQ yjoQ== X-Gm-Message-State: AOJu0YwS1Vsu8qg0F8N8N7EpfNsCg49+GyG52l5CdXk0o3a8TAISGC++ GgrGh05xOfGbOyxKYIcPSfgqXJqu7Ci4TPSQfdaOWyk/T1CVQ4fXuheZRDCETLEY X-Gm-Gg: ASbGncuno9joZxL8yNttGPOVhagqsCMVhgzCcpq5PBby1Fwbs28dGTrT4LcdMt69pCg 5p5Y7OrFrLmg4tXoh2LDMb3KQY+MWoP/uS6P/cO5xYLZFrAGnf4299qBYAPRpqR2tOv1xUyUzJe DfUe9hHnMH0FM7hZfmPXNXh+kDSMnUnRshYYQ9D3ieh6wrYHTVVZx7bG4uPdTxA+VrtFMGm80gZ N7hX4g046AMhsIAq8NbsmGDE7XKfhXyeUOzTW7YW26xU06GtDJog23pwmwyxrtoNePkzYUblpys iArEPP/lmM2k4nejrjt6DjlV3fvdBA== X-Google-Smtp-Source: AGHT+IFTsaZQaNZUXspmO1Yme3QX4uhEv8jQdNSahapBwQA0vDyv3QPwu3GY3fAYqFdzt1iqVTNB8A== X-Received: by 2002:a05:6808:1924:b0:401:ea47:2c4a with SMTP id 5614622812f47-40b057fab26mr3634682b6e.28.1750878037374; Wed, 25 Jun 2025 12:00:37 -0700 (PDT) Received: from fedora ([2806:10ae:e:b56a::1]) by smtp.gmail.com with ESMTPSA id 5614622812f47-40ac6c13318sm2289097b6e.10.2025.06.25.12.00.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jun 2025 12:00:36 -0700 (PDT) From: Elijah Gabe =?UTF-8?Q?P=C3=A9rez?= <eg642616@HIDDEN> In-Reply-To: <86bjqcdqny.fsf@HIDDEN> References: <8734bqz2lv.fsf@HIDDEN> <86zfdxe6bw.fsf@HIDDEN> <874iw5f4v0.fsf@HIDDEN> <86bjqcdqny.fsf@HIDDEN> Date: Wed, 25 Jun 2025 13:00:35 -0600 Message-ID: <87y0tflk8c.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.7 (/) --=-=-= Content-Type: text/plain Eli Zaretskii <eliz@HIDDEN> writes: [...] >> >> +The mode line is hidden from every major mode change in current buffer. >> > >> > This sentence confused me. What did you mean to say here? >> >> e.g. If you call `toggle-mode-line-visibility` in the scratch buffer and >> later call `text-mode` in the same buffer, the mode line will become >> visible again, which is not convenient since this command is meant to >> enable/disable the mode line per buffer, not per major mode. > > So you want to say this: > > Changing the major mode will not display the hidden mode line. > > Or maybe simply remove this part: why would someone assume that > another major mode will override this? If they won't expect that, > you don't have to explain that it won't happen. Agree, I've removed that part. >> +(define-minor-mode toggle-mode-line-visibility >> + "Toggle mode line visibility in current buffer. > > I don't see why "toggle" should be in the name. How about > mode-line-invisible-mode ? Fine, I've renamed it to `mode-line-invisible-mode`. > or hide-mode-line-mode ? I would have liked to use that name, but there is already a package that has it. So I prefer to avoid potential bugs due to the name. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-New-command-mode-line-invisible-mode.patch From 01f04d64e1faa5d66fe3fdaf43d4794f8c7985f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616@HIDDEN> Date: Mon, 23 Jun 2025 12:50:28 -0600 Subject: [PATCH] New command 'mode-line-invisible-mode' This new command allows hide the mode line in the current buffer. (Bug#78881) * doc/emacs/display.texi (Optional Mode Line): Document feature. * etc/NEWS: Announce changes. * lisp/bindings.el (mode-line-invisible--buf-state): New buffer local variable. (mode-line-invisible-mode): New minor mode. --- doc/emacs/display.texi | 8 ++++++++ etc/NEWS | 5 +++++ lisp/bindings.el | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index ad496b5b1cd..c3bdf410c70 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1826,6 +1826,14 @@ Optional Mode Line and Emacs will hide some minor mode indicators on the mode line by collapsing them into a single clickable button. +@findex mode-line-invisible-mode + By default, most buffers display a mode line, however not in many +cases the mode line may be useful, you can use the command @kbd{M-x +mode-line-invisible-mode} to hide the mode line in the current buffer, +the mode line remains hidden until this command is called again. To +always hide the mode line when entering to a major mode, add +@code{mode-line-invisible-mode} to a hook @xref{Hooks}. + @node Text Display @section How Text Is Displayed @cindex characters (in text) diff --git a/etc/NEWS b/etc/NEWS index f7aebdf538f..003bad3d2e0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -346,6 +346,11 @@ This option allows changing or removing the delimiters shown around the major mode and list of minor modes in the mode line. The default retains the existing behavior of inserting parentheses. ++++ +*** New minor mode 'mode-line-invisible-mode'. +This command hide temporarily the mode line in current buffer until +'mode-line-invisible-mode' is called again. + ** Tab Bars and Tab Lines --- diff --git a/lisp/bindings.el b/lisp/bindings.el index 8b021a05ce2..007c096edb0 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -56,6 +56,38 @@ mode-line-widen (widen) (force-mode-line-update))) +;; Variable used by `mode-line-invisible-mode' for +;; store mode-line value in current buffer. +(defvar-local mode-line-invisible--buf-state) + +(define-minor-mode mode-line-invisible-mode + "Hide temporarily the mode line in the current buffer. +Hide the mode line in current buffer until this minor mode is called +again." + :global nil + (if mode-line-invisible-mode + (progn + (add-hook 'after-change-major-mode-hook #'mode-line-invisible-mode nil t) + (setq mode-line-invisible--buf-state + (buffer-local-set-state mode-line-format nil))) + + (remove-hook 'after-change-major-mode-hook #'mode-line-invisible-mode t) + + (when mode-line-invisible--buf-state + (setq mode-line-invisible--buf-state + (buffer-local-restore-state mode-line-invisible--buf-state))) + + ;; Display a mode line if buffer does not have one by default + (unless mode-line-format + (setq-local mode-line-format (default-value 'mode-line-format))) + + ;; Update mode line + (when (called-interactively-p 'any) + (force-mode-line-update)))) + +(put 'mode-line-invisible--buf-state 'permanent-local t) +(put 'mode-line-invisible-mode 'permanent-local-hook t) + (defvar mode-line-input-method-map (let ((map (make-sparse-keymap))) (define-key map [mode-line mouse-2] -- 2.49.0 --=-=-= Content-Type: text/plain -- - E.G via GNU Emacs and Org. --=-=-=--
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.