0

I know I can kill current line text by using Ctrl+k in Terminal(Terminal.app). I want to know how to yank it to Emacs.

For example:

|------+-----------------+--------------|
| step | action          | where        |
|------+-----------------+--------------|
|    1 | Type "ABC"      | Terminal.app |
|    2 | C-a             | Terminal.app |
|    3 | C-k             | Terminal.app |
|    4 | Switch to Emacs |              |
|    5 | C-y             | Emacs        |
|------+-----------------+--------------|

In above example step 5, I just want Emacs paste "ABC" into its emacs-buffer. Help me.

Oh, I forgot to say that I do NOT want to select text by mouse and press Command-c.

Kei Minagawa
  • 4,395
  • 3
  • 25
  • 43
  • Is using `shell-mode` and option ? – Ehvince Feb 20 '16 at 15:33
  • @Ehvince: I want to paste text killed in "Terminal.app(not Emacs `shell-mode`)" to "Emacs". It's not direct answer though, using `shell-mode` may be one of the approach to my question. – Kei Minagawa Feb 20 '16 at 16:12
  • Ctrl-k in the terminal is handled by the process running in the terminal, not by `Terminal.app`. There is no cross-process clipboard in the terminal as such (i.e. the VT102 that your shell runs within). – molbdnilo Feb 21 '16 at 09:28
  • @molbdnilo: I didn't know that. Then it seems not possible to set osx's clipboard by Ctrl-k in pure OS X Terminal.app. So using `shell-mode` In Emacs seems realistic answer. – Kei Minagawa Feb 21 '16 at 23:07
  • If shell-mode is an option then super-cool ! I use exactly for that: everything is all text, I can use Emacs as always to parse the result of my shell commands. Super-useful when I run tests, compilations, etc. See http://wikemacs.org/wiki/Shell – Ehvince Feb 21 '16 at 23:44

1 Answers1

0

There may be a better way but I get a line from the Terminal into emacs using echo and pbcopy like this:

Type your text
> ABCD 
Ctrl-A echo
> echo ABCD
Ctrl-E | pbcopy ENTER
> echo ABCD | pbcopy 

Now you can paste into emacs

justinhj
  • 11,147
  • 11
  • 58
  • 104