[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can I turn off ivy-mode in comint buffers?
From: |
Jonathan Kyle Mitchell |
Subject: |
Re: Can I turn off ivy-mode in comint buffers? |
Date: |
Sun, 01 Jul 2018 02:37:52 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> (if (derived-mode-p 'comint-mode)
>> (ivy-mode -1)
>> (ivy-mode 1)))
>
> AKA
>
> (ivy-mode (if (derived-mode-p 'comint-mode) -1 1))
>
>> (add-hook 'post-command-hook 'disable-ivy-in-comint-only)
>
> Hmm... really?
> You want to (re)enable/disable ivy-mode after every command?
>
>
> Stefan
Yeah, the command hooks are a blunt instrument. I was able to get M-x
shell working with buffer-list-update-hook instead, but I had to add a
second hook to make sure it's disabled on the first buffer switch.
(ivy-mode 1)
;; Turn off ivy on first entry into a new comint-mode buffer.
(add-hook 'comint-mode-hook (lambda () (ivy-mode -1)))
;; Toggle ivy after every buffer switch, avoiding the minibuffer.
(add-hook 'buffer-list-update-hook
(lambda ()
(unless (eq major-mode 'minibuffer-inactive-mode)
(ivy-mode (if (derived-mode-p 'comint-mode) -1 1)))))
How's that?
--
Jonathan Kyle Mitchell