unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: martin rudalics <rudalics@gmx.at>
Cc: Eli Zaretskii <eliz@gnu.org>, 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: Fri, 07 Oct 2022 15:28:56 -0400	[thread overview]
Message-ID: <jwva6675u5v.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <53e1c03a-25da-c772-1801-8c8cb8ee0df3@gmx.at> (martin rudalics's message of "Fri, 7 Oct 2022 10:17:27 +0200")

>> 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).
> AFAICT that's consistent with the remaining behavior of these functions.

Could you clarify what you mean by that?
Which other functions and what "remaining behavior" are you thinking of?

> 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"?

Also, I think it's worthwhile then to add some hook run before throwing
away that info.

>> I see 3 options:
> I'm still not convinced that window parameters are the best choice for
> keeping information about the highlighted region.

You might be right, but that's a somewhat orthogonal discussion.
I don't think this choice should be imposed by a specific choice of
behavior of `window-state-put`.

> The parameter used here is a conglomerate - 'window-point' is window
> local, the mark is buffer local and which window is the selected one is
> global.  But since, as Eli said, we also may want to highlight the
> region in non-selected windows, there might be no better choice.

Yes, I think we'll have to use a hash-table (weakly) indexed by windows :-(

> In either case, please keep in mind that the persistence of parameters
> must be also handled by ‘set-window-configuration’ though that one
> never has to transfer properties from one window to another.

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.  */


-- Stefan






  reply	other threads:[~2022-10-07 19:28 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
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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwva6675u5v.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 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).