Shawn Willden <swill...@google.com> writes:

> On Wed, Apr 27, 2011 at 6:42 AM, Matt Lundin <m...@imapmail.org> wrote:
>> I'm not too familiar with invoking sexp expansion within capture
>> templates and am not sure whether you can expand an item within a sexp.
>
> It does work, sort of.  My function is of the form:
>
>     if path matches regexp
>         return complicated link construction
>     else
>         return "[[file:" + path + "]]"
>
> What happens is that when called with the expanded %F the matching
> always fails so the "else" branch is always taken.  When called from
> evaluated lisp code (e.g. (linkify "foo/bar")), the function works
> correctly.
>

[...]

>> Would the following work, or do you require something more complex?
>>
>> ("c" "Clock sibling" item (clock) "%T %a")
>
> I require something more complex.  Our code repository has a pretty
> nifty web interface with a lot of very useful features.  What I'm
> trying to do is arrange that if the file that I was working on when I
> created the note is from the source repository, I create a link to the
> web interface's rendition of the file, rather than to the file on the
> file system.  If the file isn't from the code repository then I just
> create an ordinary file link.

Perhaps a simpler option would be to add a function to
org-store-link-functions. See the docstring of that variable for more
details.

The advantage of this approach is that your function would be called
whenever you are storing a link in one of the relevant files, instead of
only via a particular capture template.

Best,
Matt

Reply via email to