emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* confusion with file search with org-links
@ 2010-11-11 15:58 I.S.
  2010-11-11 16:09 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: I.S. @ 2010-11-11 15:58 UTC (permalink / raw)
  To: emacs-orgmode

Dear Experts,

I am a little confused about how file links are supposed to work in orgmode.

I have a link like [[file:/tmp/bug.bib::a bug][blah]] linking to a 
BiBTeX file but when I try to follow it via C-c C-o it just goes to the 
top of the file. Interestingly, when I open the file and set it to be in 
text mode and then follow the link, org puts me to the proper place in 
the file.

I suspect that org-mode is getting confused with the file search feature 
when it opens a BiBTeX file.

Why do I care? I'd like to be able to use a function like the one below 
to link to bib items:

   (defun store-bibtex-link ()
     "Make link to a bibtex entry.

Calling this function inside a BiBTeX entry will create a link to that
entry and store it so you can extract it via C-c C-l. This is useful
for making links to BiBTeX items from your org files.
"
     (interactive)
     (let* ((title (bibtex-autokey-get-field "title"))
            (myfile (buffer-file-name))
            (mylink (format "file:%s::%s" myfile title))
            )
       (setq org-stored-links (cons (list mylink title) org-stored-links))
       (message "Stored: %s" (or title mylink))
       ))

An example of the bug.bib illustrating the problem is shown below

% start bug.bib
% foo
% bar

@article{me98,
   title={a bug},
   author={me},
   journal={it},
   year=1998,
}

%blah


-- 
Thanks,
-I.S.

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

* Re: confusion with file search with org-links
  2010-11-11 15:58 confusion with file search with org-links I.S.
@ 2010-11-11 16:09 ` Carsten Dominik
  2010-11-15 18:07   ` I.S.
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2010-11-11 16:09 UTC (permalink / raw)
  To: I.S.; +Cc: emacs-orgmode

Hi I.S.

This should already work out of the box in bibtex files, but it will  
use the citation key instead of the title as the thing to search for.

the code for this functionality is in org-bibtex.el

- Carsten

On Nov 11, 2010, at 9:58 AM, I.S. wrote:

> Dear Experts,
>
> I am a little confused about how file links are supposed to work in  
> orgmode.
>
> I have a link like [[file:/tmp/bug.bib::a bug][blah]] linking to a  
> BiBTeX file but when I try to follow it via C-c C-o it just goes to  
> the top of the file. Interestingly, when I open the file and set it  
> to be in text mode and then follow the link, org puts me to the  
> proper place in the file.
>
> I suspect that org-mode is getting confused with the file search  
> feature when it opens a BiBTeX file.
>
> Why do I care? I'd like to be able to use a function like the one  
> below to link to bib items:
>
>  (defun store-bibtex-link ()
>    "Make link to a bibtex entry.
>
> Calling this function inside a BiBTeX entry will create a link to that
> entry and store it so you can extract it via C-c C-l. This is useful
> for making links to BiBTeX items from your org files.
> "
>    (interactive)
>    (let* ((title (bibtex-autokey-get-field "title"))
>           (myfile (buffer-file-name))
>           (mylink (format "file:%s::%s" myfile title))
>           )
>      (setq org-stored-links (cons (list mylink title) org-stored- 
> links))
>      (message "Stored: %s" (or title mylink))
>      ))
>
> An example of the bug.bib illustrating the problem is shown below
>
> % start bug.bib
> % foo
> % bar
>
> @article{me98,
>  title={a bug},
>  author={me},
>  journal={it},
>  year=1998,
> }
>
> %blah
>
>
> -- 
> Thanks,
> -I.S.
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: confusion with file search with org-links
  2010-11-11 16:09 ` Carsten Dominik
@ 2010-11-15 18:07   ` I.S.
  0 siblings, 0 replies; 3+ messages in thread
From: I.S. @ 2010-11-15 18:07 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

On 11/11/2010 11:09 AM, Carsten Dominik wrote:
> Hi I.S.
>
> This should already work out of the box in bibtex files, but it will 
> use the citation key instead of the title as the thing to search for.
>
> the code for this functionality is in org-bibtex.el
>
> - Carsten 
You are right, it does work out of the box.

Thanks again for such great features that new things I want are already 
there. :)

Sorry for troubling you,
-I. S.

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

end of thread, other threads:[~2010-11-15 18:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-11 15:58 confusion with file search with org-links I.S.
2010-11-11 16:09 ` Carsten Dominik
2010-11-15 18:07   ` I.S.

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