emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 760910f: Add a new buffer-local variable `minor-modes'


From: Lars Ingebrigtsen
Subject: Re: master 760910f: Add a new buffer-local variable `minor-modes'
Date: Sun, 14 Feb 2021 16:41:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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

> Hmm... those files that have already been compiled with earlier Emacsen
> will not keep this var up-to-date, so it can't be used reliably.
> Also, I wonder why we need this to be a variable.

Yes, the .elc files will have to be recompiled.

> Can't we have an `enabled-minor-modes` function instead, which can simply
> loop through `minor-mode-list` and see which ones are enabled?

But how do we know which ones are enabled?  As far as I know, there's no
way to know (reliably) -- the :variable that shows whether the mode is
on or not isn't preserved anywhere.

Even if we had a function like that, looping over all possible minor
modes and calling predicates for them sounds hopelessly slow when you
have to do this for thousands of symbols...

>> +           ;; Keep `minor-modes' up to date.
>> +           (setq minor-modes (delq ',modefun minor-modes))
>> +           (when ,getter
>> +             (push ',modefun minor-modes))
>
> For global minor modes, this will adjust the list for the buffer that
> happens to be current when the mode is changed, but it won't affect all
> other buffers's lists.

Oh, darn, didn't think about globalized minor modes...

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]