emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Aankhen <aankhen@gmail.com>
To: Juraj Kubelka <juraj.kubelka@gmail.com>,
	Org-mode ml <emacs-orgmode@gnu.org>
Subject: Re: org-attach link proposal
Date: Fri, 1 Apr 2011 18:07:51 +0530	[thread overview]
Message-ID: <AANLkTi=jwguRPxzTdK-AyQMbLi1wfqJyJTXyum5YLdi+@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimHaZQxeZNkSZvtrSimhgBFTefQ9P2v7Wa1XQ1D@mail.gmail.com>

Hi Juraj,

On Fri, Apr 1, 2011 at 16:32, Juraj Kubelka <juraj.kubelka@gmail.com> wrote:
> I played a bit with org-attach. It is great package! Thanks for it! :)
> I have one proposal. So at first why:
> I would like to do something like this:
> * Project documents
>   :PROPERTIES:
>   :Attachments: first.doc second.doc third.doc
>   :ID:       37773ace-b471-4003-a8d1-448e7c48f77b
>   :END:
>   + the first document about something1 [[att:first.doc]]
>   + the second document  [[att:second.doc]]
>   + the third document [[att:third.doc]]
> in order to easily access it just by click on related link.
> So I defined method:
> (defun org-attach-open-link (file &optional in-emacs)
>   (org-open-file (expand-file-name file (org-attach-dir t)) in-emacs))
> and link:
> #+LINK: att elisp:(org-attach-open-link "%s")
> and it works. but always asks if I want to execute elisp code.
> Would it be possible to integrate it directly to org-mode like http: and
> others? I am not sure how to do it.

I believe this should be possible using a bit of Elisp:

,----
| (org-add-link-type "att" 'org-attach-open-link)
|
| (defun org-attach-open-link (file &optional in-emacs)
|   (org-open-file (expand-file-name file (org-attach-dir t)) in-emacs))
`----

Put that in your init file, or wherever you place your customizations.
 You can read more about adding new hyperlink types in the manual.[1]
By the way, the function is only passed a single argument (the text of
the link); ‘in-emacs’ will always be ‘nil’, unless you’re also calling
it programmatically elsewhere.

Aankhen

[1]: http://orgmode.org/org.html#Adding-hyperlink-types

  reply	other threads:[~2011-04-01 12:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-01 11:02 org-attach link proposal Juraj Kubelka
2011-04-01 12:37 ` Aankhen [this message]
2011-04-01 16:25 ` Darlan Cavalcante Moreira
2011-04-01 17:45   ` Juraj Kubelka

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='AANLkTi=jwguRPxzTdK-AyQMbLi1wfqJyJTXyum5YLdi+@mail.gmail.com' \
    --to=aankhen@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=juraj.kubelka@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).