From mboxrd@z Thu Jan 1 00:00:00 1970 From: Neil Jerram Subject: Re: [RFC] Fixing link encoding once and for all Date: Tue, 5 Mar 2019 16:27:31 +0000 Message-ID: References: <87tvguyohn.fsf@nicolasgoaziou.fr> <87sgw9cxr8.fsf@nicolasgoaziou.fr> <87lg1znh9t.fsf@nicolasgoaziou.fr> <87ef7m2mpv.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:48733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1Cuv-0005lt-W3 for emacs-orgmode@gnu.org; Tue, 05 Mar 2019 11:27:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1Cuv-0001cL-1s for emacs-orgmode@gnu.org; Tue, 05 Mar 2019 11:27:45 -0500 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]:39872) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1Cuu-0001bA-QA for emacs-orgmode@gnu.org; Tue, 05 Mar 2019 11:27:44 -0500 Received: by mail-lj1-x22d.google.com with SMTP id g80so8133365ljg.6 for ; Tue, 05 Mar 2019 08:27:44 -0800 (PST) In-Reply-To: <87ef7m2mpv.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Neil Jerram , Org Mode List Hi Nicolas, On Tue, 5 Mar 2019 at 00:23, Nicolas Goaziou 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