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

xref and ag path problems after recent ivy update #2149

Closed
gusbrs opened this issue Jul 18, 2019 · 5 comments
Closed

xref and ag path problems after recent ivy update #2149

gusbrs opened this issue Jul 18, 2019 · 5 comments

Comments

@gusbrs
Copy link
Contributor

gusbrs commented Jul 18, 2019

I've been having some path problems with some commands after a recent Ivy update. I can pin down the issue between "ivy-20190715.1950" (where it works) and "ivy-20190717.1355" (where it no longer doesn't).

I don't really fully understand what's going on, but I think I could isolate it enough to be able do describe it to you with decent precision.

Start emacs -Q (with "ivy-20190717.1355").

M-x package-initialize RET
M-x ivy-mode RET
M-x toggle-degub-on-error RET

Find a library of your choice:

M-x find-library RET simple RET

Go to a variable of function of your choice, let's say the defcustom shell-command-dont-erase-buffer (or whatever). With point in the variable's name run:

M-x xref-find-references RET

Accept default with RET, and accept current directory with ivy-imediate-done "C-M-j".

The backtrace is:

Debugger entered--Lisp error: (cl-assertion-failed ((directory-name-p dir) nil))
  cl--assertion-failed((directory-name-p dir))
  xref-collect-references("shell-command-dont-erase-buffer" "")
  #f(compiled-function (dir) #<bytecode 0xd2e8b9>)("")
  mapcan(#f(compiled-function (dir) #<bytecode 0xd2e8b9>) (""))
  cl-mapcan(#f(compiled-function (dir) #<bytecode 0xd2e8b9>) (""))
  xref-backend-references(elisp "shell-command-dont-erase-buffer")
  xref--find-xrefs("shell-command-dont-erase-buffer" references "shell-command-dont-erase-buffer" nil)
  xref-find-references("shell-command-dont-erase-buffer")
  funcall-interactively(xref-find-references "shell-command-dont-erase-buffer")
  call-interactively(xref-find-references record nil)
  command-execute(xref-find-references record)
  execute-extended-command(nil "xref-find-references" nil)
  funcall-interactively(execute-extended-command nil "xref-find-references" nil)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

Similarly, run:

M-x ag RET

Accept default search term with RET, accept current directory with ivy-imediate-done "C-M-j".

Debugger entered--Lisp error: (error "No such directory found via CDPATH environment variable")
  signal(error ("No such directory found via CDPATH environment variable"))
  error("No such directory found via CDPATH environment variable")
  cd("./")
  compilation-start("ag --nocolor --literal --line-number --smart-case --nogroup --column --stats -- shell-command-dont-erase-buffer ." ag-mode (lambda (mode-name) "*ag search text:shell-command-dont-erase-buffer dir:*"))
  ag/search("shell-command-dont-erase-buffer" "")
  ag("shell-command-dont-erase-buffer" "")
  funcall-interactively(ag "shell-command-dont-erase-buffer" "")
  call-interactively(ag record nil)
  command-execute(ag record)
  execute-extended-command(nil "ag" #("ag\n2C-associate-buffer\n2C-command\n5x5-crack\n5x5-crack-mutating-best\n5x5-crack-mutating-current\n5x5-crack-randomly\n5x5-crack-xor-mutate\nBuffer-menu-backup-unmark\nBuffer-menu-delete-backwards" 2 3 (read-only nil) 3 6 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) face ((:foreground "white") ivy-current-match) read-only nil) 6 7 (face ((:foreground "white") (background-color . "#69cb34167fe6") . ivy-minibuffer-match-face-2) mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 7 12 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) face ((:foreground "white") ivy-current-match) read-only nil) 12 13 (face ((:foreground "white") (background-color . "#69cb34167fe6") . ivy-minibuffer-match-face-2) mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 13 22 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) face ((:foreground "white") ivy-current-match) read-only nil) 22 23 (read-only nil) 23 30 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 30 31 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 31 33 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 33 34 (read-only nil) 34 40 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 40 41 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 41 43 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 43 44 (read-only nil) 44 50 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 50 51 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 51 57 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 57 58 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 58 67 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 67 68 (read-only nil) 68 74 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 74 75 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 75 81 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 81 82 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 82 94 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 94 95 (read-only nil) 95 101 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 101 102 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 102 106 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 106 107 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 107 113 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 113 114 (read-only nil) 114 120 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 120 121 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 121 131 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 131 132 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 132 134 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 134 135 (read-only nil) 135 148 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 148 149 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 149 157 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 157 158 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 158 160 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 160 161 (read-only nil) 161 181 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 181 182 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 182 185 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 185 186 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 186 189 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil)))
  funcall-interactively(execute-extended-command nil "ag" #("ag\n2C-associate-buffer\n2C-command\n5x5-crack\n5x5-crack-mutating-best\n5x5-crack-mutating-current\n5x5-crack-randomly\n5x5-crack-xor-mutate\nBuffer-menu-backup-unmark\nBuffer-menu-delete-backwards" 2 3 (read-only nil) 3 6 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) face ((:foreground "white") ivy-current-match) read-only nil) 6 7 (face ((:foreground "white") (background-color . "#69cb34167fe6") . ivy-minibuffer-match-face-2) mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 7 12 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) face ((:foreground "white") ivy-current-match) read-only nil) 12 13 (face ((:foreground "white") (background-color . "#69cb34167fe6") . ivy-minibuffer-match-face-2) mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 13 22 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) face ((:foreground "white") ivy-current-match) read-only nil) 22 23 (read-only nil) 23 30 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 30 31 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 31 33 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 33 34 (read-only nil) 34 40 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 40 41 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 41 43 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 43 44 (read-only nil) 44 50 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 50 51 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 51 57 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 57 58 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 58 67 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 67 68 (read-only nil) 68 74 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 74 75 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 75 81 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 81 82 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 82 94 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 94 95 (read-only nil) 95 101 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 101 102 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 102 106 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 106 107 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 107 113 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 113 114 (read-only nil) 114 120 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 120 121 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 121 131 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 131 132 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 132 134 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 134 135 (read-only nil) 135 148 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 148 149 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 149 157 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 157 158 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 158 160 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 160 161 (read-only nil) 161 181 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 181 182 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 182 185 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 185 186 (face ivy-minibuffer-match-face-2 mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil) 186 189 (mouse-face ivy-minibuffer-match-highlight help-echo (format (if tooltip-mode "mouse-1: %s\nmouse-3: %s" "mouse-1: %s   mouse-3: %s") ivy-mouse-1-tooltip ivy-mouse-3-tooltip) read-only nil)))
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

These errors do not happen with "ivy-20190715.1950".

I'm running Emacs 26.2, the Ivy versions were given above. If you need any other info, let me know.

@abo-abo
Copy link
Owner

abo-abo commented Jul 18, 2019

The issue comes down to the return result of (project-current t) which calls:

(read-directory-name "Choose the project directory: " dir nil t)

Result:

  • C-m: "/usr/local/share/emacs/26.2/lisp/"
  • C-j: "/usr/local/share/emacs/26.2/lisp/"
  • C-M-j: ""

Note that ivy-read returns "/usr/local/share/emacs/26.2/lisp/" in all cases.

But when read-directory-name discovers that ivy-read gave it the exact same string object dir, it returns "".

The reference completion function, completing-read-default, behaves similarly to ivy-read: if the input is "", return the def argument, i.e. "/usr/local/share/emacs/26.2/lisp/", which read-directory-name turns back to "".

The solution to have C-M-j be usable for your case is to patch (copy-sequence (ivy-state-def ivy-last)) into ivy-immediate-done. But then an existing test of expected behavior breaks, since it relies on ivy-read returning the same string object and not a copy.

I'll have to think about this more later. But for now, C-m and C-j bindings should work for you.

@gusbrs
Copy link
Contributor Author

gusbrs commented Jul 18, 2019

@abo-abo Thank you for your prompt response.

There is no problem here to keep things running, as I simply rolled back to "ivy-20190715.1950".

But, that aside, in principle "C-m" and "C-j" will not substitute for "C-M-j" in this case, as far as I can tell. They will both select the first candidate available which, in my case is "calc", so the search is performed in "/usr/local/share/emacs/26.2/lisp/calc/" and not in "/usr/local/share/emacs/26.2/lisp/" as desired. From a user's perspective, I'm just trying to select the current directory somehow (indeed, there is actually no "project" associated with these files, they are not version controlled or anything).

Anyway, as I mentioned, I don't really get what is going on. So I just remain at your disposal in case you need any more info on the matter.

@gusbrs
Copy link
Contributor Author

gusbrs commented Jul 19, 2019

Even though you seem to already know where to look at, just adding some information, as in another computer I have a newer version of Ivy, "ivy-20190716.1748", which does not exhibit the problem. So you can narrow down further between "ivy-20190716.1748" and "ivy-20190717.1355".

@abo-abo
Copy link
Owner

abo-abo commented Jul 24, 2019

Thanks, please test.

@gusbrs
Copy link
Contributor Author

gusbrs commented Jul 24, 2019

@abo-abo It's working neatly, as usual. Thank you very much!

astoff pushed a commit to astoff/swiper that referenced this issue Jan 1, 2021
…name

`read-directory-name' returns "" when the completion function passes
it back the DEF argument. This is a highly questionable behavior that
some old functions depend on.

Looks like it's better to break those old functions, rather than break
the more important functions that have no idea why
`read-directory-name' returns "".

* ivy-test.el (ivy-read-file-name-in-buffer-visiting-file): Now fails.
(ivy-read-directory-name): Add test.

Fixes abo-abo#2165
Fixes abo-abo#2149
Re abo-abo#1170
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