Hi all,

I have written this function to be able to choose the type of block in
which to enclose the marked content (by default, quote). So in
my org-capture template I put %(my-capture-block) instead of %i:

┌────
│ (defun my-capture-block ()
│   (let ((initial (org-capture-get :initial)))
│     (when initial
│       (let ((block-name
│            (read-string
│             "Block type for marked content (default quote): "
│             nil nil "quote")))
│       (format
│        "#+begin_%s\n%s\n#+end_%s"
│        block-name
│        initial
│        (if (string-match "\\(src\\)\\(.+\\)" block-name)
│            (match-string 1 block-name)
│          block-name))))))
└────

The function works fine from eww, but it doesn't work with org-protocol
+ qutebrowser, as the value of :initial in org-capture-plist seems to be
nil. I've solved it by enclosing %i between two sexp %(...), one to
format the #+begin_xxx and the other to guess the #+end_xxx, but it's
more verbose. Does anyone have a clue how to get the value of %i for
org-protocol with a function inside the template?

Best regards and happy weekend,

Juan Manuel 

-- 
--
------------------------------------------------------
Juan Manuel Macías 

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com


Reply via email to