Open vidagabor opened 6 years ago
Having the same issue for a while.
I just ran into this today, after using ivy for many years without issue.
To reproduce from emacs -Q
, evaluate the following code:
(require 'package)
(setq package-load-list
'((ivy t)))
(package-initialize)
(ivy-mode)
(shell)
This opens a shell. In my case, I have a directory ~/nextcloud/org
. If I enter cd ~/next<TAB>
, it completes to ~/nextcloud/
. Pressing tab again offers me a vertical list of directories in ~/nextcloud/
. When I select one, it is inserted a few spaces backwards. For example, if I select ~/nextcloud/org
, after completion I have cd nextorg/
.
GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2024-07-02 Ivy installed from Melpa 2024-07-31: ivy-20240524.1139, Version: 0.14.2,
The problem seems to occur in ivy-completion-in-region
, which gets called from comint-dynamic-complete-filename
, which calls completion-in-region
:
https://github.com/abo-abo/swiper/blob/2a25a6fb5b081cb141c5eccac8ee58ab1feeb747/ivy.el#L2682-L2691
At this point, it looks like the length of the first match in the completion list ((car comps)
) is deleted from the path to be completed. I don't understand the logic here, and presumably it's correct in other contexts. But in this situation it's clearly causing problems.
As a temporary fix, this resets the default completion-in-region-function
value for shell-mode
:
(defun tws-shell-mode-hook ()
;; to override ivy-mode, which provides a problematic
;; completion-in-region variation:
(setq-local completion-in-region-function #'completion--in-region))
(add-hook 'shell-mode-hook 'tws-shell-mode-hook)
I just ran into this today, after using ivy for many years without issue.
Perhaps it was introduced by the following commit in Emacs 30?
At least that's when I noticed the issue in C-x p c
(project-compile
, which in turn delegates completion to comint-completion-at-point
).
Highlight the suffix in Completions buffer in 'basic' style too 6b7ff60a5e7 2024-06-13 00:46:12 +0300
At first glance it looks like #3051 might be trying to address this issue; I'll try to dig deeper soon.
Hi!
I have a long standing issue: in shell-mode, let's say there's /aa/bbb/cccc directory, and I want to complete this. If I enter "cd /aa/bbb" and I hit TAB, I get "cd /aabbb/" immediately. If I enter "cd /aa/bbb/" (there's a trailing /), and I hit TAB, the dropdown list appears which allows me to select from the candidates, which is "..", "cccc" and "." in this example. So after TAB, the already entered command switches to "cd /aa/b". If I go down and select "cccc" from the list, I get "cd /aa/bcccc". It varies how many characters of the already entered path is overwritten, but I couldn't figure out what it depends on.
If I toggle debug-on-quit, and hit ^G while the dropdown list is active, I get this back trace:
The buffer's name is "shell @ /to:dc153fnd:/" and the shell's prompt is "root@fnd01:/# ".
I'm using GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars) of 2018-06-13, and I'm using ivy 20180820.1526 installed via package.el.
I'd really appreciate any pointers how to debug this issue further, since I'm pretty sure I'm not the only one who uses Ivy like this, but seems that only I have this issue (for a long time, like at least half a year).