all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Can I turn off ivy-mode in comint buffers?
@ 2018-06-30 17:52 bbenedetto
  2018-06-30 22:22 ` Jonathan Kyle Mitchell
  0 siblings, 1 reply; 4+ messages in thread
From: bbenedetto @ 2018-06-30 17:52 UTC (permalink / raw)
  To: help-gnu-emacs

Good day.

I have loaded ivy-mode and really like it... everywhere except in
comint buffers (for filename completion).  Is there some way to either
disable it in comint buffers or to just turn it on everywhere else?

Sorry if this is a pretty basic question.  I couldn't find an answer
either online or looking through the source.

Thanks!

-- 
- Bill
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
Bill Benedetto     <bbenedetto@goodyear.com>    The Goodyear Tire & Rubber Co.
I don't speak for Goodyear and they don't speak for me.  We're both happy.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Can I turn off ivy-mode in comint buffers?
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Kyle Mitchell @ 2018-06-30 22:22 UTC (permalink / raw)
  To: bbenedetto; +Cc: help-gnu-emacs

On Sat, Jun 30, 2018 at 3:36 PM <bbenedetto@goodyear.com> wrote:
>
> Good day.
>
> I have loaded ivy-mode and really like it... everywhere except in
> comint buffers (for filename completion).  Is there some way to either
> disable it in comint buffers or to just turn it on everywhere else?
>
> Sorry if this is a pretty basic question.  I couldn't find an answer
> either online or looking through the source.
>
> Thanks!
>
> --
> - Bill
> +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
> Bill Benedetto     <bbenedetto@goodyear.com>    The Goodyear Tire & Rubber Co.
> I don't speak for Goodyear and they don't speak for me.  We're both happy.

One way to do it is to customize post-command-hook to dynamically turn
ivy on and off depending on the current buffer's major mode.

(ivy-mode 1) ; globally enabled

(defun disable-ivy-in-comint-only ()
  "Leave `ivy-mode' enabled everywhere except in buffers that derive
from `comint-mode'."
  (if (derived-mode-p 'comint-mode)
      (ivy-mode -1)
    (ivy-mode 1)))

(add-hook 'post-command-hook 'disable-ivy-in-comint-only)

--
Jonathan Kyle Mitchell



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Can I turn off ivy-mode in comint buffers?
  2018-06-30 22:22 ` Jonathan Kyle Mitchell
@ 2018-07-01  4:22   ` Stefan Monnier
  2018-07-01  7:37     ` Jonathan Kyle Mitchell
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2018-07-01  4:22 UTC (permalink / raw)
  To: help-gnu-emacs

>   (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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Can I turn off ivy-mode in comint buffers?
  2018-07-01  4:22   ` Stefan Monnier
@ 2018-07-01  7:37     ` Jonathan Kyle Mitchell
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Kyle Mitchell @ 2018-07-01  7:37 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-01  7:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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.