emacs-purpose icon indicating copy to clipboard operation
emacs-purpose copied to clipboard

Purpose mode and ivy-switch-buffer

Open gnuvince opened this issue 9 years ago • 7 comments

I use ivy-switch-buffer (rather than ido or helm), and when I activate purpose, C-x b invokes ido-switch-buffer. Is it possible to use Ivy's own command instead?

gnuvince avatar May 19 '16 02:05 gnuvince

Are you sure C-x b invokes ido-switch-buffer? Purpose binds C-x b to purpose-switch-buffer-overload in purpose-mode-map, not ido-switch-buffer. You can unbind it with (define-key purpose-mode-map (kbd "C-x b") nil), and then Emacs will use the normal C-x b binding. I assume that you or Ivy bind C-x b to ivy-switch-buffer, so that should give you Ivy's own command.

If you want to use purpose-switch-buffer (because it offers only buffers with the same purpose) with an Ivy prompt, you can change the value of purpose-preferred-prompt. From the documentation of purpose-preferred-prompt:

Available options are: 'auto - use IDO when ido-mode' is enabled, otherwise Helm whenhelm-mode' is enabled, otherwise use default Emacs prompts; 'ido - use IDO; 'helm - use Helm; 'vanilla - use default Emacs prompts.

If you (setq purpose-preferred-prompt 'vanilla), purpose should use the default completing read function. If you have ivy-mode enabled, the default should give you an Ivy prompt.

bmag avatar May 19 '16 05:05 bmag

Closing this issue due to no response. Feel free to comment/reopen if necessary.

bmag avatar Jun 02 '16 17:06 bmag

@bmag This didn't work for me, btw. After your recommended setting, purpose still invokes ido rather than ivy.

jwiegley avatar Dec 07 '17 05:12 jwiegley

@jwiegley I'm not sure what exactly didn't work for you.

  • is ivy-mode turned on?
  • is purpose-mode turned on?
  • what's the value of purpose-preferred-prompt?
  • what's bound to C-x b? (I mean what's the actual output of C-h k C-x b)
  • did you change the binding of C-x b in purpose-mode-map?

Please note that while purpose-switch-buffer with purpose-preferred-prompt set to vanilla and ivy-mode enabled should give an Ivy prompt, it still isn't the same as ivy-switch-buffers. It will just be the generic prompt Ivy gives to commands.

I'm quite busy this week (and the past one), so I could be slow to respond.

bmag avatar Dec 11 '17 11:12 bmag

Having same issue, I'm using spacemacs-purpose layer.

C-h k C-x b gives: C-x b runs the command ivy-switch-buffer (found in ivy-mode-map), which is an interactive autoloaded compiled Lisp function in ‘ivy.el’.

It is bound to C-SPC b b, C-x b, .

(ivy-switch-buffer)

Switch to another buffer.

For SPC r b it is: C-SPC r b runs the command ivy-purpose-switch-buffer-with-purpose (found in global-map), which is an interactive autoloaded compiled Lisp function in ‘ivy-purpose.el’.

It is bound to C-SPC r b.

(ivy-purpose-switch-buffer-with-purpose &optional PURPOSE)

Switch to buffer, choose from buffers with purpose PURPOSE. PURPOSE defaults to the purpose of the current buffer.

Is there a way to make C-x b work like SPC r b without adding all the bindings manually?

AshKash avatar May 14 '18 21:05 AshKash

The issue persists, but for anyone who comes by, @bmag 's code on the above referenced issue solves it somehow.

(define-key purpose-mode-map (kbd "C-x b") nil)

Thanks for this awesome package!

yiufung avatar May 26 '18 12:05 yiufung

Is there a way to make C-x b work like SPC r b without adding all the bindings manually?

@AshKash no, not really.

bmag avatar May 26 '18 13:05 bmag