* Re: master 760910f: Add a new buffer-local variable `minor-modes'
[not found] ` <20210214113756.93760209D4@vcs0.savannah.gnu.org>
@ 2021-02-14 12:26 ` Basil L. Contovounesios
2021-02-14 12:49 ` Lars Ingebrigtsen
2021-02-14 13:47 ` Lars Ingebrigtsen
2021-02-14 15:34 ` Stefan Monnier
1 sibling, 2 replies; 11+ messages in thread
From: Basil L. Contovounesios @ 2021-02-14 12:26 UTC (permalink / raw)
To: emacs-devel; +Cc: Lars Ingebrigtsen
larsi@gnus.org (Lars Ingebrigtsen) writes:
> branch: master
> commit 760910f4917ad8ff5e1cd1bf0bfec443b02f0e44
> Author: Lars Ingebrigtsen <larsi@gnus.org>
> Commit: Lars Ingebrigtsen <larsi@gnus.org>
>
> Add a new buffer-local variable `minor-modes'
Compiling with --enable-checking=structs fails with:
pdumper.c: In function ‘dump_buffer’:
pdumper.c:2696:3: error: #error "buffer changed.
See CHECK_STRUCTS comment in config.h."
2696 | # error "buffer changed. See CHECK_STRUCTS comment in config.h."
| ^~~~~
Does dump_buffer or similar need updating in pdumper.c?
Either way, its HASH_buffer value should be updated.
Thanks,
--
Basil
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: master 760910f: Add a new buffer-local variable `minor-modes'
2021-02-14 12:26 ` master 760910f: Add a new buffer-local variable `minor-modes' Basil L. Contovounesios
@ 2021-02-14 12:49 ` Lars Ingebrigtsen
2021-02-14 13:01 ` Lars Ingebrigtsen
2021-02-14 13:47 ` Lars Ingebrigtsen
1 sibling, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-14 12:49 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: emacs-devel
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
> Compiling with --enable-checking=structs fails with:
>
> pdumper.c: In function ‘dump_buffer’:
> pdumper.c:2696:3: error: #error "buffer changed.
> See CHECK_STRUCTS comment in config.h."
> 2696 | # error "buffer changed. See CHECK_STRUCTS comment in config.h."
> | ^~~~~
>
> Does dump_buffer or similar need updating in pdumper.c?
Thanks. Hm... I wonder whether I've confused myself here while doing
the merges. Did I mean to leave that new member out of the merge? I'll
check...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: master 760910f: Add a new buffer-local variable `minor-modes'
2021-02-14 12:49 ` Lars Ingebrigtsen
@ 2021-02-14 13:01 ` Lars Ingebrigtsen
0 siblings, 0 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-14 13:01 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: emacs-devel
Lars Ingebrigtsen <larsi@gnus.org> writes:
> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
>> Compiling with --enable-checking=structs fails with:
>>
>> pdumper.c: In function ‘dump_buffer’:
>> pdumper.c:2696:3: error: #error "buffer changed.
>> See CHECK_STRUCTS comment in config.h."
>> 2696 | # error "buffer changed. See CHECK_STRUCTS comment in config.h."
>> | ^~~~~
>>
>> Does dump_buffer or similar need updating in pdumper.c?
>
> Thanks. Hm... I wonder whether I've confused myself here while doing
> the merges. Did I mean to leave that new member out of the merge? I'll
> check...
Oh, no, that was a different thing I was thinking of. I've now fixed
this bit -- I think the correct thing is to set minor_modes to Qnil
here, I guess.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: master 760910f: Add a new buffer-local variable `minor-modes'
2021-02-14 12:26 ` master 760910f: Add a new buffer-local variable `minor-modes' Basil L. Contovounesios
2021-02-14 12:49 ` Lars Ingebrigtsen
@ 2021-02-14 13:47 ` Lars Ingebrigtsen
1 sibling, 0 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-14 13:47 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: emacs-devel
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
>> Add a new buffer-local variable `minor-modes'
I was surprised to find that buffer-local variables take precedence over
let-bound variables in some instances? If doing
(let ((minor-modes 1))
(with-current-buffer "some-other-buffer"
minor-modes))
will return the buffer-local variable in that other buffer, and not the
let-bound one?
Then perhaps that variable should be renamed to something longer and
convoluted... even if it seemed like a perfect pairing with
`major-mode'/`minor-modes'.
Opinions?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: master 760910f: Add a new buffer-local variable `minor-modes'
[not found] ` <20210214113756.93760209D4@vcs0.savannah.gnu.org>
2021-02-14 12:26 ` master 760910f: Add a new buffer-local variable `minor-modes' Basil L. Contovounesios
@ 2021-02-14 15:34 ` Stefan Monnier
2021-02-14 15:41 ` Lars Ingebrigtsen
1 sibling, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2021-02-14 15:34 UTC (permalink / raw)
To: emacs-devel; +Cc: Lars Ingebrigtsen
> Add a new buffer-local variable `minor-modes'
>
> * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Keep
> `minor-modes' updated.
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.
Can't we have an `enabled-minor-modes` function instead, which can simply
loop through `minor-mode-list` and see which ones are enabled?
> + ;; 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.
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: master 760910f: Add a new buffer-local variable `minor-modes'
2021-02-14 15:34 ` Stefan Monnier
@ 2021-02-14 15:41 ` Lars Ingebrigtsen
2021-02-14 15:45 ` Lars Ingebrigtsen
2021-02-14 18:17 ` Stefan Monnier
0 siblings, 2 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-14 15:41 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: master 760910f: Add a new buffer-local variable `minor-modes'
2021-02-14 15:41 ` Lars Ingebrigtsen
@ 2021-02-14 15:45 ` Lars Ingebrigtsen
2021-02-14 18:17 ` Stefan Monnier
1 sibling, 0 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-14 15:45 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Oh, darn, didn't think about globalized minor modes...
And there's a difference between globalized and global minor modes, I
guess? Hm...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: master 760910f: Add a new buffer-local variable `minor-modes'
2021-02-14 15:41 ` Lars Ingebrigtsen
2021-02-14 15:45 ` Lars Ingebrigtsen
@ 2021-02-14 18:17 ` Stefan Monnier
2021-02-14 18:40 ` Lars Ingebrigtsen
1 sibling, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2021-02-14 18:17 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel
> 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.
I can't look at it just now, but I remember this problem and have the
vague recollection that I've made some progress on it, but if it's not
sufficient yet, we can and should just fix it.
> 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...
You could do it eagerly just once before calling all the predicate
functions for all the commands, so that'd be cheap.
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: master 760910f: Add a new buffer-local variable `minor-modes'
2021-02-14 18:17 ` Stefan Monnier
@ 2021-02-14 18:40 ` Lars Ingebrigtsen
2021-02-14 23:19 ` Stefan Monnier
0 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-14 18:40 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> 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...
>
> You could do it eagerly just once before calling all the predicate
> functions for all the commands, so that'd be cheap.
That's true, but it seems like an unnecessary complication.
For instance, the mode line contains `minor-mode-alist', and has to loop
through it to find the lighters to display. It could instead work off
of the `minor-mode' list, which is order(s) of magnitude shorter for most
people.
(And whatever mechanism we add for global modes. Just adding a
`global-minor-modes' variable is the obvious solution, but I was hoping
somebody had a non-obvious alternative.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: master 760910f: Add a new buffer-local variable `minor-modes'
2021-02-14 18:40 ` Lars Ingebrigtsen
@ 2021-02-14 23:19 ` Stefan Monnier
2021-02-14 23:22 ` Lars Ingebrigtsen
0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2021-02-14 23:19 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel
> For instance, the mode line contains `minor-mode-alist', and has to loop
> through it to find the lighters to display. It could instead work off
> of the `minor-mode' list, which is order(s) of magnitude shorter for most
> people.
I have the impression that you have a hammer and you're looking for nails.
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: master 760910f: Add a new buffer-local variable `minor-modes'
2021-02-14 23:19 ` Stefan Monnier
@ 2021-02-14 23:22 ` Lars Ingebrigtsen
0 siblings, 0 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-14 23:22 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> For instance, the mode line contains `minor-mode-alist', and has to loop
>> through it to find the lighters to display. It could instead work off
>> of the `minor-mode' list, which is order(s) of magnitude shorter for most
>> people.
>
> I have the impression that you have a hammer and you're looking for nails.
There's nails sticking out all over the place!
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-02-14 23:22 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20210214113754.21891.10736@vcs0.savannah.gnu.org>
[not found] ` <20210214113756.93760209D4@vcs0.savannah.gnu.org>
2021-02-14 12:26 ` master 760910f: Add a new buffer-local variable `minor-modes' Basil L. Contovounesios
2021-02-14 12:49 ` Lars Ingebrigtsen
2021-02-14 13:01 ` Lars Ingebrigtsen
2021-02-14 13:47 ` Lars Ingebrigtsen
2021-02-14 15:34 ` Stefan Monnier
2021-02-14 15:41 ` Lars Ingebrigtsen
2021-02-14 15:45 ` Lars Ingebrigtsen
2021-02-14 18:17 ` Stefan Monnier
2021-02-14 18:40 ` Lars Ingebrigtsen
2021-02-14 23:19 ` Stefan Monnier
2021-02-14 23:22 ` Lars Ingebrigtsen
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).