I am using Mac OS and emacs -nw (the terminal mode).
I don’t know how can I paste things (having been implemented by M-w in emacs -nw) outside the emacs.
I know that the emacs -ns can do it.
Searching the internet and the command C-h b, i find out that method, but it didn’t work out.
(setq x-select-enable-clipboard t)
(setq interprogram-cut-function 'x-select-text)
I don’t know much about the argument of interprogram-cut-function.
Where does the x-select-text come from and what does it mean?
x-select-textis only used if you’re running Emacs in a GUI. (Emacs maps the Mac/Windows pasteboard/clipboard APIs to the X11 model, hence the name). You can always useC-h fto find out more about a function like this one and view its definition if it’s written in elisp.On the Mac, there is no concept of
CLIPBOARDversusPRIMARYselections, so there is no point in settingx-select-enable-clipboard.The whole point of running
emacs -nwis that it doesn’t interact with the windowing system. Why use Emacs in a terminal when there are plenty of graphical Emacsen that work very nicely on the Mac?That said, if you really wanted to hook up terminal Emacs to the Mac pasteboard, you could do something like this: