all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
@ 2023-06-13 14:33 Ihor Radchenko
  2023-06-13 15:50 ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Ihor Radchenko @ 2023-06-13 14:33 UTC (permalink / raw)
  To: 64048

Hi,

global-display-line-numbers-mode is defined as

(define-globalized-minor-mode global-display-line-numbers-mode
  display-line-numbers-mode display-line-numbers--turn-on)

Which unconditionally enables it when `display-line-numbers--turn-on'
returns t.

Wouldn't it be nicer to have something like

(define-globalized-minor-mode global-display-line-numbers-mode
  display-line-numbers-mode display-line-numbers--turn-on
  :predicate #'display-line-numbers--turn-on)

that will also define `display-line-numbers-modes' variable that
controls where the global mode is enabled/disabled?

Maybe it should even be the default in `define-globalized-minor-mode'
when :predicate is not defined.

WDYT?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





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

* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
  2023-06-13 14:33 bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled Ihor Radchenko
@ 2023-06-13 15:50 ` Eli Zaretskii
  2023-06-13 16:09   ` Ihor Radchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2023-06-13 15:50 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 64048

> From: Ihor Radchenko <yantar92@posteo.net>
> Date: Tue, 13 Jun 2023 14:33:39 +0000
> 
> global-display-line-numbers-mode is defined as
> 
> (define-globalized-minor-mode global-display-line-numbers-mode
>   display-line-numbers-mode display-line-numbers--turn-on)
> 
> Which unconditionally enables it when `display-line-numbers--turn-on'
> returns t.
> 
> Wouldn't it be nicer to have something like
> 
> (define-globalized-minor-mode global-display-line-numbers-mode
>   display-line-numbers-mode display-line-numbers--turn-on
>   :predicate #'display-line-numbers--turn-on)
> 
> that will also define `display-line-numbers-modes' variable that
> controls where the global mode is enabled/disabled?
> 
> Maybe it should even be the default in `define-globalized-minor-mode'
> when :predicate is not defined.
> 
> WDYT?

I think it's too late for such changes, because it will definitely
break someone's setup.





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

* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
  2023-06-13 15:50 ` Eli Zaretskii
@ 2023-06-13 16:09   ` Ihor Radchenko
  2023-06-13 16:49     ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Ihor Radchenko @ 2023-06-13 16:09 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64048

Eli Zaretskii <eliz@gnu.org> writes:

>> that will also define `display-line-numbers-modes' variable that
>> controls where the global mode is enabled/disabled?
>> 
>> Maybe it should even be the default in `define-globalized-minor-mode'
>> when :predicate is not defined.
>
> I think it's too late for such changes, because it will definitely
> break someone's setup.

May you please elaborate?

IMHO, the only way honouring `global-foo-modes' variable will break
someone's setup is when somebody sets `global-foo-modes' (which has no
effect now) and expects that there will be no effect in future as well.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





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

* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
  2023-06-13 16:09   ` Ihor Radchenko
@ 2023-06-13 16:49     ` Eli Zaretskii
  2023-06-13 17:21       ` Ihor Radchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2023-06-13 16:49 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 64048

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: 64048@debbugs.gnu.org
> Date: Tue, 13 Jun 2023 16:09:30 +0000
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> that will also define `display-line-numbers-modes' variable that
> >> controls where the global mode is enabled/disabled?
> >> 
> >> Maybe it should even be the default in `define-globalized-minor-mode'
> >> when :predicate is not defined.
> >
> > I think it's too late for such changes, because it will definitely
> > break someone's setup.
> 
> May you please elaborate?
> 
> IMHO, the only way honouring `global-foo-modes' variable will break
> someone's setup is when somebody sets `global-foo-modes' (which has no
> effect now) and expects that there will be no effect in future as well.

I have enough gray hair to know that any such changes break something.

This mode has been with us since Emacs 26, so we cannot make such
changes after so much time.  Especially since the problem, if there is
a problem, is minor at best.

Sorry.





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

* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
  2023-06-13 16:49     ` Eli Zaretskii
@ 2023-06-13 17:21       ` Ihor Radchenko
  2023-06-13 18:19         ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Ihor Radchenko @ 2023-06-13 17:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64048

Eli Zaretskii <eliz@gnu.org> writes:

>> May you please elaborate?
>> 
>> IMHO, the only way honouring `global-foo-modes' variable will break
>> someone's setup is when somebody sets `global-foo-modes' (which has no
>> effect now) and expects that there will be no effect in future as well.
>
> I have enough gray hair to know that any such changes break something.
>
> This mode has been with us since Emacs 26, so we cannot make such
> changes after so much time.

May I rephrase is as a feature request then?
Like, please add `global-*-modes' customization for modes defined via `define-globalized-minor-mode'?
Or, at least, add `global-display-line-numbers-modes' customization?

I see not how adding a new feature can break anything here.
If a normal minor mode is made into global, it is a given that it can be
activated independently in arbitrary number of buffers. So, extra
predicate (in addition to the mode's own) should not create any problem.

> ...  Especially since the problem, if there is
> a problem, is minor at best.

I recall multiple occasions when I tried hard to disable a global mode
in some buffers, remembered that there is some special variable for it;
just to find out that a specific global minor mode does not support it.

And then we have non-standard variables like
`dabbrev-ignored-buffer-modes', `hi-lock-exclude-modes',
`which-func-modes' - all with different conventions.

I can also tell you that a question about disabling global minor modes
in some buffers re-surfaces regularly in reddit discussions and IRC.

We even have FAQ entries like https://www.emacswiki.org/emacs/LineNumbers#h5o-10
And the suggested solution is re-defunning "turn-on" function - do we
really want to say that it is the way to go?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





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

* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
  2023-06-13 17:21       ` Ihor Radchenko
@ 2023-06-13 18:19         ` Eli Zaretskii
  2023-06-13 19:36           ` Ihor Radchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2023-06-13 18:19 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 64048

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: 64048@debbugs.gnu.org
> Date: Tue, 13 Jun 2023 17:21:30 +0000
> 
> May I rephrase is as a feature request then?
> Like, please add `global-*-modes' customization for modes defined via `define-globalized-minor-mode'?
> Or, at least, add `global-display-line-numbers-modes' customization?

I'm not against such a feature, not at all.  My objection was only to
the particular implementation that you suggested: we cannot suddenly
add a :predicate to a global mode where previously there wasn't one.
People who activate this global mode expect it to be active
everywhere, no questions asked.

> I recall multiple occasions when I tried hard to disable a global mode
> in some buffers, remembered that there is some special variable for it;
> just to find out that a specific global minor mode does not support it.

The usual way of enabling a mode selectively is to enable the
non-global variant of the mode in a mode hook.  I'm sure you know it.

> And then we have non-standard variables like
> `dabbrev-ignored-buffer-modes', `hi-lock-exclude-modes',
> `which-func-modes' - all with different conventions.
> 
> I can also tell you that a question about disabling global minor modes
> in some buffers re-surfaces regularly in reddit discussions and IRC.
> 
> We even have FAQ entries like https://www.emacswiki.org/emacs/LineNumbers#h5o-10
> And the suggested solution is re-defunning "turn-on" function - do we
> really want to say that it is the way to go?

You are preaching to the choir, really.  There's nothing wrong with
using :predicate when introducing a new globalized minor mode.  I only
objected to doing that in a mode that exists for such a long time
without any conditions.

(Btw, I don't think I understand the use of :predicate which you
proposed: it isn't documented as accepting a function, only nil, t, or
a list of modes.)





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

* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
  2023-06-13 18:19         ` Eli Zaretskii
@ 2023-06-13 19:36           ` Ihor Radchenko
  2023-06-14 11:58             ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Ihor Radchenko @ 2023-06-13 19:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64048

Eli Zaretskii <eliz@gnu.org> writes:

>> May I rephrase is as a feature request then?
>> Like, please add `global-*-modes' customization for modes defined via `define-globalized-minor-mode'?
>> Or, at least, add `global-display-line-numbers-modes' customization?
>
> I'm not against such a feature, not at all.  My objection was only to
> the particular implementation that you suggested: we cannot suddenly
> add a :predicate to a global mode where previously there wasn't one.
> People who activate this global mode expect it to be active
> everywhere, no questions asked.

> (Btw, I don't think I understand the use of :predicate which you
> proposed: it isn't documented as accepting a function, only nil, t, or
> a list of modes.)

Hmm. You are right, I did not look far enough into the code.

Let me correct my initial suggestion:

(define-globalized-minor-mode global-display-line-numbers-mode
  display-line-numbers-mode display-line-numbers--turn-on
  :predicate t)

:predicate defines the default value of
`global-display-line-numbers-modes' variable.

The above code will not change the existing behaviour, except that
`global-display-line-numbers-modes' will be accounted for, iff
customized by the user.

>> I recall multiple occasions when I tried hard to disable a global mode
>> in some buffers, remembered that there is some special variable for it;
>> just to find out that a specific global minor mode does not support it.
>
> The usual way of enabling a mode selectively is to enable the
> non-global variant of the mode in a mode hook.  I'm sure you know it.

The use case I am talking about is enabling minor mode everywhere,
except certain major modes. It is more tricky.

One can, of course, disable the minor mode selectively in some major
modes from that major mode hooks, but it is surprisingly non-obvious
approach.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





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

* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
  2023-06-13 19:36           ` Ihor Radchenko
@ 2023-06-14 11:58             ` Eli Zaretskii
  2023-06-14 12:48               ` Ihor Radchenko
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2023-06-14 11:58 UTC (permalink / raw)
  To: Ihor Radchenko, Stefan Monnier; +Cc: 64048

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: 64048@debbugs.gnu.org
> Date: Tue, 13 Jun 2023 19:36:14 +0000
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > (Btw, I don't think I understand the use of :predicate which you
> > proposed: it isn't documented as accepting a function, only nil, t, or
> > a list of modes.)
> 
> Hmm. You are right, I did not look far enough into the code.
> 
> Let me correct my initial suggestion:
> 
> (define-globalized-minor-mode global-display-line-numbers-mode
>   display-line-numbers-mode display-line-numbers--turn-on
>   :predicate t)

This change is probably harmless, but OTOH what does it give you that
the current code doesn't?  AFAIU, you still cannot customize the modes
where line numbers will be off.

IOW, :predicate is not a means for user customizations of the modes
where the minor mode will be turned on.  Or am I missing something?

> :predicate defines the default value of
> `global-display-line-numbers-modes' variable.

It does?  Where is this documented?

> The above code will not change the existing behaviour, except that
> `global-display-line-numbers-modes' will be accounted for, iff
> customized by the user.

Is this behavior documented anywhere?  What I see in the docs (both
the doc string and the ELisp manual) is that the argument of
:predicate determines _statically_ which modes will activate the minor
mode.  The variable created by :predicate can be used to query Emacs
which modes are those, but cannot be used to change which modes do and
which don't.

If this is not what happens, we have a major mis-documentation on our
hands.

> >> I recall multiple occasions when I tried hard to disable a global mode
> >> in some buffers, remembered that there is some special variable for it;
> >> just to find out that a specific global minor mode does not support it.
> >
> > The usual way of enabling a mode selectively is to enable the
> > non-global variant of the mode in a mode hook.  I'm sure you know it.
> 
> The use case I am talking about is enabling minor mode everywhere,
> except certain major modes. It is more tricky.
> 
> One can, of course, disable the minor mode selectively in some major
> modes from that major mode hooks, but it is surprisingly non-obvious
> approach.

You can either disable it selectively (which is very obvious to me,
FWIW), or you can selectively enable it.  Both approaches are not
rocket science, IMO.





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

* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
  2023-06-14 11:58             ` Eli Zaretskii
@ 2023-06-14 12:48               ` Ihor Radchenko
  2023-06-17  7:46                 ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Ihor Radchenko @ 2023-06-14 12:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64048, Stefan Monnier

Eli Zaretskii <eliz@gnu.org> writes:

>> Let me correct my initial suggestion:
>> 
>> (define-globalized-minor-mode global-display-line-numbers-mode
>>   display-line-numbers-mode display-line-numbers--turn-on
>>   :predicate t)
>
> This change is probably harmless, but OTOH what does it give you that
> the current code doesn't?  AFAIU, you still cannot customize the modes
> where line numbers will be off.
>
> IOW, :predicate is not a means for user customizations of the modes
> where the minor mode will be turned on.  Or am I missing something?

>> :predicate defines the default value of
>> `global-display-line-numbers-modes' variable.
>
> It does?  Where is this documented?

Yup. It is not documented on API level, but when :predicate is non-nil,
`define-globalized-minor-mode' does the following:

(setq turn-on-function
      `(lambda ()
         (require 'easy-mmode)
         (when (easy-mmode--globalized-predicate-p ,MODE-predicate)
           (funcall ,turn-on-function))))

;; Minor mode docstring:
(if predicate
    (concat
     "\n\n"
     (internal--format-docstring-line
      "`%s' is used to control which modes this minor mode is used in."
      MODE-predicate)) ;; <global-mode-name>-modes
  "")

,(when predicate
          `(defcustom ,MODE-predicate ,(car predicate)
             ,(format "Which major modes `%s' is switched on in.
This variable can be either t (all major modes), nil (no major modes),
or a list of modes and (not modes) to switch use this minor mode or
not.  For instance

  (c-mode (not message-mode mail-mode) text-mode)

means \"use this mode in all modes derived from `c-mode', don't use in
modes derived from `message-mode' or `mail-mode', but do use in other
modes derived from `text-mode'\".  An element with value t means \"use\"
and nil means \"don't use\".  There's an implicit nil at the end of the
list."
                      mode)
             :type '(repeat sexp)
             ,@group))

>> One can, of course, disable the minor mode selectively in some major
>> modes from that major mode hooks, but it is surprisingly non-obvious
>> approach.
>
> You can either disable it selectively (which is very obvious to me,
> FWIW), or you can selectively enable it.  Both approaches are not
> rocket science, IMO.

I partially agree, and I also find the approach obvious once I see it.
But the variable is easier (requires less Elisp knowledge) and is
already used in _some_ global minor modes. IMHO, controlling global
minor modes is one of the basic features that should be better exposed to
newbie users who use customize interface and do not know Elisp.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





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

* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
  2023-06-14 12:48               ` Ihor Radchenko
@ 2023-06-17  7:46                 ` Eli Zaretskii
  2023-06-17 18:30                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2023-06-17  7:46 UTC (permalink / raw)
  To: Ihor Radchenko, Stefan Monnier; +Cc: 64048

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 64048@debbugs.gnu.org
> Date: Wed, 14 Jun 2023 12:48:54 +0000
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> Let me correct my initial suggestion:
> >> 
> >> (define-globalized-minor-mode global-display-line-numbers-mode
> >>   display-line-numbers-mode display-line-numbers--turn-on
> >>   :predicate t)
> >
> > This change is probably harmless, but OTOH what does it give you that
> > the current code doesn't?  AFAIU, you still cannot customize the modes
> > where line numbers will be off.
> >
> > IOW, :predicate is not a means for user customizations of the modes
> > where the minor mode will be turned on.  Or am I missing something?
> 
> >> :predicate defines the default value of
> >> `global-display-line-numbers-modes' variable.
> >
> > It does?  Where is this documented?
> 
> Yup. It is not documented on API level, but when :predicate is non-nil,
> `define-globalized-minor-mode' does the following:
> 
> (setq turn-on-function
>       `(lambda ()
>          (require 'easy-mmode)
>          (when (easy-mmode--globalized-predicate-p ,MODE-predicate)
>            (funcall ,turn-on-function))))
> 
> ;; Minor mode docstring:
> (if predicate
>     (concat
>      "\n\n"
>      (internal--format-docstring-line
>       "`%s' is used to control which modes this minor mode is used in."
>       MODE-predicate)) ;; <global-mode-name>-modes
>   "")
> 
> ,(when predicate
>           `(defcustom ,MODE-predicate ,(car predicate)
>              ,(format "Which major modes `%s' is switched on in.
> This variable can be either t (all major modes), nil (no major modes),
> or a list of modes and (not modes) to switch use this minor mode or
> not.  For instance
> 
>   (c-mode (not message-mode mail-mode) text-mode)
> 
> means \"use this mode in all modes derived from `c-mode', don't use in
> modes derived from `message-mode' or `mail-mode', but do use in other
> modes derived from `text-mode'\".  An element with value t means \"use\"
> and nil means \"don't use\".  There's an implicit nil at the end of the
> list."
>                       mode)
>              :type '(repeat sexp)
>              ,@group))

Stefan, is our current documentation of :predicate incomplete?





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

* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
  2023-06-17  7:46                 ` Eli Zaretskii
@ 2023-06-17 18:30                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-06-17 18:58                     ` Eli Zaretskii
  2023-06-17 19:04                     ` Ihor Radchenko
  0 siblings, 2 replies; 15+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-06-17 18:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64048, Ihor Radchenko

> Stefan, is our current documentation of :predicate incomplete?

I'm not really familiar with that argument (AFAICT it was implemented
by Lars in commit b8b18cf34a04a).  The whole feature puts me off a bit
because of its name: in my world a "predicate" is a kind of function,
so I think it's a poor name for a variable containing some list-based
description of a set of modes.

But indeed, it seems the docstring forgets to mention that the
`:predicate MODES` argument causes the introduction of a new variable
called `MINOR-MODE-predicate` and whose default value is MODES.


        Stefan "who'd rename the `:predicate` arg to something like
                `:modes` and the `MODE-predicate` variable to something
                like `MODE-modes`."






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

* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
  2023-06-17 18:30                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-06-17 18:58                     ` Eli Zaretskii
  2023-06-17 19:06                       ` Ihor Radchenko
  2023-06-17 19:04                     ` Ihor Radchenko
  1 sibling, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2023-06-17 18:58 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 64048, yantar92

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Ihor Radchenko <yantar92@posteo.net>,  64048@debbugs.gnu.org
> Date: Sat, 17 Jun 2023 14:30:30 -0400
> 
> > Stefan, is our current documentation of :predicate incomplete?
> 
> I'm not really familiar with that argument (AFAICT it was implemented
> by Lars in commit b8b18cf34a04a).  The whole feature puts me off a bit
> because of its name: in my world a "predicate" is a kind of function,
> so I think it's a poor name for a variable containing some list-based
> description of a set of modes.
> 
> But indeed, it seems the docstring forgets to mention that the
> `:predicate MODES` argument causes the introduction of a new variable
> called `MINOR-MODE-predicate` and whose default value is MODES.

That's mostly already documented.  What is NOT documented is that by
giving that variable a non-default value one can affect in which modes
this minor mode will be turned on and in which it will be turned off.
IOW, the fact that this variable can be used for user customizations
is not documented at all.  And your answer just hints on whether the
above is true.

>         Stefan "who'd rename the `:predicate` arg to something like
>                 `:modes` and the `MODE-predicate` variable to something
>                 like `MODE-modes`."

I guess it's too late for renaming this?





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

* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
  2023-06-17 18:30                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-06-17 18:58                     ` Eli Zaretskii
@ 2023-06-17 19:04                     ` Ihor Radchenko
  2023-06-17 19:18                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 15+ messages in thread
From: Ihor Radchenko @ 2023-06-17 19:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 64048, Eli Zaretskii

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> But indeed, it seems the docstring forgets to mention that the
> `:predicate MODES` argument causes the introduction of a new variable
> called `MINOR-MODE-predicate` and whose default value is MODES.

Not `MINOR-MODE-predicate', `MINOR-MODE-modes':

(MODE-predicate (intern (concat (replace-regexp-in-string
                                          "-mode\\'" "" global-mode-name)
                                         "-modes")))

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





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

* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
  2023-06-17 18:58                     ` Eli Zaretskii
@ 2023-06-17 19:06                       ` Ihor Radchenko
  0 siblings, 0 replies; 15+ messages in thread
From: Ihor Radchenko @ 2023-06-17 19:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64048, Stefan Monnier

Eli Zaretskii <eliz@gnu.org> writes:

>>         Stefan "who'd rename the `:predicate` arg to something like
>>                 `:modes` and the `MODE-predicate` variable to something
>>                 like `MODE-modes`."
>
> I guess it's too late for renaming this?

It can be done in backwards-compatible way, so why not?
Just keep :predicate in the code as internal compatibility alias.
This is for the argument.

The defined customization does not need to be renamed. It already has
MODE-modes symbol name.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





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

* bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled
  2023-06-17 19:04                     ` Ihor Radchenko
@ 2023-06-17 19:18                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 15+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-06-17 19:18 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: 64048, Eli Zaretskii

>> But indeed, it seems the docstring forgets to mention that the
>> `:predicate MODES` argument causes the introduction of a new variable
>> called `MINOR-MODE-predicate` and whose default value is MODES.
>
> Not `MINOR-MODE-predicate', `MINOR-MODE-modes':
>
> (MODE-predicate (intern (concat (replace-regexp-in-string
>                                           "-mode\\'" "" global-mode-name)
>                                          "-modes")))

Ha!  Great minds do think alike after all!


        Stefan






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

end of thread, other threads:[~2023-06-17 19:18 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-13 14:33 bug#64048: 30.0.50; global-display-line-numbers-mode has no easy way to set modes where it is enabled Ihor Radchenko
2023-06-13 15:50 ` Eli Zaretskii
2023-06-13 16:09   ` Ihor Radchenko
2023-06-13 16:49     ` Eli Zaretskii
2023-06-13 17:21       ` Ihor Radchenko
2023-06-13 18:19         ` Eli Zaretskii
2023-06-13 19:36           ` Ihor Radchenko
2023-06-14 11:58             ` Eli Zaretskii
2023-06-14 12:48               ` Ihor Radchenko
2023-06-17  7:46                 ` Eli Zaretskii
2023-06-17 18:30                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-17 18:58                     ` Eli Zaretskii
2023-06-17 19:06                       ` Ihor Radchenko
2023-06-17 19:04                     ` Ihor Radchenko
2023-06-17 19:18                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.