purcell / emacs.d

An Emacs configuration bundle with batteries included
BSD 2-Clause "Simplified" License
6.85k stars 2.05k forks source link

Copy menu command is disabled when emacs is running in a terminal #769

Open tomb7890 opened 3 years ago

tomb7890 commented 3 years ago

Hello Steve - when using this config with emacs -nw (sans window system), I cannot then use the terminal's edit/copy menu command to copy a selection of text to the clipboard. The menu command becomes greyed out. However, if I quit emacs, then the copy menu command is restored. Or, if I blow away emacs config with rm -rf ~/.emacs.d, copy functionality is restored to emacs sessions.

M-x version says: 'GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu) of 2021-02-08'. I get the emacs package from Homebrew for what that's worth. Problem exhibited on two Linux boxes and on a macbook pro under the iTerm terminal program. Changing Linux terminal applications has no effect on this problem.

Otherwise your config is excellent I really appreciate the work you have put into it. But this clipboard issue is a nuisance to me, I wonder if you would take a look.

Thanks

purcell commented 3 years ago

Yeah, I think that's because the terminal emacs app itself supports clipboard terminal escape sequences. IIRC I've turned off xterm-mouse-mode in terminals previously so that when I select some text with the mouse, it's the terminal emulator controlling the highlight and selection rather than Emacs. But then of course there's no seamless copy/paste across Emacs/OS with Emacs keys.

purcell commented 3 years ago

Maybe you'd like to try the osx-clipboard package and see if it helps.

purcell commented 3 years ago

(For my part, I rarely use Emacs in a terminal, preferring a long-running GUI app. )

purcell commented 3 years ago

Also the clipmon package looks promising, for Linux + MacOS support.

tomb7890 commented 3 years ago

Thanks Steve -- I've found a crude workaround by just commenting out (xterm-mouse-mode 1) in lisp/init-xterm.el.

Is there a way this could be made an option in a local dotfile or the like?

purcell commented 3 years ago

Thanks Steve -- I've found a crude workaround by just commenting out (xterm-mouse-mode 1) in lisp/init-xterm.el.

Yeah, that would do it.

Is there a way this could be made an option in a local dotfile or the like?

I need to think about whether the current default is the best, but in the meantime you'd need to locally modify the config, or maybe putting (remove-hook 'after-make-console-frame-hooks 'sanityinc/console-frame-setup) in init-local.el would do the trick.

tomb7890 commented 3 years ago

Thanks Steve. Sounds like you have a better solution in mind so I will leave this open for now, but in the mean time, yes your suggestion of (remove-hook 'after-make-console-frame-hooks 'sanityinc/console-frame-setup) does the trick.

Maybe will be of use to other terminal users out there who are fans of your work. I can't be the only one!