emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-attach link proposal
@ 2011-04-01 11:02 Juraj Kubelka
  2011-04-01 12:37 ` Aankhen
  2011-04-01 16:25 ` Darlan Cavalcante Moreira
  0 siblings, 2 replies; 4+ messages in thread
From: Juraj Kubelka @ 2011-04-01 11:02 UTC (permalink / raw)
  To: Org mode mailing list

[-- Attachment #1: Type: text/plain, Size: 900 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1380 bytes --]

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

* Re: org-attach link proposal
  2011-04-01 11:02 org-attach link proposal Juraj Kubelka
@ 2011-04-01 12:37 ` Aankhen
  2011-04-01 16:25 ` Darlan Cavalcante Moreira
  1 sibling, 0 replies; 4+ messages in thread
From: Aankhen @ 2011-04-01 12:37 UTC (permalink / raw)
  To: Juraj Kubelka, Org-mode ml

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

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

* Re: org-attach link proposal
  2011-04-01 11:02 org-attach link proposal Juraj Kubelka
  2011-04-01 12:37 ` Aankhen
@ 2011-04-01 16:25 ` Darlan Cavalcante Moreira
  2011-04-01 17:45   ` Juraj Kubelka
  1 sibling, 1 reply; 4+ messages in thread
From: Darlan Cavalcante Moreira @ 2011-04-01 16:25 UTC (permalink / raw)
  To: Juraj Kubelka; +Cc: Org mode mailing list


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 <juraj.kubelka@gmail.com> wrote:
> 
> [1  <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
>   :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  <text/html; UTF-8 (quoted-printable)>]
> 

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

* Re: org-attach link proposal
  2011-04-01 16:25 ` Darlan Cavalcante Moreira
@ 2011-04-01 17:45   ` Juraj Kubelka
  0 siblings, 0 replies; 4+ messages in thread
From: Juraj Kubelka @ 2011-04-01 17:45 UTC (permalink / raw)
  To: Darlan Cavalcante Moreira, Aankhen; +Cc: Org mode mailing list

[-- Attachment #1: Type: text/plain, Size: 2484 bytes --]

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 <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/msg37613.html
>
> At Fri, 1 Apr 2011 13:02:50 +0200,
> Juraj Kubelka <juraj.kubelka@gmail.com> wrote:
> >
> > [1  <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
> >   :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  <text/html; UTF-8 (quoted-printable)>]
> >
>

[-- Attachment #2: Type: text/html, Size: 3531 bytes --]

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

end of thread, other threads:[~2011-04-01 17:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-01 11:02 org-attach link proposal Juraj Kubelka
2011-04-01 12:37 ` Aankhen
2011-04-01 16:25 ` Darlan Cavalcante Moreira
2011-04-01 17:45   ` Juraj Kubelka

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