GNU bug report logs - #9810
cw in viper mode clobbers clipboard

Previous Next

Package: emacs;

Reported by: Bob Nnamtrop <bobnnamtrop <at> gmail.com>

Date: Thu, 20 Oct 2011 16:20:02 UTC

Severity: normal

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9810 in the body.
You can then email your comments to 9810 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 16:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bob Nnamtrop <bobnnamtrop <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 20 Oct 2011 16:20:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 10:18:06 -0600
As the title says, in viper command mode typing cw (ie change word)
causes the emacs clipboard (not sure the proper name for it, but the
thing I expect a middle mouse button to paste into the buffer) to get
clobbered. This is a regression over all previous versions (actually I
remember this bug occurring a long time ago and getting fixed so
something must have broken it again). To replicate:

emacs -Q
M-x viper
i (ie, go into insert mode)
asdf hjkl (type a few words)
<escape> (ie, go into command mode)
click on the 'a' (or move there any way you want)
double click to put 'asdf' into emacs clipboard (ie X11 clipboard,
primary, whatever)
click on the 'h' (or move there any way you want)
cw (ie viper command to change word)j
<middle mouse click> (to paste the clipboard, or yank or whatever
emacs calls it :-)
hjkl is pasted in

But 'asdf' should have been pasted in. This also occurs with other
commands like 'ct', etc. This is very annoying and I cannot imagine
using the new version if this is not fixed.

Thanks much,
Bob

In GNU Emacs 24.0.90.1 (x86_64-apple-darwin10.8.0, X toolkit, Xaw3d scroll bars)
 of 2011-10-04 on where.i.am
Windowing system distributor `The X.Org Foundation', version 11.0.11003000
configured using `configure
'--prefix=/Users/name/local-emacs-24.0.90' '--with-x-toolkit=athena''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x v i p e r - o <backspace> <backspace> <return>
i a s d f SPC h j k l <escape> 0 <down-mouse-1> <mouse-1>
<double-down-mouse-1> <double-mouse-1> <down-mouse-1>
<mouse-1> c w <down-mouse-2> <mouse-2> <escape> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <menu-bar>
<help-menu> <send-emacs-bug-report>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Loading viper...
Loading /Users/name/.viper...done
Loading viper...done

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr message format-spec rfc822 mml easymenu
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader
emacsbug tabify viper viper-ex viper-macs viper-mous viper-cmd
viper-keym ring viper-util viper-init advice help-fns advice-preload
time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image fringe lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting x-toolkit x multi-tty emacs)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 16:27:02 GMT) Full text and rfc822 format available.

Message #8 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
Cc: 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 18:25:17 +0200
On Thu, Oct 20, 2011 at 18:18, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
> As the title says, in viper command mode typing cw (ie change word)
> causes the emacs clipboard (not sure the proper name for it, but the
> thing I expect a middle mouse button to paste into the buffer) to get
> clobbered. This is a regression over all previous versions (actually I
> remember this bug occurring a long time ago and getting fixed so
> something must have broken it again). To replicate:
>
> emacs -Q
> M-x viper
> i (ie, go into insert mode)
> asdf hjkl (type a few words)
> <escape> (ie, go into command mode)
> click on the 'a' (or move there any way you want)
> double click to put 'asdf' into emacs clipboard (ie X11 clipboard,
> primary, whatever)
> click on the 'h' (or move there any way you want)
> cw (ie viper command to change word)j
> <middle mouse click> (to paste the clipboard, or yank or whatever
> emacs calls it :-)
> hjkl is pasted in
>
> But 'asdf' should have been pasted in. This also occurs with other
> commands like 'ct', etc. This is very annoying and I cannot imagine
> using the new version if this is not fixed.

I think the current behavior is the correct one. Why do you think it
is in error?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 16:29:01 GMT) Full text and rfc822 format available.

Message #11 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
Cc: 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 18:27:13 +0200
> Date: Thu, 20 Oct 2011 10:18:06 -0600
> From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
> 
> emacs -Q
> M-x viper
> i (ie, go into insert mode)
> asdf hjkl (type a few words)
> <escape> (ie, go into command mode)
> click on the 'a' (or move there any way you want)
> double click to put 'asdf' into emacs clipboard (ie X11 clipboard,
> primary, whatever)
> click on the 'h' (or move there any way you want)
> cw (ie viper command to change word)j
> <middle mouse click> (to paste the clipboard, or yank or whatever
> emacs calls it :-)
> hjkl is pasted in
> 
> But 'asdf' should have been pasted in.

Did you read the section "Selection changes" in etc/NEWS?  I think
what you see is the result of a deliberate change in behavior
described there.  In particular, double-clicking a mouse no longer
puts the selected text into the clipboard, only into the PRIMARY
selection.

> This is very annoying and I cannot imagine using the new version if
> this is not fixed.

The above-mentioned section also tells you how to customize Emacs to
get the old behavior back.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 16:46:02 GMT) Full text and rfc822 format available.

Message #14 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 10:44:31 -0600
On Thu, Oct 20, 2011 at 10:25 AM, Lennart Borgman
<lennart.borgman <at> gmail.com> wrote:
> On Thu, Oct 20, 2011 at 18:18, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
>> But 'asdf' should have been pasted in. This also occurs with other
>> commands like 'ct', etc. This is very annoying and I cannot imagine
>> using the new version if this is not fixed.
>
> I think the current behavior is the correct one. Why do you think it
> is in error?
>

Because the just typing 'cw' should not cause either clipboard or
primary to be altered. The word is highlighted but that should be it,
it should not go into primary (or clipboard or any other selection).
The way it is now the common (for me) work-flow (put something into
primary, go somewhere else, use cw then <middel mouse> to change that
word) described above does not work anymore. The changes to primary
and clipboard described in NEWS have nothing to do with this (or
should not).

Bob




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 16:51:01 GMT) Full text and rfc822 format available.

Message #17 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
Cc: 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 18:48:45 +0200
On Thu, Oct 20, 2011 at 18:44, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
> On Thu, Oct 20, 2011 at 10:25 AM, Lennart Borgman
> <lennart.borgman <at> gmail.com> wrote:
>> On Thu, Oct 20, 2011 at 18:18, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
>>> But 'asdf' should have been pasted in. This also occurs with other
>>> commands like 'ct', etc. This is very annoying and I cannot imagine
>>> using the new version if this is not fixed.
>>
>> I think the current behavior is the correct one. Why do you think it
>> is in error?
>>
>
> Because the just typing 'cw' should not cause either clipboard or
> primary to be altered.

I do expect cw to cause the clipboard to change since something from
the buffer is erased. I think most people would expect that too.

However I do not understand the reason for why think differently.
(Except that you find it inconvenient, but that is a different thing.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 16:51:02 GMT) Full text and rfc822 format available.

Message #20 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 10:48:30 -0600
On Thu, Oct 20, 2011 at 10:27 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> Date: Thu, 20 Oct 2011 10:18:06 -0600
>> From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
>>
>> emacs -Q
>> M-x viper
>> i (ie, go into insert mode)
>> asdf hjkl (type a few words)
>> <escape> (ie, go into command mode)
>> click on the 'a' (or move there any way you want)
>> double click to put 'asdf' into emacs clipboard (ie X11 clipboard,
>> primary, whatever)
>> click on the 'h' (or move there any way you want)
>> cw (ie viper command to change word)j
>> <middle mouse click> (to paste the clipboard, or yank or whatever
>> emacs calls it :-)
>> hjkl is pasted in
>>
>> But 'asdf' should have been pasted in.
>
> Did you read the section "Selection changes" in etc/NEWS?  I think
> what you see is the result of a deliberate change in behavior
> described there.  In particular, double-clicking a mouse no longer
> puts the selected text into the clipboard, only into the PRIMARY
> selection.
>
>> This is very annoying and I cannot imagine using the new version if
>> this is not fixed.
>
> The above-mentioned section also tells you how to customize Emacs to
> get the old behavior back.
>

I just read that info in NEWS about selection changes and I'm glad I
did (since it will affect me in other ways). But it should have
nothing to do with the bug I describe. The point I make is that 'cw'
should not alter any of the selections (primary, clipboard, etc). The
word gets hi-lighted but that is only a visual aid, it should not
alter the 'selection'.

Bob




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 16:59:02 GMT) Full text and rfc822 format available.

Message #23 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 10:57:31 -0600
On Thu, Oct 20, 2011 at 10:48 AM, Lennart Borgman
<lennart.borgman <at> gmail.com> wrote:
> On Thu, Oct 20, 2011 at 18:44, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
>> On Thu, Oct 20, 2011 at 10:25 AM, Lennart Borgman
>> <lennart.borgman <at> gmail.com> wrote:
>>> On Thu, Oct 20, 2011 at 18:18, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
>>>> But 'asdf' should have been pasted in. This also occurs with other
>>>> commands like 'ct', etc. This is very annoying and I cannot imagine
>>>> using the new version if this is not fixed.
>>>
>>> I think the current behavior is the correct one. Why do you think it
>>> is in error?
>>>
>>
>> Because the just typing 'cw' should not cause either clipboard or
>> primary to be altered.
>
> I do expect cw to cause the clipboard to change since something from
> the buffer is erased. I think most people would expect that too.
>
> However I do not understand the reason for why think differently.
> (Except that you find it inconvenient, but that is a different thing.)
>

Right after you type 'cw' nothing in the buffer is erased. The word is
hi-lighted but that is it. So it should not change any selection at
that point. Try what I describe in 23.3. You will see it is a
regression.

Bob




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 17:00:02 GMT) Full text and rfc822 format available.

Message #26 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 18:58:00 +0200
On Thu, Oct 20, 2011 at 18:48, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
>
> The point I make is that 'cw'
> should not alter any of the selections (primary, clipboard, etc).

Doing just 'cw' in viper actually deletes the word in the buffer so
putting it on the clipboard is the expected behavior.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 17:01:01 GMT) Full text and rfc822 format available.

Message #29 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
Cc: lennart.borgman <at> gmail.com, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 18:58:53 +0200
> Date: Thu, 20 Oct 2011 10:44:31 -0600
> From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
> Cc: 9810 <at> debbugs.gnu.org
> 
> just typing 'cw' should not cause either clipboard or
> primary to be altered. The word is highlighted but that should be it,
> it should not go into primary (or clipboard or any other selection).
> The way it is now the common (for me) work-flow (put something into
> primary, go somewhere else, use cw then <middel mouse> to change that
> word) described above does not work anymore. The changes to primary
> and clipboard described in NEWS have nothing to do with this (or
> should not).

Can you tell me which function does the cw command run?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 17:12:01 GMT) Full text and rfc822 format available.

Message #32 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 11:09:58 -0600
On Thu, Oct 20, 2011 at 10:58 AM, Lennart Borgman
<lennart.borgman <at> gmail.com> wrote:
> On Thu, Oct 20, 2011 at 18:48, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
>>
>> The point I make is that 'cw'
>> should not alter any of the selections (primary, clipboard, etc).
>
> Doing just 'cw' in viper actually deletes the word in the buffer so
> putting it on the clipboard is the expected behavior.
>

Well, I do not know if that is true or not from a technical
standpoint. But from the user perspective the word is not deleted
until you type some new text or hit <esc>. Right after typing cw the
word is still displayed and it is hi-lighted. So I would not say it is
deleted. There is no advantage to the user to clobber the selection
that that point, since they may want to use what was previously in
there.

I just tried what I originally describe in a terminal window (ie
starting from emacs -Q -nw) and it works as I expect. The previously
selected selection is pasted in to the hi-lighted word after typing
cw. Just like it all previous versions of emacs (terminal or not).

Bob




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 17:14:01 GMT) Full text and rfc822 format available.

Message #35 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: lennart.borgman <at> gmail.com, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 11:12:36 -0600
On Thu, Oct 20, 2011 at 10:58 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> Date: Thu, 20 Oct 2011 10:44:31 -0600
>> From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
>> Cc: 9810 <at> debbugs.gnu.org
>>
>> just typing 'cw' should not cause either clipboard or
>> primary to be altered. The word is highlighted but that should be it,
>> it should not go into primary (or clipboard or any other selection).
>> The way it is now the common (for me) work-flow (put something into
>> primary, go somewhere else, use cw then <middel mouse> to change that
>> word) described above does not work anymore. The changes to primary
>> and clipboard described in NEWS have nothing to do with this (or
>> should not).
>
> Can you tell me which function does the cw command run?
>

Well, I do not really understand the viper code, but some searching
and I found this comment at line 1602 in viper-cmd.el

;; This function is called by various movement commands to execute a
;; destructive command on the region specified by the movement command.  For
;; instance, if the user types cw, then the command viper-forward-word will
;; call viper-execute-com to execute viper-exec-change, which eventually will
;; call viper-change to invoke the replace mode on the region.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 17:19:01 GMT) Full text and rfc822 format available.

Message #38 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
Cc: lennart.borgman <at> gmail.com, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 19:16:11 +0200
> Date: Thu, 20 Oct 2011 11:09:58 -0600
> From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 9810 <at> debbugs.gnu.org
> 
> I just tried what I originally describe in a terminal window (ie
> starting from emacs -Q -nw) and it works as I expect. The previously
> selected selection is pasted in to the hi-lighted word after typing
> cw. Just like it all previous versions of emacs (terminal or not).

On a text terminal, Emacs does not interact with the clipboard or
selections, so any problems with the clipboard or selections will
never show in "emacs -nw".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 20:09:02 GMT) Full text and rfc822 format available.

Message #41 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
Cc: Lennart Borgman <lennart.borgman <at> gmail.com>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 14:46:18 -0400
> Right after you type 'cw' nothing in the buffer is erased. The word is
> hi-lighted but that is it. So it should not change any selection at

That's what is supposed to happen now that select-active-regions
defaults to t.


        Stefan






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 20:30:02 GMT) Full text and rfc822 format available.

Message #44 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Lennart Borgman <lennart.borgman <at> gmail.com>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 14:28:14 -0600
On Thu, Oct 20, 2011 at 12:46 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>> Right after you type 'cw' nothing in the buffer is erased. The word is
>> hi-lighted but that is it. So it should not change any selection at
>
> That's what is supposed to happen now that select-active-regions
> defaults to t.

I like the behavior of select-active-regions when it is set to t.
However, I do not consider the selected word when one does 'cw' an
active region (in the usual emacs sense). It is a vi construct
independent of emacs active regions and so it need not honor the
select-active-regions setting.

I am curious what other long-time viper mode users think about this
change in behavior (note that I no idea if any of the responders to
this bug report are viper users or not).

Bob




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 20:35:02 GMT) Full text and rfc822 format available.

Message #47 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 22:32:54 +0200
On Thu, Oct 20, 2011 at 22:28, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
>
> I am curious what other long-time viper mode users think about this
> change in behavior (note that I no idea if any of the responders to
> this bug report are viper users or not).

I am always using viper (and have contributed some small bits to it).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 21:00:02 GMT) Full text and rfc822 format available.

Message #50 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Lennart Borgman <lennart.borgman <at> gmail.com>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 14:57:57 -0600
On Thu, Oct 20, 2011 at 12:46 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>> Right after you type 'cw' nothing in the buffer is erased. The word is
>> hi-lighted but that is it. So it should not change any selection at
>
> That's what is supposed to happen now that select-active-regions
> defaults to t.

Playing around a bit more exposes more inconsistencies:

-using the viper command R (viper-overwrite) hi-lights to the end of
the line in a similar way as cw does to the end of the word but the
primary selection is not clobbered. This is inconsistent to the
behavior of cw (although better).

-pasting in the primary selection (using <middle mouse>) or the
clipboard using C-y after the viper command R pastes the selection in
front of the 'R selection' instead of replacing the first part of the
'R selection' (whereas the same action after cw replaces the first
part of the 'cw selection'). Here the behavior of R is worse than cw.

Bob




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 21:06:02 GMT) Full text and rfc822 format available.

Message #53 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 23:03:34 +0200
On Thu, Oct 20, 2011 at 22:57, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
> On Thu, Oct 20, 2011 at 12:46 PM, Stefan Monnier
> <monnier <at> iro.umontreal.ca> wrote:
>>> Right after you type 'cw' nothing in the buffer is erased. The word is
>>> hi-lighted but that is it. So it should not change any selection at
>>
>> That's what is supposed to happen now that select-active-regions
>> defaults to t.
>
> Playing around a bit more exposes more inconsistencies:
>
> -using the viper command R (viper-overwrite) hi-lights to the end of
> the line in a similar way as cw does to the end of the word but the
> primary selection is not clobbered. This is inconsistent to the
> behavior of cw (although better).

They actually work quite different. If you press ESC immediately after
R then nothing is changed in the buffer. However if you press escape
after cw then the word is still deleted.

So with respect to clipboard handling I think both are consistent and ok.

But maybe they do not behave the way vi does in this cases. (But that
is a totally different matter than this bug report.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 21:33:01 GMT) Full text and rfc822 format available.

Message #56 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
Cc: Lennart Borgman <lennart.borgman <at> gmail.com>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 17:31:07 -0400
> I like the behavior of select-active-regions when it is set to t.

[ FWIW, I don't. ;-)  ]

> However, I do not consider the selected word when one does 'cw' an
> active region (in the usual emacs sense).

I see.  But technically, it is (i.e. that's how Viper implements it).

> It is a vi construct independent of Emacs active regions and so it
> need not honor the select-active-regions setting.

Of course, Viper could be changed to use some other mechanism, but it is
convenient to use the region for that.  I'm not sure how/if we could let
Viper tell Emacs to ignore select-active-regions for this case.

> I am curious what other long-time viper mode users think about this
> change in behavior (note that I no idea if any of the responders to
> this bug report are viper users or not).

I don't use Viper myself, so I'll let others handle this part.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 22:14:02 GMT) Full text and rfc822 format available.

Message #59 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Lennart Borgman <lennart.borgman <at> gmail.com>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 16:12:17 -0600
On Thu, Oct 20, 2011 at 3:31 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>> I like the behavior of select-active-regions when it is set to t.
>
> [ FWIW, I don't. ;-)  ]

I figured I would set select-active-regions to nil since I never
changed in in earlier versions, but there is an difference to the old
behavior. In 23.3 (and before):

-when one used the mouse to select a region the primary selection was set

-when one set the mark and used movement commands to make an active
region, the primary selection was not set

In 24.0., if select-active-regions is t, both of these actions set the
primary selection. But if select-active-regions is nil, neither of
these actions set the primary selection.

Do you know how I would get the behavior back what it was in 23.3?

Thanks,
Bob




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Thu, 20 Oct 2011 22:40:02 GMT) Full text and rfc822 format available.

Message #62 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Lennart Borgman <lennart.borgman <at> gmail.com>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 16:38:23 -0600
On Thu, Oct 20, 2011 at 4:12 PM, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
> On Thu, Oct 20, 2011 at 3:31 PM, Stefan Monnier
> <monnier <at> iro.umontreal.ca> wrote:
>>> I like the behavior of select-active-regions when it is set to t.
>>
>> [ FWIW, I don't. ;-)  ]
>
> I figured I would set select-active-regions to nil since I never
> changed in in earlier versions, but there is an difference to the old
> behavior. In 23.3 (and before):
>
> -when one used the mouse to select a region the primary selection was set
>
> -when one set the mark and used movement commands to make an active
> region, the primary selection was not set
>
> In 24.0., if select-active-regions is t, both of these actions set the
> primary selection. But if select-active-regions is nil, neither of
> these actions set the primary selection.
>
> Do you know how I would get the behavior back what it was in 23.3?

OK. I see now that setting select-active-regions to 'only' makes it
work the way I'm used to, and 'cw' even works correctly.

Thanks all,
Bob




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Fri, 21 Oct 2011 03:07:02 GMT) Full text and rfc822 format available.

Message #65 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
Cc: Lennart Borgman <lennart.borgman <at> gmail.com>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 23:05:24 -0400
> primary selection. But if select-active-regions is nil, neither of
> these actions set the primary selection.

I think you should report this via M-x report-emacs-bug.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Fri, 21 Oct 2011 03:09:01 GMT) Full text and rfc822 format available.

Message #68 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
Cc: Lennart Borgman <lennart.borgman <at> gmail.com>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Thu, 20 Oct 2011 23:06:41 -0400
> OK. I see now that setting select-active-regions to 'only' makes it
> work the way I'm used to, and 'cw' even works correctly.

Oh, yes, now I remember.  So it's no bug, sorry for the previous email.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Sat, 29 Oct 2011 05:40:02 GMT) Full text and rfc822 format available.

Message #71 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Sat, 29 Oct 2011 13:37:10 +0800
Bob Nnamtrop <bobnnamtrop <at> gmail.com> writes:

> I do not consider the selected word when one does 'cw' an active
> region (in the usual emacs sense). It is a vi construct independent of
> emacs active regions and so it need not honor the
> select-active-regions setting.

Could you test the following patch and see if it does what you expect?

=== modified file 'lisp/emulation/viper-cmd.el'
*** lisp/emulation/viper-cmd.el	2011-07-09 19:32:42 +0000
--- lisp/emulation/viper-cmd.el	2011-10-29 05:36:10 +0000
***************
*** 1387,1393 ****
  	(insert " ")(backward-char 1)))
    (if (= viper-com-point (point))
        (viper-forward-char-carefully))
!   (set-mark viper-com-point)
    (if (eq m-com 'viper-next-line-at-bol)
        (viper-enlarge-region (mark t) (point)))
    (if (< (point) (mark t))
--- 1387,1393 ----
  	(insert " ")(backward-char 1)))
    (if (= viper-com-point (point))
        (viper-forward-char-carefully))
!   (push-mark viper-com-point t)
    (if (eq m-com 'viper-next-line-at-bol)
        (viper-enlarge-region (mark t) (point)))
    (if (< (point) (mark t))
***************
*** 1396,1403 ****
        (viper-backward-char-carefully)) ; give back the newline
    (if (eq viper-intermediate-command 'viper-repeat)
        (viper-change-subr (mark t) (point))
!     (viper-change (mark t) (point))
!     ))
  
  ;; this is invoked by viper-substitute-line
  (defun viper-exec-Change (m-com com)
--- 1396,1403 ----
        (viper-backward-char-carefully)) ; give back the newline
    (if (eq viper-intermediate-command 'viper-repeat)
        (viper-change-subr (mark t) (point))
!     (viper-change (mark t) (point)))
!   (viper-deactivate-mark))
  
  ;; this is invoked by viper-substitute-line
  (defun viper-exec-Change (m-com com)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Sat, 29 Oct 2011 15:29:01 GMT) Full text and rfc822 format available.

Message #74 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
To: Chong Yidong <cyd <at> gnu.org>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Sat, 29 Oct 2011 09:26:57 -0600
On Fri, Oct 28, 2011 at 11:37 PM, Chong Yidong <cyd <at> gnu.org> wrote:
> Bob Nnamtrop <bobnnamtrop <at> gmail.com> writes:
>
>> I do not consider the selected word when one does 'cw' an active
>> region (in the usual emacs sense). It is a vi construct independent of
>> emacs active regions and so it need not honor the
>> select-active-regions setting.
>
> Could you test the following patch and see if it does what you expect?
>
> === modified file 'lisp/emulation/viper-cmd.el'
> *** lisp/emulation/viper-cmd.el 2011-07-09 19:32:42 +0000
> --- lisp/emulation/viper-cmd.el 2011-10-29 05:36:10 +0000
> ***************
> *** 1387,1393 ****
>        (insert " ")(backward-char 1)))
>    (if (= viper-com-point (point))
>        (viper-forward-char-carefully))
> !   (set-mark viper-com-point)
>    (if (eq m-com 'viper-next-line-at-bol)
>        (viper-enlarge-region (mark t) (point)))
>    (if (< (point) (mark t))
> --- 1387,1393 ----
>        (insert " ")(backward-char 1)))
>    (if (= viper-com-point (point))
>        (viper-forward-char-carefully))
> !   (push-mark viper-com-point t)
>    (if (eq m-com 'viper-next-line-at-bol)
>        (viper-enlarge-region (mark t) (point)))
>    (if (< (point) (mark t))
> ***************
> *** 1396,1403 ****
>        (viper-backward-char-carefully)) ; give back the newline
>    (if (eq viper-intermediate-command 'viper-repeat)
>        (viper-change-subr (mark t) (point))
> !     (viper-change (mark t) (point))
> !     ))
>
>  ;; this is invoked by viper-substitute-line
>  (defun viper-exec-Change (m-com com)
> --- 1396,1403 ----
>        (viper-backward-char-carefully)) ; give back the newline
>    (if (eq viper-intermediate-command 'viper-repeat)
>        (viper-change-subr (mark t) (point))
> !     (viper-change (mark t) (point)))
> !   (viper-deactivate-mark))
>
>  ;; this is invoked by viper-substitute-line
>  (defun viper-exec-Change (m-com com)
>
>

Yes, it makes cw work the way I expect even if select-active-regions is t.

Thanks,
Bob




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#9810; Package emacs. (Sun, 30 Oct 2011 03:42:02 GMT) Full text and rfc822 format available.

Message #77 received at 9810 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Bob Nnamtrop <bobnnamtrop <at> gmail.com>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 9810 <at> debbugs.gnu.org
Subject: Re: bug#9810: cw in viper mode clobbers clipboard
Date: Sun, 30 Oct 2011 11:39:22 +0800
Bob Nnamtrop <bobnnamtrop <at> gmail.com> writes:

> Yes, it makes cw work the way I expect even if select-active-regions
> is t.

Thanks.  I've committed the patch.




bug closed, send any further explanations to 9810 <at> debbugs.gnu.org and Bob Nnamtrop <bobnnamtrop <at> gmail.com> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 30 Oct 2011 03:42:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 27 Nov 2011 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 174 days ago.

Previous Next


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