From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id wB75NnBk92H91gAAgWs5BA (envelope-from ) for ; Mon, 31 Jan 2022 05:24:16 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id fQ9ENHBk92EjSQAA9RJhRA (envelope-from ) for ; Mon, 31 Jan 2022 05:24:16 +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 4D2A62D374 for ; Mon, 31 Jan 2022 05:24:16 +0100 (CET) Received: from localhost ([::1]:41306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEOEf-0000eI-Vz for larch@yhetil.org; Sun, 30 Jan 2022 23:24:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEOE9-0000ds-F3 for emacs-orgmode@gnu.org; Sun, 30 Jan 2022 23:23:41 -0500 Received: from [2a00:1450:4864:20::42b] (port=44753 helo=mail-wr1-x42b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nEOE7-0006XF-E1 for emacs-orgmode@gnu.org; Sun, 30 Jan 2022 23:23:41 -0500 Received: by mail-wr1-x42b.google.com with SMTP id k18so22877909wrg.11 for ; Sun, 30 Jan 2022 20:23:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=YXpHr0iNZTsmDnxR2Oadmlyf3T9dWgvCcdN2j/Xu93k=; b=a8IuleDRlIB4sEIg03XLTQIrBzsNKlbYajRq4Mf3SWjuL+fqUQT38h6MidRWAqeGXI wW+fiqeQ1/0eK8JaDLPQ+0i9XbJr7SyqCRqgnj9vskf8O7GCEh6ZCHO3EtblUB2/de2D C0xH8tGWe2szmdS03RuPRm36BJBfis258el36RD364eBX7xzPvFapp37u+UW6n6rpb04 ceRjIiHngR6IndbDJO0emKgI9WYLTj7OTV8g/m2DD/JYCZlENMBkOyrV3ICN6krIXYD3 r+tIX7XCcF3hZgVL6dRqH/aUtSUSpVdgIAqCVMQWKwVI1xuoyDs6SuKD1hrOWDP1eFl5 +E9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YXpHr0iNZTsmDnxR2Oadmlyf3T9dWgvCcdN2j/Xu93k=; b=f25MeC/y6m7ePaUR1HRsIBDgyxfLdy5LlhjsPWye50EIRNX8a7asWVL5cCqavmpd6y GrPfKsJdxny/Whhc1PFlxuxTUBYLs2KtXgNrRm2b8/OstjagfXBhdSn5MEt2+gb8wxMz r7y2LyYMyOv/GRgA+mlcGdQgzoEeDRtfdOHx2atAZT40QYlP1nzA+bC6DCgvNXmx/OdH 7rQrRGM4iagPFnfgTAei2p5LMpB3mykBUoJlIE9AkIbiywoDeQWsYKjNV+xQO5AtVfLE 8kR81VlgCaPqcklfWTh4zYdQC8RmX2BWgYODhd6mmYvUVmWctlIT6Ifl5zdgxhZLxuWm bteg== X-Gm-Message-State: AOAM530fAGWEd2PV37eSMrfbwP3evBPrr4xnAhZRQubm7lLm5AIq9yMh aommho1b4yqVcUq0C/T+mAAzW/zfycU= X-Google-Smtp-Source: ABdhPJwFONHZaOXIa0z66gNWLyyqFhjWsh4Vxr0+KQBuz9z55tXRKiIzAmLC7IOmAybV8rrXYSHFjA== X-Received: by 2002:adf:a388:: with SMTP id l8mr15678595wrb.237.1643603018131; Sun, 30 Jan 2022 20:23:38 -0800 (PST) Received: from pluto.localnet (alagny-552-1-21-233.w83-200.abo.wanadoo.fr. [83.200.40.233]) by smtp.gmail.com with ESMTPSA id m6sm8282172wmq.6.2022.01.30.20.23.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jan 2022 20:23:37 -0800 (PST) From: chris To: emacs-orgmode@gnu.org Subject: Re: looking for examples of `org-capture-templates` working with `org-protocol://capture` Date: Mon, 31 Jan 2022 05:23:36 +0100 Message-ID: <10223357.zeXQE78KxU@pluto> In-Reply-To: <4933995.AmxDJHG10n@pluto> References: <8993061.SSAKWaIIEW@pluto> <4933995.AmxDJHG10n@pluto> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="nextPart5167003.t5syJ6KUGq" Content-Transfer-Encoding: 7Bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42b (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=inkbottle007@gmail.com; helo=mail-wr1-x42b.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" 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=1643603056; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=YXpHr0iNZTsmDnxR2Oadmlyf3T9dWgvCcdN2j/Xu93k=; b=qpni0Lq1H74V5LAPCvC940DWHJGIRlRmD+pig5GbL1ZCQ/m2Z5IgM/+s7Ht/wnX55aQuG8 A/X64xMxcak5oByNFLWvJF+rvijY01gkN9TugyWMgLUsoAGbJ6yj/2IseJlryxddka+yjw 0jigKT7xahVI+MxXnf4U6qhv72Ia2/d6s4UgnE/Ft64M10wpY50CFq8/O5dyxLAqXBjP6+ upsrfd8kTtsOdp+mVeGWnP/dltj6hOqurvlvRnCYe131PC2odfCFt5Cgbgoouhq9YJ9wkG yxfEDUo1XPw7jnYV2/0ItTk/B/ZLB5EILS48oQpv1oLhHWc1cRfeusvRxRDrSA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643603056; a=rsa-sha256; cv=none; b=X61eTyBMlDPjE0mMpO9daS98jB9tb0gaUgJeb51tRSOwvGlopMp/AzmgXJOeHekIlZF6Jf ZT/xjC/2OVZ6iJi0qTWICgZFkdSf7Jl5fTB5jexKcaGlqtxurpwk4/2UDVAQxKZOfqdG4e QIQwEngcK9/zi/bKdPqe4cv5IIBnB79313kcYTPsspPjz8wUD53GR/0juR5udVIf8bilC0 FInrGx8ZnmXQelEtjjb2QhVg1bgItN0dzQPD6wPE18PkUo8FJcHaey1wGMH7eLN3jeWxee pvstrczCFLs5yQKfvrtuXAHJ/BqcKG1fH5Hi3ZIXWddWzc9IEGz04AL1K2LRjg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=a8IuleDR; dmarc=pass (policy=none) header.from=gmail.com; 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.33 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=a8IuleDR; dmarc=pass (policy=none) header.from=gmail.com; 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: 4D2A62D374 X-Spam-Score: -2.33 X-Migadu-Scanner: scn1.migadu.com X-TUID: I5s942Rl6qnT This is a multi-part message in MIME format. --nextPart5167003.t5syJ6KUGq Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" On Monday, 31 January 2022 04:07:01 CET chris wrote: > On Monday, 31 January 2022 03:30:41 CET chris wrote: > > Hi, > > When you do > > `emacsclient "org-protocol://capture? > > template=X&url=URL&title=TITLE&body=BODY"` > > I don't understand at all how you make use of `url` `title` and `body` in > > `org- capture-template`. > > I understand there is some sort of "encoding" that doesn't make use of the > > keywords `url` `title` or `body`, but it's dense. > > There are no indications of how to do that here: > > https://orgmode.org/manual/The-capture-protocol.html[1] > > I haven't found any example that I've been able to reproduce in the whole > > web. I've spent hours on the documentation and the source code of > > https://github.com/emacs-mirror/emacs/blob/master/lisp/org/org-protocol.el > > [2 ] And I have absolutely no idea of how to use `url` `title` and `body` > > in `org-capture- template`. > > The last example in https://blog.jethro.dev/posts/capturing_inbox/[1], > namely: ```emacs-lisp > (setq org-capture-templates > `(("l" "org-protocol-capture" entry > (file "~/path/inbox.org") > "* TODO [[%:link][%:description]]\n\n %i" > > :immediate-finish t))) > > ``` > Seems to work consistently with: > `xdg-open "org-protocol://capture?template=l&url=URL$(date > --iso-8601=s)&title=TITLE$ (date --iso-86 > 01=s)&body=BODY$(date --iso-8601=s)"` > > > Provided I have opened at least one org buffer before hand, otherwise it > opens a buffer named > `"org-protocol://capture?template=l&url=URL&title=TITLE&body=BODY" ` at > what point it can get messy. Probably I have to "start" somehow "org-mode" > first, and it doesn't get enough started from my `init.el`. > So, reverse-engineering the example I've eventually found the relevant points of the documentation: https://orgmode.org/worg/org-contrib/org-protocol.html[1] %i' will be replaced by the selected text in your browser window if any. In addition, you may use the following placeholders in your template: Placeholders Replacement %:link URL of the web-page %:description The title of the web-page %:initial Selected text. https://orgmode.org/manual/Template-expansion.html[2] So, not so many examples, that's all. So I've rewritten Jethro's example using `%:initial` because it's easier to read: ```emacs-lisp (setq org-capture-templates `(("l" "org-protocol-capture" entry (file "~/path/inbox.org") "* TODO [[%:link][%:description]]\n\n %:initial" :immediate-finish t))) ``` > > Goal is to have the capturing work in the background, with emacs started as > a daemon, but with no opened emacsclient frame: > capture, simply, silently, unobtrusively. > > > Chris > > > > -------- > > [1] https://orgmode.org/manual/The-capture-protocol.html > > [2] > > https://github.com/emacs-mirror/emacs/blob/master/lisp/org/org-protocol.el > > -------- > [1] https://blog.jethro.dev/posts/capturing_inbox/ -------- [1] https://orgmode.org/worg/org-contrib/org-protocol.html --nextPart5167003.t5syJ6KUGq Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="UTF-8"

On Monday, 31 January 2022 04:07:01 CET chris wrote:

>= ; On Monday, 31 January 2022 03:30:41 CET chris wrote:

>= ; > Hi,

>= ; > When you do

>= ; > `emacsclient "org-protocol://capture?

>= ; > template=3DX&url=3DURL&title=3DTITLE&body=3DBODY"`<= /p>

>= ; > I don't understand at all how you make use of `url` `title` and `bod= y` in

>= ; > `org- capture-template`.

>= ; > I understand there is some sort of "encoding" that doesn't= make use of the

>= ; > keywords `url` `title` or `body`, but it's dense.

>= ; > There are no indications of how to do that here:

>= ; > https://orgmode.org/manual/The-capture-protocol.html[1]

>= ; > I haven't found any example that I've been able to reproduce in the = whole

>= ; > web. I've spent hours on the documentation and the source code of

>= ; > https://github.com/emacs-mirror/emacs/blob/master/lisp/org/org-proto= col.el

>= ; > [2 ] And I have absolutely no idea of how to use `url` `title` and `= body`

>= ; > in `org-capture- template`.

>= ;

>= ; The last example in https://blog.jethro.dev/posts/capturing_inbox/[1],

>= ; namely: ```emacs-lisp

>= ; (setq org-capture-templates

>= ;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 `(("l" "org-protocol-c= apture" entry

>= ;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (file "~/path/= inbox.org")

>= ;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "* TODO [[%:link][%:= description]]\n\n %i"

>= ;

>= ;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 :immediate-finish t)))

>= ;

>= ; ```

>= ; Seems to work consistently with:

>= ; `xdg-open "org-protocol://capture?template=3Dl&url=3DURL$(date

>= ; --iso-8601=3Ds)&title=3DTITLE$ (date --iso-86

>= ; 01=3Ds)&body=3DBODY$(date --iso-8601=3Ds)"`

>= ;

>= ;

>= ; Provided I have opened at least one org buffer before hand, otherwise it<= /p>

>= ; opens a buffer named

>= ; `"org-protocol://capture?template=3Dl&url=3DURL&title=3DTITL= E&body=3DBODY" ` at

>= ; what point it can get messy. Probably I have to "start" somehow= "org-mode"

>= ; first, and it doesn't get enough started from my `init.el`.

>= ;


So, reverse-engineering the example I've eventually found the relevant p= oints of the documentation:


https= ://orgmode.org/worg/org-contrib/org-protocol.html

%i'=

=C2= =A0=C2=A0=C2=A0 will be replaced by the selected text in your browser windo= w if any.

In = addition, you may use the following placeholders in your template:

Pla= ceholders =C2=A0=C2=A0=C2=A0 Replacement

%:l= ink =C2=A0=C2=A0=C2=A0 URL of the web-page

%:d= escription =C2=A0=C2=A0=C2=A0 The title of the web-page

%:i= nitial =C2=A0=C2=A0=C2=A0 Selected text.

 

https://orgmode= =2Eorg/manual/Template-expansion.html


So, not so many examples, that's all.


So I've rewritten Jethro's example using `%:initial` because it's easier= to read:

 

```= emacs-lisp

(se= tq org-capture-templates

=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 `(("l" "org-protocol-capture&quo= t; entry

=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (file "~/path/inbox.org&= quot;)

=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "* TODO [[%:link][%:descriptio= n]]\n\n %:initial"

=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 :immediate-finish t)))

```=


>

>= ; Goal is to have the capturing work in the background, with emacs started = as

>= ; a daemon, but with no opened emacsclient frame:

>= ; capture, simply, silently, unobtrusively.

>= ;

>= ; > Chris

>= ; >

>= ; > --------

>= ; > [1] https://orgmode.org/manual/The-capture-protocol.html

>= ; > [2]

>= ; > https://github.com/emacs-mirror/emacs/blob/master/lisp/org/org-proto= col.el

>= ;

>= ; --------

>= ; [1] https://blog.jethro.dev/posts/capturing_inbox/

--nextPart5167003.t5syJ6KUGq--