From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id oAGLBUMbkWZl2wAA62LTzQ:P1 (envelope-from ) for ; Fri, 12 Jul 2024 12:02:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id oAGLBUMbkWZl2wAA62LTzQ (envelope-from ) for ; Fri, 12 Jul 2024 14:02:11 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; 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"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1720785731; 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; bh=viqUlkU0p1Bb5UmMEXCQqoNvQ5Mvri7SxtoSnr0zo+Q=; b=qcWMaFSMM0Xj+KqEca3zj4XxjXhQtTIHFoE9WjQfhiNoeGERHTRnV36s9FqnlfUcW+RNC/ QhHFNb11c8Ki6zQXDFXj3mEzWFP+58jzTcjatwcfCfrxoW4u5ptgmsDgW4yKg61G4CjmMj r2l9GdfouRk/yEGqDbQeO6ai/A0cUfyi/nvqDiwsY65+IorCI6lrE997+PPHN6AjXH2AYL yGoLXR1nUn1X7FVImj/oDT9VwicooLcTgCEnhUl4Ub/UnnnTRc/ng4HYbYJKqIZWJghGxW uNCETjb4vHbSvrgPmjCjf9g/7x1qxBGhKsGY4MWQSoW+A/WlAuZNCmoKNwX+bw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1720785731; a=rsa-sha256; cv=none; b=ugLQYRSD07p0ZG3DZxrul8wn73YGzBCDzo0CjrUD0FpZEEuXFjO9qfQazq8a1F62Eso5MY 3+E+MxsLMrEv4cKE6vSw/JPMblXSH/FJ8IORX0cvkptBloSythOp0dOYWJ6Xx9UEXLW/+R dO5gZjLQ69i5fSIOPGyEM1AR5upwEcLGp2QzZAawhc7bZKYUr1V7ne4CMhOehPeiT9Tt5r BfqS9d+bjq7CggCUKjnEfdsETCaLPdS0EUdb7DBup8wekr8/T/a3ORSOofybAxTtF7SReB HrauFD3H/XSnHockE5GYbKn4F3mCVGxSKfNu8ODWjynDperijAjq9ifXerR4sQ== 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 E97E03B283 for ; Fri, 12 Jul 2024 14:02:10 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sSExL-0003q2-LT; Fri, 12 Jul 2024 08:00: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 1sSExK-0003n1-Qc for emacs-orgmode@gnu.org; Fri, 12 Jul 2024 08:00:54 -0400 Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sSExJ-0004TQ-8O for emacs-orgmode@gnu.org; Fri, 12 Jul 2024 08:00:54 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1sSExG-0001sg-1G for emacs-orgmode@gnu.org; Fri, 12 Jul 2024 14:00:50 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Max Nikulin Subject: Re: Capture, template expansion and keyword for link type Date: Fri, 12 Jul 2024 19:00:45 +0700 Message-ID: References: <87sewga4ni.fsf@k-7.ch> <87r0c08ldo.fsf@k-7.ch> <87ikxbwtru.fsf@k-7.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit User-Agent: Mozilla Thunderbird Content-Language: en-US, ru-RU In-Reply-To: <87ikxbwtru.fsf@k-7.ch> Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 23 X-Spam_score: 2.3 X-Spam_bar: ++ X-Spam_report: (2.3 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: E97E03B283 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -5.79 X-Spam-Score: -5.79 X-TUID: GxO1p1nEC1y4 On 12/07/2024 03:36, Sébastien Gendre wrote: > Max Nikulin writes: >> See the "Link type, Available keywords" table in this section. >> `org-capture' may be executed in various Emacs buffers and available >> keywords may depend on major mode. > > Is it necessary to call "org-store-link" before calling "org-capture" to > extracet the informations used by theses keywords ? [...] > I found the documentation unclear about this. Have a look into `org-capture' code. It calls `org-store-link'. > Is there a way to discover the keywords that a major mode provide to a > capture template ? See specific store link functions, e.g. `org-gnus-store-link'. >> %(let ((bla (plist-get (plist-get org-store-link-plist :query) :bla))) >> (or bla "No bla"))" >> >> emacsclient >> 'org-protocol:/capture?template=s&title=Hello&body=World&url=http:%2F%2Fexample.com&bla=foo' > > A new parameter added to the org-protocol url is only accessible through > the ":query" key ? It will not create a new "%:keywoard" automatically ? With "capture" subprotocol it does not mapped to keywords. > What I would love to do, is creating a Firefox extension that can > extract different metadata from known well known web site and pass them > to an Org-mode capture through org-protocol. > > For example, for a book, extracting author, title, year, etc. Not all books have authors in metadata. Some have editors since every chapter has its own author. To avoid handling such logic in capture templates I decided to resort to formatting inside an extension (or formatting performed by a dedicated tool if site has API, e.g. GitHub). > And then, I could simply create a capture template that would use the > keywords "%:author", "%:title", etc. If you are using Emacs-30 I would suggest to keep away from org-protocol hacks and to rely on `server-eval-args-left' handled by a dedicated function emacsclient --eval '(my-capture)' 'my-proto://something?param=value' For older versions you may either use backslash hell like in emacsclient-mail.desktop or to define custom subprotocol for org-protocol.