syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.64k stars 4.89k forks source link

Evil commands involving yank (x,dd,yy,cw, ...) cause Emacs to hang or error #8359

Closed coreysharris closed 2 years ago

coreysharris commented 7 years ago

Description :octocat:

Basic evil commands involving yanking hang or cause errors.

The error referred to in the backtrace was caused by pressing 'x' to delete the current character. Other commands that seem to cause problems include dd, yy, cw, etc.

This does NOT happen every time. Also, I am using emacs-snapshot on Ubuntu, but the hanging would also happen in Emacs 25. (It may be relevant that this is running in the Windows Subsystem for Linux using XMing with Ubuntu 14.04)

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart: An Backtrace buffer opens indicated "Timed out waiting for reply from selection owner"

Expected behaviour: :heart: :smile: The evil command should be executed without hanging or giving an error.

System Info :computer:

Backtrace :paw_prints:

Debugger entered--Lisp error: (error "Timed out waiting for reply from selection owner")
  x-get-selection-internal(CLIPBOARD UTF8_STRING nil nil)
  #[1026 "\300$\207" [x-get-selection-internal] 9 "\n\n(fn SELECTION-SYMBOL TARGET-TYPE &optional TIME-STAMP TERMINAL)"](CLIPBOARD UTF8_STRING)
  apply(#[1026 "\300$\207" [x-get-selection-internal] 9 "\n\n(fn SELECTION-SYMBOL TARGET-TYPE &optional TIME-STAMP TERMINAL)"] (CLIPBOARD UTF8_STRING))
  gui-backend-get-selection(CLIPBOARD UTF8_STRING)
  gui-get-selection(CLIPBOARD UTF8_STRING)
  gui--selection-value-internal(CLIPBOARD)
  gui-selection-value()
  kill-new(#("`" 0 1 (fontified t wrap-prefix #("  " 0 2 (fontified t wrap-prefix #("  " 0 2 (fontified t)))) face (font-latex-italic-face))))
  evil-yank-characters(3903 3904 nil nil)
  evil-yank(3903 3904 exclusive nil nil)
  evil-delete(3903 3904 exclusive nil)
  evil-delete-char(3903 3904 exclusive nil)
  funcall-interactively(evil-delete-char 3903 3904 exclusive nil)
  call-interactively(evil-delete-char nil nil)
  command-execute(evil-delete-char)
braham-snyder commented 7 years ago

may or may not be related: https://github.com/syl20bnr/spacemacs/issues/8315

olejorgenb commented 7 years ago

Do the backtrace appear immediately or do emacs hang (using 100% cpu) a while?

I experience something very similar to your description (hanging) using GNU Emacs 24.5.2 and spacemacs fresh from develop c17722ba96048d3d88419a0d812b2214f3c05d30)

Miciah commented 6 years ago

Possibly the same issue as #6650 (but on a different OS). If you specify the blackhole register by first pressing "_ and then use one of the commands, do you still see the problem?

deisi commented 5 years ago

Hey I think I have a very similar situation. Here is my backtrace:

Debugger entered--Lisp error: (quit)
  x-get-selection-internal(CLIPBOARD UTF8_STRING nil nil)
  #f(compiled-function (selection-symbol target-type &optional time-stamp terminal) #<bytecode 0x4fc2ed>)(CLIPBOARD UTF8_STRING)
  apply(#f(compiled-function (selection-symbol target-type &optional time-stamp terminal) #<bytecode 0x4fc2ed>) (CLIPBOARD UTF8_STRING))
  gui-backend-get-selection(CLIPBOARD UTF8_STRING)
  gui-get-selection(CLIPBOARD UTF8_STRING)
  gui--selection-value-internal(CLIPBOARD)
  gui-selection-value()
  kill-new(#("cite:Hsieh18780" 0 5 (fontified t org-category "manuscript" help-echo (lambda (window object position) (when org-ref-show-citation-on-enter (save-excursion (goto-char position) (let ((s ...)) (with-temp-buffer (insert s) (fill-paragraph) (buffer-string)))))) htmlize-link (:uri "cite:Hsieh18780") face org-ref-cite-face mouse-face highlight keymap (keymap (S-up . org-ref-sort-citation-link) (S-right lambda nil (interactive) (org-ref-swap-citation-link 1)) (S-left lambda nil (interactive) (org-ref-swap-citation-link -1)) (C-right . org-ref-next-key) (C-left . org-ref-previous-key) (16777337 lambda nil "Paste key at point. Assumes the first thing in the killring is a key." (interactive) (org-ref-insert-key-at-point (car kill-ring))) (16777303 lambda nil "Copy all the keys at point." (interactive) (kill-new (org-element-property :path (org-element-context)))) (16777335 lambda nil (interactive) (kill-new (car (org-ref-get-bibtex-key-and-file)))) (16777318 lambda nil (interactive) (save-excursion (org-ref-open-citation-at-point) (kill-new (org-ref-format-bibtex-entry-at-point)))) (16777319 . org-ref-google-scholar-at-point) (16777317 lambda nil "Email entry at point" (interactive) (org-ref-open-citation-at-point) (org-ref-email-bibtex-entry)) (16777315 . org-ref-wos-citing-at-point) (16777330 . org-ref-wos-related-at-point) (16777326 . org-ref-open-notes-at-point) (16777328 . org-ref-open-pdf-at-point) (16777333 . org-ref-open-url-at-point) (16777314 . org-ref-open-citation-at-point) (follow-link . mouse-face) (mouse-3 . org-find-file-at-mouse) (mouse-2 . org-open-at-mouse)) font-lock-multiline t) 5 14 (fontified t face org-ref-cite-face mouse-face highlight keymap (keymap (S-up . org-ref-sort-citation-link) (S-right lambda nil (interactive) (org-ref-swap-citation-link 1)) (S-left lambda nil (interactive) (org-ref-swap-citation-link -1)) (C-right . org-ref-next-key) (C-left . org-ref-previous-key) (16777337 lambda nil "Paste key at point. Assumes the first thing in the killring is a key." (interactive) (org-ref-insert-key-at-point (car kill-ring))) (16777303 lambda nil "Copy all the keys at point." (interactive) (kill-new (org-element-property :path (org-element-context)))) (16777335 lambda nil (interactive) (kill-new (car (org-ref-get-bibtex-key-and-file)))) (16777318 lambda nil (interactive) (save-excursion (org-ref-open-citation-at-point) (kill-new (org-ref-format-bibtex-entry-at-point)))) (16777319 . org-ref-google-scholar-at-point) (16777317 lambda nil "Email entry at point" (interactive) (org-ref-open-citation-at-point) (org-ref-email-bibtex-entry)) (16777315 . org-ref-wos-citing-at-point) (16777330 . org-ref-wos-related-at-point) (16777326 . org-ref-open-notes-at-point) (16777328 . org-ref-open-pdf-at-point) (16777333 . org-ref-open-url-at-point) (16777314 . org-ref-open-citation-at-point) (follow-link . mouse-face) (mouse-3 . org-find-file-at-mouse) (mouse-2 . org-open-at-mouse)) help-echo (lambda (window object position) (when org-ref-show-citation-on-enter (save-excursion (goto-char position) (let ((s ...)) (with-temp-buffer (insert s) (fill-paragraph) (buffer-string)))))) htmlize-link (:uri "cite:Hsieh18780") font-lock-multiline t) 14 15 (fontified t rear-nonsticky (mouse-face highlight keymap invisible intangible help-echo org-linked-text htmlize-link) face org-ref-cite-face mouse-face highlight keymap (keymap (S-up . org-ref-sort-citation-link) (S-right lambda nil (interactive) (org-ref-swap-citation-link 1)) (S-left lambda nil (interactive) (org-ref-swap-citation-link -1)) (C-right . org-ref-next-key) (C-left . org-ref-previous-key) (16777337 lambda nil "Paste key at point. Assumes the first thing in the killring is a key." (interactive) (org-ref-insert-key-at-point (car kill-ring))) (16777303 lambda nil "Copy all the keys at point." (interactive) (kill-new (org-element-property :path (org-element-context)))) (16777335 lambda nil (interactive) (kill-new (car (org-ref-get-bibtex-key-and-file)))) (16777318 lambda nil (interactive) (save-excursion (org-ref-open-citation-at-point) (kill-new (org-ref-format-bibtex-entry-at-point)))) (16777319 . org-ref-google-scholar-at-point) (16777317 lambda nil "Email entry at point" (interactive) (org-ref-open-citation-at-point) (org-ref-email-bibtex-entry)) (16777315 . org-ref-wos-citing-at-point) (16777330 . org-ref-wos-related-at-point) (16777326 . org-ref-open-notes-at-point) (16777328 . org-ref-open-pdf-at-point) (16777333 . org-ref-open-url-at-point) (16777314 . org-ref-open-citation-at-point) (follow-link . mouse-face) (mouse-3 . org-find-file-at-mouse) (mouse-2 . org-open-at-mouse)) help-echo (lambda (window object position) (when org-ref-show-citation-on-enter (save-excursion (goto-char position) (let ((s ...)) (with-temp-buffer (insert s) (fill-paragraph) (buffer-string)))))) htmlize-link (:uri "cite:Hsieh18780") font-lock-multiline t)))
  evil-yank-characters(22430 22445 nil nil)
  evil-yank(22430 22445 inclusive nil nil)
  evil-delete(22430 22445 inclusive nil)
  evil-delete-char(22430 22445 inclusive nil)
  evil-org-delete-char(1 22430 22445 inclusive nil)
  funcall-interactively(evil-org-delete-char 1 22430 22445 inclusive nil)
  call-interactively(evil-org-delete-char nil nil)
  command-execute(evil-org-delete-char)

It hapend while I was trying to delete a character with x. However I had a similar incidence before, where it went away magically but showed the following on the *Messages* buffer:

gui-get-selection: (error "Timed out waiting for reply from selection owner")

I'm on spaces develop branch 9865e77313646a0da2a49bba986d2090b6d4bd74 updated all packages today and use emacs 26.1. The layers I load are:

     php
     csv
     html
     rust
     javascript
     yaml
     helm
     auto-completion
     emacs-lisp
     git
     markdown
     org
     bibtex
     latex
     (spell-checking :variables
                     spell-checking-enable-auto-dictionary nil)
     syntax-checking
     version-control
     python
     ipython-notebook
coventry commented 5 years ago

Came here with a similar issue. In my case, FWIW, it seems to be a problem with the clipboard itself, not emacs. I also see delays when I try to paste into chromium.

afcady commented 5 years ago

I had this same issue and I figured out how to reproduce it. I don't think it's a bug in spacemacs, though it may be a bug in emacs.

Here is how to reproduce the bug. Open a firefox window, select something, and then in a terminal type killall -STOP firefox-bin. Now try to delete a line in an emacs buffer. It hangs -- I presume, it is waiting for firefox-bin to provide the content of the buffer, so that it can save it in the kill ring, so that it can overwrite it. But firefox-bin will never provide the content, so that it hangs forever. Running killall -CONT firefox-bin unhangs emacs.

You might have to copy with ctrl-c instead of just selecting with mouse. I have (setq x-select-enable-primary t) set in my config.

Compro-Prasad commented 4 years ago

@afcady Is that reported in the Emacs Mailing List?

Compro-Prasad commented 4 years ago

@afcady Are you sure its related to other processes only? Can it be reproduced alone in Emacs? @duianto @bmag

duianto commented 4 years ago

When I follow afcady's reproduction steps, with (setq x-select-enable-primary t) in my user-config and call the killall stop command with a selection in either:

When dd is pressed, then Spacemacs stops responding for about 5 second, then the same error message as the OP appears:

gui-get-selection: (error "Timed out waiting for reply from selection owner")

After that dd or selecting etc. seems to work as expected. (that's before calling the killall cont command)

I was unable to reproduce freezing or the error message with just Emacs and the evil package.

GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.7) of 2019-04-11, modified by Debian
Evil version 1.2.14

System Info :computer:

afcady commented 4 years ago

I didn't report anything anywhere but here.

github-actions[bot] commented 3 years ago

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!

seantalts commented 3 years ago

This is still an issue for me - did anyone figure out a workaround?

afcady commented 3 years ago

In a newer emacs, I also get gui-get-selection: (error "Timed out waiting for reply from selection owner") after a few seconds.

It looks to me like the bug in gui-get-selection has been fixed (to the extent possible) by adding this timeout.

@seantalts what's your emacs version?

github-actions[bot] commented 2 years ago

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!

Tokubara commented 1 year ago

This is still an issue for me, as I posted here

oaraque commented 2 months ago

I have had this problem for several months now. It happens sometimes, and then Spacemacs becomes unusable.

Fortunately I have discovered this, and it actually helps. If I see the Timed out waiting for reply from selection owner message, I just copy anything in other application and it solves.