all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Raffaele Ricciardi <rfflrccrd@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to speed up cutting & pasting from/to emacs?
Date: Sun, 12 Jul 2015 17:24:13 +0200	[thread overview]
Message-ID: <d0ff4tF1r3nU1@mid.individual.net> (raw)
In-Reply-To: <mailman.6773.1436703421.904.help-gnu-emacs@gnu.org>

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.


       reply	other threads:[~2015-07-12 15:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.6773.1436703421.904.help-gnu-emacs@gnu.org>
2015-07-12 15:24 ` Raffaele Ricciardi [this message]
2015-07-12 12:17 How to speed up cutting & pasting from/to emacs? Sharon Kimble
2015-07-12 16:11 ` Ian Zimmerman
2015-07-12 17:28   ` Sharon Kimble
     [not found]   ` <mailman.6791.1436722135.904.help-gnu-emacs@gnu.org>
2015-07-12 17:35     ` Rusi
2015-07-12 18:20       ` Sharon Kimble
2015-07-12 18:24       ` Ian Zimmerman
2015-07-12 17:13 ` Emanuel Berg
2015-07-12 18:02   ` Ian Zimmerman
2015-07-12 18:58   ` Sharon Kimble
2015-07-13  0:32     ` Emanuel Berg
2015-07-13  0:51       ` Emanuel Berg
2015-07-13 15:05       ` Sharon Kimble
2015-07-13 23:55         ` Emanuel Berg
2015-07-27  1:36         ` Emanuel Berg
2015-07-13 15:30     ` Jorge A. Alfaro-Murillo
2015-07-12 17:35 ` Yuri Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d0ff4tF1r3nU1@mid.individual.net \
    --to=rfflrccrd@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.