abo-abo / avy

Jump to things in Emacs tree-style
1.71k stars 109 forks source link

How do I trigger some action only if `avy-jump` succeeds? #320

Open NightMachinery opened 3 years ago

NightMachinery commented 3 years ago

I want org-back-to-heading to only be called if avy-jump has succeeded.

(defun night/avy-goto-org-header ()
    (interactive)
    (when (avy-jump "^\*+ ")
      (org-back-to-heading)))
NightMachinery commented 3 years ago

I just noticed that `org-back-to-heading- jumps to the beginning of the heading, which I don't want anyway; Is there any way to jump to the end of the matched regex with avy?