0

I have questions regarding keybindings and cut & paste for Emacs and OSX v10.14.3. I'm hoping there are some Emacs users with similar configurations that can provide guidance as to be productive on the platform.

I'm invoking Emacs v25.1.1 over an ssh session into a Debian VM. This is for security purposes. There are two invocation instances of Emacs over ssh:

  • (a) with X forwarding enabled using X-Quartz
  • (b) without X forwarding in a Terminal.app.

Session (b) works as expected, option maps correctly to Meta. The only issue is the lack of pbcopy and pbpaste. This makes it challenging to cut and paste between the Terminal.app and Mac OS apps. I suspect a reverse ssh session could be used to accomplish this, however this opens up security issues. For now, my cut and paste solution is a buffer written to a shared VM folder.

I notice that session (a) has problems with the Meta key. Command-X is interpreted as M-x, however when I try Command-w, instead of M-w 'kill-ring-save', OS X has this mapped to "close the current window". In regards to reclaiming the Option keys under X-Quartz I noted that by default an X-Quartz xterm session into Debian, showkey -a does not map the Option keys at all. I had to open up X-Quartz preferences and in the input tab check 'Option keys send Alt_L and Alt_R... instead of Mode_switch'. I was confused that Mode_switch wasn't detected in the first place.

To finish fixing the session (a) situation, I modified Emacs global keybindings as follows:

(global-set-key (kbd "A-w") 'kill-ring-save)

Now Option-w saves to the kill ring. Is there a way to accomplish this universally for the Alt key vs redefining every function?

I thought I found the solution above, however a new problem is presented as a result of the above action. Cut and paste between Emacs X-Quartz session and Mac OS apps no longer works. I determined this issue is caused when enabling 'Option keys send Alt_L and Alt_R' option in X-Quartz preferences.

Does anyone have suggestions on getting a good set of key bindings and copy/paste running in similar configuration? Appreciate your guidance!

Thanks

I have read the following related articles: EmacsForMacOS - mostly covers Emacs running on OS X, not a terminal session. xsel xclip tmux wrapper copy and paste with emacs

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.