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

Error in geiser-repl-import-module #2134

Closed
Ambrevar opened this issue Feb 14, 2019 · 19 comments
Closed

Error in geiser-repl-import-module #2134

Ambrevar opened this issue Feb 14, 2019 · 19 comments

Comments

@Ambrevar
Copy link
Member

Expected behavior

No error.

Actual behavior (from emacs-helm.sh if possible, see note at the bottom)

Error while inputting characters in geiser-repl-import-module.

Steps to reproduce (recipe)

  • M-x run-guile
  • C-c C-i
  • Write "a".

Backtraces if any (M-x toggle-debug-on-error)

The trace cannot be displayed because the "display is not ready".
Here is the error value however. Truncated because it's very long.

Error running timer: (error "In ‘geiser-repl-import-module’ source: ‘(closure ((loc-map keymap (27 keymap (13 . helm-cr-empty-string)) (C-return . helm-cr-empty-string) keymap (8388700 . helm-toggle-resplit-and-swap-windows) (33554464 . ambrevar/helm-toggle-visible-mark-backwards) (normal-state keymap (32 . helm-toggle-visible-mark) (121 keymap (121 . helm-kill-selection-and-quit) (80 . helm-copy-to-buffer) (112 . helm-yank-selection)) (47 . helm-quit-and-find-file) (71 . helm-end-of-buffer) (107 . helm-previous-line) (106 . helm-next-line) (41 . helm-next-visible-mark) (40 . helm-prev-visible-mark) (103 keymap (114 . helm-refresh) (103 . helm-beginning-of-buffer) (106 . helm-next-source) (107 . helm-previous-source)) (93 . helm-next-source) (91 . helm-previous-source) (tab . helm-select-action) (4 . helm-next-page) (15 . helm-next-source) (14 . helm-next-line) (16 . helm-previous-line) (22 . helm-next-page)
...
 (left . helm-previous-source) (right . helm-next-source) (7 . helm-keyboard-quit) (22 . helm-next-page) (27 keymap (110 . next-history-element) (112 . previous-history-element) (115 . undefined) (5 . helm-display-all-sources) (1 . helm-show-all-candidates-in-source) (85 . helm-unmark-all) (97 . helm-mark-all) (109 . helm-toggle-all-marks) (41 . helm-next-visible-mark) (40 . helm-prev-visible-mark) (91) (32 . helm-toggle-visible-mark) (33554454 . helm-scroll-other-window-down) (25 . helm-scroll-other-window-down) (22 . helm-scroll-other-window) (12 . helm-reposition-window-other-window) (111 . helm-previous-source) (62 . helm-end-of-buffer) (60 . helm-beginning-of-buffer) (118 . helm-previous-page)) (next . helm-next-page) (prior . helm-previous-page) (C-up . helm-follow-action-backward) (C-down . helm-follow-action-forward) (16 . helm-previous-line) (14 . helm-next-line) (up . helm-previous-line) (down . helm-next-line) keymap (18 . helm-minibuffer-history) (normal-state keymap Auxiliary keymap for Normal state (return . exit-minibuffer) (escape . abort-recursive-edit)) (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 . minibuffer-keyboard-quit) (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))) (help-message . helm-comp-read-help-message) (mode-line . \\<helm-comp-read-map>C/\\[helm-cr-empty-string]:Empty \\<helm-map>\\[helm-help]:Help \\[helm-select-action]:Act \\[helm-maybe-exit-minibuffer]/f1/f2/f-n:NthAct \\[helm-toggle-suspend-update]:Tog.suspend) (persistent-help . DoNothing) (persistent-action) (del-input . t) (case-fold . smart) (input-history) (history) (requires-pattern . 0) (reverse-history . t) (fuzzy) (must-match) (buffer . *helm-mode-geiser-repl-import-module*) (preselect) (default . ) (initial-input) (test) (--cl-rest-- :test nil :history nil :reverse-history t :input-history nil :must-match nil :alistp nil :help-message helm-comp-read-help-message :name geiser-repl-import-module :requires-pattern 0 :candidates-in-buffer nil :exec-when-only-one nil :fuzzy nil :buffer *helm-mode-geiser-repl-import-module* :default  :initial-input nil) (collection . #[771 \\211\\242\\302=\\206

Describe versions of Helm, Emacs, operating system, etc.

  • Helm 3.0
  • Emacs 26.1
  • GuixSD

Are you using emacs-helm.sh to reproduce this bug (yes/no):

No.

@thierryvolpiatto
Copy link
Member

Seems to be the same issue as #1030, will see what I can do.

@thierryvolpiatto
Copy link
Member

@Ambrevar
Copy link
Member Author

Ambrevar commented Mar 5, 2019

@thierryvolpiatto
Copy link
Member

Ok, I found where the bug comes, it is in the definition of geiser-completion--module-list-func, which use the switch-buffer arg of completion-table-dynamic when emacs version is > 25.
Setting it to the same value used with emacs-25 fix the bug:

(setq geiser-completion--module-list-func
      (completion-table-dynamic 'geiser-completion--module-list))

See completion-table-dynamic docstring for more info on the switch-buffer option.
So the fix have to be done on the geiser side IMO.

@Ambrevar
Copy link
Member Author

Ambrevar commented Mar 6, 2019

Thanks for looking into it!

  • The value for emacs-25 only works with Helm. Without Helm on Emacs 26, it will fail.

  • There is no fuzzy completion. For instance, typing "g" shows an empty list, while a lot of modules have the "g" letter.

@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Mar 6, 2019 via email

@Ambrevar
Copy link
Member Author

Ambrevar commented Mar 6, 2019

Same here though I have here completion on geiser modules.

Wait, how is this possible?
If I write (g is get completion on the geiser modules.
If I only write g I get nothing. I'm running Helm-3.0. Maybe time for an update?

@thierryvolpiatto
Copy link
Member

capture d ecran_2019-03-06_12-55-50

@Ambrevar
Copy link
Member Author

Ambrevar commented Mar 6, 2019

So that's another weird difference: My list is made of

(geiser completion)
(geiser doc)
...

They are not the same element as yours and the syntax differs.
I use Geiser 0.10.

@Ambrevar
Copy link
Member Author

Ambrevar commented Mar 6, 2019

Forget it, just noticed you were in the Racket REPL. I tested with Guile. I get the exact same result as yours. Still, pressing a spaces empties the list and that's a problem. Should Geiser fix it?

@thierryvolpiatto
Copy link
Member

Yes, geiser should not pass the pattern (PREFIX) to its completion function, don't know exactly where it do this in the geiser code.
Also Geiser have to fix its call to completion-table-dynamic which doesn't work with or without helm on emacs-26, IMO even better would be to not relay on completion-table-dynamic at all (only give the module list to the completing-read).

@Ambrevar
Copy link
Member Author

Ambrevar commented Mar 7, 2019

OK, I've updated the discussion on GitLab.
I'll open a new issue in a week if there is no news by then.

@thierryvolpiatto
Copy link
Member

Eval the two functions, and then try in each completing-read typing "b z", one completing-read returns "baz" while the other returns nothing (apart the unknow pattern of course).

(defun helm-test-cands-1 ()
  (all-completions "" '("foo" "bar" "baz")))

(defun helm-test-cands-2 (str)
  (all-completions str '("foo" "bar" "baz")))

(completing-read "test: " (completion-table-dynamic 'helm-test-cands-2))

(completing-read "test: " (helm-test-cands-1))

@Ambrevar
Copy link
Member Author

Ambrevar commented Mar 8, 2019

Good example, thanks!

thierryvolpiatto added a commit that referenced this issue Mar 8, 2019
when a function is used as collection.

* helm-mode.el (helm-comp-read): Always pass empty string to
helm-comp-read-get-candidates.
@thierryvolpiatto
Copy link
Member

Could fix it from Helm by always passing an empty string to the function generated by completion-table-dynamic. Have a try.

@Ambrevar
Copy link
Member Author

Ambrevar commented Mar 8, 2019

Works for me, thanks!
By the way, it seems that the geiser-completion--module-list-func patch is not needed anymore.

@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Mar 8, 2019 via email

@Ambrevar
Copy link
Member Author

Ambrevar commented Mar 8, 2019 via email

@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Mar 8, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants