From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id cElKFbMkT2Z0fwAAqHPOHw:P1 (envelope-from ) for ; Thu, 23 May 2024 13:12:51 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id cElKFbMkT2Z0fwAAqHPOHw (envelope-from ) for ; Thu, 23 May 2024 13:12:51 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=PF3HOq6z; 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=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1716462771; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=+W5q+IXvNaNFj1yCs9ymBzBQDzWllTvRO0npwKZEovM=; b=JV8TOgtPxX4/ydehC8l/tYtwx3e7X2j/hGlz0FKemKtF9X58CPVMG0RGID7vAOuhJsKM6U lEcYjVud31Cu66gz4ovmlirEKkajNUrXctQKKew8Ch7fKoFzRS5ApGlQPKWAZIwv81785v WtdnJMfgvEYSg908+mgOwj1Ya87c1Z3bQ274eUdSlfB+MXNfJiz2NQTe07N694MWyeKg3X ldaK7l8irCM5115bft0CuhsDHjrrTlBq2OXu/gfwhu81dxetXybKlsLpsg1Hae7NSwyxTo 91EkxH9Mqm35enMse+vYKi7y/1/pltwU6HOiycQ/gUKyU2kKzQoz3SVw3+YIaQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=PF3HOq6z; 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=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1716462771; a=rsa-sha256; cv=none; b=I+qpIPBFMNyYxN+lLhfnN2TOVlW+rQV74MCm0MzFPcdEespaXcJ/qrezVe+HSnng++zi7g G955pga8LT2tpWiyINAQ9D3xqy3JCmeX+YhTl/kbdUiV1F4aEqoPXn2cPDo0t6tbFkGpUI lcnwGvmRj/rNllmgdR4sD+oUuKVPHemjtSuR9Ooieyr4cEMHBh0pzj3QO7swU+KQG/YyAd A+wZv/ijVKqRCb++GQcsZRIAZFxxtiD5MWOcrr3T83TkL6/5nDU0yEvHIMZ3T6RK0J0mPc k9IWI1/8VjVHY3drbUq4w0mHh+DnKoms7p4OkV0Zh47FUnK03IL6vNTvuWNfig== 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 27C5270333 for ; Thu, 23 May 2024 13:12:51 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sA6Me-0002IK-6e; Thu, 23 May 2024 07:12:04 -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 1sA6MZ-0002HC-Ft for emacs-orgmode@gnu.org; Thu, 23 May 2024 07:11:59 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sA6MW-000152-Ek for emacs-orgmode@gnu.org; Thu, 23 May 2024 07:11:59 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 727FE240104 for ; Thu, 23 May 2024 13:11:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1716462713; bh=L8CfvAZin4EP7bR1xc8iQWF4wPj3V352HRmZQTSLsEM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=PF3HOq6zg7OGrOaWPVKaJetXkHhtmnwZLZNYUrM2xNCNVNd+n7blGT/4I64ZjA5v9 Q6ObantwFpqaiXnNGv6NQEWUXe24ekmCpiYhUp3mm+cObNbV3AK1T8bQB1IL7K6BU8 4TsokJf5HN1JEN3rSQkM2ba8ObVy5nFH5o1z30je8Aphw0d+C2oR33aPqEv/SU6DGq rsLf2AVLEaecZdXOFxtNySloOVG+/bj70qG0LUmmy0hvuHO1aQyOezhHjgWTANpBG2 em0HLe8jRDzAHW9s0yYaPQVyCj8RPIvAFR8Av0Q3CvLGZqwsRFb5kTzvZCOqE8WZpW Xm5A9HHOJ/vLg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VlQVJ6XYLz6tw9; Thu, 23 May 2024 13:11:52 +0200 (CEST) From: Ihor Radchenko To: Bruno Cardoso Cc: emacs-orgmode@gnu.org Subject: Re: [BUG] org-capture: %\N template expansion In-Reply-To: <87o78xz697.fsf@gmail.com> References: <87o78xz697.fsf@gmail.com> Date: Thu, 23 May 2024 11:13:38 +0000 Message-ID: <87msogye59.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.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, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -9.57 X-Migadu-Queue-Id: 27C5270333 X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -9.57 X-TUID: DvFO/GR1DA4f Bruno Cardoso writes: > I'm having trouble expanding the '%\N' template in org-capture. > > For example, with the following template: > > (add-to-list 'org-capture-templates > '("t" "TEST" entry > (file+headline "~/org/test.org" "TEST") > "** TODO %? > :PROPERTIES: > :TITLE: %^{TITLE} > :AUTHOR: %^{AUTHOR}p > :END: > %\1 %\2")) > > The properties are read correctly, but "%\1 %\2" expands to "%^A %^B". That's expected - you do need to escape \ in Elisp strings. \1 in string is ^A (Ctrl-A) and \2 is ^B. > Either escaping the backslashes ("%\\1 %\\2") or reading the template above from a file throws an error: > > : org-capture: Capture abort: Wrong type argument: stringp, nil That's because you can only use %\N placeholder for %^{prompt} but not for %^{prompt}X. Try (add-to-list 'org-capture-templates '("t" "TEST" entry (file+headline "~/org/test.org" "TEST") "** TODO %? :PROPERTIES: :TITLE: %^{TITLE} :AUTHOR: %^{AUTHOR} :END: %\\1 %\\2")) We can probably improve the error and the docstring to clarify this. We may also make %^{prompt}X expansions to work with %\N, but it can break the existing templates that are tuned to the current behaviour. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at