From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id 8ILzNNxRR2YaPgEAqHPOHw:P1 (envelope-from ) for ; Fri, 17 May 2024 14:47:24 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 8ILzNNxRR2YaPgEAqHPOHw (envelope-from ) for ; Fri, 17 May 2024 14:47:24 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Hb+DfzGo; 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=1715950044; 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=de4+uIuKTmuEwpRRwWUoIvj24B/qM2NjvQB434FLs/g=; b=Di1VJo84h5xgKASsWzI/Ok5REHMAgNur3Nj4rzeMAxVp45ijeQgUBkMIWKavdiO/Db5QNQ +M6SiJQ1zCiQERC60UxebvgA69J79IRljTNAVQk05fp31bPBh7m2rpdkbjKQ9vFvDyOr1e KkhadrpG+XCzj+21fLjYlUs7Q/1VZhflRjsFBvmt5JtF+xb5cAs5f8imskSGAjct2xAzrl CQVh8MGDWIvzmQmpdsbLvBnKWyhd2641gUSuexUWwBuHuAV6ZTdCe8SWk6zFI5fv1Az0dM uSa96yzPPz1tGfwJExILdLY9piPt/kLXWWSHhUbnVvewtio8r/3noQshJ75gJQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Hb+DfzGo; 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=1715950044; a=rsa-sha256; cv=none; b=Ilak0s6u/268COLezZ43RSF0IN/c/yNKCHIuYP5zJrsBcu+L2MnY2GaxabUJjd3V+3HPeG y9weMQiQ+4VcehV0ZTbmRHrGFJvN/nhU2mBQD1pjZc7IDtypY0Mc2lylIWO7DZKyv2c4GP Fc5h6MHjdJs3diTivZGucaG/FJLvHhy+F3ZdNzpIS+qF5OjG8vkImIrjdUsYrPF3YUa/V2 TkzfR1qU3msNJ5l+FibigYlhFrQByNS3iEYVAbYQSm+1MGia/edUNcITHKuxIuxezO66bw A3NQ2B5LgWO2rMUPjgoVFTAsMc/op3q6et2lITB25zT0d0fx6Bl1aaIirMWsZQ== 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 872011569D for ; Fri, 17 May 2024 14:47:24 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7wyh-0007Gr-UV; Fri, 17 May 2024 08:46:27 -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 1s7wyf-0007E1-8K for emacs-orgmode@gnu.org; Fri, 17 May 2024 08:46:25 -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 1s7wyc-0003IA-PU for emacs-orgmode@gnu.org; Fri, 17 May 2024 08:46:24 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 1B961240103 for ; Fri, 17 May 2024 14:46:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1715949980; bh=0tAjHaCp3n0N40m4V3jGcB161xliSNudugBMGAbwCyE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=Hb+DfzGov4fBnchgXWrx0+IW7HFooUQUHFrLeDIEmFiH73r9k6q5kds4ZjiuUxdx0 wcNQe5u55WG3wn7hwf91zxcPNZYvu5NjkaJ17b0vRBXtgCExCPDK6cUCss1Ess7kpg sJxq9S+nkkuZRdo5HjUguNP2VIL5sNzOeJhd9lD/XTMtZn+mFBh8rQS/NkvNaYQNSb D/sS1dd5L3xRPM5ZfLfA94+4SEvLQWW/iOIggROznc/p3Nv2OZKQtWnNferl11YGBi FVPLedP0PaDoBciYdgC1MQBgPbaRJDLgIuEUF4K6ehA2u6STHs96SKT00ZhB12t5WN ayHOuaVh7IOYg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Vgmt33D1Yz6twR; Fri, 17 May 2024 14:46:19 +0200 (CEST) From: Ihor Radchenko To: Nafiz Islam Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] function and symbol for headline and olp for org-capture-templates In-Reply-To: References: Date: Fri, 17 May 2024 12:48:00 +0000 Message-ID: <87r0e08v0f.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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -9.58 X-Spam-Score: -9.58 X-Migadu-Queue-Id: 872011569D X-Migadu-Scanner: mx13.migadu.com X-TUID: 1lrmH8QBksfh Nafiz Islam writes: > This patch adds the option to provide function and symbol for headline and > olp for org-capture-templates. Thanks for the patch. A few comments. Firstly, your total contribution to Org mode with this patch will exceed the maximum allowed number of LOC changes we can accept without FSF copyright assignment. May I know if you have FSF copyright assignment? If not, would you consider doing the paperwork? See https://orgmode.org/worg/org-contribute.html#copyright > - (string :tag " Headline")) > + (choice :tag "Headline" > + (string :tag "Headline") > + (function :tag "Function") > + (variable :tag "Variable") > + (sexp :tag "Form"))) Please update the docstring of `org-capture-templates' as well. > +(defun org-capture-expand-olp (&rest olp) > + "Expand functions, symbols and outline paths for OLP. > +When OLP is a function, call it. When it is a variable, > +return its value. When it is a list of string, return it. > +In any other case, return `nil'." > + (let* ((final-olp (cond ((stringp (car olp)) olp) > + (t (org-capture-expand-function-or-symbol (car olp)))))) > + final-olp)) I think that we should filter out incorrect target specifications when the function name is followed by more list elements - (cdr olp) is non-nil. > ... > However, I just realized that the suggestion provided in > https://lists.gnu.org/archive/html/emacs-orgmode/2024-05/msg00216.html > might not work how I was hoping for. Basically, I wanted it to be possible > to search for headlines and even outline paths in the > buffer while in the function. But, by expanding outline-path before setting > the buffer (by calling outside of `org-find-olp') that > becomes infeasible. I think that we may pass the file name as an argument to outline path function. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at