unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#53776: Modeline indicator when using define-minor-mode
@ 2022-02-04 11:55 goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-02-04 13:02 ` Stephen Berman
  0 siblings, 1 reply; 19+ messages in thread
From: goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-02-04 11:55 UTC (permalink / raw)
  To: 53776

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

Have been using define-minor-mode and noticed that when setting the modeline indicator,
the text is appended with no space between other modeline indicators. Is this how :lighter
is supposed to work?

(define-minor-mode rich-minor-mode
"This is the docstring."
:lighter "rich"

[-- Attachment #2: Type: text/html, Size: 1170 bytes --]

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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-04 11:55 bug#53776: Modeline indicator when using define-minor-mode goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-02-04 13:02 ` Stephen Berman
  2022-02-04 13:22   ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Berman @ 2022-02-04 13:02 UTC (permalink / raw)
  To: 53776; +Cc: goncholden

On Fri, 04 Feb 2022 11:55:45 +0000 goncholden via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> wrote:

> Have been using define-minor-mode and noticed that when setting the
> modeline indicator, the text is appended with no space between other
> modeline indicators. Is this how :lighter is supposed to work?

Yes, the lack of a space is in the definition of `mode-line-modes':

  `(:propertize ("" minor-mode-alist)

I guess the reason is that you can have multiple minor mode lighters and
providing a space between each would complicate the definition of
`mode-line-modes', so that's the job of the minor mode definition
itself:

> (define-minor-mode rich-minor-mode
> "This is the docstring."
> :lighter "rich"

So you should do this: :lighter " rich"

Steve Berman





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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-04 13:02 ` Stephen Berman
@ 2022-02-04 13:22   ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-02-04 13:35     ` Stephen Berman
  2022-02-05  0:12     ` Phil Sainty
  0 siblings, 2 replies; 19+ messages in thread
From: goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-02-04 13:22 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 53776

------- Original Message -------

On Friday, February 4th, 2022 at 1:02 PM, Stephen Berman <stephen.berman@gmx.net> wrote:

> On Fri, 04 Feb 2022 11:55:45 +0000 goncholden via "Bug reports for GNU Emacs, the Swiss army knife of text editors" bug-gnu-emacs@gnu.org wrote:
>
> > Have been using define-minor-mode and noticed that when setting the
> > modeline indicator, the text is appended with no space between other
> > modeline indicators. Is this how :lighter is supposed to work?
>
> Yes, the lack of a space is in the definition of `mode-line-modes':` (:propertize ("" minor-mode-alist)
>
> I guess the reason is that you can have multiple minor mode lighters and
> providing a space between each would complicate the definition of
> `mode-line-modes', so that's the job of the minor mode definition
> itself:
>
> > (define-minor-mode rich-minor-mode
> >
> > "This is the docstring."
> > :lighter "rich"
>
> So you should do this: :lighter " rich"
>
> Steve Berman

Because one can easily add minor-modes that exceed the mode-line mini-buffer, is there
the capability of making a hierarchical modeline indicator.

e.g.

Emacs-Lisp
company
Outl
Gon -> rich
    -> gudin
    -> cholden












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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-04 13:22   ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-02-04 13:35     ` Stephen Berman
  2022-02-04 14:05       ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-02-06  3:39       ` Michael Heerdegen
  2022-02-05  0:12     ` Phil Sainty
  1 sibling, 2 replies; 19+ messages in thread
From: Stephen Berman @ 2022-02-04 13:35 UTC (permalink / raw)
  To: goncholden; +Cc: 53776

On Fri, 04 Feb 2022 13:22:08 +0000 goncholden <goncholden@protonmail.com> wrote:

> ------- Original Message -------
>
> On Friday, February 4th, 2022 at 1:02 PM, Stephen Berman
> <stephen.berman@gmx.net> wrote:
>
>> On Fri, 04 Feb 2022 11:55:45 +0000 goncholden via "Bug reports for GNU
>> Emacs, the Swiss army knife of text editors" bug-gnu-emacs@gnu.org wrote:
>>
>> > Have been using define-minor-mode and noticed that when setting the
>> > modeline indicator, the text is appended with no space between other
>> > modeline indicators. Is this how :lighter is supposed to work?
>>
>> Yes, the lack of a space is in the definition of `mode-line-modes':`
>> (:propertize ("" minor-mode-alist)
>>
>> I guess the reason is that you can have multiple minor mode lighters and
>> providing a space between each would complicate the definition of
>> `mode-line-modes', so that's the job of the minor mode definition
>> itself:
>>
>> > (define-minor-mode rich-minor-mode
>> >
>> > "This is the docstring."
>> > :lighter "rich"
>>
>> So you should do this: :lighter " rich"
>>
>> Steve Berman
>
> Because one can easily add minor-modes that exceed the mode-line mini-buffer,
> is there
> the capability of making a hierarchical modeline indicator.
>
> e.g.
>
> Emacs-Lisp
> company
> Outl
> Gon -> rich
>     -> gudin
>     -> cholden

That would appear to require a multiline mode line, which is not
possible with the current implementation.  An alternative, which might
be easier to implement (for someone who knows how, not me), would be to
make the mode line horizontally scrollable.  But maybe that's not so
easy, since it seems so obviously useful, yet hasn't been implemented.

Steve Berman





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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-04 13:35     ` Stephen Berman
@ 2022-02-04 14:05       ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-02-04 14:38         ` Stephen Berman
  2022-02-06  3:39       ` Michael Heerdegen
  1 sibling, 1 reply; 19+ messages in thread
From: goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-02-04 14:05 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 53776


------- Original Message -------

On Friday, February 4th, 2022 at 1:35 PM, Stephen Berman <stephen.berman@gmx.net> wrote:

> On Fri, 04 Feb 2022 13:22:08 +0000 goncholden goncholden@protonmail.com wrote:
>
> > ------- Original Message -------
> >
> > On Friday, February 4th, 2022 at 1:02 PM, Stephen Berman
> >
> > stephen.berman@gmx.net wrote:
> >
> > > On Fri, 04 Feb 2022 11:55:45 +0000 goncholden via "Bug reports for GNU
> > >
> > > Emacs, the Swiss army knife of text editors" bug-gnu-emacs@gnu.org wrote:
> > >
> > > > Have been using define-minor-mode and noticed that when setting the
> > > > modeline indicator, the text is appended with no space between other
> > > > modeline indicators. Is this how :lighter is supposed to work?
> > >
> > > Yes, the lack of a space is in the definition of `mode-line-modes':`
> > >
> > > (:propertize ("" minor-mode-alist)
> > >
> > > I guess the reason is that you can have multiple minor mode lighters and
> > > providing a space between each would complicate the definition of
> > > `mode-line-modes', so that's the job of the minor mode definition
> > > itself:
> > >
> > > > (define-minor-mode rich-minor-mode
> > > > "This is the docstring."
> > > > :lighter "rich"
> > >
> > > So you should do this: :lighter " rich"
> > >
> > > Steve Berman
> >
> > Because one can easily add minor-modes that exceed the mode-line mini-buffer,
> > is there
> > the capability of making a hierarchical modeline indicator.
> >
> > e.g.
> >
> > Emacs-Lisp
> > company
> > Outl
> > Gon -> rich
> > -> gudin
> > -> cholden
>
> That would appear to require a multiline mode line, which is not
> possible with the current implementation. An alternative, which might
> be easier to implement (for someone who knows how, not me), would be to
> make the mode line horizontally scrollable. But maybe that's not so
> easy, since it seems so obviously useful, yet hasn't been implemented.

> Steve Berman

Much useful.  Would we be able to include such proposition for emacs?







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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-04 14:05       ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-02-04 14:38         ` Stephen Berman
  2022-02-04 14:43           ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Berman @ 2022-02-04 14:38 UTC (permalink / raw)
  To: goncholden; +Cc: 53776

On Fri, 04 Feb 2022 14:05:58 +0000 goncholden <goncholden@protonmail.com> wrote:

> ------- Original Message -------
>
> On Friday, February 4th, 2022 at 1:35 PM, Stephen Berman
> <stephen.berman@gmx.net> wrote:
>
>> On Fri, 04 Feb 2022 13:22:08 +0000 goncholden goncholden@protonmail.com wrote:
>>
>> > ------- Original Message -------
>> >
>> > On Friday, February 4th, 2022 at 1:02 PM, Stephen Berman
>> >
>> > stephen.berman@gmx.net wrote:
>> >
>> > > On Fri, 04 Feb 2022 11:55:45 +0000 goncholden via "Bug reports for GNU
>> > >
>> > > Emacs, the Swiss army knife of text editors" bug-gnu-emacs@gnu.org wrote:
>> > >
>> > > > Have been using define-minor-mode and noticed that when setting the
>> > > > modeline indicator, the text is appended with no space between other
>> > > > modeline indicators. Is this how :lighter is supposed to work?
>> > >
>> > > Yes, the lack of a space is in the definition of `mode-line-modes':`
>> > >
>> > > (:propertize ("" minor-mode-alist)
>> > >
>> > > I guess the reason is that you can have multiple minor mode lighters and
>> > > providing a space between each would complicate the definition of
>> > > `mode-line-modes', so that's the job of the minor mode definition
>> > > itself:
>> > >
>> > > > (define-minor-mode rich-minor-mode
>> > > > "This is the docstring."
>> > > > :lighter "rich"
>> > >
>> > > So you should do this: :lighter " rich"
>> > >
>> > > Steve Berman
>> >
>> > Because one can easily add minor-modes that exceed the mode-line mini-buffer,
>> > is there
>> > the capability of making a hierarchical modeline indicator.
>> >
>> > e.g.
>> >
>> > Emacs-Lisp
>> > company
>> > Outl
>> > Gon -> rich
>> > -> gudin
>> > -> cholden
>>
>> That would appear to require a multiline mode line, which is not
>> possible with the current implementation. An alternative, which might
>> be easier to implement (for someone who knows how, not me), would be to
>> make the mode line horizontally scrollable. But maybe that's not so
>> easy, since it seems so obviously useful, yet hasn't been implemented.
>
>> Steve Berman
>
> Much useful.  Would we be able to include such proposition for emacs?

It could certainly be a feature request.  In fact, maybe this bug report
can be repurposed as such as request, since the lack of a space in the
minor mode lighter isn't a bug per se.

Steve Berman





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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-04 14:38         ` Stephen Berman
@ 2022-02-04 14:43           ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-02-04 14:49             ` Stephen Berman
  0 siblings, 1 reply; 19+ messages in thread
From: goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-02-04 14:43 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 53776


------- Original Message -------

On Friday, February 4th, 2022 at 2:38 PM, Stephen Berman <stephen.berman@gmx.net> wrote:

> On Fri, 04 Feb 2022 14:05:58 +0000 goncholden goncholden@protonmail.com wrote:
> > ------- Original Message -------
> >
> > On Friday, February 4th, 2022 at 1:35 PM, Stephen Berman
> > stephen.berman@gmx.net wrote:
> >
> > > On Fri, 04 Feb 2022 13:22:08 +0000 goncholden goncholden@protonmail.com wrote:
> > > > ------- Original Message -------
> > > >
> > > > On Friday, February 4th, 2022 at 1:02 PM, Stephen Berman
> > > > stephen.berman@gmx.net wrote:
> > > > > On Fri, 04 Feb 2022 11:55:45 +0000 goncholden via "Bug reports for GNU
> > > > > Emacs, the Swiss army knife of text editors" bug-gnu-emacs@gnu.org wrote:
> > > > >
> > > > > > Have been using define-minor-mode and noticed that when setting the
> > > > > > modeline indicator, the text is appended with no space between other
> > > > > > modeline indicators. Is this how :lighter is supposed to work?
> > > > >
> > > > > Yes, the lack of a space is in the definition of `mode-line-modes':`
> > > > > (:propertize ("" minor-mode-alist)
> > > > > I guess the reason is that you can have multiple minor mode lighters and
> > > > > providing a space between each would complicate the definition of
> > > > > `mode-line-modes', so that's the job of the minor mode definition
> > > > > itself:
> > > > >
> > > > > > (define-minor-mode rich-minor-mode
> > > > > > "This is the docstring."
> > > > > > :lighter "rich"

> > > > > So you should do this: :lighter " rich"
> > > > >
> > > > > Steve Berman
> > > >
> > > > Because one can easily add minor-modes that exceed the mode-line mini-buffer,
> > > > is there any capability of making a hierarchical modeline indicator.
> > > >
> > > > e.g.
> > > >
> > > > Emacs-Lisp
> > > > company
> > > > Outl
> > > > Gon -> rich
> > > > -> gudin
> > > > -> cholden
> > >
> > > That would appear to require a multiline mode line, which is not
> > > possible with the current implementation. An alternative, which might
> > > be easier to implement (for someone who knows how, not me), would be to
> > > make the mode line horizontally scrollable. But maybe that's not so
> > > easy, since it seems so obviously useful, yet hasn't been implemented.
> >
> > > Steve Berman
> >
> > Much useful. Would we be able to include such proposition for emacs?
>
> It could certainly be a feature request. In fact, maybe this bug report
> can be repurposed as such as request, since the lack of a space in the
> minor mode lighter isn't a bug per se.
>
> Steve Berman

Anything I need to do on my part?







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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-04 14:43           ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-02-04 14:49             ` Stephen Berman
  2022-02-05  6:45               ` Lars Ingebrigtsen
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Berman @ 2022-02-04 14:49 UTC (permalink / raw)
  To: goncholden; +Cc: 53776

On Fri, 04 Feb 2022 14:43:14 +0000 goncholden <goncholden@protonmail.com> wrote:

> ------- Original Message -------
>
> On Friday, February 4th, 2022 at 2:38 PM, Stephen Berman
> <stephen.berman@gmx.net> wrote:
>
>> On Fri, 04 Feb 2022 14:05:58 +0000 goncholden goncholden@protonmail.com wrote:
>> > ------- Original Message -------
>> >
>> > On Friday, February 4th, 2022 at 1:35 PM, Stephen Berman
>> > stephen.berman@gmx.net wrote:
>> >
>> > > On Fri, 04 Feb 2022 13:22:08 +0000 goncholden goncholden@protonmail.com wrote:
>> > > > ------- Original Message -------
>> > > >
>> > > > On Friday, February 4th, 2022 at 1:02 PM, Stephen Berman
>> > > > stephen.berman@gmx.net wrote:
>> > > > > On Fri, 04 Feb 2022 11:55:45 +0000 goncholden via "Bug reports for GNU
>> > > > > Emacs, the Swiss army knife of text editors" bug-gnu-emacs@gnu.org wrote:
>> > > > >
>> > > > > > Have been using define-minor-mode and noticed that when setting the
>> > > > > > modeline indicator, the text is appended with no space between other
>> > > > > > modeline indicators. Is this how :lighter is supposed to work?
>> > > > >
>> > > > > Yes, the lack of a space is in the definition of `mode-line-modes':`
>> > > > > (:propertize ("" minor-mode-alist)
>> > > > > I guess the reason is that you can have multiple minor mode lighters and
>> > > > > providing a space between each would complicate the definition of
>> > > > > `mode-line-modes', so that's the job of the minor mode definition
>> > > > > itself:
>> > > > >
>> > > > > > (define-minor-mode rich-minor-mode
>> > > > > > "This is the docstring."
>> > > > > > :lighter "rich"
>
>> > > > > So you should do this: :lighter " rich"
>> > > > >
>> > > > > Steve Berman
>> > > >
>> > > > Because one can easily add minor-modes that exceed the mode-line mini-buffer,
>> > > > is there any capability of making a hierarchical modeline indicator.
>> > > >
>> > > > e.g.
>> > > >
>> > > > Emacs-Lisp
>> > > > company
>> > > > Outl
>> > > > Gon -> rich
>> > > > -> gudin
>> > > > -> cholden
>> > >
>> > > That would appear to require a multiline mode line, which is not
>> > > possible with the current implementation. An alternative, which might
>> > > be easier to implement (for someone who knows how, not me), would be to
>> > > make the mode line horizontally scrollable. But maybe that's not so
>> > > easy, since it seems so obviously useful, yet hasn't been implemented.
>> >
>> > > Steve Berman
>> >
>> > Much useful. Would we be able to include such proposition for emacs?
>>
>> It could certainly be a feature request. In fact, maybe this bug report
>> can be repurposed as such as request, since the lack of a space in the
>> minor mode lighter isn't a bug per se.
>>
>> Steve Berman
>
> Anything I need to do on my part?

Maybe this issue should be retitled, but let's wait and see if the
maintainers react, maybe they'll prefer making a separate feature
request.

Steve Berman





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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-04 13:22   ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-02-04 13:35     ` Stephen Berman
@ 2022-02-05  0:12     ` Phil Sainty
  1 sibling, 0 replies; 19+ messages in thread
From: Phil Sainty @ 2022-02-05  0:12 UTC (permalink / raw)
  To: goncholden; +Cc: 53776, Stephen Berman

On 2022-02-05 02:22, goncholden wrote:
> Because one can easily add minor-modes that exceed the mode-line
> mini-buffer, is there
> the capability of making a hierarchical modeline indicator.
> 
> e.g.
> 
> Emacs-Lisp
> company
> Outl
> Gon -> rich
>     -> gudin
>     -> cholden

I've not seen anything which looks like your example, however there
are several libraries available which are designed to reclaim space
in the mode-line by manipulating the appearance of the minor mode
lighter text and/or major mode names.

https://github.com/tarsius/minions turns the minor mode list into
a menu, if you do want a (usually hidden) vertical listing.

If you just want to rename (or hide) certain names, take a look at
https://www.emacswiki.org/emacs/DelightedModes (or alternatively
blackout.el, dim.el, or diminish.el, which are all similar).

https://github.com/Malabarba/rich-minority is an approach which
lets you target rendered lighters with regexps, and modify them
using text properties.

I haven't seen anything "hierarchical" (but then minor modes have
no inherent hierarchy), however you could fake it to some extent by
using conditional elements in your mode-line constructs to combine
multiple lighters into a single multi-mode lighter.  For example:
https://stackoverflow.com/questions/23944477/emacs-how-to-consolidate-lighters-for-minor-modes


-Phil






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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-04 14:49             ` Stephen Berman
@ 2022-02-05  6:45               ` Lars Ingebrigtsen
  0 siblings, 0 replies; 19+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-05  6:45 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 53776, goncholden

Stephen Berman <stephen.berman@gmx.net> writes:

> Maybe this issue should be retitled, but let's wait and see if the
> maintainers react, maybe they'll prefer making a separate feature
> request.

As has been pointed out, there's many packages that do various minor
mode lighter handling, so I don't think there's much to be done on the
Emacs side?  So I'm therefore closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-04 13:35     ` Stephen Berman
  2022-02-04 14:05       ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-02-06  3:39       ` Michael Heerdegen
  2022-02-06 12:52         ` Stephen Berman
  2022-02-06 17:12         ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 2 replies; 19+ messages in thread
From: Michael Heerdegen @ 2022-02-06  3:39 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 53776, goncholden

Stephen Berman <stephen.berman@gmx.net> writes:

> > Because one can easily add minor-modes that exceed the mode-line
> > mini-buffer,
> > is there
> > the capability of making a hierarchical modeline indicator.
> >
> > e.g.
> >
> > Emacs-Lisp
> > company
> > Outl
> > Gon -> rich
> >     -> gudin
> >     -> cholden
>
> That would appear to require a multiline mode line, which is not
> possible with the current implementation.

Maybe goncholden wants to visualize alternative "submodes".  That's
possible: the :lighter can be any modeline construct so you can do
anything here the modeline supports, e.g. using :eval.  See the
definition of `emacs-lock-mode' for an example.

> An alternative, which might be easier to implement (for someone who
> knows how, not me), would be to make the mode line horizontally
> scrollable.  But maybe that's not so easy, since it seems so obviously
> useful, yet hasn't been implemented.

It's not hard to achieve, no.  But it replaces something that is too
crowded to be useful with something scrollable that is too crowded to be
useful.  I tried it once and was very disappointed - a modeline you need
to scroll to see everything is worse than using a help command like C-h
m.

There are better alternatives: The more you use Emacs, the more the
minor modes you use don't change any more.  Better choose one of the
available ways to make the mode indicator less longish in appearance.

Michael.





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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-06  3:39       ` Michael Heerdegen
@ 2022-02-06 12:52         ` Stephen Berman
  2022-02-06 21:52           ` Michael Heerdegen
  2022-02-06 17:12         ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 19+ messages in thread
From: Stephen Berman @ 2022-02-06 12:52 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 53776, goncholden

On Sun, 06 Feb 2022 04:39:54 +0100 Michael Heerdegen <michael_heerdegen@web.de> wrote:

> Stephen Berman <stephen.berman@gmx.net> writes:
[...]
> Maybe goncholden wants to visualize alternative "submodes".  That's
> possible: the :lighter can be any modeline construct so you can do
> anything here the modeline supports, e.g. using :eval.  See the
> definition of `emacs-lock-mode' for an example.
>
>> An alternative, which might be easier to implement (for someone who
>> knows how, not me), would be to make the mode line horizontally
>> scrollable.  But maybe that's not so easy, since it seems so obviously
>> useful, yet hasn't been implemented.
>
> It's not hard to achieve, no.  But it replaces something that is too
> crowded to be useful with something scrollable that is too crowded to be
> useful.  I tried it once and was very disappointed - a modeline you need
> to scroll to see everything is worse than using a help command like C-h
> m.

Nevertheless, I would be interested in trying it and seeing the code.
Can you post it?

Thanks,

Steve Berman





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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-06  3:39       ` Michael Heerdegen
  2022-02-06 12:52         ` Stephen Berman
@ 2022-02-06 17:12         ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 19+ messages in thread
From: goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-02-06 17:12 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 53776, Stephen Berman


------- Original Message -------

On Sunday, February 6th, 2022 at 3:39 AM, Michael Heerdegen <michael_heerdegen@web.de> wrote:

> Stephen Berman stephen.berman@gmx.net writes:
>
> > > Because one can easily add minor-modes that exceed the mode-line
> > > mini-buffer,
> > > is there
> > > the capability of making a hierarchical modeline indicator.

> > > e.g.
> > > Emacs-Lisp
> > > company
> > > Outl
> > > Gon -> rich
> > > -> gudin
> > > -> cholden
> >
> > That would appear to require a multiline mode line, which is not
> > possible with the current implementation.
>
> Maybe goncholden wants to visualize alternative "submodes". That's
> possible: the :lighter can be any modeline construct so you can do
> anything here the modeline supports, e.g. using :eval. See the
> definition of `emacs-lock-mode' for an example.

It is quite easy to have many minor-modes, and would be good to see them categorised,
perhaps in some kind of menu.  Been directed to minions, but would be great if emacs
has such functionality built-in.  I am ending with too many minor-modes being activated.

> > An alternative, which might be easier to implement (for someone who
> > knows how, not me), would be to make the mode line horizontally
> > scrollable. But maybe that's not so easy, since it seems so obviously
> > useful, yet hasn't been implemented.
>
> It's not hard to achieve, no. But it replaces something that is too
> crowded to be useful with something scrollable that is too crowded to be
> useful. I tried it once and was very disappointed - a modeline you need
> to scroll to see everything is worse than using a help command like C-h
> m.
>
> There are better alternatives: The more you use Emacs, the more the
> minor modes you use don't change any more. Better choose one of the
> available ways to make the mode indicator less longish in appearance.
>
> Michael.





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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-06 12:52         ` Stephen Berman
@ 2022-02-06 21:52           ` Michael Heerdegen
  2022-02-06 23:13             ` Stephen Berman
  0 siblings, 1 reply; 19+ messages in thread
From: Michael Heerdegen @ 2022-02-06 21:52 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 53776, goncholden

Stephen Berman <stephen.berman@gmx.net> writes:

> Nevertheless, I would be interested in trying it and seeing the code.
> Can you post it?

I don't have it any more.  The basic idea was like

#+begin_src emacs-lisp
(defvar ml-scroll-amnt 0)

(setq-default
 mode-line-format
 `(:eval (substring (format-mode-line ',mode-line-format)
                    ml-scroll-amnt)))
#+end_src

and let mouse-4 and mouse-5 over the mode-line de- and increase
`ml-scroll-amnt'.  That's all.

Be careful when the variable binding of `mode-line-format' changes - the
above hack won't survive that, so when a certain mode redefines
`mode-line-format' (with other words: doesn't use the default value,
like Gnus), you need to do the above after the variable has been set.

Michael.





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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-06 21:52           ` Michael Heerdegen
@ 2022-02-06 23:13             ` Stephen Berman
  2022-02-06 23:59               ` Michael Heerdegen
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Berman @ 2022-02-06 23:13 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 53776, goncholden

On Sun, 06 Feb 2022 22:52:13 +0100 Michael Heerdegen <michael_heerdegen@web.de> wrote:

> Stephen Berman <stephen.berman@gmx.net> writes:
>
>> Nevertheless, I would be interested in trying it and seeing the code.
>> Can you post it?
>
> I don't have it any more.  The basic idea was like
>
> #+begin_src emacs-lisp
> (defvar ml-scroll-amnt 0)
>
> (setq-default
>  mode-line-format
>  `(:eval (substring (format-mode-line ',mode-line-format)
>                     ml-scroll-amnt)))
> #+end_src
>
> and let mouse-4 and mouse-5 over the mode-line de- and increase
> `ml-scroll-amnt'.  That's all.

Thanks, but doesn't this just truncate the mode-line-string
continuously?  For scrolling back, it seems necessary to store the
original mode-line-string and concatenate the previously truncated part
of it with the current value.

> Be careful when the variable binding of `mode-line-format' changes - the
> above hack won't survive that, so when a certain mode redefines
> `mode-line-format' (with other words: doesn't use the default value,
> like Gnus), you need to do the above after the variable has been set.

What I had in mind was something like using auto-hscroll-mode on the
mode line, or making it into something like a horizontal scroll bar.
Either of these, if possible at all, requires changes in the C code.

Steve Berman





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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-06 23:13             ` Stephen Berman
@ 2022-02-06 23:59               ` Michael Heerdegen
  2022-02-07  0:28                 ` Stephen Berman
  0 siblings, 1 reply; 19+ messages in thread
From: Michael Heerdegen @ 2022-02-06 23:59 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 53776, goncholden

Stephen Berman <stephen.berman@gmx.net> writes:

> > #+begin_src emacs-lisp
> > (defvar ml-scroll-amnt 0)
> >
> > (setq-default
> >  mode-line-format
> >  `(:eval (substring (format-mode-line ',mode-line-format)
> >                     ml-scroll-amnt)))
> > #+end_src
> >
> > and let mouse-4 and mouse-5 over the mode-line de- and increase
> > `ml-scroll-amnt'.  That's all.
>
> Thanks, but doesn't this just truncate the mode-line-string
> continuously?  For scrolling back, it seems necessary to store the
> original mode-line-string and concatenate the previously truncated part
> of it with the current value.

No, you just have to change the value of `ml-scroll-amnt'.  Try it.
That piece of code doesn't work as you describe.

Michael.





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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-06 23:59               ` Michael Heerdegen
@ 2022-02-07  0:28                 ` Stephen Berman
  2022-02-07  0:51                   ` Michael Heerdegen
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Berman @ 2022-02-07  0:28 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 53776, goncholden

On Mon, 07 Feb 2022 00:59:31 +0100 Michael Heerdegen <michael_heerdegen@web.de> wrote:

> Stephen Berman <stephen.berman@gmx.net> writes:
>
>> > #+begin_src emacs-lisp
>> > (defvar ml-scroll-amnt 0)
>> >
>> > (setq-default
>> >  mode-line-format
>> >  `(:eval (substring (format-mode-line ',mode-line-format)
>> >                     ml-scroll-amnt)))
>> > #+end_src
>> >
>> > and let mouse-4 and mouse-5 over the mode-line de- and increase
>> > `ml-scroll-amnt'.  That's all.
>>
>> Thanks, but doesn't this just truncate the mode-line-string
>> continuously?  For scrolling back, it seems necessary to store the
>> original mode-line-string and concatenate the previously truncated part
>> of it with the current value.
>
> No, you just have to change the value of `ml-scroll-amnt'.  Try it.
> That piece of code doesn't work as you describe.

Since I don't have mouse-4 and mouse-5, I just tried evaluating that
sexp with integral values (1, 0, -1) for ml-scroll-amnt, and only got
truncation.  Maybe I don't understand what you mean by "let mouse-4 and
mouse-5 over the mode-line de- and increase `ml-scroll-amnt'".  Can you
show me bindings I can try with a 3-button mouse, or just with the
keyboard?

Steve Berman





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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-07  0:28                 ` Stephen Berman
@ 2022-02-07  0:51                   ` Michael Heerdegen
  2022-02-07 22:40                     ` Stephen Berman
  0 siblings, 1 reply; 19+ messages in thread
From: Michael Heerdegen @ 2022-02-07  0:51 UTC (permalink / raw)
  To: Stephen Berman; +Cc: 53776, goncholden

Stephen Berman <stephen.berman@gmx.net> writes:

> Since I don't have mouse-4 and mouse-5

These are the "keys" associated with the mouse wheel.  In case you want
to scroll with the mouse wheel.

> I just tried evaluating that sexp with integral values (1, 0, -1) for
>ml-scroll-amnt, and only got truncation.  Maybe I don't understand what
>you mean by "let mouse-4 and mouse-5 over the mode-line de- and
>increase `ml-scroll-amnt'".  Can you show me bindings I can try with a
>3-button mouse, or just with the keyboard?

I dunno how you want to scroll.  Drag with mouse-1, scroll with a wheel
or a key, something else?

The code

#+begin_src emacs-lisp
(defvar ml-scroll-amnt 0)

(setq-default
 mode-line-format
 `(:eval (substring (format-mode-line ',mode-line-format)
                    ml-scroll-amnt)))
#+end_src

has to be evaluated once.  Mode-line looks like before.

(setq ml-scroll-amnt 3) scrolls the mode-line three chars to the left.
(setq ml-scroll-amnt 0) to scroll back.  Changing `ml-scroll-amnt'
changes the scroll amount.

How you implement changing the binding of `ml-scroll-amnt' is up to you,
depends on how you want it to be.

Scrolling to the right would only prepend space to the beginning, so I
didn't handle negative `ml-scroll-amnt' values.

Michael.





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

* bug#53776: Modeline indicator when using define-minor-mode
  2022-02-07  0:51                   ` Michael Heerdegen
@ 2022-02-07 22:40                     ` Stephen Berman
  0 siblings, 0 replies; 19+ messages in thread
From: Stephen Berman @ 2022-02-07 22:40 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 53776, goncholden

On Mon, 07 Feb 2022 01:51:25 +0100 Michael Heerdegen <michael_heerdegen@web.de> wrote:

> Stephen Berman <stephen.berman@gmx.net> writes:
>
>> Since I don't have mouse-4 and mouse-5
>
> These are the "keys" associated with the mouse wheel.  In case you want
> to scroll with the mouse wheel.

Ah, ok.

>> I just tried evaluating that sexp with integral values (1, 0, -1) for
>>ml-scroll-amnt, and only got truncation.  Maybe I don't understand what
>>you mean by "let mouse-4 and mouse-5 over the mode-line de- and
>>increase `ml-scroll-amnt'".  Can you show me bindings I can try with a
>>3-button mouse, or just with the keyboard?
>
> I dunno how you want to scroll.  Drag with mouse-1, scroll with a wheel
> or a key, something else?
>
> The code
>
> #+begin_src emacs-lisp
> (defvar ml-scroll-amnt 0)
>
> (setq-default
>  mode-line-format
>  `(:eval (substring (format-mode-line ',mode-line-format)
>                     ml-scroll-amnt)))
> #+end_src
>
> has to be evaluated once.  Mode-line looks like before.
>
> (setq ml-scroll-amnt 3) scrolls the mode-line three chars to the left.
> (setq ml-scroll-amnt 0) to scroll back.  Changing `ml-scroll-amnt'
> changes the scroll amount.
>
> How you implement changing the binding of `ml-scroll-amnt' is up to you,
> depends on how you want it to be.

Ok.  When I have more time to spend on this, I'll try to do it.

Steve Berman





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

end of thread, other threads:[~2022-02-07 22:40 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-04 11:55 bug#53776: Modeline indicator when using define-minor-mode goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-04 13:02 ` Stephen Berman
2022-02-04 13:22   ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-04 13:35     ` Stephen Berman
2022-02-04 14:05       ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-04 14:38         ` Stephen Berman
2022-02-04 14:43           ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-04 14:49             ` Stephen Berman
2022-02-05  6:45               ` Lars Ingebrigtsen
2022-02-06  3:39       ` Michael Heerdegen
2022-02-06 12:52         ` Stephen Berman
2022-02-06 21:52           ` Michael Heerdegen
2022-02-06 23:13             ` Stephen Berman
2022-02-06 23:59               ` Michael Heerdegen
2022-02-07  0:28                 ` Stephen Berman
2022-02-07  0:51                   ` Michael Heerdegen
2022-02-07 22:40                     ` Stephen Berman
2022-02-06 17:12         ` goncholden via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-05  0:12     ` Phil Sainty

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).