From: tsd@tsdye.com (Thomas S. Dye)
To: Bastien <bzg@gnu.org>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Org mode links for helm
Date: Sat, 24 May 2014 17:32:06 -1000 [thread overview]
Message-ID: <m2y4xqile1.fsf@tsdye.com> (raw)
In-Reply-To: <8738fzu7iq.fsf@bzg.ath.cx> (Bastien's message of "Sat, 24 May 2014 06:26:21 +0200")
Aloha Bastien,
Bastien <bzg@gnu.org> writes:
> Hi Thomas,
>
> tsd@tsdye.com (Thomas S. Dye) writes:
>
>> Has anyone implemented a helm interface for Org-mode #+name lines? I
>> think it might be useful for inserting cross reference links.
>
> did you try
>
> https://github.com/emacs-helm/helm/blob/master/helm-org.el
>
> ?
This code, adapted from some code I found on John Kitchin's blog, does
what I want.
** Cross references
#+name: tsd-xref
#+begin_src emacs-lisp
(defun tsd-get-names-and-labels ()
(interactive)
(save-excursion
(goto-char (point-min))
(let ((matches '()))
(while (re-search-forward "\\#\\+\\(name\\|label\\):\\s-\\(.*\\)" (point-max) t)
(add-to-list 'matches (match-string-no-properties 2) t))
matches)))
(defun tsd-org-insert-crossref-link (&optional arg)
(interactive (list (completing-read "insert: " (tsd-get-names-and-labels))))
(insert (format "[[%s]]" arg)))
#+end_src
Now, when I'm referring to something I've labeled or named, I call
tsd-org-insert-crossref-link and helm works on a list of labels and
names defined in the buffer.
It's almost as convenient as using Carsten's reftex mode when writing in
LaTeX.
All the best,
Tom
--
Thomas S. Dye
http://www.tsdye.com
next prev parent reply other threads:[~2014-05-25 3:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-24 0:11 Org mode links for helm Thomas S. Dye
2014-05-24 4:26 ` Bastien
2014-05-24 7:49 ` Sebastien Vauban
2014-05-24 18:52 ` Thomas S. Dye
2014-05-25 3:32 ` Thomas S. Dye [this message]
2014-05-25 11:28 ` John Kitchin
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2y4xqile1.fsf@tsdye.com \
--to=tsd@tsdye.com \
--cc=bzg@gnu.org \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.