[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [RFC] Fixing link encoding once and for all
From: |
Neil Jerram |
Subject: |
Re: [O] [RFC] Fixing link encoding once and for all |
Date: |
Tue, 5 Mar 2019 16:27:31 +0000 |
Hi Nicolas,
On Tue, 5 Mar 2019 at 00:23, Nicolas Goaziou <address@hidden> wrote:
[...]
> So, the new challenger is:
>
>
> "\\[\\[\\(\\(?:.\\|\n\\)*?[^\\]\\(\\\\\\\\\\)*\\)\\]\\(?:\\[\\(\\(?:.\\|\n\\)+?\\)\\]\\)?\\]"
>
> Beautiful.
>
> The commented rx equivalent would be:
>
> (seq "["
> ;; URI part: match group 1.
> "["
> (group
> (*? anything)
> ;; Allow an even number of backslashes before the closing bracket.
> (not (any "\\"))
> (zero-or-more (group "\\\\")))
> "]"
> ;; Description (optional): match group 2.
> (opt "[" (group (+? anything)) "]")
> "]")
>
> > \( # begin group 3
> > ? # don't understand
> > :\[ # literal :[
>
> [...]
>
> > but there's at least a ? that I don't understand, and I'm afraid I'm
> > not seeing how it's useful.
>
> \(?: ... \) is a shy group.
Thanks for explaining that. It's not mentioned in the manual though
(https://www.gnu.org/software/emacs/manual/html_node/emacs/Regexps.html);
are you sure that it's supported in Emacs regexps?
> > If you think it works, I'm happy to defer to your judgement on that!
> > Although I suggested the idea, I don't know Org nearly well enough to
> > be sure that I haven't missed problems;
>
> We are solving the problem with a regexp. What bad things could happen? ;)
Well hopefully the fallout is limited to destroying all of the text in
one Org buffer. :-)
More seriously, though, I don't understand when and how the regexp is
used. Presumably you loop through the buffer looking for matches, but
what do you do after each match?
Regards,
Neil
- Re: [O] [RFC] Fixing link encoding once and for all, Nicolas Goaziou, 2019/03/01
- Re: [O] [RFC] Fixing link encoding once and for all, Nicolas Goaziou, 2019/03/01
- Re: [O] [RFC] Fixing link encoding once and for all, Michael Brand, 2019/03/01
- Re: [O] [RFC] Fixing link encoding once and for all, Jens Lechtenboerger, 2019/03/01
- Re: [O] [RFC] Fixing link encoding once and for all, stardiviner, 2019/03/03
- Re: [O] [RFC] Fixing link encoding once and for all, Neil Jerram, 2019/03/04