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
counsel-find-file destroys filenames when called with ivy-call or ivy-next-line-and-call #1903
Comments
Sorry, I can't reproduce what I think you mean, but your recipe is not clear.
What does "destroy" mean in this context, and what do you mean by "filename"? Are you talking about the buffer-local value of the variable
I don't understand how
Again, this is not clear to me. What does "yield buffer" mean? Did you create the Ibuffer buffer, or was it created automatically? What does "buffer with nonexisting file" mean? Do you mean a buffer not visiting a file, i.e. with a Here's what I tried:
Here's my full Emacs version:
I get the same results with the following Emacs version as well:
What am I missing? |
my head --> table --> ouch. You are missing nothing, i am afraid, i was a bit tired when i wrote this issue. |
Ah, no worries. I can reproduce the issue now. Does the following patch solve it? diff --git a/counsel.el b/counsel.el
index fa214c4..658b87c 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2451,8 +2451,8 @@ counsel-file-jump
(list nil
(when current-prefix-arg
(read-directory-name "From directory: "))))
- (counsel-require-program "find")
- (let* ((default-directory (or initial-directory default-directory)))
+ (counsel-require-program find-program)
+ (let ((default-directory (or initial-directory default-directory)))
(ivy-read "Find file: "
(split-string
(shell-command-to-string
@@ -2460,9 +2460,7 @@ counsel-file-jump
"\n" t)
:matcher #'counsel--find-file-matcher
:initial-input initial-input
- :action (lambda (x)
- (with-ivy-window
- (find-file (expand-file-name x ivy--directory))))
+ :action #'find-file
:preselect (counsel--preselect-file)
:require-match 'confirm-after-completion
:history 'file-name-history @justbur Why did you deem the call to |
Expand candidate file names relative to original default-directory, not that of ivy-state-window (ivy--directory seems to always be nil in the action function). Fixes abo-abo#1903
@vornado63 I'm glad it resolves your issue.
If and when #1938 gets merged, plus a few hours to propagate. |
Expand candidate file names relative to original default-directory, not that of ivy-state-window (ivy--directory seems to always be nil in the action function). Fixes abo-abo#1903
steps to reproduce:
dired some directory:
call counsel-find-file (i used something like ^lisp el.gz$)
call ivy-next-line-and-call multiple times
This yields buffer with nonexisting files:
In this case, the dirname "lisp" appears multiple times.
(emacs-version)
"GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2018-08-21"
counsel-20190123.1048
ivy-20190123.1100
This problem only occurs when opening files in a subdirectory of the cwd.
The text was updated successfully, but these errors were encountered: