[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to speed up cutting & pasting from/to emacs?
From: |
Raffaele Ricciardi |
Subject: |
Re: How to speed up cutting & pasting from/to emacs? |
Date: |
Sun, 12 Jul 2015 17:24:13 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 |
Here is a possible solution, complete with code. I have not tested it,
but I have solved a similar problem recently. Anyway, use it at your
own risk, as they say.
You could write a script that transfers the current selection to the
clipboard and then asks Emacs to paste it. Then you would bind this
script to a keyboard shortcut. This way, you could select the text to
copy and then press that keyboard shortcut to paste it into Emacs.
I will assume that you have both the `xsel` and the `xbindkeys` programs
on your system. Apparently, there are two different programs whose name
is `xsel` around... Mine is version 1.2.0 by Conrad Parker. I will also
assume that your Emacs instance is running as an *edit server*.
Let's call our script ~/bin/emacs-yank:
--8<---------------cut here---------------start------------->8---
#!/bin/sh
# Copy the current selection to the clipboard.
xsel --output | xsel --input --clipboard
# Ask Emacs to paste from the clipboard.
emacsclient --no-wait --eval "(yank)"
--8<---------------cut here---------------end--------------->8---
Remember to make the script executable:
chmod +x ~/bin/emacs-yank
Here is the `~/.xbindkeysrc.scm` file to tell `xbindkeys` to bind
Windows+Alt+E to the above script (of course, you must adjust the
absolute path to the script):
--8<---------------cut here---------------start------------->8---
(xbindkey '(mod4 alt e) "/home/lele/bin/emacs-yank")
--8<---------------cut here---------------end--------------->8---
Remember to start `xbindkeys`:
xbindkeys
That's all. Good luck.
- Re: How to speed up cutting & pasting from/to emacs?, (continued)
- Re: How to speed up cutting & pasting from/to emacs?, Emanuel Berg, 2015/07/12
- Re: How to speed up cutting & pasting from/to emacs?, Ian Zimmerman, 2015/07/12
- Re: How to speed up cutting & pasting from/to emacs?, Sharon Kimble, 2015/07/12
- Re: How to speed up cutting & pasting from/to emacs?, Emanuel Berg, 2015/07/12
- Re: How to speed up cutting & pasting from/to emacs?, Emanuel Berg, 2015/07/12
- Re: How to speed up cutting & pasting from/to emacs?, Sharon Kimble, 2015/07/13
- Re: How to speed up cutting & pasting from/to emacs?, Emanuel Berg, 2015/07/13
- Re: How to speed up cutting & pasting from/to emacs?, Emanuel Berg, 2015/07/26
- Re: How to speed up cutting & pasting from/to emacs?, Jorge A. Alfaro-Murillo, 2015/07/13
Re: How to speed up cutting & pasting from/to emacs?, Yuri Khan, 2015/07/12
Re: How to speed up cutting & pasting from/to emacs?,
Raffaele Ricciardi <=