From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mario Martelli Subject: Re: [PATCH] org-protocol: fixes open-source and extends rewriting of URLs Date: Tue, 27 Jun 2017 08:54:08 +0200 Message-ID: <92533F36-7529-496B-BA7B-8ED49FBFB3D2@schnuddelhuddel.de> References: <68E12968-9AF5-440A-B22C-AC55B70BA910@schnuddelhuddel.de> <87k248b6p8.fsf@nicolasgoaziou.fr> <7C76EDC3-CC7E-4AFE-B45B-867752C1B33A@schnuddelhuddel.de> <87a8519rlg.fsf@nicolasgoaziou.fr> <8760fp9mui.fsf@nicolasgoaziou.fr> <2FAD7DF2-2A0C-4703-A383-BA8D3346C691@schnuddelhuddel.de> <18D83D3C-C472-4614-988F-1F1DA5EB5CEC@schnuddelhuddel.de> <87efub7psj.fsf@nicolasgoaziou.fr> <8CE2CFE3-2911-4369-8E93-E80CD25FD7E4@schnuddelhuddel.de> <5442AC7A-D45E-46FE-A3A7-3AB25679B3FE@schnuddelhuddel.de> <4427263B-5534-4FFD-AFA0-211EDA489001@schnuddelhuddel.de> <8760fk4jur.fsf@nicolasgoaziou.fr> <87mv8uv5ns.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_90DCDD77-5C21-4D19-A957-2F84A8B98097" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPkO9-0004uj-46 for emacs-orgmode@gnu.org; Tue, 27 Jun 2017 02:54:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPkO4-0004Nu-8u for emacs-orgmode@gnu.org; Tue, 27 Jun 2017 02:54:17 -0400 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:36063) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dPkO3-0004NX-S6 for emacs-orgmode@gnu.org; Tue, 27 Jun 2017 02:54:12 -0400 Received: by mail-wm0-x235.google.com with SMTP id 62so15636527wmw.1 for ; Mon, 26 Jun 2017 23:54:11 -0700 (PDT) In-Reply-To: <87mv8uv5ns.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: Nicolas Goaziou Cc: emacs-orgmode@gnu.org --Apple-Mail=_90DCDD77-5C21-4D19-A957-2F84A8B98097 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi, > OK. Could you wrap up the patches needed so far, with appropriate = commit > messages, so I can apply them? Sorry for producing noise. Just read the contribution guidelines once = again ;) Hope everything is now according to the guidelines. --Apple-Mail=_90DCDD77-5C21-4D19-A957-2F84A8B98097 Content-Disposition: attachment; filename=0001-org-protocol.el-Fix-for-failing-open-source-subproto.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-org-protocol.el-Fix-for-failing-open-source-subproto.patch" Content-Transfer-Encoding: quoted-printable =46rom=200605063662ef6ae92abe75956dc2432f5028a041=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Mario=20Martelli=20=0A= Date:=20Fri,=2023=20Jun=202017=2018:32:49=20+0200=0ASubject:=20[PATCH=20= 1/4]=20org-protocol.el:=20Fix=20for=20failing=20open-source=20= subprotocol=0A=0A*=20=20(org-protocol-open-source):=20make=20sure=20url=20= is=0Asanitised=20before=20processing=0A=0ATINYCHANGE=0A---=0A=20= lisp/org-protocol.el=20|=202=20+-=0A=201=20file=20changed,=201=20= insertion(+),=201=20deletion(-)=0A=0Adiff=20--git=20= a/lisp/org-protocol.el=20b/lisp/org-protocol.el=0Aindex=20= 825435674..7e986a9ed=20100644=0A---=20a/lisp/org-protocol.el=0A+++=20= b/lisp/org-protocol.el=0A@@=20-520,7=20+520,7=20@@=20The=20location=20= for=20a=20browser's=20bookmark=20should=20look=20like=20this:=0A=20=20=20= ;;=20As=20we=20enter=20this=20function=20for=20a=20match=20on=20our=20= protocol,=20the=20return=20value=0A=20=20=20;;=20defaults=20to=20nil.=0A=20= =20=20(let=20((result=20nil)=0A-=20=20=20=20=20=20=20=20(f=20(plist-get=20= (org-protocol-parse-parameters=20fname=20nil=20'(:url))=20:url)))=0A+=09= (f=20(org-protocol-sanitize-uri=20(plist-get=20= (org-protocol-parse-parameters=20fname=20nil=20'(:url))=20:url))))=0A=20=20= =20=20=20(catch=20'result=0A=20=20=20=20=20=20=20(dolist=20(prolist=20= org-protocol-project-alist)=0A=20=20=20=20=20=20=20=20=20(let*=20= ((base-url=20(plist-get=20(cdr=20prolist)=20:base-url))=0A--=20=0A2.11.0=20= (Apple=20Git-81)=0A=0A= --Apple-Mail=_90DCDD77-5C21-4D19-A957-2F84A8B98097 Content-Disposition: attachment; filename=0002-org-protocol.el-Fix-for-silently-failing-open-source.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0002-org-protocol.el-Fix-for-silently-failing-open-source.patch" Content-Transfer-Encoding: quoted-printable =46rom=2044d0ea97c452ed5f5cd0f358b75115a029a28487=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Mario=20Martelli=20=0A= Date:=20Sat,=2024=20Jun=202017=2016:01:20=20+0200=0ASubject:=20[PATCH=20= 2/4]=20org-protocol.el:=20Fix=20for=20silently=20failing=20open-source=0A= =20subprotocol=0A=0A*=20(org-protocol-open-source):=20tests=20URL=20= against=0Abase-url=20and=20not=20the=20filename=0A=0ATINYCHANGE=0A---=0A=20= lisp/org-protocol.el=20|=202=20+-=0A=201=20file=20changed,=201=20= insertion(+),=201=20deletion(-)=0A=0Adiff=20--git=20= a/lisp/org-protocol.el=20b/lisp/org-protocol.el=0Aindex=20= 7e986a9ed..6744fc0ac=20100644=0A---=20a/lisp/org-protocol.el=0A+++=20= b/lisp/org-protocol.el=0A@@=20-554,7=20+554,7=20@@=20The=20location=20= for=20a=20browser's=20bookmark=20should=20look=20like=20this:=0A=20=09=09= =20=20=20=20=20=20;;=20Try=20to=20match=20a=20rewritten=20URL=20and=20= map=20it=20to=0A=20=09=09=20=20=20=20=20=20;;=20a=20real=20file.=20=20= Compare=20redirects=20without=0A=20=09=09=20=20=20=20=20=20;;=20suffix.=0A= -=09=09=20=20=20=20=20=20(when=20(string-match-p=20(car=20rewrite)=20f2)=0A= +=09=09=20=20=20=20=20=20(when=20(string-match-p=20(car=20rewrite)=20f1)=0A= =20=09=09=09(throw=20'result=20(concat=20wdir=20(cdr=20rewrite))))))))=0A= =20=09=20=20=20=20=20=20;;=20--=20end=20of=20redirects=20--=0A=20=0A--=20= =0A2.11.0=20(Apple=20Git-81)=0A=0A= --Apple-Mail=_90DCDD77-5C21-4D19-A957-2F84A8B98097 Content-Disposition: attachment; filename=0003-org-protocol.el-sources-with-date-URL-are-supported.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0003-org-protocol.el-sources-with-date-URL-are-supported.patch" Content-Transfer-Encoding: quoted-printable =46rom=20dd9d41cfb6d48cc03a71c8604f3d913c35df4844=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Mario=20Martelli=20=0A= Date:=20Sun,=2025=20Jun=202017=2001:03:34=20+0200=0ASubject:=20[PATCH=20= 3/4]=20org-protocol.el=20sources=20with=20date=20URL=20are=20supported=0A= =0A*=20(org-protocol-project-alist):=20date-URL=20is=20added=20as=20= example=0A*=20(org-protocol-open-source):=20first=20match=20is=20= processed=20in=20rewrite=0A=0ATINYCHANGE=0A---=0A=20lisp/org-protocol.el=20= |=2018=20+++++++++++++++---=0A=201=20file=20changed,=2015=20= insertions(+),=203=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/org-protocol.el=20b/lisp/org-protocol.el=0Aindex=20= 6744fc0ac..5d4baae34=20100644=0A---=20a/lisp/org-protocol.el=0A+++=20= b/lisp/org-protocol.el=0A@@=20-194,7=20+194,14=20@@=20Example:=0A=20=20=20= =20=20=20=20=20=20=20=20:working-suffix=20\".org\"=0A=20=20=20=20=20=20=20= =20=20=20=20:base-url=20\"http://localhost/org/\"=0A=20=20=20=20=20=20=20= =20=20=20=20:working-directory=20\"/home/user/org/\"=0A-=20=20=20=20=20=20= =20=20=20=20:rewrites=20((\"org/?$\"=20.=20\"index.php\")))))=0A+=20=20=20= =20=20=20=20=20=20=20:rewrites=20((\"org/?$\"=20.=20\"index.php\")))=0A+=20= =20=20=20=20=20=20=20=20(\"Hugo=20based=20blog\"=0A+=20=20=20=20=20=20=20= =20=20=20:base-url=20\"https://themes.gohugo.io/theme/hugo-icarus/\"=0A+=20= =20=20=20=20=20=20=20=20=20:working-directory=20= \"~/Documents/MyBlog/themes/hugo-icarus-theme/exampleSite/content/post/\"=0A= +=20=20=20=20=20=20=20=20=20=20:online-suffix=20\".html\"=0A+=20=20=20=20= =20=20=20=20=20=20:working-suffix=20\".md\"=0A+=20=20=20=20=20=20=20=20=20= =20:rewrites=20= ((\"\\(https://themes.gohugo.io/theme/hugo-icarus/[0-9]+/[0-9]+/[0-9]+/\\)= \"=20.=20\".md\")))))=0A+=0A=20=0A=20=20=20=20The=20last=20line=20tells=20= `org-protocol-open-source'=20to=20open=0A=20=20=20=20= /home/user/org/index.php,=20if=20the=20URL=20cannot=20be=20mapped=20to=20= an=20existing=0A@@=20-554,8=20+561,13=20@@=20The=20location=20for=20a=20= browser's=20bookmark=20should=20look=20like=20this:=0A=20=09=09=20=20=20=20= =20=20;;=20Try=20to=20match=20a=20rewritten=20URL=20and=20map=20it=20to=0A= =20=09=09=20=20=20=20=20=20;;=20a=20real=20file.=20=20Compare=20= redirects=20without=0A=20=09=09=20=20=20=20=20=20;;=20suffix.=0A-=09=09=20= =20=20=20=20=20(when=20(string-match-p=20(car=20rewrite)=20f1)=0A-=09=09=09= (throw=20'result=20(concat=20wdir=20(cdr=20rewrite))))))))=0A+=09=09=20=20= =20=20=20=20(when=20(string-match=20(car=20rewrite)=20f1)=0A+=09=09=09= (setq=20replacement=20(cdr=20rewrite))=0A+=09=09=09(if=20(match-string=20= 0=20f1)=0A+=09=09=09=20=20=20=20(setq=20replacement=20(concat=0A+=09=09=09= =09=09=20=20=20=20=20=20=20(directory-file-name=20=20(replace-match=20""=20= nil=20nil=20f1=201))=0A+=09=09=09=09=09=20=20=20=20=20=20=20replacement=20= )))))=0A+=09=09=20=20=20=20(throw=20'result=20(concat=20wdir=20= replacement)))))=0A=20=09=20=20=20=20=20=20;;=20--=20end=20of=20= redirects=20--=0A=20=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20= (file-readable-p=20the-file)=0A--=20=0A2.11.0=20(Apple=20Git-81)=0A=0A= --Apple-Mail=_90DCDD77-5C21-4D19-A957-2F84A8B98097 Content-Disposition: attachment; filename=0004-test-org-protocol.el-date-style-URL-support.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0004-test-org-protocol.el-date-style-URL-support.patch" Content-Transfer-Encoding: quoted-printable =46rom=20ec444303c239bc6d82bd8566e3fb283ea580070d=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Mario=20Martelli=20=0A= Date:=20Sun,=2025=20Jun=202017=2010:14:40=20+0200=0ASubject:=20[PATCH=20= 4/4]=20test-org-protocol.el:=20date=20style=20URL=20support=0A=0A*=20= (test-org-protocol/org-protocol-open-source):=20configuration=0A= displaying=20a=20date-style=20URL=20is=20added=0A=0ATINYCHANGE=0A---=0A=20= testing/lisp/test-org-protocol.el=20|=206=20++++++=0A=201=20file=20= changed,=206=20insertions(+)=0A=0Adiff=20--git=20= a/testing/lisp/test-org-protocol.el=20= b/testing/lisp/test-org-protocol.el=0Aindex=208f946864c..b11c72a68=20= 100644=0A---=20a/testing/lisp/test-org-protocol.el=0A+++=20= b/testing/lisp/test-org-protocol.el=0A@@=20-137,6=20+137,12=20@@=0A=20=09= =20=20=20=20=20:base-url=20"http://another.example.com/"=0A=20=09=20=20=20= =20=20:online-suffix=20".js"=0A=20=09=20=20=20=20=20:working-directory=20= ,(file-name-directory=20temp-file-name2))=0A+=09=20=20=20=20(test3=0A+=09= =20=20=20=20=20:base-url=20"https://blog-example.com/"=0A+=09=20=20=20=20= =20:working-directory=20,(file-name-directory=20temp-file-name2))=0A+=09=20= =20=20=20=20:online-suffix=20".html"=0A+=09=20=20=20=20=20= :working-suffix=20".md"=0A+=09=20=20=20=20=20:rewrites=20= (("\\(https://blog-example.com/[0-9]+/[0-9]+/[0-9]+/\\)"=20.=20".md"))=0A= =20=09=20=20=20=20))=0A=20=09=20(test-cases=0A=20=09=20=20(list=0A--=20=0A= 2.11.0=20(Apple=20Git-81)=0A=0A= --Apple-Mail=_90DCDD77-5C21-4D19-A957-2F84A8B98097 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > BTW, have you signed FSF papers? Applied for it just now. Have marked the changes as tiny.=20 Kind regards Mario =E2=80=94=20 --Apple-Mail=_90DCDD77-5C21-4D19-A957-2F84A8B98097--