abo-abo / hydra

make Emacs bindings that stick around

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can be hydra buffer local?

Ergus opened this issue · comments

Hi:

I am wondering if it is possible to create an hydra, but making it buffer local. I use hydra with smerge and the hydra is autostarted with code like this:

(defun my/enable-smerge-maybe ()
    "Auto-enable `smerge-mode' when merge conflict is detected."
    (when (not (bound-and-true-p smerge-mode))
      (save-excursion
	(goto-char (point-min))
	(when (re-search-forward "^<<<<<<< " nil :noerror)
          (smerge-mode 1)
	  (hydra-smerge/body)))))

This shows the hydra at the bottom and works perfectly, but when I try to use the minibuffer I need to quit hydra to type some letters that are in the hydra.

Is it possible to specify hydra to be buffer local? so it only "capture" the keys in it's own buffer but not affect the others or the minibuffer?

Thanks in advance,
Ergus.

You could slay the hydra on leaving the smerge buffer, and call it on reentering the buffer?