* Re: [Emacs-diffs] scratch/highlight-n-windows 6da5ca1 2/2: Set `mark-active' to selected window
[not found] ` <E1YcvqH-0005KD-2v@vcs.savannah.gnu.org>
@ 2015-04-01 2:53 ` Stefan Monnier
2015-04-01 7:03 ` Oleh Krehel
0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2015-04-01 2:53 UTC (permalink / raw)
To: emacs-devel; +Cc: Oleh Krehel
> + (and (eq w mark-active)
> + w))
I think there's a good chance some code out there still sets mark-active
to t, so we should handle this case conservatively (i.e. highlight in all
windows displaying this buffer).
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Emacs-diffs] scratch/highlight-n-windows 6da5ca1 2/2: Set `mark-active' to selected window
2015-04-01 2:53 ` [Emacs-diffs] scratch/highlight-n-windows 6da5ca1 2/2: Set `mark-active' to selected window Stefan Monnier
@ 2015-04-01 7:03 ` Oleh Krehel
2015-04-01 14:04 ` Stefan Monnier
2015-04-01 15:17 ` Drew Adams
0 siblings, 2 replies; 9+ messages in thread
From: Oleh Krehel @ 2015-04-01 7:03 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> + (and (eq w mark-active)
>> + w))
>
> I think there's a good chance some code out there still sets mark-active
> to t, so we should handle this case conservatively (i.e. highlight in all
> windows displaying this buffer).
OK, updated to check for t as well.
> IIUC the problem that annoys you, it comes from the fact that the
> region is defined to be "anything between point and mark" but point is
> a per-window attribute while mark is a per-buffer attribute.
Could we possibly have the mark to be per-window as well?
It would automatically solve my problem, as well as allow for some
features that users think they might like. For instance, swap two
regions in two windows of the same buffer.
Oleh
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Emacs-diffs] scratch/highlight-n-windows 6da5ca1 2/2: Set `mark-active' to selected window
2015-04-01 7:03 ` Oleh Krehel
@ 2015-04-01 14:04 ` Stefan Monnier
2015-04-01 16:20 ` Oleh Krehel
2015-04-01 15:17 ` Drew Adams
1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2015-04-01 14:04 UTC (permalink / raw)
To: Oleh Krehel; +Cc: emacs-devel
> OK, updated to check for t as well.
Thanks. Looks OK. How does it behave?
>> IIUC the problem that annoys you, it comes from the fact that the
>> region is defined to be "anything between point and mark" but point is
>> a per-window attribute while mark is a per-buffer attribute.
> Could we possibly have the mark to be per-window as well?
Everything is possible. It sounds like it might require a fair bit of
code changes, but feel free to try it out.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [Emacs-diffs] scratch/highlight-n-windows 6da5ca1 2/2: Set `mark-active' to selected window
2015-04-01 7:03 ` Oleh Krehel
2015-04-01 14:04 ` Stefan Monnier
@ 2015-04-01 15:17 ` Drew Adams
2015-04-01 15:46 ` Oleh Krehel
1 sibling, 1 reply; 9+ messages in thread
From: Drew Adams @ 2015-04-01 15:17 UTC (permalink / raw)
To: Oleh Krehel, Stefan Monnier; +Cc: emacs-devel
> > I think there's a good chance some code out there still sets mark-active
> > to t, so we should handle this case conservatively (i.e. highlight in all
> > windows displaying this buffer).
Is the intention that the use of a non-window, non-nil value
will be deprecated at some point?
Or is the use of a window in some way preferable/recommended?
If so, is that change in preference documented, including describing
any differences in behavior that using a window introduces?
> OK, updated to check for t as well.
Thx.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Emacs-diffs] scratch/highlight-n-windows 6da5ca1 2/2: Set `mark-active' to selected window
2015-04-01 15:17 ` Drew Adams
@ 2015-04-01 15:46 ` Oleh Krehel
2015-04-01 17:11 ` martin rudalics
0 siblings, 1 reply; 9+ messages in thread
From: Oleh Krehel @ 2015-04-01 15:46 UTC (permalink / raw)
To: Drew Adams; +Cc: Stefan Monnier, emacs-devel
Drew Adams <drew.adams@oracle.com> writes:
>> > I think there's a good chance some code out there still sets mark-active
>> > to t, so we should handle this case conservatively (i.e. highlight in all
>> > windows displaying this buffer).
>
> Is the intention that the use of a non-window, non-nil value
> will be deprecated at some point?
I think so, since if a package sets it to t, and user has
`highlight-nonselected-windows' it would upset the user. A different
solution would be to introduce a new variable that mirrors
`mark-active'. But that would make `mark-active' redundant w.r.t. that
variable.
> Or is the use of a window in some way preferable/recommended?
> If so, is that change in preference documented, including describing
> any differences in behavior that using a window introduces?
I will try to make the mark and `mark-active' window-local instead of
just `buffer-local'. In that case, it will still be fine to have
`mark-active' set to t. I don't yet know how hard this task would be.
Oleh
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Emacs-diffs] scratch/highlight-n-windows 6da5ca1 2/2: Set `mark-active' to selected window
2015-04-01 14:04 ` Stefan Monnier
@ 2015-04-01 16:20 ` Oleh Krehel
2015-04-01 18:27 ` Stefan Monnier
0 siblings, 1 reply; 9+ messages in thread
From: Oleh Krehel @ 2015-04-01 16:20 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Thanks. Looks OK. How does it behave?
It behaves quite well: the selection in one window doesn't change when I
update it in the other window. And there is nothing flashing when I
click with the left mouse button.
The only issue left is that when I move the mark in one window and
switch, the mark is moved in the other window as well. And since the
region wasn't updated in the other window, it's a sharp transition.
Still, it's much better than the pre-patch behavior.
Should I apply this change or wait until I figure out how to make the
mark window-local?
Oleh
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Emacs-diffs] scratch/highlight-n-windows 6da5ca1 2/2: Set `mark-active' to selected window
2015-04-01 15:46 ` Oleh Krehel
@ 2015-04-01 17:11 ` martin rudalics
0 siblings, 0 replies; 9+ messages in thread
From: martin rudalics @ 2015-04-01 17:11 UTC (permalink / raw)
To: Oleh Krehel, Drew Adams; +Cc: Stefan Monnier, emacs-devel
> I will try to make the mark and `mark-active' window-local instead of
> just `buffer-local'.
I don't agree with the "instead". I suppose we'd want functions, say
`window-mark' and `window-mark-active' which would be handled as
`window-point' as well as `set-window-mark' and `set-window-mark-active'
which would be handled as `set-window-point'. So two new entries for
the window structure in window.h.
`select-window' would have to set the buffer's mark and mark-active like
it sets point from the respective window slots and restore the old
window's mark and mark-active. And window configurations would have to
save and restore mark and mark-active too.
And obvious `mark-active' is slightly different since that's a variable.
I would like it but it's probably a bit tedious to implement.
martin
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Emacs-diffs] scratch/highlight-n-windows 6da5ca1 2/2: Set `mark-active' to selected window
2015-04-01 16:20 ` Oleh Krehel
@ 2015-04-01 18:27 ` Stefan Monnier
2015-04-01 18:38 ` Oleh Krehel
0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2015-04-01 18:27 UTC (permalink / raw)
To: Oleh Krehel; +Cc: emacs-devel
> Should I apply this change or wait until I figure out how to make the
> mark window-local?
While trying it out I noticed that it introduces behavior which some
users will find unexpected: while the highlighting only happens in the
window where the mark was set, mark-active is non-nil in all windows
displaying that buffer, so the commands will behave according to
"the mark is active" while the user may think "it's not highlighted, so
the mark is not active".
IOW, it's a cute hack, but I don't think it's right. Sorry.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Emacs-diffs] scratch/highlight-n-windows 6da5ca1 2/2: Set `mark-active' to selected window
2015-04-01 18:27 ` Stefan Monnier
@ 2015-04-01 18:38 ` Oleh Krehel
0 siblings, 0 replies; 9+ messages in thread
From: Oleh Krehel @ 2015-04-01 18:38 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Should I apply this change or wait until I figure out how to make the
>> mark window-local?
>
> While trying it out I noticed that it introduces behavior which some
> users will find unexpected: while the highlighting only happens in the
> window where the mark was set, mark-active is non-nil in all windows
> displaying that buffer, so the commands will behave according to
> "the mark is active" while the user may think "it's not highlighted, so
> the mark is not active".
>
> IOW, it's a cute hack, but I don't think it's right. Sorry.
Of course, that was the point of the current change: just to get rid of
the visual distraction.
It's not going to get intuitive until the mark becomes window-local.
But I would take not-annoying over non-intuitive any day though:)
Oleh
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-04-01 18:38 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20150331130427.20388.74881@vcs.savannah.gnu.org>
[not found] ` <E1YcvqH-0005KD-2v@vcs.savannah.gnu.org>
2015-04-01 2:53 ` [Emacs-diffs] scratch/highlight-n-windows 6da5ca1 2/2: Set `mark-active' to selected window Stefan Monnier
2015-04-01 7:03 ` Oleh Krehel
2015-04-01 14:04 ` Stefan Monnier
2015-04-01 16:20 ` Oleh Krehel
2015-04-01 18:27 ` Stefan Monnier
2015-04-01 18:38 ` Oleh Krehel
2015-04-01 15:17 ` Drew Adams
2015-04-01 15:46 ` Oleh Krehel
2015-04-01 17:11 ` martin rudalics
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.