From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juraj Kubelka Subject: Re: org-attach link proposal Date: Fri, 1 Apr 2011 19:45:36 +0200 Message-ID: References: <4d95fc80.1c1c640a.7c91.ffff898b@mx.google.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016364ed6d8650e6d049fdefb91 Return-path: Received: from [140.186.70.92] (port=54319 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q5iQ2-0004V8-EY for emacs-orgmode@gnu.org; Fri, 01 Apr 2011 13:45:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q5iQ1-0004Vz-60 for emacs-orgmode@gnu.org; Fri, 01 Apr 2011 13:45:58 -0400 Received: from mail-qy0-f169.google.com ([209.85.216.169]:47903) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q5iQ1-0004Vg-1g for emacs-orgmode@gnu.org; Fri, 01 Apr 2011 13:45:57 -0400 Received: by qyk2 with SMTP id 2so591139qyk.0 for ; Fri, 01 Apr 2011 10:45:56 -0700 (PDT) In-Reply-To: <4d95fc80.1c1c640a.7c91.ffff898b@mx.google.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Darlan Cavalcante Moreira , Aankhen Cc: Org mode mailing list --0016364ed6d8650e6d049fdefb91 Content-Type: text/plain; charset=UTF-8 Hi Darlan and Aankhen, thank you for your help! In the end a use this setup: (org-add-link-type "att" 'org-attach-open-link) (defun org-attach-open-link (file) (org-open-file (org-attach-expand file))) (set-variable 'org-attach-store-link-p t) I have learned a lot. This is a great project! Best regards, Juraj On Fri, Apr 1, 2011 at 6:25 PM, Darlan Cavalcante Moreira wrote: > > I have the same use-case scenario as you and I asked the same question a > while ago [1]. As you, I define a link type for attached files with > > #+LINK: attach elisp:(org-open-file (org-attach-expand "%s")) > > > To avoid the confirmation to execute elisp code you can use the > org-confirm-elisp-link-not-regexp variable that Bastien introduced after > [1]. In my case it is > > (setq org-confirm-elisp-link-not-regexp "org-open-file") > > Off-course you can also disable confirmation to execute any elisp code, but > I think it is more reasonable to disable only the one you need. > > > Bastien also introduced the org-attach-store-link-p variable. Set it to > 'attached and org will store a link to the attached file that you can > easily insert with "C-c C-l". > > -- > Darlan > > [1]: http://www.mail-archive.com/emacs-orgmode@gnu.org/msg37613.html > > At Fri, 1 Apr 2011 13:02:50 +0200, > Juraj Kubelka wrote: > > > > [1 ] > > Hi, > > > > 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. > > > > Thank you! > > Juraj > > [2 ] > > > --0016364ed6d8650e6d049fdefb91 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Darlan and Aankhen,

thank you for your help! In the e= nd a use this setup:

=C2=A0=C2=A0(org-ad= d-link-type "att" 'org-attach-open-link)
=C2=A0=C2= =A0(defun org-attach-open-link (file)
=C2=A0=C2=A0 =C2=A0(org-open-file (org-attach-expand file)))
=C2=A0=C2=A0(set-variable 'org-attach-store-link-p t)
=

I have learned a lot. This is a great project!
Best regards,
Juraj

On Fri, Apr 1, 20= 11 at 6:25 PM, Darlan Cavalcante Moreira <darcamo@gmail.com> wrote:

I have the same use-case scenario as you and I asked the same question a while ago [1]. As you, I define a link type for attached files with

#+LINK: attach elisp:(org-open-file (org-attach-expand "%s"))


To avoid the confirmation to execute elisp code you can use the
org-confirm-elisp-link-not-regexp variable that Bastien introduced after [1]. In my case it is

(setq org-confirm-elisp-link-not-regexp "org-open-file")

Off-course you can also disable confirmation to execute any elisp code, but=
I think it is more reasonable to disable only the one you need.


Bastien also introduced the org-attach-store-link-p variable. Set it to
'attached and org will store a link to the attached file that you can easily insert with "C-c C-l".

--
Darlan

[1]: http://www.mail-archive.com/emacs-orgmode@gnu.org/m= sg37613.html

At Fri, 1 Apr 2011 13:02:50 +0200,
Juraj Kubelka <juraj.kubelka@gmail.com> wrote:
>
> [1 =C2=A0<text/plain; UTF-8 (7bit)>]
> Hi,
>
> 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
> =C2=A0 :PROPERTIES:
> =C2=A0 :Attachments: first.doc second.doc third.doc
> =C2=A0 :ID: =C2=A0 =C2=A0 =C2=A0 37773ace-b471-4003-a8d1-448e7c48f77b<= br> > =C2=A0 :END:
>
> =C2=A0 + the first document about something1 [[att:first.doc]]
> =C2=A0 + the second document =C2=A0[[att:second.doc]]
> =C2=A0 + 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)
> =C2=A0 (org-open-file (expand-file-name file (org-attach-dir t)) in-em= acs))
>
> 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: a= nd
> others? I am not sure how to do it.
>
> Thank you!
> Juraj
> [2 =C2=A0<text/html; UTF-8 (quoted-printable)>]
>

--0016364ed6d8650e6d049fdefb91--