From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id mOvXNV3BZGP/UQAAbAwnHQ (envelope-from ) for ; Fri, 04 Nov 2022 08:38:05 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id aJTSNV3BZGOqMwEAauVa8A (envelope-from ) for ; Fri, 04 Nov 2022 08:38:05 +0100 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 9FE543D747 for ; Fri, 4 Nov 2022 08:38:05 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqrF5-0008Hj-Cz; Fri, 04 Nov 2022 03:35:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqqwc-0007ZX-BY for emacs-orgmode@gnu.org; Fri, 04 Nov 2022 03:16:50 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqqwP-0001Qt-Lt for emacs-orgmode@gnu.org; Fri, 04 Nov 2022 03:16:42 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 61A99240027 for ; Fri, 4 Nov 2022 08:16:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667546192; bh=ve2VIGhmNV+Z5h5jcItsRQ7anu5lmoHd3tFRlZFw3Aw=; h=From:To:Cc:Subject:Date:From; b=EJ/0/30LuH0e9kqTmIJ/YCl6TKkH4TUaePzA7hEzo6ZAUNjgZtKXxYO6RfSUhbRwy oLWcPHtdTSqHMeeQyidqbOVllT8foizx8n503K6X7NDjQhk9qVZQgIZxoqAHmdMD2h pXB1SJZb84YZy8qpEpESUBXH650rF5U5CDt85q6LdkxRg/+2SWRtzHLOThjpphAHNd RE0ZacH7yah3WfmNAgCi4tcBagLey97ZE0aEopfwihEE17VBG7c8UNOBnWDIBKQAaI pUyVfSkpwxnAH3jZ133tsTJVA4ajErTskJ8HVrSluJZWLc3uuHCz3a9VvHz4ADd1c6 uh6/S9urWXhpA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N3X3y09ssz9rxP; Fri, 4 Nov 2022 08:16:29 +0100 (CET) From: Ihor Radchenko To: Ihor Radchenko Cc: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= , emacs-orgmode@gnu.org Subject: [PATCH] Re: Link-words with spaces, allowed or not? In-Reply-To: <87zgf7zujc.fsf@localhost> References: <87zgf7zujc.fsf@localhost> Date: Fri, 04 Nov 2022 07:17:10 +0000 Message-ID: <87k04b42a1.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.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, IP_LINK_PLUS=0.012, NUMERIC_HTTP_ADDR=1.242, 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.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Emacs-orgmode" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1667547485; 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=8Z1HtPi4iBl7Qo0Ai8/cYmMbovQUZikX6J0VkLe6vNc=; b=MfkqbuKem0ZE/SjwDUSkwraEIc6+ml5I3blSz+aZCjDKzG+swawy63w8NW33SWU3eRC6xK jgcIt93bDimKPtC2+uMrx94MnQkY2WnrTEJiFEQhS8i7lSV4BcNn0s98inySY8bF2aFVW3 Rb/C1nYjVzUaDmw+j0zG8V/3ysBj15Ph0U8Eej+HW7MarF+0no3f7DsbeB6QztERktx66D xD79wG6F2uxQYDPzMsuN1LGZC7FYtTZMzPfKIDNmQ35wALBBthj7GfOvdbBb7jSCx/n0n0 juUeggB+DkV35N7YSUVxcUG/nakj6TakAPjgwkgxHT2dEj1E5RoqlnxBPJmohg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1667547485; a=rsa-sha256; cv=none; b=EUIXQ7U64L1L6hT4RxZsRmO36Iph9rRODiFnhPvIeqMoFI5oX0VcWOFu72UuFi00JTREKU NntUn4QigMGltGltbT8tJkpLr1LTIo5UZFJzYZyDpUgSZpSZbOgfwvsavGt+0QrIifH2LH 8bvKHwYK16TCtj05CQ6IKnUXBHyUkJ4rbKNFcrjmgFLLK7Q1HFIV+ytn4xwBD8UyyexdLF r2cUWGZAw+w/sWBU0Hq+BKHnCVRxX3yXd629clje15V+YkZAxoWZu70mSzE3tlZM6QG2tJ qxBut/acr9oYWwPJFL3EqjuVeMQQnwGxjG9Yww1iEaiXau/MzRryrVQV+PUHtQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="EJ/0/30L"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.50 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="EJ/0/30L"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 9FE543D747 X-Spam-Score: -2.50 X-Migadu-Scanner: scn1.migadu.com X-TUID: LoUsSbzZqJfe --=-=-= Content-Type: text/plain Ihor Radchenko writes: > We may allow something like > #+LINK: "this is a link with spaces" http://replacement See the attached patch allowing the above syntax in #+LINK keywords. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-org-Allow-spaces-in-LINK-abbreviation-definitions.patch Content-Transfer-Encoding: quoted-printable >From 0b81f2d4cc9f6dd5f8d38f9a6550387c93b15435 Mon Sep 17 00:00:00 2001 Message-Id: <0b81f2d4cc9f6dd5f8d38f9a6550387c93b15435.1667546163.git.yantar= 92@posteo.net> From: Ihor Radchenko Date: Fri, 4 Nov 2022 15:14:44 +0800 Subject: [PATCH] org: Allow spaces in #+LINK abbreviation definitions MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * lisp/org.el (org-set-regexps-and-options): Allow spaces when defining link abbreviations via #+LINK keyword. * testing/lisp/test-org-element.el (test-org-element/link-parser): Add a new test. * doc/org-manual.org (Link Abbreviations): Add example demonstrating link abbreviation with spaces. Reported-by: Rudolf Adamkovi=C4=8D Link: https://orgmode.org/list/87zgf7zujc.fsf@localhost --- doc/org-manual.org | 3 +++ lisp/org.el | 6 +++++- testing/lisp/test-org-element.el | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index dc2fc57cd..47710466a 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -3652,8 +3652,11 @@ ** Link Abbreviations #+begin_example ,#+LINK: bugzilla https://10.1.2.9/bugzilla/show_bug.cgi?id=3D ,#+LINK: duckduckgo https://duckduckgo.com/?q=3D%s +,#+LINK: "Nu Html Checker" https://validator.w3.org/nu/?doc=3D%h #+end_example =20 +The abbreviations containing spaces must be quoted. + In-buffer completion (see [[*Completion]]) can be used after =3D[=3D to complete link abbreviations. You may also define a Lisp function that implements special (e.g., completion) support for inserting such a diff --git a/lisp/org.el b/lisp/org.el index d8708f8f2..0036b189a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4184,7 +4184,11 @@ (defun org-set-regexps-and-options (&optional tags-o= nly) (delq nil (mapcar (lambda (value) - (and (string-match "\\`\\(\\S-+\\)[ \t]+\\(.+\\)" value) + (and (or + ;; "abbrev with spaces" spec + (string-match "\\`\"\\(.+[^\\]\\)\"[ \t]+\\(= .+\\)" value) + ;; abbrev spec + (string-match "\\`\\(\\S-+\\)[ \t]+\\(.+\\)"= value)) (cons (match-string-no-properties 1 value) (match-string-no-properties 2 value)))) (cdr (assoc "LINK" alist)))))) diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-eleme= nt.el index eb5b95e86..78a735efe 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -2007,6 +2007,15 @@ (ert-deftest test-org-element/link-parser () (progn (org-mode-restart) (goto-char (1- (point-max))) (org-element-property :type (org-element-context)))))) + ;; Link abbreviation with spaces. + (should + (equal "https" + (org-test-with-temp-text + "#+LINK: \"Nu Html Checker\" https://validator.w3.org/nu/?do= c=3D%h + [[Nu Html Checker:test]]" + (progn (org-mode-restart) + (goto-char (1- (point-max))) + (org-element-property :type (org-element-context)))))) ;; Link abbreviation in a secondary string. (should (equal "https" --=20 2.35.1 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--