emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sébastien Gendre" <seb@k-7.ch>
To: emacs-orgmode@gnu.org
Subject: Re: Capture, template expansion and keyword for link type
Date: Thu, 11 Jul 2024 22:36:21 +0200	[thread overview]
Message-ID: <87ikxbwtru.fsf@k-7.ch> (raw)
In-Reply-To: <d8ae4eff-852b-4424-9527-a98e5b5538e3@gmail.com> (Max Nikulin's message of "Thu, 11 Jul 2024 21:05:04 +0700")

[-- Attachment #1: Type: text/plain, Size: 2084 bytes --]

Max Nikulin <manikulin@gmail.com> 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 ?

Or did I missundertant how it work ?

I found the documentation unclear about this.

Is there a way to discover the keywords that a major mode provide to a
capture template ?



Max Nikulin <manikulin@gmail.com> writes:
> Some time ago I tried %(exp) elisp snippets in templates (untested)
>
>       "* [[%:link][%:description]]
> #+BEGIN_QUOTE
> %i
> #+END_QUOTE
> %(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 ?



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.

And then, I could simply create a capture template that would use the
keywords "%:author", "%:title", etc.

I was also thinking, instead of a Firefox extension, creating an Elisp
function that take a web page URL as parameter, extract the metadata
from the web page and then call Org-capture providing the keywords
"%:author", "%:title", etc, to the template.

But I don't know how to do the last part and I cant found documentation
about it. And with this second solution, I don't know how to make it
work with org-protocol. As an org-protocol call result directly in an
Org-capture call. And extracting metadata from Firefox give more
flexibility on manually selecting information to extract on the web page.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 849 bytes --]

  reply	other threads:[~2024-07-11 20:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87sewga4ni.fsf@k-7.ch>
2024-07-11  6:59 ` Capture, template expansion and keyword for link type Sébastien Gendre
2024-07-11 13:56   ` Ihor Radchenko
2024-07-11 20:47     ` Sébastien Gendre
2024-07-11 14:05   ` Max Nikulin
2024-07-11 20:36     ` Sébastien Gendre [this message]
2024-07-12 12:00       ` Max Nikulin
2024-07-12 16:34         ` Sébastien Gendre
2024-07-14  8:22           ` Max Nikulin
2024-07-11  3:42 Sébastien Gendre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ikxbwtru.fsf@k-7.ch \
    --to=seb@k-7.ch \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).