unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Window splitting deactivates the mark?
@ 2005-12-12 23:17 Stephen Berman
  2005-12-15 20:01 ` Stephen Berman
  2005-12-19  4:40 ` Richard M. Stallman
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Berman @ 2005-12-12 23:17 UTC (permalink / raw)


Is splitting the window supposed to deactivate the mark sometimes?  I
don't see in the source where it does, but I may not understand all of
the splitting code.  I ask, because I have been observing behavior
involving the mark being deactivated when the window is split, but
only under certain conditions.  So far I have only seen this behavior
when tabbar-mode is enabled.  This mode is from tabbar.el, which is
not part of Emacs (but I would be in favor of adding it!).
Nevertheless, I'm asking about this here, because (i) the behavior
obtains under Emacs 22 but not under Emacs 21 using the same version
of tabbar.el (the current version, available at
<http://cvs.sourceforge.net/viewcvs.py/emhacks/emhacks/tabbar.el?rev=1.67&view=auto>),
and (ii) I've corresponded with the author of tabbar.el, David Ponce,
and he could not immediately find the cause of the problem in
tabbar.el but did find a possible workaround and he also suggested I
post here about the matter.

Here are the minimal steps to reproduce the behavior (using tabbar.el
v1.67 and current CVS Emacs):

1. emacs -q

2. Type either `C-x 2' or `C-x 3' to split the window, and then type
`C-x b', so that one window contains the *Messages* buffer and the
other contains the *scratch* buffer.

3. (Sanity check:) In *scratch*, using the mouse, drag across or
double click on a word to highlight it, then type C-w to delete the
highlighted word.  Undo the deletion to restore the original state.

4. Load tabbar.el and type M-x tabbar-mode to enable tabbar-mode.

5. Repeat step 3: you will now find that upon typing C-w the
highlighted word is not deleted and is no longer highlighted, and in
the echo area the message "The mark is not active now" appears.

6. Now do any one of the following: (i) type `C-x 1' to remove the
window splitting, (ii) keep the splitting but have the same buffer in
both windows, (iii) keep the splitting but have buffers from two
different tab bar groups in the windows, e.g. *scratch* and a *Help*
buffer (this holds for this particular case, and for some other modes
I tried, but I can't say whether it's really true in general), or (iv)
disable tabbar-mode.  Now you can repeat step 3 and deleting the
highlighted word works again.  Also note that, in step 5, if you mark
the word not with the mouse but with the keyboard (C-SPC etc.), then
deletion can happen and in *Messages* "Mark activated" appears.

In correspondence David Ponce added the following observations:
> I just noticed that the same scenario works [i.e., behaves as in
> step 3, not as in step 5] in Emacs 21.4. Also, it works in Emacs 22
> after enabling CUA mode. And even after disabling it!

And he discovered an apparent workaround:
> I found that setting `mark-even-if-inactive' to non-nil seems to fix
> the tabbar problem. I also found that CUA mode set it to non-nil
> when enabled and don't restore it when disabled.  That explains why
> your scenario works after enabling CUA mode.

I've confirmed these further observations and the workaround.
Assuming the problem doesn't lie in tabbar.el (and if it does, it has
yet to be found there), does the window-splitting code do something
that deactivates the mark in the circumstances described above?  Or
could it be due to something in the mouse code, in view of the
difference between mouse and keyboard selection noted above?  Any
advice, also about how to go about investigating this further
(instrumenting tabbar.el and stepping though it with edebug didn't
reveal anything to me), would be appreciated.

Steve Berman

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Window splitting deactivates the mark?
  2005-12-12 23:17 Window splitting deactivates the mark? Stephen Berman
@ 2005-12-15 20:01 ` Stephen Berman
  2005-12-19  4:40 ` Richard M. Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Berman @ 2005-12-15 20:01 UTC (permalink / raw)


On Tue, 13 Dec 2005 00:17:27 +0100 Stephen Berman
<Stephen.Berman@gmx.net> wrote: 

> Assuming the problem doesn't lie in tabbar.el (and if it does, it has
> yet to be found there)

For the record, David Ponce has informed he has found the problem in
tabbar.el and checked in a fix to CVS (and I confirm the fix works).

Steve Berman

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Window splitting deactivates the mark?
  2005-12-12 23:17 Window splitting deactivates the mark? Stephen Berman
  2005-12-15 20:01 ` Stephen Berman
@ 2005-12-19  4:40 ` Richard M. Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Richard M. Stallman @ 2005-12-19  4:40 UTC (permalink / raw)
  Cc: David Ponce, emacs-devel

I don't think window splitting does anything to deactivate the mark.
There is nothing in Fsplit_window that would do it.  Empirically, if I
set the mark (with Transient Mark mode) and then split the window, the
region remains active.

So this must be due, somehow, to whatever is done in tabbar.el.

Remember that deactivating the mark is normally done by setting
deactivate-mark to t.  When the command loop sees that, it deactivates
the mark.  It should be pretty easy to determine whether something
sets deactivate-mark to t.

split-window can run window-scroll-functions and it can run
window-configuration-change-hook.  If either of those does
editing in a buffer, it would set deactivate-mark to t.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-12-19  4:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-12 23:17 Window splitting deactivates the mark? Stephen Berman
2005-12-15 20:01 ` Stephen Berman
2005-12-19  4:40 ` Richard M. Stallman

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).