emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to escape "[" and "]" characters in org-mode links
@ 2015-07-25 14:27 Ivanov Dmitry
  0 siblings, 0 replies; 8+ messages in thread
From: Ivanov Dmitry @ 2015-07-25 14:27 UTC (permalink / raw)
  To: emacs-orgmode

org-mode has the following format for links:

[[<file-name>::<text-to-search>][<link text>]]

What should I do, if <text-to-search> contains ']' symbol? Like this:

$form['input']

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

* Re: How to escape "[" and "]" characters in org-mode links
@ 2015-07-27 13:04 Xiha
  2015-07-29 12:02 ` Ivanov Dmitry
  0 siblings, 1 reply; 8+ messages in thread
From: Xiha @ 2015-07-27 13:04 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: usr345

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

Hi Dmitry,

> org-mode has the following format for links:
>
> [[<file-name>::<text-to-search>][<link text>]]
>
> What should I do, if <text-to-search> contains ']' symbol? Like this:
>
> $form['input']

Not sure it helps in your case, but this

    * Heading containing [brackets]

    * Other heading

    Here is a link to [[Heading containing *%5B*brackets*%5D*][that
    first heading]].

works for me.

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

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

* Re: How to escape "[" and "]" characters in org-mode links
  2015-07-27 13:04 How to escape "[" and "]" characters in org-mode links Xiha
@ 2015-07-29 12:02 ` Ivanov Dmitry
  2015-07-29 15:55   ` Kyle Meyer
  2015-08-02 16:17   ` Nicolas Goaziou
  0 siblings, 2 replies; 8+ messages in thread
From: Ivanov Dmitry @ 2015-07-29 12:02 UTC (permalink / raw)
  To: Xiha; +Cc: emacs-orgmode

Hi, Xiha

Unfortunately URL encoding the [ and ] doesn't work for me. Try to
reproduce it. Create 2 files:

file.txt. Content:
--------------------------------
$form['text1']

$form['text2']
--------------------------------
file.org. Content:
--------------------------------
[[./file.txt::$form%5B'text2'%5D][text2]]
--------------------------------

When I click the link, it says "No match".

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

* Re: How to escape "[" and "]" characters in org-mode links
  2015-07-29 12:02 ` Ivanov Dmitry
@ 2015-07-29 15:55   ` Kyle Meyer
  2015-08-02 16:17   ` Nicolas Goaziou
  1 sibling, 0 replies; 8+ messages in thread
From: Kyle Meyer @ 2015-07-29 15:55 UTC (permalink / raw)
  To: Ivanov Dmitry; +Cc: Xiha, emacs-orgmode

Ivanov Dmitry <usr345@gmail.com> wrote:
> Hi, Xiha
>
> Unfortunately URL encoding the [ and ] doesn't work for me. Try to
> reproduce it. Create 2 files:
>
> file.txt. Content:
> --------------------------------
> $form['text1']
>
> $form['text2']
> --------------------------------
> file.org. Content:
> --------------------------------
> [[./file.txt::$form%5B'text2'%5D][text2]]
> --------------------------------
>
> When I click the link, it says "No match".

While the search string is escaped elsewhere in org-link-search using
regexp-quote, it is treated as a regular expression for normal text
search.  Try escaping with "\":

    [[./file.txt::$form\%5B'text2'\%5D]]

--
Kyle

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

* Re: How to escape "[" and "]" characters in org-mode links
  2015-07-29 12:02 ` Ivanov Dmitry
  2015-07-29 15:55   ` Kyle Meyer
@ 2015-08-02 16:17   ` Nicolas Goaziou
  2015-08-02 16:17     ` Ivanov Dmitry
  2015-08-02 17:57     ` Kyle Meyer
  1 sibling, 2 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2015-08-02 16:17 UTC (permalink / raw)
  To: Ivanov Dmitry; +Cc: Xiha, emacs-orgmode

Hello,

Ivanov Dmitry <usr345@gmail.com> writes:

> Unfortunately URL encoding the [ and ] doesn't work for me. Try to
> reproduce it. Create 2 files:
>
> file.txt. Content:
> --------------------------------
> $form['text1']
>
> $form['text2']
> --------------------------------
> file.org. Content:
> --------------------------------
> [[./file.txt::$form%5B'text2'%5D][text2]]
> --------------------------------
>
> When I click the link, it says "No match".

It works here on a recent Org.


Regards,

-- 
Nicolas Goaziou

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

* Re: How to escape "[" and "]" characters in org-mode links
  2015-08-02 16:17   ` Nicolas Goaziou
@ 2015-08-02 16:17     ` Ivanov Dmitry
  2015-08-02 17:57     ` Kyle Meyer
  1 sibling, 0 replies; 8+ messages in thread
From: Ivanov Dmitry @ 2015-08-02 16:17 UTC (permalink / raw)
  To: Ivanov Dmitry, Xiha, emacs-orgmode

> It works here on a recent Org.

Thank you. I have a little outdated version. It started to work after
I used the escaped percent as Kyle Meyer suggested.

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

* Re: How to escape "[" and "]" characters in org-mode links
  2015-08-02 16:17   ` Nicolas Goaziou
  2015-08-02 16:17     ` Ivanov Dmitry
@ 2015-08-02 17:57     ` Kyle Meyer
  2015-08-02 23:15       ` Nicolas Goaziou
  1 sibling, 1 reply; 8+ messages in thread
From: Kyle Meyer @ 2015-08-02 17:57 UTC (permalink / raw)
  To: Ivanov Dmitry; +Cc: Xiha, emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> Hello,
>
> Ivanov Dmitry <usr345@gmail.com> writes:
>
>> Unfortunately URL encoding the [ and ] doesn't work for me. Try to
>> reproduce it. Create 2 files:
>>
>> file.txt. Content:
>> --------------------------------
>> $form['text1']
>>
>> $form['text2']
>> --------------------------------
>> file.org. Content:
>> --------------------------------
>> [[./file.txt::$form%5B'text2'%5D][text2]]
>> --------------------------------
>>
>> When I click the link, it says "No match".
>
> It works here on a recent Org.

Hmm, that's weird.  I'm still seeing this with emacs -Q using
release_8.3beta-1312-g8094d0.

--
Kyle

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

* Re: How to escape "[" and "]" characters in org-mode links
  2015-08-02 17:57     ` Kyle Meyer
@ 2015-08-02 23:15       ` Nicolas Goaziou
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2015-08-02 23:15 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: Xiha, emacs-orgmode, Ivanov Dmitry

Hello,

Kyle Meyer <kyle@kyleam.com> writes:

> Hmm, that's weird.  I'm still seeing this with emacs -Q using
> release_8.3beta-1312-g8094d0.

Indeed, my bad. This should be fixed in cfe5bc9.

However, the current escaping mechanism for links in Org is not really
satisfactory. In the long run, we will need to change it.


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2015-08-02 23:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-27 13:04 How to escape "[" and "]" characters in org-mode links Xiha
2015-07-29 12:02 ` Ivanov Dmitry
2015-07-29 15:55   ` Kyle Meyer
2015-08-02 16:17   ` Nicolas Goaziou
2015-08-02 16:17     ` Ivanov Dmitry
2015-08-02 17:57     ` Kyle Meyer
2015-08-02 23:15       ` Nicolas Goaziou
  -- strict thread matches above, loose matches on Subject: below --
2015-07-25 14:27 Ivanov Dmitry

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