Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy/paste slowness with osx configuration layer in terminal #2049

Closed
fedragon opened this issue Jun 18, 2015 · 22 comments
Closed

Copy/paste slowness with osx configuration layer in terminal #2049

fedragon opened this issue Jun 18, 2015 · 22 comments
Labels
- Forum - Kills Kittens (=^-^=) macOS stale marked as a stale issue/pr (usually by a bot) Terminals

Comments

@fedragon
Copy link

Hi,
I recently installed Spacemacs and I'm very happy with it but I have some issues with the osx configuration layer, when running from terminal: if I enable it, any copy/paste operation becomes very slow (2-3 seconds). On the other hand, without osx layer, clipboard-kill-region or clipboard-yank execute instantly.
I'm running Spacemacs in Yosemite from iTerm2, inside or outside tmux (it does not seem to make a difference on this regard). As I mentioned, I don't have this issue with the GUI app.

@syl20bnr Thank you for creating Spacemacs by the way, it's amazing!

@fedragon fedragon changed the title Copy/paste slowness with osx configuration layer Copy/paste slowness with osx configuration layer in terminal Jun 18, 2015
@syl20bnr
Copy link
Owner

This is slow right from the start or does it become slow after some time ?

@fedragon
Copy link
Author

Hi @syl20bnr,
it is slow from the start.
Here are my software versions and what I already tried, I hope it will give you some more handle on this:

Emacs: 24.5.1 (installed via brew install emacs-mac)
iTerm2: 2.9.20150616-nightly (I also tried running in Terminal, the issue is still there)
Spacemacs: master branch (I also tried develop, the issue is still there)

I tried to remove as much as possible from my .spacemacs and I can still reproduce the issue with only:

dotspacemacs-configuration-layers
'(
     emacs-lisp
     osx
     )

@antonyshchenko
Copy link
Contributor

@fedragon, I've had this problem and the solution for me was to use osx-clipboard package.

Add osx-clipboard to packages list in your packages.el and then:

(defun <your private layer name>/init-osx-clipboard ()
  (use-package osx-clipboard
    :config
    (progn
      (osx-clipboard-mode +1)
      (diminish 'osx-clipboard-mode))))

After this you can use regular VIM key-bindings for pasting (p in normal mode and C-r in insert mode). Cmd-v is still slow, though.

@fedragon
Copy link
Author

thank you @env0der I will try this as soon as I can!

@fedragon
Copy link
Author

Uhm I get Could not load osx-clipboard-mode at startup. Do you maybe have any clue why?

@antonyshchenko
Copy link
Contributor

@fedragon did you add it to list of packages in packages.el?

Take a look at https://github.com/env0der/dotemacs/blob/spacemacs/env0der/packages.el#L27

@fedragon
Copy link
Author

@env0der I figured out the issue, there is a small typo in your example: use-package osx-clipboard-mode should actually be use-package osx-clipboard...

Besides this, it works like a charm! Maybe you could fix your code examples above, in case anybody else needs this :)

Thank you very much again!

@antonyshchenko
Copy link
Contributor

@fedragon, good catch, thanks!

fedragon added a commit to fedragon/dotfiles that referenced this issue Jun 22, 2015
@d12frosted
Copy link
Collaborator

Can't reproduce it even with copying buffer that contains 24337 lines. Copies instantly, pastes instantly. iTerm2, Terminal.app. But El Capitan.

@fedragon
Copy link
Author

@d12frosted thanks for taking a look! I haven't upgraded to El Capitan yet but I do update spacemacs on a regular basis and I still have this issue... not sure how to give you more context.

@d12frosted
Copy link
Collaborator

@fedragon so pbcopy doesn't work for you as good as osx-clipboard, huh? Looks like pbcopy has richer functionality (and I am not really understand all it's features), while osx-clipboard is very simple and straightforward.

@syl20bnr have you considered using osx-clipboard instead of pbcopy? What are the advantages of the currently used package?

@fedragon
Copy link
Author

@d12frosted looking at the osx-clipboard source code, I would think that it uses pbcopy under the hood:

It sets the variables interprogram-cut-function' and interprogram-paste-function' to thin wrappers around the
"pbcopy" and "pbpaste" command-line programs.

@d12frosted
Copy link
Collaborator

@fedragon yeah, pbcopy and pbpaste are OS X commands. But pbcopy.el uses pbcopy and pbpaste commands as well. Sorry for the confusion about pbcopy as emacs package vs pbcopy as OS X command.

@fedragon
Copy link
Author

@d12frosted no problem, actually thanks for explaining!

@codedmart
Copy link

@fedragon @d12frosted Any changes on this. If I use osx-clipboard and p or C-r as @env0der mentioned paste is instant, but if I use CMD-v it is terribly slow.

@fedragon
Copy link
Author

fedragon commented Dec 2, 2015

@codedmart I'm not using Spacemacs on a daily basis these days so I cannot confirm it unfortunately

@d12frosted
Copy link
Collaborator

@codedmart never use CMD-v in terminal, since (AFAIK) you can't override this shortcut. Which means that text from clipboard will be pasted into terminal avoiding any hooks / configs for text yanking in emacs. It means that any goodies for indentation will not be called and most importantly, pasting huge hunks of text will be slow as hell.

I know that habits are hard to change, but using C-y for pasting is pretty good in terminal, since it work not only in emacs (just try typing something in terminal and then doing C-a, then C-k and then C-y).

@theckman
Copy link
Contributor

I've had the osx layer working for me for nearly 6 months. Only within the past week did this become an issue. The issue persists across restarts of emacs and OS X.

@hooleyhoop
Copy link

this is a bit anecdotal but fwiw.. when i have the osx layer enabled, pasting takes as long as it would take to start a new shell. i.e. if i put something silly in my .zshenv that takes 3 minutes, then pasting in emacs will take 3 minutes.

@paultopia
Copy link

paultopia commented Sep 11, 2017

This just started happening to me. Like today. All of a sudden, out of nowhere, both copy and paste in spacemacs in OSX take forever. And I haven't changed any major configuration---seriously the only thing I can think of that I've done is move some environment variables around.

And for me, it happens in GUI, and happens both with standard osx control-v keybindings and with vim keybindings.

After commenting out the osx layer and restarting the problem resolves.

@theckman
Copy link
Contributor

@paultopia The environment variables may be it. My issue was the same as @hooleyhoop described, my shell was talking awhile to start. I've dramatically reduced my startup time and now copying and pasting is working fine for me.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Forum - Kills Kittens (=^-^=) macOS stale marked as a stale issue/pr (usually by a bot) Terminals
Projects
None yet
Development

No branches or pull requests

8 participants