Proper use of the clipboard

Titus von der Malsburg malsburg at posteo.de
Mon Dec 23 11:59:25 CET 2013


frank-fischer at shadow-soft.de writes:
> I remember that we fought a little bit with this selection stuff. It
> gets even more complicated because MacOS, Windows and X all behave
> differently and Emacs (and Evil) has to deal with all of them.

Frank, thank you for this patch, this looks very promising.  I just
tested it with the customizations listed below and it works pretty much
as I think it should: selecting text via the mouse of visual mode copies
the active region to primary but not to the clipboard.  Yanking or
deleting text copies it to the clipboard and to primary. 

    (setq x-select-enable-primary t)
    (setq x-select-enable-clipboard t)
    (setq select-active-regions t)
    (setq mouse-drag-copy-region t)

However, I also agree with Jason: the current behaviour of Evil seems to
be consistent with Vim (when I set x-select-enable-clipboard to nil) and
it allows me to copy text to the clipboard by sending it to the +
register.  While I think that compatibility is important, it's precisely
the possibility to deviate from Vim's behavior what makes Evil so
useful, at least for me.  Thus, the best solution would perhaps be to
make this configurable: there should be a way to get Vim's default
behavior.  Alternatively, it should be possible to send yanked and
deleted text to the + register by default.  I guess this would require a
different solution than the one in the patch.  Namely one in which yank
and delete operators are modified instead of
evil-visual-update-x-selection.

A special case is evil-delete-char (bound to x in normal mode).  If I
use that command, a single character is copied to the clipboard.  My
guess is that this is hardly ever desired: why would I type C-v for
pasting a single character in another application when I could simply
type that character directly?  Thus it would perhaps be better to
exclude evil-delete-char from the commands that copy to the clipboard,
unless the user explicitely asks for it by specifying the + register.

  Titus



More information about the implementations-list mailing list