Thank you very much Matt, it was exactly what I was looking for! And thanks to Matt for his prompt reply. Just wondering, so there is (no way of | no point in) trying to execute the org-match-sparse-tree programmatically, right? This community rocks On Fri, Mar 7, 2014 at 2:54 PM, Matt Lundin wrote: > > On Fri, Mar 7, 2014 at 7:13 AM, Giacomo M > > wrote: > > > > Dear all, > > I would like, by pressing the speed command N, to be brought to > > the next NEXT headline. I can see that somehow the functions > > involved could be org-match-sparse-tree and next-error, but I > > don't know how to code a programmatic execution of the two > > (unfortunately I don't speak elisp very well) into a function > > that can then be specified in the org-speed-commands-user > > customization. > > > > Is there anybody so kind to guide me to the (probably trivial) > > solution? > > > > Giacomo M writes: > > > Sorry for having been ambiguous, I meant the next headline with a > > "NEXT" todo keyword. > > Thanks > > Here's a very quick hack/proof of concept. There's very likely a better > way to do it. This is simply to illustrate the general idea. > > --8<---------------cut here---------------start------------->8--- > (defun my-org-next-next () > (interactive) > (forward-word) > (when (re-search-forward "\\*+\\s-+NEXT" nil t) > (org-reveal t)) > (org-back-to-heading)) > > (add-to-list 'org-speed-commands-user '("N" . (org-speed-move-safe > 'my-org-next-next))) > --8<---------------cut here---------------end--------------->8--- > > Best, > Matt >