From mboxrd@z Thu Jan 1 00:00:00 1970 From: Giacomo M Subject: Re: Get to next NEXT headline with one key Date: Fri, 7 Mar 2014 15:28:51 +0100 Message-ID: References: <87k3c6glmr.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bd9164e9bf05e04f405129e Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLvld-0003zA-KB for emacs-orgmode@gnu.org; Fri, 07 Mar 2014 09:28:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLvlc-0005Dc-DH for emacs-orgmode@gnu.org; Fri, 07 Mar 2014 09:28:53 -0500 Received: from mail-pd0-x232.google.com ([2607:f8b0:400e:c02::232]:59508) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLvlc-0005DN-0P for emacs-orgmode@gnu.org; Fri, 07 Mar 2014 09:28:52 -0500 Received: by mail-pd0-f178.google.com with SMTP id x10so4085707pdj.37 for ; Fri, 07 Mar 2014 06:28:51 -0800 (PST) In-Reply-To: <87k3c6glmr.fsf@fastmail.fm> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --047d7bd9164e9bf05e04f405129e Content-Type: text/plain; charset=ISO-8859-1 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 > --047d7bd9164e9bf05e04f405129e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Thank you very much Matt, it was exactly what I was lookin= g for! And thanks to Matt for his prompt reply.
Just wondering, so ther= e 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 <mdl@imapmail.org> wrote:
> =A0 =A0 On Fri, Mar 7, = 2014 at 7:13 AM, Giacomo M <jackj= ackk@gmail.com>
> =A0 =A0 wrote:
>
> =A0 =A0 =A0 =A0 Dear all,
> =A0 =A0 =A0 =A0 I would like, by pressing the speed command N, to be b= rought to
> =A0 =A0 =A0 =A0 the next NEXT headline. I can see that somehow the fun= ctions
> =A0 =A0 =A0 =A0 involved could be=A0org-match-sparse-tree and next-err= or, but I
> =A0 =A0 =A0 =A0 don't know how to code a programmatic execution of= the two
> =A0 =A0 =A0 =A0 (unfortunately I don't speak elisp very well) into= a function
> =A0 =A0 =A0 =A0 that can then be specified in the=A0org-speed-commands= -user
> =A0 =A0 =A0 =A0 customization.
>
> =A0 =A0 =A0 =A0 Is there anybody so kind to guide me to the (probably = trivial)
> =A0 =A0 =A0 =A0 solution?
>

Giacomo M <= jackjackk@gmail.com> 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 likel= y a better
way to do it. This is simply to illustrate the general idea.

--8<---------------cut here---------------start------------->8---
(defun my-org-next-next ()
=A0 (interactive)
=A0 (forward-word)
=A0 (when (re-search-forward "\\*+\\s-+NEXT" nil t)
=A0 =A0 (org-reveal t))
=A0 (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

--047d7bd9164e9bf05e04f405129e--