0

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?

0

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.

3
  • 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)
    – Tom
    Jan 11 '20 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.
    – Stefan
    Jan 11 '20 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.
    – Tom
    Jan 11 '20 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.