From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Re: Org mode links for helm Date: Sat, 24 May 2014 17:32:06 -1000 Message-ID: References: <8738fzu7iq.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WoPAu-0003eO-HX for emacs-orgmode@gnu.org; Sat, 24 May 2014 23:32:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WoPAn-0001J7-OB for emacs-orgmode@gnu.org; Sat, 24 May 2014 23:32:40 -0400 Received: from gproxy2-pub.mail.unifiedlayer.com ([69.89.18.3]:41454) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1WoPAn-0001Fd-GP for emacs-orgmode@gnu.org; Sat, 24 May 2014 23:32:33 -0400 In-Reply-To: <8738fzu7iq.fsf@bzg.ath.cx> (Bastien's message of "Sat, 24 May 2014 06:26:21 +0200") 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: Bastien Cc: Org-mode Aloha Bastien, Bastien 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