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: Wed, 28 Jun 2017 16:44:38 +0200 Message-ID: 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> <92533F36-7529-496B-BA7B-8ED49FBFB3D2@schnuddelhuddel.de> <87injgh2yl.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_C4D7B9A9-B14D-4601-BC4D-33C882489D26" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQED2-0003TS-6K for emacs-orgmode@gnu.org; Wed, 28 Jun 2017 10:44:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQECx-0000P9-Ap for emacs-orgmode@gnu.org; Wed, 28 Jun 2017 10:44:48 -0400 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:35922) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dQECw-0000Og-Vv for emacs-orgmode@gnu.org; Wed, 28 Jun 2017 10:44:43 -0400 Received: by mail-wm0-x232.google.com with SMTP id 62so55800251wmw.1 for ; Wed, 28 Jun 2017 07:44:41 -0700 (PDT) In-Reply-To: <87injgh2yl.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=_C4D7B9A9-B14D-4601-BC4D-33C882489D26 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi, > Would it be possible to make the path involved smaller so that the > example can fit in 80 columns? The idea was to give an example which is available online and could get = cloned easily onto the local machine. Changed it to a simple example. > Here, `replacement' isn't lexically bound, so compiling > "org-protocol.el" should return an error. `replacement' should be > let-bound instead. ... Thank you for your patience, Nicolas =F0=9F=98=87 Please find attached a fresh attempt. --Apple-Mail=_C4D7B9A9-B14D-4601-BC4D-33C882489D26 Content-Disposition: attachment; filename=0001-org-protocol.el-sources-with-date-URL-are-supported.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-org-protocol.el-sources-with-date-URL-are-supported.patch" Content-Transfer-Encoding: quoted-printable =46rom=20d6744d7fee6a78a20759c7a61dbc9a118cc21c78=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Mario=20Martelli=20=0A= Date:=20Wed,=2028=20Jun=202017=2016:36:45=20+0200=0ASubject:=20[PATCH]=20= org-protocol.el=20sources=20with=20date=20URL=20are=20supported=0A=0A*=20= (org-protocol-project-alist):=20date-URL=20is=20added=20as=20example=0A*=20= (org-protocol-open-source):=20first=20match=20is=20processed=20in=20= rewrite=0A*=20(test-org-protocol/org-protocol-open-source):=20= configuration=0Adisplaying=20a=20date-style=20URL=20is=20added=0A=0A= TINYCHANGE=0A---=0A=20lisp/org-protocol.el=20=20=20=20=20=20=20=20=20=20=20= =20=20=20|=2016=20+++++++++++++---=0A=20= testing/lisp/test-org-protocol.el=20|=20=206=20++++++=0A=202=20files=20= changed,=2019=20insertions(+),=203=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/org-protocol.el=20b/lisp/org-protocol.el=0Aindex=20= cd4b216aa..099e7e25d=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://www.site.com/\"=0A+=20=20=20=20=20=20=20=20= =20=20:working-directory=20\"~/site/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://site.com/[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-556,8=20+563,11=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=20=20=20= =20=20=20=09=20=20=20=20=20=20(when=20(string-match=20(car=20rewrite)=20= f1)=0A+=09=09=09(let=20((replacement=20(concat=0A+=09=09=09=09=09=20=20=20= =20(directory-file-name=20=20(replace-match=20""=20nil=20nil=20f1=201))=0A= +=09=09=09=09=09=20=20=20=20(cdr=20rewrite))))=0A+=09=09=09=20=20(throw=20= 'result=20(concat=20wdir=20replacement))))))))=0A=20=09=20=20=20=20=20=20= ;;=20--=20end=20of=20redirects=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)=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=_C4D7B9A9-B14D-4601-BC4D-33C882489D26 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Great. Let me know when the process is complete. Will do. Sent out the signed copy today. Kind regards Mario =E2=80=94=20 --Apple-Mail=_C4D7B9A9-B14D-4601-BC4D-33C882489D26--