From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: rudalics@gmx.at, 58175@debbugs.gnu.org, miha@kamnitnik.top
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Date: Thu, 06 Oct 2022 08:25:19 -0400 [thread overview]
Message-ID: <jwvtu4h40hs.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83wn9eu8qu.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 05 Oct 2022 08:42:17 +0300")
>> We could change the above code so it only sets to nil those
>> parameters that are listed in `window-persistent-parameters`, but I'm
>> not sure if that's the right choice. It might be, tho: it seems odd to
>> just zap properties owned by arbitrary packages without giving them
>> a chance to "say goodbye".
>
> Martin will tell, but I'm pretty sure this wasn't born out of thin
> air.
Could be, but the behavior is not documented, AFAICT: the doc seems to
suggest that `window-state-put` doesn't touch the parameters that are
not mentioned in `window-persistent-parameters` (whereas it actually
throws them out unconditionally).
> I'm sure there are window parameters that will do harm if
> copied.
I'm not talking about copying. I'm talking about leaving them where
they are.
>> Or we could add some kind of hook (similar to a `change-major-mode-hook`
>> but for window state changes rather than major mode changes) so code
>> like the region-highlight code can register itself there to throw away
>> its overlays before a new window-state is installed.
> Why is this cleaner than maintaining a list of "persistent"
> parameters?
Notice there are two notions of "persistent" here.
Let's say we use `window-stat-save` in window A and then
`window-state-put` in window B:
- `window-persistent-parameters` lets you control which parameters of
window A are "persisted/copied" to B. `internal-region-overlay`
doesn't want to be among those copied parameters.
- I'm suggesting we add some way to control what happens to parameters
that were in window B. Clearly, for those parameters in
`window-persistent-parameters` they'll have to be overwritten.
But currently they are all wiped out unconditionally just before
putting the new state, which is a problem in the case of
`internal-region-overlay` where we don't necessarily need to preserve
its value (tho that would work as well), but we'd need to remove it
a bit more carefully at least.
I see `window-state-put` as something similar to calling a major-mode:
it starts by "killing all local variables" (i.e. removing all window
parameters) and then sets up its own state.
I see 3 options:
- Change `window-state-put` so it doesn't touch those parameters not
mentioned in `window-persistent-parameters`. This is arguably the
simplest change and IMO it would make it behave closer to what its
doc suggests.
- Add a `before-clearing-window-parameters-hook`, just like
`kill-all-local-variables` runs the `change-major-mode-hook` (tho, if
so, we should design it such that it's a bit easier for that hook
to make some parameters survive unscathed).
- Add a new variable (or some new special value for
`window-persistent-parameters`) listing those window parameters that
should not be touched by `window-state-put` (i.e. the equivalent of
"persistent variables").
Stefan
next prev parent reply other threads:[~2022-10-06 12:25 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-29 17:29 bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-29 18:34 ` Eli Zaretskii
2022-09-29 19:17 ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-29 19:19 ` Eli Zaretskii
2022-10-02 16:50 ` Eli Zaretskii
2022-10-04 8:23 ` martin rudalics
2022-10-04 16:54 ` Eli Zaretskii
2022-10-04 20:27 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-04 21:03 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-04 21:25 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-05 5:42 ` Eli Zaretskii
2022-10-06 12:25 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-10-07 8:17 ` martin rudalics
2022-10-07 19:28 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-08 10:05 ` martin rudalics
2022-10-08 17:24 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-09 14:05 ` martin rudalics
2022-10-05 7:36 ` martin rudalics
2022-10-05 8:28 ` Eli Zaretskii
2022-10-06 7:48 ` martin rudalics
2022-10-06 8:13 ` Eli Zaretskii
2022-10-07 8:09 ` martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvtu4h40hs.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=58175@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=miha@kamnitnik.top \
--cc=monnier@iro.umontreal.ca \
--cc=rudalics@gmx.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.