emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Wish list: Storing links and enabling MIME actions on files
@ 2007-09-27 16:43 Bernt Hansen
  2007-09-27 17:24 ` Bastien
  2007-09-27 18:01 ` Carsten Dominik
  0 siblings, 2 replies; 13+ messages in thread
From: Bernt Hansen @ 2007-09-27 16:43 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

I occasionally receive documents (like PDF files) in emails and I want
to just save some of the attachments to a local directory for reference
in my org file (usually because the email contained half a dozen
documents and only 1 is interesting.)

I'd like to be able to link to the file easily for my org document and
have it invoke the appropriate viewer as defined in my MIME setup.  Gnus
correctly opens the PDF attachment for viewing.  I can link to the Gnus
email and then open the right attachment - but I need to remember which
attachment it is of the 6 in the mail.

When I create a link like [[file:~/path/to/some-long-filename.pdf]]
C-c C-o on the link just opens the raw PDF text in another buffer which
isn't useful -- sorry I can't read raw PDF source ;)

I'm wondering if there is a way to create a [[file:...]] link easily by
browsing for the file instead of typing it in -- long case sensitive
files with blanks are a bit of a pain here -- and having the file opened
by the appropriate viewer when it's not text.

Knowing Carsten this probably already exists somewhere and I just
haven't found it yet.

Bernt

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

* Re: Wish list: Storing links and enabling MIME actions on files
  2007-09-27 16:43 Wish list: Storing links and enabling MIME actions on files Bernt Hansen
@ 2007-09-27 17:24 ` Bastien
  2007-09-27 17:51   ` William Henney
  2007-09-27 18:44   ` Bernt Hansen
  2007-09-27 18:01 ` Carsten Dominik
  1 sibling, 2 replies; 13+ messages in thread
From: Bastien @ 2007-09-27 17:24 UTC (permalink / raw)
  To: emacs-orgmode

Bernt Hansen <bernt@alumni.uwaterloo.ca> writes:

> I occasionally receive documents (like PDF files) in emails and I want
> to just save some of the attachments to a local directory for reference
> in my org file (usually because the email contained half a dozen
> documents and only 1 is interesting.)

One idea is to be able to add a search string in email link types.  

For example: [[gnus:nnml.orgmode#6548::org.pdf]] would fetch the mail
#6548 in nnml.orgmode Gnus group and search for the string "org.pdf" in
the body of the mail (this could also be a regexp). Then RET will open
this PDF attachment with the right app.

> I'd like to be able to link to the file easily for my org document and
> have it invoke the appropriate viewer as defined in my MIME setup.  

Org uses the local mailcap setup to decide what application to open a
file with.  Don't you have this on your computer?

~$ man mailcap

> I'm wondering if there is a way to create a [[file:...]] link easily
> by browsing for the file

M-x org-store-link in dired-mode will store a link to the file under the
point. But maybe you already know this and I missed the question...

Regards,

-- 
Bastien

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

* Re: Wish list: Storing links and enabling MIME actions on files
  2007-09-27 17:24 ` Bastien
@ 2007-09-27 17:51   ` William Henney
  2007-09-27 18:02     ` Bastien
  2007-09-27 18:44   ` Bernt Hansen
  1 sibling, 1 reply; 13+ messages in thread
From: William Henney @ 2007-09-27 17:51 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

On 9/27/07, Bastien <bzg@altern.org> wrote:
> Bernt Hansen <bernt@alumni.uwaterloo.ca> writes:
> > I'd like to be able to link to the file easily for my org document and
> > have it invoke the appropriate viewer as defined in my MIME setup.
>
> Org uses the local mailcap setup to decide what application to open a
> file with.  Don't you have this on your computer?
>
> ~$ man mailcap
>

This is just for linux/unix, but things work fine for me on Mac OS X
too (e.g., file:foo.pdf links open in my default PDF viewer).

This should have been set up out of the box by one of the following
variables, depending on your system

`org-file-apps-defaults-macosx'
`org-file-apps-defaults-windowsnt'
`org-file-apps-defaults-gnu'


Cheers

Will

-- 

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

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

* Re: Wish list: Storing links and enabling MIME actions on files
  2007-09-27 16:43 Wish list: Storing links and enabling MIME actions on files Bernt Hansen
  2007-09-27 17:24 ` Bastien
@ 2007-09-27 18:01 ` Carsten Dominik
  2007-09-27 18:38   ` Bernt Hansen
  1 sibling, 1 reply; 13+ messages in thread
From: Carsten Dominik @ 2007-09-27 18:01 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode


On Sep 27, 2007, at 18:43, Bernt Hansen wrote:

> Hi all,
>
> I occasionally receive documents (like PDF files) in emails and I want
> to just save some of the attachments to a local directory for reference
> in my org file (usually because the email contained half a dozen
> documents and only 1 is interesting.)
>
> I'd like to be able to link to the file easily for my org document and
> have it invoke the appropriate viewer as defined in my MIME setup.  
> Gnus
> correctly opens the PDF attachment for viewing.  I can link to the Gnus
> email and then open the right attachment - but I need to remember which
> attachment it is of the 6 in the mail.
>
> When I create a link like [[file:~/path/to/some-long-filename.pdf]]
> C-c C-o on the link just opens the raw PDF text in another buffer which
> isn't useful -- sorry I can't read raw PDF source ;)
>
> I'm wondering if there is a way to create a [[file:...]] link easily by
> browsing for the file instead of typing it in -- long case sensitive
> files with blanks are a bit of a pain here -- and having the file 
> opened
> by the appropriate viewer when it's not text.

`C-u C-c C-l' will insert a link to a local file, using file name 
completion.

For the rest, like Bastien says, check the mailcap setup.  Or customize 
the variable
org-file-apps or one of its opeating-system-dependent equivalents.


- Carsten

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

* Re: Wish list: Storing links and enabling MIME actions on files
  2007-09-27 17:51   ` William Henney
@ 2007-09-27 18:02     ` Bastien
  2007-09-27 18:15       ` William Henney
  0 siblings, 1 reply; 13+ messages in thread
From: Bastien @ 2007-09-27 18:02 UTC (permalink / raw)
  To: emacs-orgmode

"William Henney" <whenney@gmail.com> writes:

> On 9/27/07, Bastien <bzg@altern.org> wrote:
>> Bernt Hansen <bernt@alumni.uwaterloo.ca> writes:
>> > I'd like to be able to link to the file easily for my org document and
>> > have it invoke the appropriate viewer as defined in my MIME setup.
>>
>> Org uses the local mailcap setup to decide what application to open a
>> file with.  Don't you have this on your computer?
>>
>> ~$ man mailcap
>>
>
> This is just for linux/unix, but things work fine for me on Mac OS X
> too (e.g., file:foo.pdf links open in my default PDF viewer).

The User-Agent header of Bernt said:
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

... so I was assuming he was using Emacs on a GNU System.  

-- 
Bastien

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

* Re: Wish list: Storing links and enabling MIME actions on files
  2007-09-27 18:02     ` Bastien
@ 2007-09-27 18:15       ` William Henney
  2007-09-27 19:35         ` Bastien
  0 siblings, 1 reply; 13+ messages in thread
From: William Henney @ 2007-09-27 18:15 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

On 9/27/07, Bastien <bzg@altern.org> wrote:
> "William Henney" <whenney@gmail.com> writes:
> > This is just for linux/unix, but things work fine for me on Mac OS X
> > too (e.g., file:foo.pdf links open in my default PDF viewer).
>
> The User-Agent header of Bernt said:
> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)
>
> ... so I was assuming he was using Emacs on a GNU System.
>

Ah yes... you are right of course. Sorry for the noise.

Cheers

Will

P.S. Saw a strange bug in org-toc this morning: after a certain point
in the toc, all fontification stopped. The previous headline contained
an inactive date stamp, which might have something to do with it. I'll
try and make a minimal example

-- 

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

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

* Re: Wish list: Storing links and enabling MIME actions on files
  2007-09-27 18:01 ` Carsten Dominik
@ 2007-09-27 18:38   ` Bernt Hansen
  2007-09-27 19:08     ` Bernt Hansen
  0 siblings, 1 reply; 13+ messages in thread
From: Bernt Hansen @ 2007-09-27 18:38 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> `C-u C-c C-l' will insert a link to a local file, using file name
> completion.
>
> For the rest, like Bastien says, check the mailcap setup.  Or
> customize the variable
> org-file-apps or one of its opeating-system-dependent equivalents.

Thanks.  My mailcap must be misconfigured or something.  It works fine
for MIME attachments in Gnus - just for not filenames with no mime info.

Bernt

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

* Re: Wish list: Storing links and enabling MIME actions on files
  2007-09-27 17:24 ` Bastien
  2007-09-27 17:51   ` William Henney
@ 2007-09-27 18:44   ` Bernt Hansen
  2007-09-27 22:50     ` Bastien
  1 sibling, 1 reply; 13+ messages in thread
From: Bernt Hansen @ 2007-09-27 18:44 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Bastien <bzg@altern.org> writes:

> Bernt Hansen <bernt@alumni.uwaterloo.ca> writes:
>
>> I occasionally receive documents (like PDF files) in emails and I want
>> to just save some of the attachments to a local directory for reference
>> in my org file (usually because the email contained half a dozen
>> documents and only 1 is interesting.)
>
> One idea is to be able to add a search string in email link types.  
>
> For example: [[gnus:nnml.orgmode#6548::org.pdf]] would fetch the mail
> #6548 in nnml.orgmode Gnus group and search for the string "org.pdf" in
> the body of the mail (this could also be a regexp). Then RET will open
> this PDF attachment with the right app.

Thanks - I'll try that.

>
>> I'd like to be able to link to the file easily for my org document and
>> have it invoke the appropriate viewer as defined in my MIME setup.  
>
> Org uses the local mailcap setup to decide what application to open a
> file with.  Don't you have this on your computer?
>
> ~$ man mailcap
>

Yes I have mailcap - and I assume Gnus is using it to open the MIME
attachment with the pdf file in it.  I don't have anything in ~/.mailcap
- only /etc/mailcap on my Debian system.  It just doesn't seem to
associate filename.pdf with the viewer for some reason.  I'm probably
missing something simple in the mailcap setup.

Bernt

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

* Re: Wish list: Storing links and enabling MIME actions on files
  2007-09-27 18:38   ` Bernt Hansen
@ 2007-09-27 19:08     ` Bernt Hansen
  2007-09-27 19:39       ` Bastien
  0 siblings, 1 reply; 13+ messages in thread
From: Bernt Hansen @ 2007-09-27 19:08 UTC (permalink / raw)
  To: emacs-orgmode

Bernt Hansen <bernt@alumni.uwaterloo.ca> writes:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> `C-u C-c C-l' will insert a link to a local file, using file name
>> completion.
>>
>> For the rest, like Bastien says, check the mailcap setup.  Or
>> customize the variable
>> org-file-apps or one of its opeating-system-dependent equivalents.
>
> Thanks.  My mailcap must be misconfigured or something.  It works fine
> for MIME attachments in Gnus - just for not filenames with no mime info.

Sorry for the noise :/

Creating the link like this works great.  For some reason the previous
links I created has ::blah after them - I opened the file with C-x C-f
filename.pdf and then did used org-store-link - which created a link
with a search expresssion in it - and that's why it didn't open with the
PDF viewer by default.

Thanks all!

Bernt

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

* Re: Wish list: Storing links and enabling MIME actions on files
  2007-09-27 18:15       ` William Henney
@ 2007-09-27 19:35         ` Bastien
  0 siblings, 0 replies; 13+ messages in thread
From: Bastien @ 2007-09-27 19:35 UTC (permalink / raw)
  To: emacs-orgmode

"William Henney" <whenney@gmail.com> writes:

> P.S. Saw a strange bug in org-toc this morning: after a certain point
> in the toc, all fontification stopped. The previous headline contained
> an inactive date stamp, which might have something to do with it. I'll
> try and make a minimal example

I guess it's time to quote this excellent read:

  Fatherly Advice To New Programmers -- <http://tinyurl.com/pn9f7>

  Own Up To Your Mistakes: You will make mistakes. How you handle your
  mistakes is how you will be judged. Learn how to say "I was wrong." If
  you underestimated how long it will take you to do something, tell
  people as soon as it is clear to you. If you broke the build, fix it.
  If you created a bug, fix it. Don't deny the mistake, don't make
  excuses for the mistake, don't figure out how to hide the mistake,
  don't blame others for the mistake, do something about it. Take
  ownership of your mistake or you will repeat it.

So, yes, I knew about this bug and I'm not sure on how to fix it right
now. I'll digg this further and come back with a solution.

Thanks!

-- 
Bastien

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

* Re: Re: Wish list: Storing links and enabling MIME actions on files
  2007-09-27 19:08     ` Bernt Hansen
@ 2007-09-27 19:39       ` Bastien
  0 siblings, 0 replies; 13+ messages in thread
From: Bastien @ 2007-09-27 19:39 UTC (permalink / raw)
  To: emacs-orgmode

Bernt Hansen <bernt@alumni.uwaterloo.ca> writes:

> Creating the link like this works great.  For some reason the previous
> links I created has ::blah after them - I opened the file with C-x C-f
> filename.pdf and then did used org-store-link - which created a link
> with a search expresssion in it - and that's why it didn't open with the
> PDF viewer by default.

This behavior is driven by `org-context-in-file-links':

,----[ C-h v org-context-in-file-links ]
| Non-nil means, file links from `org-store-link' contain context. A
| search string will be added to the file name with :: as separator and
| used to find the context when the link is activated by the command
| `org-open-at-point'. Using a prefix arg to the command C-c l
| (`org-store-link') negates this setting for the duration of the command.
`----

(setq org-context-in-file-links nil)  

won't try to add context to the file link. But linking the file from
dired-mode won't add contextual search string neither.

HTH,

-- 
Bastien

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

* Re: Wish list: Storing links and enabling MIME actions on files
  2007-09-27 18:44   ` Bernt Hansen
@ 2007-09-27 22:50     ` Bastien
  2007-09-27 23:08       ` Bernt Hansen
  0 siblings, 1 reply; 13+ messages in thread
From: Bastien @ 2007-09-27 22:50 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Bernt Hansen <bernt@alumni.uwaterloo.ca> writes:

>> For example: [[gnus:nnml.orgmode#6548::org.pdf]] would fetch the mail
>> #6548 in nnml.orgmode Gnus group and search for the string "org.pdf" in
>> the body of the mail (this could also be a regexp). Then RET will open
>> this PDF attachment with the right app.
>
> Thanks - I'll try that.

Well -- it was a proposal for a possible feature.  Just as storing a
file link lets you keep the context with, it would be nice if we had
context with us when storing e-mail links.  At least for what you're
trying to achieve (directly go to an attachment).

> I don't have anything in ~/.mailcap

Why don't you try a simple ~/.mailcap like this:

application/pdf; /usr/bin/acroread '%s'; test=test -n "$DISPLAY"; description=Portable Document Format; nametemplate=%s.pdf

Or digg for the documentation of `org-file-apps' -- here you can bind
extension and application directly.

-- 
Bastien

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

* Re: Wish list: Storing links and enabling MIME actions on files
  2007-09-27 22:50     ` Bastien
@ 2007-09-27 23:08       ` Bernt Hansen
  0 siblings, 0 replies; 13+ messages in thread
From: Bernt Hansen @ 2007-09-27 23:08 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg@altern.org> writes:

> Bernt Hansen <bernt@alumni.uwaterloo.ca> writes:
>
>>> For example: [[gnus:nnml.orgmode#6548::org.pdf]] would fetch the mail
>>> #6548 in nnml.orgmode Gnus group and search for the string "org.pdf" in
>>> the body of the mail (this could also be a regexp). Then RET will open
>>> this PDF attachment with the right app.
>>
>> Thanks - I'll try that.
>
> Well -- it was a proposal for a possible feature.  Just as storing a
> file link lets you keep the context with, it would be nice if we had
> context with us when storing e-mail links.  At least for what you're
> trying to achieve (directly go to an attachment).
>
>> I don't have anything in ~/.mailcap
>
> Why don't you try a simple ~/.mailcap like this:
>
> application/pdf; /usr/bin/acroread '%s'; test=test -n "$DISPLAY"; description=Portable Document Format; nametemplate=%s.pdf
>
> Or digg for the documentation of `org-file-apps' -- here you can bind
> extension and application directly.

This is fixed. Thanks.  My mailcap entry works - it's just the link I
was using was broken.

Bernt

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

end of thread, other threads:[~2007-09-27 23:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-27 16:43 Wish list: Storing links and enabling MIME actions on files Bernt Hansen
2007-09-27 17:24 ` Bastien
2007-09-27 17:51   ` William Henney
2007-09-27 18:02     ` Bastien
2007-09-27 18:15       ` William Henney
2007-09-27 19:35         ` Bastien
2007-09-27 18:44   ` Bernt Hansen
2007-09-27 22:50     ` Bastien
2007-09-27 23:08       ` Bernt Hansen
2007-09-27 18:01 ` Carsten Dominik
2007-09-27 18:38   ` Bernt Hansen
2007-09-27 19:08     ` Bernt Hansen
2007-09-27 19:39       ` Bastien

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