From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id SKPxDq1LTGAlFQAA0tVLHw (envelope-from ) for ; Sat, 13 Mar 2021 05:20:45 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id IFS9Cq1LTGAcVwAA1q6Kng (envelope-from ) for ; Sat, 13 Mar 2021 05:20:45 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2B00A28F62 for ; Sat, 13 Mar 2021 06:20:44 +0100 (CET) Received: from localhost ([::1]:37708 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKwhe-000253-UH for larch@yhetil.org; Sat, 13 Mar 2021 00:20:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKwhG-00022B-Np for emacs-orgmode@gnu.org; Sat, 13 Mar 2021 00:20:18 -0500 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]:42427) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lKwhE-0002QU-P9 for emacs-orgmode@gnu.org; Sat, 13 Mar 2021 00:20:18 -0500 Received: by mail-lf1-x130.google.com with SMTP id v2so35668098lft.9 for ; Fri, 12 Mar 2021 21:20:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=TakGXJhVP4C8gEIDyCQTwqeoSZTrfNHr5yMvAdt71Ug=; b=gheR7qCQN/9h5rPBDThOoonWcSY6KC26z6Rpyglc3/jR9/yh64PbmYEKTVFkISZRPe UZzEmPZFvYhjLO6ozWu8twMdM+HP3f90R9PZrC2vMTwf86yc851bHnjJ+TvVqYAyDjKW kVeDQqvSZDhVIEsdhfy5o6bKG1eLttmFLqOY1tMbk5led8mbKUmCzIJVwDY+QnOC3iFA C2PEkXk9PS4fty/0O48Qnueiy9A1E7ciXH8jlUEt10ZBz79hFCrErFdjWeKDSqm9uw6K fGU8jFkhPu0YioIcwq2ybuROYb7XNQKFirTiFpXKBb6PC3Eo3JoJ5dH9fWDPaB0SIsYj vEyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=TakGXJhVP4C8gEIDyCQTwqeoSZTrfNHr5yMvAdt71Ug=; b=NawBiML3vVdSrJ8d4x5//RlA9LCCKWUrZ5iwRqJ0CdSOJzl1INowr5e/iiYgW5Trdv YXil0YuVFSRFr0jYHiRMH0pfhNVJHBYaDKcW9GmnIZBpu0vrl8iCCqSQinKPM54173bQ iCPAvoMAng6slX1dMWF35SAJmX1TJ6RpmpZd+tFBv8e8lBN/ZU88fKxv3PCId1xTTIiy eJmh9X7CpydhvtzPHvTs+B7tkoX5cK9HUEctftrQLMNzQ4XN7ylcrzYmxFsO44q4ogLt Ev8MxpPjR9SNaDLeu1A33Wylc7ucSHvj4x9dekK3LOIVKx/rM38uMr8Z0vDNBIE02bvS rFtw== X-Gm-Message-State: AOAM532Rn4rA59nZB5vLHQ2SRzXpuxndT6f8wFgRmmWUOaUpfjLxp6D4 vYYzfswg8pLEyEsWUhuNAh6gA+yKz4MTwQ== X-Google-Smtp-Source: ABdhPJxdxVds1Y1rc85sxEh7vOX3ocCgPQga8sRPWHLSV51EEEwv3GqOZ6HL0/CWg4VRAPGPSoYnrg== X-Received: by 2002:a19:6910:: with SMTP id e16mr1591068lfc.482.1615612814959; Fri, 12 Mar 2021 21:20:14 -0800 (PST) Received: from localhost ([141.105.67.194]) by smtp.gmail.com with ESMTPSA id z1sm2188302ljo.134.2021.03.12.21.20.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 21:20:14 -0800 (PST) From: Ihor Radchenko To: Kyle Meyer Subject: Re: [PATCH] Re: Bug: Plain https links with brackets are not recognised [9.4.4 (release_9.4.4-625-g763c7a @ /home/yantar92/.emacs.d/straight/build/org/)] In-Reply-To: <87k0qbk4rq.fsf@localhost> References: <87pn03g3rr.fsf@localhost> <87sg4zu47p.fsf@kyleam.com> <87k0qbk4rq.fsf@localhost> Date: Sat, 13 Mar 2021 13:24:20 +0800 Message-ID: <87h7lfk4mz.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=yantar92@gmail.com; helo=mail-lf1-x130.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1615612845; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=TakGXJhVP4C8gEIDyCQTwqeoSZTrfNHr5yMvAdt71Ug=; b=peYpcF4RB1hzSTaUPaukXu/V8hNF2i9CPVe0H0vKUdpwqrK8PaS7ZJPp9Za0qmisndmT/6 wvoH+ssFkjmBYz0kGuCx+BljQkGQSUz5Ds327XEide43tblpvyOjS6qyfSkZnU2GsR/WGL AaVBwP0/3P2dYSmbiaKCqPp0I+jaP8VVKli16hEqudJVKEKixgTuPUKLALM/gvYphqJkMr 4+md6+joCgxOwN5zJhYKJn3RCydcyQCCh5fKzzNy9qIyPIuUDZNiU1W7orxbJvGz1PdTDS JxrNq5elZhmeoBZOsRczY1j+ELRp1q7IhPsZd49q66ZQetYLt95RVVtjID/EoQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1615612845; a=rsa-sha256; cv=none; b=cCpf+3Ptjpn/3VAQXivHL+wcQCe+5QIqScbcfvJuy6BSPNDyrd1MuwO3m6VRav2stjzN6d Cu7AXcEzp9kuzVq8Uoxtc6vPH2zNkxTp6w2YxtdtayHDQ5netKj3l6eOXSxkLRSeS9XEl+ YGcM+kkt9qacGVFv3EvFcya9OkQAISUchcry5E6HmN4HGQZcV1DHB2gB2IHI7a55ui14X8 RGUMpx5wEal/V15jtwmtPjlVB6QDLApZ7e5IkQVxtqNmHyEzRor76Evtzku801nVGaws23 3lY5D7nQi0GDzd00aZUmAOOswMjXbppAuV3ztxvKC84UuLoRdSR8JI5U96TPyg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=gheR7qCQ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.59 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=gheR7qCQ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 2B00A28F62 X-Spam-Score: -2.59 X-Migadu-Scanner: scn0.migadu.com X-TUID: 9HntGgC3QAXY --=-=-= Content-Type: text/plain Sorry, attached wrong version of the patch. Here is the right one --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Improve-org-link-plain-re.patch >From 0acb961d916d4bfde505c9f5eb16d1e8851b6c8f Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sat, 13 Mar 2021 13:16:06 +0800 Subject: [PATCH] Improve org-link-plain-re * lisp/ol.el (org-link-make-regexps): Allow URLs with up to two levels of nested brackets. Now, URLs like [1] can be matched. The new regexp is taken from [2]. [1] https://doi.org/10.1016/0160-791x(79)90023-x [2] https://daringfireball.net/2010/07/improved_regex_for_matching_urls --- lisp/ol.el | 55 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/lisp/ol.el b/lisp/ol.el index 8b9755b51..7ce7a4798 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -829,26 +829,43 @@ This should be called after the variable `org-link-parameters' has changed." (format "<%s:\\([^>\n]*\\(?:\n[ \t]*[^> \t\n][^>\n]*\\)*\\)>" types-re) org-link-plain-re - (concat - "\\<" types-re ":" - "\\([^][ \t\n()<>]+\\(?:([[:word:]0-9_]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)") - ;; "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)") - org-link-bracket-re - (rx (seq "[[" - ;; URI part: match group 1. - (group - (one-or-more + (let ((non-space-bracket "[^][ \t\n()<>]+")) + ;; Heiristics for an URL link. Source: + ;; https://daringfireball.net/2010/07/improved_regex_for_matching_urls + (rx-to-string + `(seq (regexp "\\<") + (regexp ,types-re) + ":" + (1+ (or (regex ,non-space-bracket) + (seq "(" + (* (or (regex ,non-space-bracket) + (seq "(" + (regex ,non-space-bracket) + ")"))) + ")"))) + (or (seq "(" + (* (or (regex ,non-space-bracket) + (seq "(" + (regex ,non-space-bracket) + ")"))) + ")") + (regexp "\\([^[:punct:] \t\n]\\|/\\)"))))) + org-link-bracket-re + (rx (seq "[[" + ;; URI part: match group 1. + (group + (one-or-more (or (not (any "[]\\")) - (and "\\" (zero-or-more "\\\\") (any "[]")) - (and (one-or-more "\\") (not (any "[]")))))) - "]" - ;; Description (optional): match group 2. - (opt "[" (group (+? anything)) "]") - "]")) - org-link-any-re - (concat "\\(" org-link-bracket-re "\\)\\|\\(" - org-link-angle-re "\\)\\|\\(" - org-link-plain-re "\\)")))) + (and "\\" (zero-or-more "\\\\") (any "[]")) + (and (one-or-more "\\") (not (any "[]")))))) + "]" + ;; Description (optional): match group 2. + (opt "[" (group (+? anything)) "]") + "]")) + org-link-any-re + (concat "\\(" org-link-bracket-re "\\)\\|\\(" + org-link-angle-re "\\)\\|\\(" + org-link-plain-re "\\)")))) (defun org-link-complete-file (&optional arg) "Create a file link using completion." -- 2.26.2 --=-=-=--