emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* file link format question - How to format link when square brackets [ ] are already in filename?
@ 2010-02-02 10:50 Erwin Panen
  2010-02-02 16:57 ` David Maus
  0 siblings, 1 reply; 5+ messages in thread
From: Erwin Panen @ 2010-02-02 10:50 UTC (permalink / raw)
  To: emacs-orgmode

Hi everyone,

I guess this is a minor question, but it has puzzled me already more 
than once.
My example: The below example is normally all on one line.
---------------Begin code----------------------------------------------
** Action: started to play video 
[[\\Dcerouter\public\videos\STORY_Station (sdb1)-CORE [32]\Les Rivières 
Pourpres 720x304\The Crimson Rivers.mkv][The Crimson Rivers.mkv]]
---------------End code------------------------------------------------

The problem is that the file location already contains a number between 
square brackets [32] which renders Org to treat the link in an 
unsuspected way.

Is there any way to circumvent this behaviour e.g. by inserting special 
characters to avoid Org to look inbetween the special characters?

Looking forward to a solution :-)

Thanks,

Erwin

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

* Re: file link format question - How to format link when square brackets [ ] are already in filename?
  2010-02-02 10:50 file link format question - How to format link when square brackets [ ] are already in filename? Erwin Panen
@ 2010-02-02 16:57 ` David Maus
  2010-02-02 19:43   ` Erwin Panen
  0 siblings, 1 reply; 5+ messages in thread
From: David Maus @ 2010-02-02 16:57 UTC (permalink / raw)
  To: erwinpanen; +Cc: emacs-orgmode

At Tue, 02 Feb 2010 11:50:31 +0100,
Erwin Panen wrote:
> 
> Hi everyone,
> 
> I guess this is a minor question, but it has puzzled me already more 
> than once.
> My example: The below example is normally all on one line.
> ---------------Begin code----------------------------------------------
> ** Action: started to play video 
> [[\\Dcerouter\public\videos\STORY_Station (sdb1)-CORE [32]\Les Rivières 
> Pourpres 720x304\The Crimson Rivers.mkv][The Crimson Rivers.mkv]]
> ---------------End code------------------------------------------------
> 
> The problem is that the file location already contains a number between 
> square brackets [32] which renders Org to treat the link in an 
> unsuspected way.
> 
> Is there any way to circumvent this behaviour e.g. by inserting special 
> characters to avoid Org to look inbetween the special characters?

You can url-encode the square brackets with %5B ("[") and %5D ("]") --
orgmode does this when calling `org-store-link' (C-c l) for a place
that contains square brackets and opens the links fine.

HTH
 -- David

-- 
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... maus.david@gmail.com

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

* Re: file link format question - How to format link when square brackets [ ] are already in filename?
  2010-02-02 16:57 ` David Maus
@ 2010-02-02 19:43   ` Erwin Panen
  2010-02-02 20:38     ` David Maus
  0 siblings, 1 reply; 5+ messages in thread
From: Erwin Panen @ 2010-02-02 19:43 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1977 bytes --]

Hi David,

Thanks for replying;
I don't understand what you mean. I was not aware off url-encoding, but 
found help here: 
http://www.eskimo.com/~bloo/indexdot/html/topics/urlencoding.htm 
<http://www.eskimo.com/%7Ebloo/indexdot/html/topics/urlencoding.htm>
So far so good.
The way I interpret this is that I can 'replace' [square brackets] in 
orgmode  with %5Bsquare brackets%5D
However when I try this, org does not 'convert' to a link...? What am I 
missing?

Perhaps for clarification:
The link I used in my example may be confusing, it is a long UNC path to 
a file on a network server that has somewhere [32] in it's name.
It's the [32] that seems to confuse org's linking.
I also noticed when hovering over [32] that org seems to recognize this 
as a footnote??

Thanks,

Erwin

David Maus wrote:
> At Tue, 02 Feb 2010 11:50:31 +0100,
> Erwin Panen wrote:
>   
>> Hi everyone,
>>
>> I guess this is a minor question, but it has puzzled me already more 
>> than once.
>> My example: The below example is normally all on one line.
>> ---------------Begin code----------------------------------------------
>> ** Action: started to play video 
>> [[\\Dcerouter\public\videos\STORY_Station (sdb1)-CORE [32]\Les Rivières 
>> Pourpres 720x304\The Crimson Rivers.mkv][The Crimson Rivers.mkv]]
>> ---------------End code------------------------------------------------
>>
>> The problem is that the file location already contains a number between 
>> square brackets [32] which renders Org to treat the link in an 
>> unsuspected way.
>>
>> Is there any way to circumvent this behaviour e.g. by inserting special 
>> characters to avoid Org to look inbetween the special characters?
>>     
>
> You can url-encode the square brackets with %5B ("[") and %5D ("]") --
> orgmode does this when calling `org-store-link' (C-c l) for a place
> that contains square brackets and opens the links fine.
>
> HTH
>  -- David
>
>   

[-- Attachment #1.2: Type: text/html, Size: 2423 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: file link format question - How to format link when square brackets [ ] are already in filename?
  2010-02-02 19:43   ` Erwin Panen
@ 2010-02-02 20:38     ` David Maus
  2010-02-02 20:46       ` Erwin Panen
  0 siblings, 1 reply; 5+ messages in thread
From: David Maus @ 2010-02-02 20:38 UTC (permalink / raw)
  To: erwinpanen; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2488 bytes --]

Hi Erwin,

At Tue, 02 Feb 2010 20:43:27 +0100,
Erwin Panen wrote:
> 
> Hi David,
> 
> Thanks for replying;
> I don't understand what you mean. I was not aware off url-encoding, but found help here: http://www.eskimo.com/~bloo/
> indexdot/html/topics/urlencoding.htm
> So far so good.
> The way I interpret this is that I can 'replace' [square brackets] in orgmode  with %5Bsquare brackets%5D

That's exactly what I meant. The behaviour you notice when /not/
encoding the square brackets is absolutely correct because of the way
Orgmode works: If you display a file in org-mode, the Orgmode
functions interpret the file's content and change the way certain
portions of the file look ("folding" of the link, i.e. only display
the description) and what you can do on this regions (i.e. open the
link).

So there is for instance a pattern that "tells" Orgmode that something
is a link: [[<some characters][<some other characters>]] is recognized
as a link with a target (first set of characters) and a description
(second set of characters). If there are literal square brackets in
either the description or the target, Orgmode simply does not
recognize the string as a link.

The same principle (interpreting strings/a sequence of characters)
causes Orgmode to recognize the [32] as a footnote. Why? Because there
is a definition that says the "a number between two square brakets is
a footnote".

> However when I try this, org does not 'convert' to a link...? What
> am I missing?

Strange. What Emacs and Orgmode version do you use?[1] I use 

"GNU Emacs 23.1.92.1 (i486-pc-linux-gnu, GTK+ Version 2.18.6) of
 2010-01-31 on elegiac, modified by Debian"

with

"Org-mode version 6.34trans (release_6.34c.65.g45c58)"

For me encoding the square brackets in the link name with %5B and %5D
works. That is: Emacs/Orgmode "collapses" the link and only displays
the description part.

,----
| [[\\Dcerouter\public\videos\STORY_Station (sdb1)-CORE %5B32%5D\Les Rivières Pourpres 720x304\The Crimson Rivers.mkv][The Crimson Rivers.mkv]]
`----

gives:

,----
| The Crimson Rivers.mkv
`----

Regards,
 -- David


[1] To find out your version simply execute "org-version" (M-x
org-version RET) and "emacs-version" (M-x emacs-version RET) and
switch to the buffer called "*Messages*" to see the version strings of
Emacs and Orgmode.
-- 
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... maus.david@gmail.com

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: file link format question - How to format link when square brackets [ ] are already in filename?
  2010-02-02 20:38     ` David Maus
@ 2010-02-02 20:46       ` Erwin Panen
  0 siblings, 0 replies; 5+ messages in thread
From: Erwin Panen @ 2010-02-02 20:46 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-orgmode

David, thanks for clarifying :-)
I think I get it now.
Your example helps!

What I did (wrongly) was to exchange the outer brackets with %5B and %5D
Instead I should have exchanged the brackets enclosing 32
I get an error of the file not found now, but at least Emacs/org does 
fold the link now and only leaves the description!

I guess I'll figure out the missing file problem.

Thanks very much for helping out!

Erwin

David Maus wrote:
> Hi Erwin,
> 
> At Tue, 02 Feb 2010 20:43:27 +0100,
> Erwin Panen wrote:
>> Hi David,
>>
>> Thanks for replying;
>> I don't understand what you mean. I was not aware off url-encoding, but found help here: http://www.eskimo.com/~bloo/
>> indexdot/html/topics/urlencoding.htm
>> So far so good.
>> The way I interpret this is that I can 'replace' [square brackets] in orgmode  with %5Bsquare brackets%5D
> 
> That's exactly what I meant. The behaviour you notice when /not/
> encoding the square brackets is absolutely correct because of the way
> Orgmode works: If you display a file in org-mode, the Orgmode
> functions interpret the file's content and change the way certain
> portions of the file look ("folding" of the link, i.e. only display
> the description) and what you can do on this regions (i.e. open the
> link).
> 
> So there is for instance a pattern that "tells" Orgmode that something
> is a link: [[<some characters][<some other characters>]] is recognized
> as a link with a target (first set of characters) and a description
> (second set of characters). If there are literal square brackets in
> either the description or the target, Orgmode simply does not
> recognize the string as a link.
> 
> The same principle (interpreting strings/a sequence of characters)
> causes Orgmode to recognize the [32] as a footnote. Why? Because there
> is a definition that says the "a number between two square brakets is
> a footnote".
> 
>> However when I try this, org does not 'convert' to a link...? What
>> am I missing?
> 
> Strange. What Emacs and Orgmode version do you use?[1] I use 
> 
> "GNU Emacs 23.1.92.1 (i486-pc-linux-gnu, GTK+ Version 2.18.6) of
>  2010-01-31 on elegiac, modified by Debian"
> 
> with
> 
> "Org-mode version 6.34trans (release_6.34c.65.g45c58)"
> 
> For me encoding the square brackets in the link name with %5B and %5D
> works. That is: Emacs/Orgmode "collapses" the link and only displays
> the description part.
> 
> ,----
> | [[\\Dcerouter\public\videos\STORY_Station (sdb1)-CORE %5B32%5D\Les Rivières Pourpres 720x304\The Crimson Rivers.mkv][The Crimson Rivers.mkv]]
> `----
> 
> gives:
> 
> ,----
> | The Crimson Rivers.mkv
> `----
> 
> Regards,
>  -- David
> 
> 
> [1] To find out your version simply execute "org-version" (M-x
> org-version RET) and "emacs-version" (M-x emacs-version RET) and
> switch to the buffer called "*Messages*" to see the version strings of
> Emacs and Orgmode.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2010-02-02 20:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-02 10:50 file link format question - How to format link when square brackets [ ] are already in filename? Erwin Panen
2010-02-02 16:57 ` David Maus
2010-02-02 19:43   ` Erwin Panen
2010-02-02 20:38     ` David Maus
2010-02-02 20:46       ` Erwin Panen

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