* Problems with hyperlinked files
@ 2010-03-23 9:13 Leo Alekseyev
2010-03-23 20:26 ` Jan Böcker
0 siblings, 1 reply; 5+ messages in thread
From: Leo Alekseyev @ 2010-03-23 9:13 UTC (permalink / raw)
To: emacs-orgmode
Hi all,
I am unable to open locally linked files if I use angle brackets to
protect spaces, like so:
[[<file:E:\ebooks\math\Probability and statistics\The Elements of
Statistical Learning (2nd ed).pdf>][Hastie et al]]
-- the echo area displays "no such file: E:\ebooks\math\Probability
and statistics\The Elements of Statistical Learning (2nd ed).pdf>"
<---- note the right angle bracket here. Generally, any file links
with angle brackets refuse to open. Is this a known bug?... is there
a patch?.. (Org mode 6.31a, emacs 23.1)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Problems with hyperlinked files
2010-03-23 9:13 Problems with hyperlinked files Leo Alekseyev
@ 2010-03-23 20:26 ` Jan Böcker
2010-03-24 3:45 ` Leo Alekseyev
0 siblings, 1 reply; 5+ messages in thread
From: Jan Böcker @ 2010-03-23 20:26 UTC (permalink / raw)
To: Leo Alekseyev; +Cc: emacs-orgmode
On 23.03.2010 10:13, Leo Alekseyev wrote:
> Hi all,
> I am unable to open locally linked files if I use angle brackets to
> protect spaces, like so:
>
> [[<file:E:\ebooks\math\Probability and statistics\The Elements of
> Statistical Learning (2nd ed).pdf>][Hastie et al]]
>
> -- the echo area displays "no such file: E:\ebooks\math\Probability
> and statistics\The Elements of Statistical Learning (2nd ed).pdf>"
> <---- note the right angle bracket here. Generally, any file links
> with angle brackets refuse to open. Is this a known bug?... is there
> a patch?.. (Org mode 6.31a, emacs 23.1)
Hi Leo,
I could reproduce this, but I don't know if this is really a bug.
(I never heard of protecting spaces with angle brackets.)
You do not have to protect spaces, because the URL is surrounded by the
square brackets. I could only insert angle brackets into a link by
editing it manually; when you edit a link with C-c C-l and enclose the
URL in angle brackets, Org will automatically remove them.
HTH, Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Problems with hyperlinked files
2010-03-23 20:26 ` Jan Böcker
@ 2010-03-24 3:45 ` Leo Alekseyev
2010-03-24 10:50 ` Carsten Dominik
2010-03-24 13:42 ` Jan Böcker
0 siblings, 2 replies; 5+ messages in thread
From: Leo Alekseyev @ 2010-03-24 3:45 UTC (permalink / raw)
To: Jan Böcker; +Cc: emacs-orgmode
>
> I could reproduce this, but I don't know if this is really a bug.
> (I never heard of protecting spaces with angle brackets.)
Actually, it's right there in section 4.3 of the manual, last
sentence: "if you need to remove ambiguities about the end of the
link, enclose them in angular brackets. "
> You do not have to protect spaces, because the URL is surrounded by the
> square brackets. I could only insert angle brackets into a link by
> editing it manually; when you edit a link with C-c C-l and enclose the
> URL in angle brackets, Org will automatically remove them.
Thanks, both these methods work -- although I still think it would be
nice if org mode could properly handle angle brackets inside square
ones; the motivation here is that often I just paste in file paths
instead of using C-c C-l, and then I have to use angle brackets to
deal w/ spaces; if I later want to change it to an annotated link, it
would be nice not to have to strip the angle brackets before wrapping
it in square ones...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Problems with hyperlinked files
2010-03-24 3:45 ` Leo Alekseyev
@ 2010-03-24 10:50 ` Carsten Dominik
2010-03-24 13:42 ` Jan Böcker
1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2010-03-24 10:50 UTC (permalink / raw)
To: Leo Alekseyev; +Cc: emacs-orgmode
On Mar 24, 2010, at 4:45 AM, Leo Alekseyev wrote:
>>
>> I could reproduce this, but I don't know if this is really a bug.
>> (I never heard of protecting spaces with angle brackets.)
>
> Actually, it's right there in section 4.3 of the manual, last
> sentence: "if you need to remove ambiguities about the end of the
> link, enclose them in angular brackets. "
>
>> You do not have to protect spaces, because the URL is surrounded by
>> the
>> square brackets. I could only insert angle brackets into a link by
>> editing it manually; when you edit a link with C-c C-l and enclose
>> the
>> URL in angle brackets, Org will automatically remove them.
>
> Thanks, both these methods work -- although I still think it would be
> nice if org mode could properly handle angle brackets inside square
> ones; the motivation here is that often I just paste in file paths
> instead of using C-c C-l, and then I have to use angle brackets to
> deal w/ spaces; if I later want to change it to an annotated link, it
> would be nice not to have to strip the angle brackets before wrapping
> it in square ones...
It would be hard for Org to make that distinction in a stable way. For
all it knows, the > might be part of the link.
Best habit is to always use [[..]] when you have a link
that contains spaces, just ignore the availability of
angular brackets as delimiters. These were used historically
in Org before the bracket notation was introduced.
I am keeping that syntax for backward compatibility, but had
I had bracket links from the start, the angular bracket
representation would not exist today.
Best wishes
- Carsten
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Problems with hyperlinked files
2010-03-24 3:45 ` Leo Alekseyev
2010-03-24 10:50 ` Carsten Dominik
@ 2010-03-24 13:42 ` Jan Böcker
1 sibling, 0 replies; 5+ messages in thread
From: Jan Böcker @ 2010-03-24 13:42 UTC (permalink / raw)
To: Leo Alekseyev; +Cc: emacs-orgmode
On 24.03.2010 04:45, Leo Alekseyev wrote:
> Actually, it's right there in section 4.3 of the manual, last
> sentence: "if you need to remove ambiguities about the end of the
> link, enclose them in angular brackets. "
>
Ah, I see -- this seems to be meant for the use case you mention below,
pasting in a URL without a description.
>> You do not have to protect spaces, because the URL is surrounded by the
>> square brackets. I could only insert angle brackets into a link by
>> editing it manually; when you edit a link with C-c C-l and enclose the
>> URL in angle brackets, Org will automatically remove them.
>
> Thanks, both these methods work -- although I still think it would be
> nice if org mode could properly handle angle brackets inside square
> ones; the motivation here is that often I just paste in file paths
> instead of using C-c C-l, and then I have to use angle brackets to
> deal w/ spaces; if I later want to change it to an annotated link, it
> would be nice not to have to strip the angle brackets before wrapping
> it in square ones...
Wouldn't you change it to an annotated link using C-c C-l anyway, which
would strip the square brackets for you? (C-c C-l can also edit existing
links, not only insert new ones.)
I looked at the code of org-open-at-point, and believe I can at least
explain the current behaviour (but I have no idea how a clean/elegant
fix would look):
- Org notices it is in a bracket link, say [[<file:~/s b.txt>]][test]]
- the link variable in org-open-at-point is set to "<file:~/s b.txt>"
- after expanding the ~ abbreviation, it is set to "<file:/home/jan/s b.txt"
- this string is not an absolute path, so it checks if
org-link-re-with-space3 matches, which is defined as follows:
"<?\\(http\\|https\\|ftp\\|mailto\\|file\\|news\\|shell\\|elisp\\|file\\+sys\\|file\\+emacs\\|bbdb\\|bibtex\\|docview\\|gnus\\|info\\|irc\\|mew\\|mhe\\|rmail\\|vm\\|wl\\|id\\):\\([^]
<> ][^
]*\\)"
Notice the optional < at the beginning? This regexp matches, and
captures "file" as the link type. Now Org takes the rest of the link,
"/home/jan/a b.txt>", and tries to open a non-existing file.
I assume angle brackets are not meant to be supported in bracket links,
because they are not needed there and are stripped by C-c C-l, but only
Carsten would know what the intended behaviour is here.
- Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-03-24 13:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-23 9:13 Problems with hyperlinked files Leo Alekseyev
2010-03-23 20:26 ` Jan Böcker
2010-03-24 3:45 ` Leo Alekseyev
2010-03-24 10:50 ` Carsten Dominik
2010-03-24 13:42 ` Jan Böcker
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).