3

I'm looking for a way to copy to clipboard from emacs without passing through the kill-ring, moving the marker or using the mouse.
If I use x-select-enable-primary and x-select-enable-clipboard, I can unite the clipboard and the kill-ring, but it is really great to have two kill-rings (ring + clipboard) available and I don't want to give it up (scrolling between kill-ring items is less fun than having two rings).
I'm using emacs 25.1 on linux (not OSX) and also limited on what I can add to my emacs (it is on a secured web).

Anyone knows if it is even possible?
p.s.
My ultimate goal is to be able to catch the entire word/ phrase the marker is currently on and copy it to clipboard. I plan doing it by taking code bits from ffap (find-file-at-point), but if such a thing already exists, this can be a much better solution to this question...

A testcase:
/this/is/a_filname/that_might/appear/in-my.logs
I want to be able to put the marker anywhere on the name (say, the "g" in the middle) and grab the entire thing into my clipboard without overwriting my killring, moving the marker or using the mouse.

  • 2
    Take a look at interprogram-cut-function and interprogram-paste-function – npostavs May 11 '17 at 12:17
  • 1
    What @npostavs said. You can, BTW, also have two rings of selections by using the secondary selection (see library second-sel.el, and if you use browse-kill-ring with library browse-kill-ring+.el then you can have any number of rings of selections. – Drew May 11 '17 at 14:48
  • @npostavs - thanks, this is exactly what I had in mind! I'll start working on the target function in a couple of days (according to pressure at work) and will close this question when done. maybe even post my function (if it is not offending rules from my work place and of the forum) – user2141046 May 14 '17 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.