From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id KMVEBa7OSmNlXwAAbAwnHQ (envelope-from ) for ; Sat, 15 Oct 2022 17:15:58 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id mOdXBa7OSmMsAgEA9RJhRA (envelope-from ) for ; Sat, 15 Oct 2022 17:15:58 +0200 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 ACEF9323A4 for ; Sat, 15 Oct 2022 17:15:57 +0200 (CEST) Received: from localhost ([::1]:48932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ojitI-00025D-Rd for larch@yhetil.org; Sat, 15 Oct 2022 11:15:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ojis9-000255-62 for emacs-orgmode@gnu.org; Sat, 15 Oct 2022 11:14:45 -0400 Received: from mout01.posteo.de ([185.67.36.65]:50177) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ojis7-0002uA-6z for emacs-orgmode@gnu.org; Sat, 15 Oct 2022 11:14:44 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id F232324002C for ; Sat, 15 Oct 2022 17:14:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665846881; bh=AzuvdTeb6E7ViE9ZqvYBeeC21w8durMWGG6wcYzkUAA=; h=From:To:Subject:Date:From; b=moqr1jMLJeQS57i9DkHns1RrL2Q+/KBxUGI23VHpkhiKtmEn2S3qYlfTwBwyO8DSa ca+ND4bIPCs9F+9exOSmYPteSSPSC8+uUq93yoUXD3J6dCTxfV8011zJtjqIpeuTZH ULrDRRNQl6gDABZwsyl2hMdJp39xbbCIEDYU8r0Ok7FaWPRMz2PMfjode4coECBRWm xzZRutRuwmG9PfQ6Q5gDG2+bAxKVEZ9bE5ZSeh+CQi/andYdpXpS5WGLmBleDE16zz qNHxUbsFdluxVuzcQ6WETWWHYB7eDfVjjsHCrj+EKEg0IFPvvjfpjRHzO9KzoDLPUd kN1ADqr+Fp9BQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MqRct28stz9rxK for ; Sat, 15 Oct 2022 17:14:37 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: orgmode Subject: Doubts about a function for my org-capture template Date: Sat, 15 Oct 2022 15:14:36 +0000 Message-ID: <87wn91f7ab.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.65; envelope-from=maciaschain@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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=1665846957; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=m1rt6/rFKklSe1I2ItuioBBxpAlYM4Q3vBJDGC7Rt/U=; b=sYnzlhQL2Kw9NhYlozSiEggtp0GGKoXozDqjdR+QJrtuBsFDBMmzRDTHl0LMxqYJwd1m2M gPE4tIXUfGodhAj9wgPjkRRohXc/jfKgMZK1MDls4X/HCWU3A7puqdonAXhDOupmRinmlS sdx0tFddEQK7nV0hWUL9G5eHLetqNYh7MTI1tfnBGJNpgKtqe8kDCsiteeD4zR/BV6QYnn TtlWLdg9RvHm9g9qpY0bKNiUkv440TM+8NzGdlgJM2o8R8qEmRqJKmuC6bXGDgJ2BDy0rl D87BNYBcVknUCtzwyMbPuYkg7/ESN6NcEuCttw6siW0OWVWVU2h+ENzOsenRsA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665846957; a=rsa-sha256; cv=none; b=garbVQq2vTGCXe/X5rCLM6ABYtZcEKXkapNx2iejrb/ZjKpk6lNjRiJEGErm9mR+DDB+Sy yoCAywjml/uNu5DIpJJ1P3ymgRX7E59rcEFQjoq/kDm/m+O/Jae5nwqO0MlBQDtHJ0Qrbv g47SDVjiAy9zhZ1wP9lZxb69MoWucICaLYocPm2Ql825C2JlId1G5PtcqYDz2yqn2jNv/Z v2iczDrA8eb8JmQ8ht3wIFFdDhHA6onmb3iJVQTajxVPqPKHhv27GLQ++0blwfElfAtHeV bCzaMFHTBVLpgvEIXpqmjQ0UPJ9s2/o8gGWqE2OvCEmq/DthvgIc3kFpwaKTHw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=moqr1jML; dmarc=pass (policy=none) header.from=posteo.net; 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: -9.00 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=moqr1jML; dmarc=pass (policy=none) header.from=posteo.net; 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: ACEF9323A4 X-Spam-Score: -9.00 X-Migadu-Scanner: scn0.migadu.com X-TUID: IPX5m494tFTq 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: =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 (defun my-capture-block () =E2=94=82 (let ((initial (org-capture-get :initial))) =E2=94=82 (when initial =E2=94=82 (let ((block-name =E2=94=82 (read-string =E2=94=82 "Block type for marked content (default quote): " =E2=94=82 nil nil "quote"))) =E2=94=82 (format =E2=94=82 "#+begin_%s\n%s\n#+end_%s" =E2=94=82 block-name =E2=94=82 initial =E2=94=82 (if (string-match "\\(src\\)\\(.+\\)" block-name) =E2=94=82 (match-string 1 block-name) =E2=94=82 block-name)))))) =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 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=20 --=20 -- ------------------------------------------------------ Juan Manuel Mac=C3=ADas=20 https://juanmanuelmacias.com https://lunotipia.juanmanuelmacias.com https://gnutas.juanmanuelmacias.com