emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org mode links for helm
@ 2014-05-24  0:11 Thomas S. Dye
  2014-05-24  4:26 ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas S. Dye @ 2014-05-24  0:11 UTC (permalink / raw)
  To: Org-mode

Aloha all,

Has anyone implemented a helm interface for Org-mode #+name lines?  I
think it might be useful for inserting cross reference links.

All the best,
Tom

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Org mode links for helm
  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-25  3:32   ` Thomas S. Dye
  0 siblings, 2 replies; 6+ messages in thread
From: Bastien @ 2014-05-24  4:26 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode

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

?

Maybe the authors can help I guess.

All best,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Org mode links for helm
  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
  1 sibling, 1 reply; 6+ messages in thread
From: Sebastien Vauban @ 2014-05-24  7:49 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Bastien wrote:
> tsd-P0awH739Ni4AvxtiuMwx3w@public.gmane.org (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 ?
>
> Maybe the authors can help I guess.

The author, Thierry Volpiatto, does not support Helm-Org anymore, as
told in http://article.gmane.org/gmane.emacs.helm.user/617.

BTW, it is only for the Org headlines, not for Org code block names.

Though, this particular question has already gotten tentatives of
answers, see http://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg00712.html.

I remember (thanks to Org!) having written the following in my .emacs file:

#+begin_src emacs-lisp
  ;; extension of Imenu
  (when (and
         ;; `org-babel' has been loaded
         (fboundp 'org-babel-execute-src-block)

         ;; `imenu' has been loaded
         (fboundp 'try-to-add-imenu))

    (setq org-src-blocks-imenu-generic-expression
          `(("Snippets" ,org-babel-src-name-w-name-regexp 2)))

    (add-hook 'org-mode-hook
              (lambda ()
                (setq imenu-generic-expression
                      org-src-blocks-imenu-generic-expression))))
#+end_src

... but I never saw any name of code chunk in the "IMenu" menu.
I only saw the headings of my current Org file.

Don't know what's wrong.

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Org mode links for helm
  2014-05-24  7:49   ` Sebastien Vauban
@ 2014-05-24 18:52     ` Thomas S. Dye
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas S. Dye @ 2014-05-24 18:52 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Aloha Seb,

Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
writes:

> Bastien wrote:
>> tsd-P0awH739Ni4AvxtiuMwx3w@public.gmane.org (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 ?
>>
>> Maybe the authors can help I guess.
>
> The author, Thierry Volpiatto, does not support Helm-Org anymore, as
> told in http://article.gmane.org/gmane.emacs.helm.user/617.
>
> BTW, it is only for the Org headlines, not for Org code block names.
>
> Though, this particular question has already gotten tentatives of
> answers, see http://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg00712.html.
>
> I remember (thanks to Org!) having written the following in my .emacs file:
>
> #+begin_src emacs-lisp
>   ;; extension of Imenu
>   (when (and
>          ;; `org-babel' has been loaded
>          (fboundp 'org-babel-execute-src-block)
>
>          ;; `imenu' has been loaded
>          (fboundp 'try-to-add-imenu))
>
>     (setq org-src-blocks-imenu-generic-expression
>           `(("Snippets" ,org-babel-src-name-w-name-regexp 2)))
>
>     (add-hook 'org-mode-hook
>               (lambda ()
>                 (setq imenu-generic-expression
>                       org-src-blocks-imenu-generic-expression))))
> #+end_src
>
> ... but I never saw any name of code chunk in the "IMenu" menu.
> I only saw the headings of my current Org file.

Thanks for this helpful information.  I didn't know about imenu, but it
appears to provide much of the functionality I'm after.

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Org mode links for helm
  2014-05-24  4:26 ` Bastien
  2014-05-24  7:49   ` Sebastien Vauban
@ 2014-05-25  3:32   ` Thomas S. Dye
  2014-05-25 11:28     ` John Kitchin
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas S. Dye @ 2014-05-25  3:32 UTC (permalink / raw)
  To: Bastien; +Cc: Org-mode

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Org mode links for helm
  2014-05-25  3:32   ` Thomas S. Dye
@ 2014-05-25 11:28     ` John Kitchin
  0 siblings, 0 replies; 6+ messages in thread
From: John Kitchin @ 2014-05-25 11:28 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Bastien, Org-mode

[-- Attachment #1: Type: text/plain, Size: 2011 bytes --]

nice. I have similar code in org-ref  for a ref links to labels, but it
doesn't have #+name in it yet, but it does do table names. You might find
the function org-label-store-link (
https://github.com/jkitchin/jmax/blob/master/org-ref.org#label)
interesting, so you can use C-c l and C-c C-l to put your links in. I think
you could do something like that with #+name.



John

-----------------------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingroup.cheme.cmu.edu



On Sat, May 24, 2014 at 11:32 PM, Thomas S. Dye <tsd@tsdye.com> wrote:

> 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
>
>

[-- Attachment #2: Type: text/html, Size: 3096 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-05-25 11:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-05-25 11:28     ` John Kitchin

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).