1

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?

Drew
  • 75,699
  • 9
  • 109
  • 225
Tom
  • 1,190
  • 7
  • 16

1 Answers1

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.

Stefan
  • 26,154
  • 3
  • 46
  • 84
  • 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 08: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