From: Hugo Heden <hugoheden@gmail.com>
To: Nikolaj Schumacher <me@nschum.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Emacs (in terminal): keeping clipboard synchronized with the system global one?
Date: Fri, 6 Mar 2009 22:55:02 +0100 [thread overview]
Message-ID: <2bdf908c0903061355n72c673adrc5a591542ca02e65@mail.gmail.com> (raw)
In-Reply-To: <m2hc26dd5b.fsf@nschum.de>
On Fri, Mar 6, 2009 at 1:55 PM, Nikolaj Schumacher <me@nschum.de> wrote:
> Hugo Heden <hugoheden@gmail.com> wrote:
>
>> (global-set-key "\M-w" 'copy-to-x-clipboard)
>>
>> Now, I would like to refine this so that M-w is bound to
>> "copy-to-x-clipboard" whenever emacs is run within a terminal
>
> (unless (window-system)
> (global-set-key "\M-w" 'copy-to-x-clipboard))
Ah, that would be:
(defun copy-to-x-clipboard ()
(interactive)
(with-current-buffer (current-buffer)
(call-process-region (region-beginning) (region-end) "xsel" nil 0
nil "-p" "-i")))
(unless (window-system)
(global-set-key "\M-w" 'copy-to-x-clipboard))
Thanks, that works excellently!
How would I write a corresponding defun that uses xsel when it does
*kill-region*, C-w?
Can I reuse the copy-to-x-clipboard function, and write something like
this (if you see what I mean):
(unless (window-system)
( global-set-key "\C-w"
copy-to-x-clipboard
and-then
erase-region
))
?
Thanks in advance
Hugo Heden
next prev parent reply other threads:[~2009-03-06 21:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-06 12:33 Emacs (in terminal): keeping clipboard synchronized with the system global one? Hugo Heden
2009-03-06 12:55 ` Nikolaj Schumacher
2009-03-06 21:55 ` Hugo Heden [this message]
2009-03-08 10:05 ` Hugo Heden
[not found] ` <mailman.2690.1236506736.31690.help-gnu-emacs@gnu.org>
2009-03-08 14:37 ` Miles Bader
2009-03-08 19:27 ` Hugo Heden
[not found] ` <mailman.2725.1236540431.31690.help-gnu-emacs@gnu.org>
2009-03-08 23:13 ` Miles Bader
2009-03-10 20:22 ` Hugo Heden
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=2bdf908c0903061355n72c673adrc5a591542ca02e65@mail.gmail.com \
--to=hugoheden@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=me@nschum.de \
/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.