DarwinAwardWinner / ido-completing-read-plus

Fancy completion all over Emacs, not just for buffers and files.
GNU General Public License v3.0
241 stars 31 forks source link

Reproducable freeze with org-mode #152

Closed kentprimrose closed 5 years ago

kentprimrose commented 6 years ago

I seem to only have this problem with org mode, but it's consistently reproducible.

Running Emacs 25.3.1 on MacOS 10.13.4 with org-mode 9.1.9 and ido-completing-read+-version 4.7

When I open an org file, move to a heading and execute org-refile, I receive a list of target files this section could be moved to. This is fine. If I type a string that does NOT match any targets, I can backspace (via the "delete" key) just fine. However, if there is a match, the first time a backspace is entered, emacs freezes after the backspace is processed (i.e. the prior character is removed). Emacs is entirely unresponsive at this point and must be killed and re-started.

This is very frustrating since version 9 of org-mode dropped support for ido (see https://orgmode.org/Changes_old.html#org168013f) making it necessary to use ido-completing-read+ to restore this capability.

My ido configuration is:

(use-package ido
  :ensure t
  :config
  (setq
   ido-file-extensions-order
   '(".org" ".txt" ".py" ".emacs" ".xml" ".el" ".ini" ".cfg" ".cnf")
   )

  (ido-mode 1)
  (ido-everywhere 1)

  (use-package ido-completing-read+
    :ensure t
    :config
    (ido-ubiquitous-mode 1))

  (use-package smex
    :ensure t
    :config
    (smex-initialize)

    :bind
    ("M-x" . smex)
    ("M-X" . smex-major-mode-commands)
    ("C-c C-c M-x" . execute-extended-command))) ; old M-x
DarwinAwardWinner commented 6 years ago

I assume that mashing control+G doesn't manage to break out of the frozen state? And hence there's no way to get a backtrace from this error?

kentprimrose commented 6 years ago

No, control+g does nothing. ("control+G" with a shift for a capital G doesn't either.) I have to kill emacs - either via a "sigterm" from a terminal window, or via "Force Quit" from the apple menu bar.

Is there a way I can generate more error information? I tried just running "emacs" from a terminal window, hoping errors would be reported there, but no luck.

kentprimrose commented 6 years ago

Here's a clue though: I noticed that causing the freeze by backspacing immediately after typing one character left Emacs in a state where a sigterm from a terminal unfroze rather than closing Emacs (strange). Using this I was able to M-x "toggle-debug-on-quit" (per instructions at https://emacs.stackexchange.com/questions/506/debugging-a-frozen-emacs) before freezing, and Ctrl-g after the sigterm removed the freeze. This resulted in the debugger information below. Does this help?


redisplay_internal\ \(C\ function\)()
  read-from-minibuffer("Tags: " nil (keymap keymap (4 . ido-magic-delete-char) (6 . ido-magic-forward-char) (2 . ido-magic-backward-char) (63 . ido-completion-help) (left . ido-prev-match) (right . ido-next-match) (0 . ido-restrict-to-matches) (27 keymap (32 . ido-take-first-match)) (67108896 . ido-restrict-to-matches) (26 . ido-undo-merge-work-directory) (20 . ido-toggle-regexp) (67108908 . ido-prev-match) (67108910 . ido-next-match) (19 . ido-next-match) (18 . ido-prev-match) (16 . ido-toggle-prefix) (13 . ido-exit-minibuffer) (10 . ido-select-text) (32 . ido-complete-space) (9 . ido-complete) (5 . ido-edit-input) (3 . ido-toggle-case) (1 . ido-toggle-ignore) keymap (menu-bar keymap (minibuf "Minibuf" keymap (previous menu-item "Previous History Item" previous-history-element :help "Put previous minibuffer history element in the minibuffer") (next menu-item "Next History Item" next-history-element :help "Put next minibuffer history element in the minibuffer") (isearch-backward menu-item "Isearch History Backward" isearch-backward :help "Incrementally search minibuffer history backward") (isearch-forward menu-item "Isearch History Forward" isearch-forward :help "Incrementally search minibuffer history forward") (return menu-item "Enter" exit-minibuffer :key-sequence "
" :help "Terminate input and exit minibuffer") (quit menu-item "Quit" abort-recursive-edit :help "Abort input and exit minibuffer") "Minibuf")) (10 . exit-minibuffer) (13 . exit-minibuffer) (7 . abort-recursive-edit) (C-tab . file-cache-minibuffer-complete) (9 . self-insert-command) (XF86Back . previous-history-element) (up . previous-line-or-history-element) (prior . previous-history-element) (XF86Forward . next-history-element) (down . next-line-or-history-element) (next . next-history-element) (27 keymap (114 . previous-matching-history-element) (115 . next-matching-history-element) (112 . previous-history-element) (110 . next-history-element))) nil org-tags-history)
  ido-read-internal(list "Tags: " org-tags-history nil nil nil)
  #[(prompt choices &optional _predicate require-match initial-input hist def _inherit-input-method) "\306\211\211\307������\310 \210\311\312���\f�
����&�-\207" [choices ido-choice-list ido-context-switch-command ido-directory-too-big ido-directory-nonreadable ido-current-directory nil ignore ido-common-initialization ido-read-internal list prompt hist def require-match initial-input] 7 ("/Applications/Emacs.app/Contents/Resources/lisp/ido.elc" . 120784)]("Tags: " ("w" #("REFILE" 0 6 (inherited t)) "@wrk" "@hom" "@out" "@net" "@cmp" "@pho" "@eml" "PROJ" "IDEA") nil nil nil org-tags-history nil nil)
  apply(#[(prompt choices &optional _predicate require-match initial-input hist def _inherit-input-method) "\306\211\211\307������\310 \210\311\312���\f�
����&�-\207" [choices ido-choice-list ido-context-switch-command ido-directory-too-big ido-directory-nonreadable ido-current-directory nil ignore ido-common-initialization ido-read-internal list prompt hist def require-match initial-input] 7 ("/Applications/Emacs.app/Contents/Resources/lisp/ido.elc" . 120784)] ("Tags: " ("w" #("REFILE" 0 6 (inherited t)) "@wrk" "@hom" "@out" "@net" "@cmp" "@pho" "@eml" "PROJ" "IDEA") nil nil nil org-tags-history nil nil))
  ido-completing-read@ido-cr+-replace(#[(prompt choices &optional _predicate require-match initial-input hist def _inherit-input-method) "\306\211\211\307������\310 \210\311\312���\f�
����&�-\207" [choices ido-choice-list ido-context-switch-command ido-directory-too-big ido-directory-nonreadable ido-current-directory nil ignore ido-common-initialization ido-read-internal list prompt hist def require-match initial-input] 7 ("/Applications/Emacs.app/Contents/Resources/lisp/ido.elc" . 120784)] "Tags: " ("w" #("REFILE" 0 6 (inherited t)) "@wrk" "@hom" "@out" "@net" "@cmp" "@pho" "@eml" "PROJ" "IDEA") nil nil nil org-tags-history nil nil)
  apply(ido-completing-read@ido-cr+-replace #[(prompt choices &optional _predicate require-match initial-input hist def _inherit-input-method) "\306\211\211\307������\310 \210\311\312���\f�
����&�-\207" [choices ido-choice-list ido-context-switch-command ido-directory-too-big ido-directory-nonreadable ido-current-directory nil ignore ido-common-initialization ido-read-internal list prompt hist def require-match initial-input] 7 ("/Applications/Emacs.app/Contents/Resources/lisp/ido.elc" . 120784)] ("Tags: " ("w" #("REFILE" 0 6 (inherited t)) "@wrk" "@hom" "@out" "@net" "@cmp" "@pho" "@eml" "PROJ" "IDEA") nil nil nil org-tags-history nil nil))
  ido-completing-read("Tags: " ("w" #("REFILE" 0 6 (inherited t)) "@wrk" "@hom" "@out" "@net" "@cmp" "@pho" "@eml" "PROJ" "IDEA") nil nil nil org-tags-history nil nil)
  ido-completing-read+("Tags: " org-tags-completion-function nil nil nil org-tags-history nil nil)
  completing-read("Tags: " org-tags-completion-function nil nil nil org-tags-history)
  org-capture-fill-template()
  org-capture(nil)
  funcall-interactively(org-capture nil)
  #<subr call-interactively>(org-capture nil nil)
  apply(#<subr call-interactively> org-capture (nil nil))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> org-capture nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (org-capture nil nil))
  call-interactively(org-capture nil nil)
  command-execute(org-capture)
DarwinAwardWinner commented 6 years ago

You say in your original report that you triggered the hang by using org-refile, but your backtrace seems to show you executing org-capture. Which is the correct one?

DarwinAwardWinner commented 5 years ago

Looking at the backtrace you posted, it looks like the problem is the interaction between ido-cr+ and org-tags-completion-function. That function has been blacklisted from ido-cr+ for unrelated reasons (see #156), so that should prevent this freeze as well.