From: Jonathan Kyle Mitchell <kyle@jonathanmitchell.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Can I turn off ivy-mode in comint buffers?
Date: Sun, 01 Jul 2018 02:37:52 -0500 [thread overview]
Message-ID: <87a7rb5ru7.fsf@jonathanmitchell.org> (raw)
In-Reply-To: <jwvzhzb37ta.fsf-monnier+gmane.emacs.help@gnu.org> (Stefan Monnier's message of "Sun, 01 Jul 2018 00:22:22 -0400")
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
prev parent reply other threads:[~2018-07-01 7:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-30 17:52 Can I turn off ivy-mode in comint buffers? bbenedetto
2018-06-30 22:22 ` Jonathan Kyle Mitchell
2018-07-01 4:22 ` Stefan Monnier
2018-07-01 7:37 ` Jonathan Kyle Mitchell [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a7rb5ru7.fsf@jonathanmitchell.org \
--to=kyle@jonathanmitchell.org \
--cc=help-gnu-emacs@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.