From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 2Is3LfQYt15oTwAA0tVLHw (envelope-from ) for ; Sat, 09 May 2020 20:56:20 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id SPfVOgEZt15CdQAAbx9fmQ (envelope-from ) for ; Sat, 09 May 2020 20:56:33 +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 9CDD9940448 for ; Sat, 9 May 2020 20:56:31 +0000 (UTC) Received: from localhost ([::1]:38188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jXWWM-0008Md-TF for larch@yhetil.org; Sat, 09 May 2020 16:56:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jXWVw-0008MV-Oj for emacs-orgmode@gnu.org; Sat, 09 May 2020 16:56:04 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:50997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jXWVv-00077R-Df for emacs-orgmode@gnu.org; Sat, 09 May 2020 16:56:04 -0400 Received: by mail-wm1-x330.google.com with SMTP id m12so8845828wmc.0 for ; Sat, 09 May 2020 13:56:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=oTyMfu0H1VBTdGtBF6wwEdujwxj1xAR+B7ISXg4BApA=; b=V1bN2sox0wgT0zQ3zNsTNSqR+PNRBtV3yhuHDKD13TM8bX/S84hhqXSf1ZJRpvOwDK PLv3hDcazxzIINKnO00kU7sjTbyoRa5QkqCBVUw0nHjBUTIQLRBoEw1nLR4juGdxnSwb xc0L+RNt9hQAbySTIAfFOeIKu2sj5lFuHvEaldNljt2lC/8tKLZU0hCf6ukoo2yViuzd l3q9uzTVgQmjkMZOjRfSOgahHA0b2M4RMpg6yk95a85NdA0oQk616Jxh+bdvr5kKw8/W 2u5WS2N6eAJvdMfe5JiIlZrDJ0Zp90WDXL0JRHZdb4ViYC2c5nDYYs59Ze0jDUZ3aJ3K LvmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=oTyMfu0H1VBTdGtBF6wwEdujwxj1xAR+B7ISXg4BApA=; b=W+l+2Qg7JEZg3ifRMNjupJGryLqQdKUzPmdXTaCrCNNa+H7N888MUpyJ+SrmBtX2By EMMCPaqGaNAlsD8bqF2Y1rMv6NWG1KeNhwQm/9ts6raUdHNi0optu7ARiuRrRxrpx0OJ QN3q13xb1M0tT1MXT5dR8DezujaozosK3uL7witMoH+RKIcMxq6tb+N9VsfvhGSb9OKW IXJHPq4MNcPIYYg2sq2j2y7Fbw8wfe8R2GrLNfJfg16adPcgpue2+Vi9ahr25NFJnv2P 4YlKQREBLMUVwRU7ekSAs6p7i+YzUoqkDM21ziskwPyBbEThfFKQA3vrWtK513l7pTG2 QGeQ== X-Gm-Message-State: AGi0PuY+RR76ZDUJw1znhTpxXtVIaAudu8keyD4zBOptoAPzkxQe6Jjm TaB3iwCcqbrHtCmEUrIa0lQAeDlL X-Google-Smtp-Source: APiQypK/ZvzWMyzi+Us4qMMZj0lIPgGnyOERTdY1fJ9uwn92pWgLWc17Kqeh5+x/OY5z3bR6GAfQWg== X-Received: by 2002:a1c:7c10:: with SMTP id x16mr22084889wmc.74.1589057761375; Sat, 09 May 2020 13:56:01 -0700 (PDT) Received: from [192.168.0.38] (cpc81195-farn9-2-0-cust897.6-2.cable.virginm.net. [82.6.59.130]) by smtp.gmail.com with ESMTPSA id l16sm9203581wrp.91.2020.05.09.13.56.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 May 2020 13:56:00 -0700 (PDT) From: "Stacey Marshall" To: emacs-orgmode@gnu.org Subject: patch for org-capture.el to allow for no file extension on open-source, protocol Date: Sat, 09 May 2020 21:55:58 +0100 X-Mailer: MailMate (1.13.1r5671) Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_MailMate_30DA513A-C229-4E1B-868F-16DFB5769FB4_=" Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=stacey.marshall@gmail.com; helo=mail-wm1-x330.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 X-Spam-Score: -0.21 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=V1bN2sox; 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-Scan-Result: default: False [-0.21 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.53996998502349]; MX_INVALID(1.00)[cached]; DWL_DNSWL_FAIL(0.00)[gmail.com:server fail,209.51.188.17:server fail]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_NONE(0.00)[]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.09), country: US(-0.00), ip: 209.51.188.17(-0.54)]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_IN_DNSWL_FAIL(0.00)[209.51.188.17:server fail]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_COUNT_FIVE(0.00)[6]; FROM_HAS_DN(0.00)[]; URIBL_BLOCKED(0.00)[site.com:url,orgmode.org:url,housegordon.com:url]; FROM_NEQ_ENVFROM(0.00)[staceymarshall@gmail.com,emacs-orgmode-bounces@gnu.org]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[emacs-orgmode@gnu.org]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; RECEIVED_SPAMHAUS_PBL(0.00)[82.6.59.130:received]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.51.188.17:from]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: ydbDyJdpMiVC --=_MailMate_30DA513A-C229-4E1B-868F-16DFB5769FB4_= Content-Type: text/plain; format=flowed; markup=markdown The issue was that the URL I was opening had the full filename as-is. No extension needed to be added or removed. If no suffix is provided in the alist then the function failed. The patch allows both online-suffix and working-suffix to not be required. ``` From 213b7968199bebcf11d0bcf0bbc44d0843f19ecc Mon Sep 17 00:00:00 2001 From: Stacey Marshall Date: Sat, 9 May 2020 21:31:04 +0100 Subject: [PATCH] org-capture.el: Allow for no file extension on open-source protocol * lisp/org-capture.el (org-protocol-open-source): Remove requirement to have :online-suffix and :working-suffix. The problem here was that two assignments expected suffix's to be provided in org-protocol-project-alist. When they were missing an error occurred. With the changes source URLs that include the file name as-is, such as those presented by openGrok, may be opened. TINYCHANGE --- lisp/org-protocol.el | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el index 55a534d0d..35f58f490 100644 --- a/lisp/org-protocol.el +++ b/lisp/org-protocol.el @@ -191,7 +191,7 @@ Example: :working-suffix \".org\" :base-url \"https://orgmode.org/worg/\" :working-directory \"/home/user/org/Worg/\") - (\"http://localhost/org-notes/\" + (\"localhost org-notes/\" :online-suffix \".html\" :working-suffix \".org\" :base-url \"http://localhost/org/\" @@ -202,12 +202,17 @@ Example: :working-directory \"~/site/content/post/\" :online-suffix \".html\" :working-suffix \".md\" - :rewrites ((\"\\(https://site.com/[0-9]+/[0-9]+/[0-9]+/\\)\" . \".md\"))))) - - - The last line tells `org-protocol-open-source' to open - /home/user/org/index.php, if the URL cannot be mapped to an existing - file, and ends with either \"org\" or \"org/\". + :rewrites ((\"\\(https://site.com/[0-9]+/[0-9]+/[0-9]+/\\)\" . \".md\"))) + (\"GNU emacs OpenGrok\" + :base-url \"https://opengrok.housegordon.com/source/xref/emacs/\" + :working-directory \"~/dev/gnu-emacs/\"))) + + The :rewrites line of \"localhost org-notes\" entry tells + `org-protocol-open-source' to open /home/user/org/index.php, + if the URL cannot be mapped to an existing file, and ends with + either \"org\" or \"org/\". The \"GNU emacs OpenGrok\" entry + does not include any suffix properties, allowing local source + file to be opened as found by OpenGrok. Consider using the interactive functions `org-protocol-create' and `org-protocol-create-for-org' to help you filling this variable with valid contents." @@ -545,11 +550,12 @@ The location for a browser's bookmark should look like this: ;; ending than strip-suffix here: (f1 (substring f 0 (string-match "\\([\\?#].*\\)?$" f))) (start-pos (+ (string-match wsearch f1) (length base-url))) - (end-pos (string-match - (regexp-quote strip-suffix) f1)) + (end-pos (if strip-suffix + (string-match (regexp-quote strip-suffix) f1) + (length f1))) ;; We have to compare redirects without suffix below: (f2 (concat wdir (substring f1 start-pos end-pos))) - (the-file (concat f2 add-suffix))) + (the-file (if add-suffix (concat f2 add-suffix) f2))) ;; Note: the-file may still contain `%C3' et al here because browsers ;; tend to encode `ä' in URLs to `%25C3' - `%25' being `%'. -- 2.21.1 (Apple Git-122.3) ``` -- [Stacey](https://staceymarshall.wordpress.com/) --=_MailMate_30DA513A-C229-4E1B-868F-16DFB5769FB4_= Content-Type: text/html Content-Transfer-Encoding: quoted-printable

The issue was that the URL I was opening had the full fil= ename as-is. No extension needed to be added or removed. If no suffix i= s provided in the alist then the function failed. The patch allows both = online-suffix and working-suffix to not be required.

From 213b7968199bebcf11d0bcf0bbc44d0843f19ecc Mon Sep 17 00:00=
:00 2001
From: Stacey Marshall <stacey.marshall@gmail.com>
Date: Sat, 9 May 2020 21:31:04 +0100
Subject: [PATCH] org-capture.el: Allow for no file extension on open-sour=
ce
 protocol

* lisp/org-capture.el (org-protocol-open-source): Remove requirement
to have :online-suffix and :working-suffix.

The problem here was that two assignments expected suffix's to be
provided in org-protocol-project-alist.  When they were missing an
error occurred.  With the changes source URLs that include the file
name as-is, such as those presented by openGrok, may be opened.

TINYCHANGE
---
 lisp/org-protocol.el | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
index 55a534d0d..35f58f490 100644
--- a/lisp/org-protocol.el
+++ b/lisp/org-protocol.el
@@ -191,7 +191,7 @@ Example:
           :working-suffix \".org\"
           :base-url \"https://orgmode.org/worg/\"
           :working-directory \"/home/user/org/Worg/\")
-         (\"http://localhost/org-notes/\"
+         (\"localhost org-notes/\"
           :online-suffix \".html\"
           :working-suffix \".org\"
           :base-url \"http://localhost/org/\"
@@ -202,12 +202,17 @@ Example:
           :working-directory \"~/site/content/post/\"
           :online-suffix \".html\"
           :working-suffix \".md\"
-          :rewrites ((\"\\(https://site.com/[0-9]+/[0-9]+/[0-9]+/\\)\" .=
 \".md\")))))
-
-
-   The last line tells `org-protocol-open-source' to open
-   /home/user/org/index.php, if the URL cannot be mapped to an existing
-   file, and ends with either \"org\" or \"org/\".
+          :rewrites ((\"\\(https://site.com/[0-9]+/[0-9]+/[0-9]+/\\)\" .=
 \".md\")))
+         (\"GNU emacs OpenGrok\"
+          :base-url \"https://opengrok.housegordon.com/source/xref/emacs=
/\"
+          :working-directory \"~/dev/gnu-emacs/\")))
+
+   The :rewrites line of \"localhost org-notes\" entry tells
+   `org-protocol-open-source' to open /home/user/org/index.php,
+   if the URL cannot be mapped to an existing file, and ends with
+   either \"org\" or \"org/\".  The \"GNU emacs OpenGrok\" entry
+   does not include any suffix properties, allowing local source
+   file to be opened as found by OpenGrok.

 Consider using the interactive functions `org-protocol-create' and
 `org-protocol-create-for-org' to help you filling this variable with val=
id contents."
@@ -545,11 +550,12 @@ The location for a browser's bookmark should look l=
ike this:
            ;; ending than strip-suffix here:
            (f1 (substring f 0 (string-match "\\([\\?#].*\\)?$" f)))
                    (start-pos (+ (string-match wsearch f1) (length base-=
url)))
-                   (end-pos (string-match
-                 (regexp-quote strip-suffix) f1))
+                   (end-pos (if strip-suffix
+                  (string-match (regexp-quote strip-suffix) f1)
+                  (length f1)))
            ;; We have to compare redirects without suffix below:
            (f2 (concat wdir (substring f1 start-pos end-pos)))
-                   (the-file (concat f2 add-suffix)))
+                   (the-file (if add-suffix (concat f2 add-suffix) f2)))=


           ;; Note: the-file may still contain `%C3' et al here because b=
rowsers
           ;; tend to encode `&auml;' in URLs to `%25C3' - `%25' bein=
g `%'.
-- =

2.21.1 (Apple Git-122.3)

--
Stacey

--=_MailMate_30DA513A-C229-4E1B-868F-16DFB5769FB4_=--