emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Gustav Wikström" <gustav.erik@gmail.com>
To: Suvayu Ali <fatkasuvayu+linux@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Link abbreviations, org-files with searches
Date: Mon, 31 Oct 2011 22:00:56 +0100	[thread overview]
Message-ID: <CA+SyOP_KipNYA1Xs1cBw0Zt3VP2RA1KhxuP_pvvB8wrcEKHXrA@mail.gmail.com> (raw)
In-Reply-To: <CA+SyOP-wBwO8t3Fu-iGm_AE0wqkOa=Uja7UkTD+8sBYg2wiUmw@mail.gmail.com>

I did some digging and ended at the function org-link-expand-abbrev.

According to the org-documentation, abbreviations should be written with:

[[linkword:tag]]

however the regular expression doing the matching in the function also
allows the following:

[[linkword::tag]]

The greed of the regular expression makes it a requirement to use four
colons when using abbreviation and search. Also, all types of
searching works, not only the headline-search as I stated earlier.

Just wanted to clear this out
/Gustav

2011/10/31 Gustav Wikström <gustav.erik@gmail.com>:
> 2011/10/31 Suvayu Ali <fatkasuvayu+linux@gmail.com>:
>> Hi Gustav,
>>
>> On Mon, 31 Oct 2011 14:55:27 +0100
>> Gustav Wikström <gustav.erik@gmail.com> wrote:
>>
>>> This works when adding "::" to the end of the link. But with this
>>> setting I cannot use the link as a simple file-link, eg. the following
>>> does not work:
>>>
>>> #+LINK: foo     file:/long/path/to/file/foo.org::
>>> [[foo][Description]]
>>>
>>> When trying to follow this link I get an error saying that there is
>>> "no such file: /long/path/to/file/foo.org::"
>>
>> Of course that won't work! The resulting link is not a valid link
>> syntax. Since you don't specify a tag, the final link looks like this:
>>
>> [[file:/path/to/file.org::]]
>>
>> which is incorrect.
>>
>> From a test the following worked nicely.
>>
>> #+LINK: odir2 file:~/org/coding.org
>>
>> [[odir2][link to file]]
>>
>> So in conclusion, if you want to use both bare file/directory links as
>> well as headline/search links, you would have to define two separate
>> link shortcuts.
>
> Yes, I'm aware of this. And this is the reason of my initial question.
> Should it really be necessary to specify two separate links to the
> same file when I want to both link to the file directly and link it
> with a search?
>
> Thus, this works:
>
>   #+LINK: foo     file:/long/path/to/file/foo.org
>   [[foo::::*<heading search>]]
>
> but this does not:
>
>  #+LINK: foo     file:/long/path/to/file/foo.org
>  [[foo::::<search>]]
>
> I find the use of four ":" a bit strange, but I guess this is only a
> limit of my understanding a.t.m. In my view the first colon should be
> stating the start of the "tag" and the rest of the string the tag
> itself. This leaves three colons for the tag which in my view is one
> to many. But it seems to work. And this is what I'm scratching my head
> about.
>
> I also suspect a bug hidden somewhere, since headlines can be searched
> for but not text inside the document.
>
> Anyone got any input on this?
> /Gustav
>

      reply	other threads:[~2011-10-31 21:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 11:36 Link abbreviations, org-files with searches Gustav Wikström
2011-10-31 12:10 ` suvayu ali
2011-10-31 12:33   ` Gustav Wikström
2011-10-31 13:01     ` Suvayu Ali
2011-10-31 13:55       ` Gustav Wikström
2011-10-31 14:09         ` Suvayu Ali
     [not found]           ` <CA+SyOP_+ywn8d5n-bngggc9LYSyZGNpiD3yvLbt=id7P=zmvmQ@mail.gmail.com>
2011-10-31 17:50             ` Gustav Wikström
2011-10-31 21:00               ` Gustav Wikström [this message]

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=CA+SyOP_KipNYA1Xs1cBw0Zt3VP2RA1KhxuP_pvvB8wrcEKHXrA@mail.gmail.com \
    --to=gustav.erik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=fatkasuvayu+linux@gmail.com \
    /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).