GNU bug report logs - #58175
29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay

Previous Next

Package: emacs;

Reported by: miha <at> kamnitnik.top

Date: Thu, 29 Sep 2022 17:17:02 UTC

Severity: normal

Found in version 29.0.50

Full log


View this message in rfc822 format

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 58175 <at> debbugs.gnu.org, miha <at> kamnitnik.top
Subject: bug#58175: 29.0.50; M-x window-swap-states during an active mark leaves behind a region overlay
Date: Sat, 8 Oct 2022 12:05:25 +0200
> Could you clarify what you mean by that?
> Which other functions and what "remaining behavior" are you thinking of?

I meant the functions 'window-state-put' and 'set-window-configuration'
and the "remaining behavior" stands for how these functions restore
components like a window's scroll bars or fringes from the saved values.

>> The values of the window where the state is put are completely replaced
>> by the values of the window where the state has been obtained from.
>
> That's indeed the behavior of the code, as I pointed it out, but the
> docstring of `window-persistent-parameters` says:
>
>      Parameters not saved by ‘current-window-configuration’ or
>      ‘window-state-get’ are left alone by ‘set-window-configuration’
>      respectively are not installed by ‘window-state-put’.
>
> "not installed" is not the same as "thrown away".

> If we want to keep this behavior, we should document it a bit more
> clearly, I think.  Maybe that's what you meant by the distinction
> between "left alone" and "not installed"?

What we talk about here is this form in 'window--state-put-2':

      (dolist (parameter (window-parameters window))
	(set-window-parameter window (car parameter) nil))

which has no equivalent in 'set-window-configuration'.

The distinction is due to the fact that 'set-window-configuration' works
on already existing (albeit temporarily deleted) windows while
'window-state-put' as a rule has to work on pristine windows.  The
latter have no parameters from the outset.  'window-swap-states', which
was added later, is an exclusion from that rule because it has to work
on an already existing window.  Maybe that aspect is biting us here and
we should leave pre-existing parameters alone as you suggest.

But doesn't the fact that 'set-window-configuration' handles a nil value
of a parameter distinctly from "no value for that parameter has been
stored yet" mean that it handles window parameters specially, unlike
other window components or the way we handle frame parameters?

And haven't we discussed these issues already here

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=10348

and here?

https://lists.gnu.org/archive/html/emacs-diffs/2012-01/msg00140.html

> AFAIK the current code works fine with `set-window-configuration`.
> And indeed `set-window-configuration` behaves the way I suggest
> `window-state-put` should behave:
>
> 	  /* Restore any window parameters that have been saved.
> 	     Parameters that have not been saved are left alone.  */

But 'set-window-configuration' does not DTRT when the region overlay
parameter is made persistent.

martin

This bug report was last modified 2 years and 304 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.