Subject: bug#78881: [PATCH] New command 'toggle-mode-line-visibility'

From: Eli Zaretskii <[email-masked]>
Date: Wed, 25 Jun 2025 14:08:49 +0300

> From: Elijah Gabe Pérez <[email-masked]>
> Cc: [email-masked]
> 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.