新建org-protocol的sub-protocols

有人知道如何创建custom的org-protocol的sub-protocols?能不能扩展现在org-protocol-capture的功能,现在它只能从网页获得3个参数,包括url: location.href, title: document.title, body: window.getSelection()

能不能获取更多的参数写到org-capture-template里面去?

在默认的实现org-capture的函数org-protocol-capture的基础上创建一个自定义的函数,然后自定义org-protocol-protocol-alist

org-protocol-protocol-alist的文档:

org-protocol-protocol-alist is a variable defined in ‘org-protocol.el’.
Its value is nil

  You can customize this variable.

Documentation:
Register custom handlers for org-protocol.

Each element of this list must be of the form:

  (module-name :protocol protocol :function func :kill-client nil)

protocol - protocol to detect in a filename without trailing
           colon and slashes.  See rfc1738 section 2.1 for more
           on this.  If you define a protocol "my-protocol",
           ‘org-protocol-check-filename-for-protocol’ will search
           filenames for "org-protocol:/my-protocol" and
           trigger your action for every match.  ‘org-protocol’
           is defined in ‘org-protocol-the-protocol’.  Double and
           triple slashes are compressed to one by emacsclient.

function - function that handles requests with protocol and takes
           one argument.  If a new-style link (key=val&key2=val2)
           is given, the argument will be a property list with
           the values from the link.  If an old-style link is
           given (val1/val2), the argument will be the filename
           with all protocols stripped.

           If the function returns nil, emacsclient and -server
           do nothing.  Any non-nil return value is considered a
           valid filename and thus passed to the server.

           ‘org-protocol.el’ provides some support for handling
           old-style filenames, if you follow the conventions
           used for the standard handlers in
           ‘org-protocol-protocol-alist-default’.  See
           ‘org-protocol-parse-parameters’.

kill-client - If t, kill the client immediately, once the sub-protocol is
           detected.  This is necessary for actions that can be interrupted by
           ‘C-g’ to avoid dangling emacsclients.  Note that all other command
           line arguments but the this one will be discarded.  Greedy handlers
           still receive the whole list of arguments though.

Here is an example:

  (setq org-protocol-protocol-alist
      '(("my-protocol"
         :protocol "my-protocol"
         :function my-protocol-handler-function)
        ("your-protocol"
         :protocol "your-protocol"
         :function your-protocol-handler-function)))