I'd like to use icomplete-mode for certain commands, but not for everything. Is there a way to enable it for just a list of commands I specify?
1 Answer
IIRC, Currently, the only way icomplete offers to control it is via icomplete-with-completion-tables
which is rather inflexible. Of course, you could enable/disable it for specific commands by advising those commands and temporarily rebinding icomplete-with-completion-tables
accordingly.
-
I tried simple around advising, turning icomplete on and off, but it doesn't work for some reason
(defun my-icomplete (orig-fun &rest args) (icomplete-mode 1) (apply orig-fun args) (icomplete-mode -1)) (advice-add 'describe-variable :around 'my-icomplete)
– TomCommented Jan 11, 2020 at 8:14 -
1@Tom: This advice applies to the execution of the function, i.e. the code run once we know which arguments to pass to the function, whereas you need the advice to apply to the construction of those arguments, i.e. the interactive spec.– StefanCommented Jan 11, 2020 at 15:08
-
Thanks, I didn't know that. I tried advising completing-read, but apparently I can't detect the current command while the arguments are gathered. Shouldn't this-command show this? Even if the command is not executing yet, its arguments are being gathered, so this-command could indicate the current command already.– TomCommented Jan 11, 2020 at 17:12