emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Myles English <mylesenglish@gmail.com>
To: "Alexander Wingård" <alexander.wingard@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Go to heading using LISP
Date: Mon, 10 Jun 2013 20:00:54 +0100	[thread overview]
Message-ID: <87wqq1oknt.fsf@gmail.com> (raw)
In-Reply-To: <CAJDwVzLpfd9RrxmtwgBhug90SMdPHKSy1s0oDeH+i9WhNqLsxA@mail.gmail.com>


Hi Alexander,

Alexander Wingård writes:

> I want to create special key-bindings that use the org-refile goto
> interface to jump to specific headings.

It doesn't use org-refile but this is what I use:

(defun my-goto-heading(file heading-text)
  "Visit file `file' and goto headline `heading-text'"
  (find-file file)
  (org-element-map (org-element-parse-buffer 'headline) 'headline
      (lambda (x)
          (if (string= (org-element-property :raw-value x) heading-text)
              (goto-char (org-element-property :begin x))
              nil))
   nil t)) ;; stop at first find

(defun gtd()
  (interactive)
  (my-goto-heading (concat org-directory "/gtd.org") "Daily work")
  (org-show-entry)
  ;;(org-show-subtree)
  (reposition-window)
  (org-agenda-list))

In the gtd function I also set org-agenda-files but left it out for
clarity.

Myles

  parent reply	other threads:[~2013-06-10 18:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-08 13:52 Go to heading using LISP Alexander Wingård
2013-06-09  1:36 ` Eric Abrahamsen
2013-06-09 14:43   ` Alexander Wingård
2013-06-10  4:26     ` Eric Abrahamsen
2013-06-10  5:53       ` Jambunathan K
2013-06-10 19:00 ` Myles English [this message]
2013-06-10 21:14   ` Alexander Wingård
2013-06-19 18:24     ` Alexander Wingård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wqq1oknt.fsf@gmail.com \
    --to=mylesenglish@gmail.com \
    --cc=alexander.wingard@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).