abo-abo / hydra

make Emacs bindings that stick around
1.85k stars 113 forks source link

`hydra-yank-pop` repeatly yank new, other replace the previous `yank` #202

Open magicdirac opened 8 years ago

magicdirac commented 8 years ago

This hydra looks like quite different from the yank-pop default behavior. Call yank-pop, it should replace the previous yank by previous one in the kill ring. But the hydra keep yanking more.

Does the hydra suppose to be that way, or do I miss something?

(defhydra hydra-yank-pop ()
  "yank"
  ("C-y" yank nil)
  ("M-y" yank-pop nil)
  ("y" (yank-pop 1) "next")
  ("Y" (yank-pop -1) "prev")
  ("l" helm-show-kill-ring "list" :color blue))   ; or browse-kill-ring
(global-set-key (kbd "M-y") #'hydra-yank-pop/yank-pop)
(global-set-key (kbd "C-y") #'hydra-yank-pop/yank)
abo-abo commented 8 years ago

Look at the code of yank-pop. It checks if this-command is 'yank. Just set it to 'yank if you need.