[lug] silly emacs
David
dajo at frii.com
Sat Aug 11 14:43:27 MDT 2001
> > > I'm no lisp guru- so silly emacs question. How can I get emacs to NOT
> > > automatically copy a selection when I select something with the mouse? I
> > > hate that!
> > >
> > >
> > > ljp
> >There is no such thing as a silly question, only silly answers 8-)
> >
> >I may be able to help, I programme Emacs a lot; but I do not
> >understand what you are trying to do because I never use the mouse in
> >Emacs. If you can describe things a little more I shall be happy to
> >look at it.
>
> Sure. Every windblows editor natively does this-> When I select a word by
> clicking on it, it does not copy the word to the clipboard.
> I can then C-v to paste into the selected item. Move to another word,
> highlight it, and paste the same word as before. Whereas emacs, when I
> highlight a word, copies the text into the clipboard 'ring', I can only
> paste what I have in the clipboard only once. Like this-
> C-c: "this phrase"
>
> highlight: "the phrase to be overwritten"
> C-v: "this phrase"
>
> when I try to paste a second time, what gets pasted is
> "the phrase to be overwritten"
> instead of "this phrase"
>
> ljp
I am still not completely clear about this. But here are some things
that come to mind. Tell me if your Emacs does not behave like this.
* In Emacs if I double-leftclick on a word, or if I mark a region by
holding down the left button, dragging, and releasing the button,
then I copy the marked text into the kill-ring (= Win:clipboard).
After doing this I can paste that copied text at point (= left side
of the cursor) by clicking the middle button. I can paste this way
any number of times; and I can move the cursor anywhere and it keeps
on pasting. "Anywhere" includes any other application, such as
Konqueror, Netscape, StarOffice, another Emacs, etc.; however
sometimes the recipient (e.g. StarOffice) seems to require C-v
rather than a middle click.
* If I double-rightclick the current region is deleted. My immediate
reaction is that this seems to me to be asymetric wrt to
double-leftclick, and is not what I would want - how do I know what
is going to disappear? However, I can control deletion by first
selecting a region as described in the bullet above
(double-leftclick or dragging) and then immediately
double-rightclicking.
* What I cannot do is, first copy something, then highlight some other
region and *replace* the region with the copied material. I have
always liked this Windows feature, and I have for a long time now
intended to train Emacs to do that (it is not difficult to
programme, but I have never got a round tuit). However, having
written that, I feel that, since replacement is such a nice
characteristic, someone else must have done it; I am close to
betting that it has been done already. Do you know how to do this
with the mouse?
Here is one way how to do it with the keyboard.
- position point (= left side of cursor) at the beginning of the
copy
- set the mark with C-@
- move to the end of the copy, this can be in either direction from
the beginning of the copy
- run kill-ring-save with M-w
- move to the beginning of the text to be replaced
- set the mark
- move to the end of the text to be replaced
- kill the text with C-w
- select the second item in the kill-ring with C-u 2
- insert the copy with C-y
This may seem long-winded, but my experience is that it is faster
than using the mouse; especially since I have other key bindings
which cut down on the keystrokes.
* What you want is to highlight the region, use C-c to copy it,
highlight another region and use C-v to replace one with the other -
is that right? If so, all you need really is a "replace-region"
entry (= C-v) in your menu. In other words actually the C-c is
superfluous (just highlighting the region copies it, and anyway, in
Emacs, C-c is a *very* bad choice since C-c is reserved for other
things); however, having highlit the region for replacement, which
puts *that* text into the kill-ring, you want to yank the second
entry. I still cannot help but think that there is another way; but
I do not know it if there is.
Ok, you have spurred me into doing the coding; I shall post it
when it is done. In the meantime let me know if I am off-base wrt
what you want.
In conclusion, with regard to this topic Emacs is somewhat like Linux:
you can make it do all sorts of thing, but you have to read about it
first, understand the topic and then do the implementation. You might
try reading the sections on "Important Text-Changing Commands" in the
Info entry for Emacs.
dajo
More information about the LUG
mailing list