From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id qH/1AH7XdWVytwAAauVa8A:P1 (envelope-from ) for ; Sun, 10 Dec 2023 16:21:34 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id qH/1AH7XdWVytwAAauVa8A (envelope-from ) for ; Sun, 10 Dec 2023 16:21:34 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=devnulllabs-io.20230601.gappssmtp.com header.s=20230601 header.b=LFhp7zib; 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=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1702221693; 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=ODyGByAyfP8rCD5kPdXFuq97qjrhqxQXl+qCP5KSdWM=; b=UuLXny6TyFCDcbOdvE4v04EJ649NREfjEcVOqdtKThaRGGyQh7UbWZ5llsO5weFQrzYOMO 0OZcMTqInrrpzpjxLKsa6hWaD6gCVlLHgAKSQyYX4hvzI+jw+SHsWDy1TCCgTPtpn4Zc8w CL+1xUylI3Y54Y1ZLOdl+9LFmjwlaLQqVOYsXizfOX//qd63zWgq2lzW7DV9cNjTVX556x DMi2G/7pCE0Ui5WQQhSFH7e7F+cG6Mn9lhEV12CHL77bova5pPkmlAIWsEXmFh0jHum9Vz HlngMsLZ/SlASQvNUMcarnZGJk1epVYWh7zlVMVkna8OSuRoDPs28OZt9kCdJQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=devnulllabs-io.20230601.gappssmtp.com header.s=20230601 header.b=LFhp7zib; 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=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1702221693; a=rsa-sha256; cv=none; b=OUq6Z/E/a/vhE+TeHxcFCUEBWTsAInYq5Q1Vq8+pgMDXndbAgfggZ7HW92LCYsCTgGQjOd 3to6rP/3MlbfDl9W1UGFGHTpYO2htBzKNsUITvOlaCW8//bpqL5plTfhGe13xFCz/2tANq Dnt6/8OUJ7TPqJI/+TmW5KaJmZz6HQ4LjeZ7ZWBL5Nfi2xzSsIB8UMkiHleuS7q2AIUd5Y o9oeXGGxmt71ex3Gx83ADaX7QelirLLzLE6BslmZXwrW7+Mm41YjbHF3e7J2LANHso63uS 03fLhMAuOKH9LIOo0sfxtJNXyrV9Pi6IjA3P/jS1TWtX0iZsWeDJscBqE2ZgcA== 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 B34725948A for ; Sun, 10 Dec 2023 16:21:33 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rCLbu-0005m5-Lb; Sun, 10 Dec 2023 10:20:50 -0500 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 1rC6He-0004pb-PS for emacs-orgmode@gnu.org; Sat, 09 Dec 2023 17:58:54 -0500 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rC6Hc-0004kD-I8 for emacs-orgmode@gnu.org; Sat, 09 Dec 2023 17:58:54 -0500 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-590b3337d2bso575900eaf.2 for ; Sat, 09 Dec 2023 14:58:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devnulllabs-io.20230601.gappssmtp.com; s=20230601; t=1702162730; x=1702767530; darn=gnu.org; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=ODyGByAyfP8rCD5kPdXFuq97qjrhqxQXl+qCP5KSdWM=; b=LFhp7zibquQU3OBAzp7XWTtiH+J1vEXVviw7w085JtLRNgWo51Q+7FM+mW+2GJ1kJO Ddg+mSSRpbZXvmHP5KtWINbpcx8KBZPVsbvFpdWoUeDnmcaOxU4dZno7D4m2YOmcje6X m7JEXn4BqsCTt6VfBL2hPPm0c2qhQu18m0p888r+PsGGXClBS6Kb9nulxyl+x3YeLaii rmzEOz3PmCwSj2P5fG9yElFBlLtWWliOW5/kiGyPSz1xR15umjG9PMuHmRnJq2Yqg7c0 EOb84bsKI1Wq/hIyv9TOlpj61QY9aHL+JbqAkRKyH0O8SO+H0bbmSxLQOBkJlYgAefgm It3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702162730; x=1702767530; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ODyGByAyfP8rCD5kPdXFuq97qjrhqxQXl+qCP5KSdWM=; b=pU3tEYRdXxdREuaxIwYbhSzJaBMiDfWm/H48MlP53C+Ag6zk2q7XEG+UJ7YrTg/WSv gFly1np0qfxHUqjcicP+A84AQknqvSleumeQe9Qta9/n0F8XUcm8Pko02G06J3EsK2/H BL1aeqijn+PkeQP0JQGTbG/LN7d0jQweIMpTREwEi6MlQIAI+2um+9WR6YqSeNh8spJp vdV+HTfmYzr3pQeg+E+TtNRPsHxGWxyBSwXFrF49ssbJz8HYzeOpDGV8ePOkJ6au7bT6 nZ9nk+AAISWhxT0FhUEtvmSn4osvA7c04k1ML5HrHD/F/97ErYQqH0C5fke3wLzTPUXi RgsQ== X-Gm-Message-State: AOJu0YxQMNOhOji5m548q8os/26tZjYm6UfAAt92jVxgIHFRTHsA412a pW6V8yEgfKPR1LlNNBgXnyPHFA== X-Google-Smtp-Source: AGHT+IFjKi8GvhGGWZ33O873t3pXt//USDfUyIhWJjZqBMEbLmGoB6uqIPCgmkh+xo+ypNEx9iDD5w== X-Received: by 2002:a05:6359:4c25:b0:170:c921:fed9 with SMTP id kj37-20020a0563594c2500b00170c921fed9mr932305rwc.60.1702162730527; Sat, 09 Dec 2023 14:58:50 -0800 (PST) Received: from localhost (67-60-133-188.cpe.sparklight.net. [67.60.133.188]) by smtp.gmail.com with ESMTPSA id z3-20020a170902834300b001d1d1ef8be5sm3855157pln.173.2023.12.09.14.58.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Dec 2023 14:58:49 -0800 (PST) References: <87y2byx8ml.fsf@localhost> <20231207185326.7937-1-kb@devnulllabs.io> <87a5qkssq6.fsf@localhost> <874jgsa5nh.fsf@devnulllabs.io> <875y18cycg.fsf@localhost> User-agent: mu4e 1.10.8; emacs 30.0.50 From: Kenny Ballou To: Ihor Radchenko Cc: yantar92@gmail.com, emacs-orgmode@gnu.org Subject: Re: [PATCH] lisp/org-capture.el: use link ID's for %K Date: Sat, 09 Dec 2023 15:53:02 -0700 In-reply-to: <875y18cycg.fsf@localhost> X-PGP-Key: https://kennyballou.com/932F3E8E1C0F4A9895D7B8B8B0CAA28A02958308.txt Message-ID: <87zfyj7zko.fsf@devnulllabs.io> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::c30; envelope-from=kb@devnulllabs.io; helo=mail-oo1-xc30.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 10 Dec 2023 10:20:47 -0500 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-Migadu-Spam-Score: -8.81 X-Spam-Score: -8.81 X-Migadu-Queue-Id: B34725948A X-Migadu-Scanner: mx10.migadu.com X-TUID: FT75VyzDofq6 --=-=-= Content-Type: text/plain On 2023-12-08 19:01 GMT, Ihor Radchenko wrote: > Kenny Ballou writes: > >> I'm currently struggling through modifying it to work with >> `org-store-link'. Something, save-excursion -> org-clock-goto -> >> org-store-link -> org-insert-link is what I'm trying for now, but that's >> not quite working. I'll come back to this in a few hours. > > The last step is unnecessary. You may just examine `org-stored-links' > (documented in the docstring of `org-store-link') or > `org-store-link-plist' (undocumented, but containing more info and also > used by `org-capture-fill-template'). I ended up using `org-store-link-plist'. For some reason that I don't understand, the `save-excursion' -> `org-store-link' was not updating `org-stored-links'. Similarly, I had to use `save-window-excursion' or the `org-clock-goto' would really break things. If there's a better approach for getting the link, I'm all ears. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-lisp-org-capture.el-use-link-ID-s-for-K.patch >From e618508cdfbf899b93d5081aeec3eda18d5bd306 Mon Sep 17 00:00:00 2001 From: Kenny Ballou Date: Thu, 7 Dec 2023 10:29:46 -0700 Subject: [PATCH] lisp/org-capture.el: use link ID's for %K * org-capture.el (org-capture-fill-template): fill %K values using org ID's if `org-id-link-to-org-use-id' is non-nil. * doc/ORG-NEWS: (Template variable expansion %K) Document new behavior. Reported-by: Nathaniel W Griswold Signed-off-by: Kenny Ballou Link: https://list.orgmode.org/EF459D47-FCA4-4A18-AFC7-3E62159F186C@manicmind.earth/ TINYCHANGE --- etc/ORG-NEWS | 8 ++++++++ lisp/org-capture.el | 16 +++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 59c45b2aa..924ce43cc 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -539,6 +539,14 @@ Currently implemented options are: tasks this technically violates the iCalendar spec, but some iCalendar programs support this usage. +*** Capture template expansion now supports ID links +:PROPERTIES: +:ID: 6f1f4f77-2b16-4a4d-8c84-fb7ba5ddf1e5 +:END: + +The capture template expansion element `%K' now creates links using +the `ID' property of the currently clocked task if +`org-id-link-to-use-org-id' is non-nil. ** New features *** =ob-plantuml.el=: Support tikz file format output diff --git a/lisp/org-capture.el b/lisp/org-capture.el index e482f667f..5bb65de53 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1675,11 +1675,17 @@ Expansion occurs in a temporary Org mode buffer." (org-no-properties org-clock-heading) "")) (v-K (if (marker-buffer org-clock-marker) - (org-link-make-string - (format "%s::*%s" - (buffer-file-name (marker-buffer org-clock-marker)) - v-k) - v-k) + (if (and (org-clock-is-active) org-id-link-to-org-use-id) + (save-window-excursion + (org-clock-goto) + (org-store-link nil) + (let ((link (plist-get org-store-link-plist :link))) + (org-link-make-string link v-k))) + (org-link-make-string + (format "%s::*%s" + (buffer-file-name (marker-buffer org-clock-marker)) + v-k) + v-k)) "")) (v-f (or (org-capture-get :original-file-nondirectory) "")) (v-F (or (org-capture-get :original-file) "")) base-commit: 282c0fb6d1d2e6289a5b535a7ee9888f845b760b -- 2.41.0 --=-=-= Content-Type: text/plain -- -Kenny --=-=-=--