From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 2IH3MKhIFmOcGQEAbAwnHQ (envelope-from ) for ; Mon, 05 Sep 2022 21:06:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 0CIUMKhIFmP30gAAG6o9tA (envelope-from ) for ; Mon, 05 Sep 2022 21:06:16 +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 D438D3C95E for ; Mon, 5 Sep 2022 21:06:15 +0200 (CEST) Received: from localhost ([::1]:49600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVHQD-0004ZO-PJ for larch@yhetil.org; Mon, 05 Sep 2022 15:06:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVHN6-0004Wo-9p for emacs-orgmode@gnu.org; Mon, 05 Sep 2022 15:03:13 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:52993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVHN4-0008MG-DL for emacs-orgmode@gnu.org; Mon, 05 Sep 2022 15:02:59 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 387C65C0153; Mon, 5 Sep 2022 15:02:56 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 05 Sep 2022 15:02:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eml.cc; h=cc:cc :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1662404576; x=1662490976; bh=lFVlkfyU7S hBmwHxHL8y18lKTbXMMJWbafjE33wSgB4=; b=TqyHcRSBmoFuSER0sok1zAxPZy 4zuwFBiVDou6kM3oAaGXM1gU/5mKCw/qOk0tUMCeyWDABb0SsoJzedphhFbkbc92 yV9eIgSkDrDoYWelyod5qvvpkxjE03Tdbk+cxJ0BE2qwyRUCqNi1wlFA0gcsV8sf Hp+C03U54OFs95iRrRKUBvwl0QjSF2zo6YmtZv2xxTHo60AO+xYd9hjzEz7jIvvb Tlmx/o3zeg9U6nWkz2zyPgePFKGlnj8PyZOK+JuJD8UksWGEXtBpmgO+EkOpd8fm gIJkPSoEHeg04SzYVuTpfiL6lUUXbirPw/UB0/2Wz07XzB3Hc6Axb/Ca8cYQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1662404576; x=1662490976; bh=lFVlkfyU7ShBmwHxHL8y18lKTbXM MJWbafjE33wSgB4=; b=t2ZGhR2YtHXIb4AUJURFYjp/oV4eZej3eo5o+o/2Vvuj kVl3cjZmY/PESu70LroHCcBuJFgrQCF+U52P6OjiO5rUFs7DvnjFayOM5nc47yON ABToJItK1lk3J37PY89vGJNoPg4iZLk7WWeXNhObcre7CHdj+BykeuSLnOGwL5PC k43Il99ynrQr4shOfHbZfcIQyT6wnErYPLDpbk4GOQ8TXyLCfusq4k3nDROjqqxe 7B58/1lBMcH1xNb9OProYAkiGdp6GnkHDI2V9ax81lkS9tcvvGQfDvGt9YnV3cA2 SvqL4qSTa0aSCVB74gFLKlmlJP0XWT7uqcKegsH2zQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdeliedgudefjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculdduhedmnecujfgurhephffvvefuffhffggjkfggtgesmhdtreer tderjeenucfhrhhomhepofhikhhhrghilhcuufhkohhriihhihhsnhhkihhiuceomhhskh horhiihhhinhhskhhiihesvghmlhdrtggtqeenucggtffrrghtthgvrhhnpedtffeuhfdv heehvddtieehhfeijeegtdeilefhtdefheefleegieevieehgedttdenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmshhkohhriihhihhnshhk ihhisegvmhhlrdgttg X-ME-Proxy: Feedback-ID: i171146f6:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 5 Sep 2022 15:02:55 -0400 (EDT) From: Mikhail Skorzhisnkii To: Ihor Radchenko Cc: Org Mode Subject: Re: [PATCH] ox-icalendar.el: customizable vevent summary prefix Date: Mon, 05 Sep 2022 20:59:32 +0200 References: <0a1b98af1974ec260c4074df056715e237c08fce.camel@eml.cc> <871r1zawhp.fsf@nicolasgoaziou.fr> <8451fcc20c68d9863a4613df5a1cd5dbba0a77cd.camel@eml.cc> <87h72xn44k.fsf@localhost> <25163bf9-2455-4790-b258-84e766813de3@www.fastmail.com> <87ilndl9jx.fsf@localhost> <87o7w1j0su.fsf@eml.cc> <87pmggobl9.fsf@localhost> User-agent: mu4e 1.8.7; emacs 29.0.50 In-reply-to: <87pmggobl9.fsf@localhost> Message-ID: <87wnah3asw.fsf@eml.cc> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=66.111.4.26; envelope-from=mskorzhinskii@eml.cc; helo=out2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1662404776; 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=EU6pxqfStLYyvKx3hvqkiWVX9yUgFMmeewEyMNXfHJs=; b=ZZDcnSmLWM0wuvG6pm+CywtFuXFUGOVzpuuoJyAE+8buH9YO8GW82Cn9kF7mwPoRCcgPyJ ZzjfppRpeG7m8CXru+WOtLEP60Fw3FVrUKP4oHGqLAh8uDxGukfWQ1ShRurPmCrmUczjU+ rz0AXgGjmtd1Uai+AJioP/35EkOGgjd98kj3bqKMWzXTegqMkQs/pZFtXHzWtMU1OnJSxq bvdA5FHSi6qk1SVUPw5/8ru4Q1vk/7RMv2W+kT2lFQuVGybJTGEECqYxuGDRS0j0STskes BvhJGl5yte9UB3XTGyzNLUTYtlNXQeWqK1Pmj5DixjZYQPnzYkkEI7zwrSWXqg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1662404776; a=rsa-sha256; cv=none; b=Fwg2uzN4VgaFzwHdRbyOaztp3PgtcuK/vhTtA/7BM+2kwg0MZZFTOa9ItXLlGBq026VWWe COt3CdL3GmgOZrURW3rg15kN+Hwk6uywOATMB+c6d4jCKCBsEBwvgmaXLHgGzspIZdIjG3 HTeFDyNrf+a+BtnY0pMi0HVluTOoNs2l3oK7igZucgC/Nijo7s5+IORSvMTYv9yGzTUH5b EbtsiUd6yMx5jnLuKXkS+oFpbzj/7wFRhW5RtjEeNxm0704FsR6OZBIh2iUgL1OBbHyadR B2MlTVk+/0KjrscGylaQFHvVBFMiVp3Zt+AoJ6UyLJv8dTdSJpeiWRCefrFZdw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=eml.cc header.s=fm1 header.b=TqyHcRSB; dkim=fail ("body hash did not verify") header.d=messagingengine.com header.s=fm1 header.b=t2ZGhR2Y; dmarc=fail reason="SPF not aligned (relaxed)" header.from=eml.cc (policy=none); 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: 7.92 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=eml.cc header.s=fm1 header.b=TqyHcRSB; dkim=fail ("body hash did not verify") header.d=messagingengine.com header.s=fm1 header.b=t2ZGhR2Y; dmarc=fail reason="SPF not aligned (relaxed)" header.from=eml.cc (policy=none); 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: D438D3C95E X-Spam-Score: 7.92 X-Migadu-Scanner: scn1.migadu.com X-TUID: LSLTxI4Lju8q --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Ah, sorry =E2=80=94 probably forgot to attach it, yes. See the second patch= here in the attachment. Ihor Radchenko writes: > Mikhail Skorzhisnkii writes: > >> Subject: [PATCH 1/2] org-agenda.el: customize outline path in echo area > > I do not see the second patch. Did you forget to attach it? --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0002-org-refile.el-show-refile-targets-with-doc.-title.patch >From 686a1d813ec8962bff993add1305015eb2788213 Mon Sep 17 00:00:00 2001 From: Mikhail Skorzhinskii Date: Mon, 21 Sep 2020 14:53:13 +0200 Subject: [PATCH 2/2] org-refile.el: show refile targets with doc. title * lisp/org-refile.el (org-refile-use-outline-path): Add new option 'title * lisp/org-refile.el (org-refile-get-targets): Start refile target outline with document title (#+TITLE) instead of file name if corresponding customization is set to 'title. Fallback to filename if title is absent. --- etc/ORG-NEWS | 6 ++++++ lisp/org-refile.el | 15 ++++++++++++--- testing/lisp/test-org.el | 37 ++++++++++++++++++++++++++++++++++++- 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 529fea41a..51471428c 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -290,6 +290,12 @@ level used for top level headings, much like how headings in HTML export. ** New options +*** A new option for custom setting =org-refile-use-outline-path= to show document title in refile targets + +Setting =org-refile-use-outline-path= to ='title= will show title +instead of the file name in refile targets. If the documen do not have +a title, the filename will be used, similar to ='file= option. + *** A new option for custom setting =org-agenda-show-outline-path= to show document title Setting =org-agenda-show-outline-path= to ='title= will show title diff --git a/lisp/org-refile.el b/lisp/org-refile.el index 01f0dfa46..88fe13f23 100644 --- a/lisp/org-refile.el +++ b/lisp/org-refile.el @@ -158,7 +158,8 @@ When `buffer-name', use the buffer name." (const :tag "Yes" t) (const :tag "Start with file name" file) (const :tag "Start with full file path" full-file-path) - (const :tag "Start with buffer name" buffer-name))) + (const :tag "Start with buffer name" buffer-name) + (const :tag "Start with document title" title))) (defcustom org-outline-path-complete-in-steps t "Non-nil means complete the outline path in hierarchical steps. @@ -317,6 +318,9 @@ converted to a headline before refiling." (push (list (and (buffer-file-name (buffer-base-buffer)) (file-truename (buffer-file-name (buffer-base-buffer)))) f nil nil) tgs)) + (when (eq org-refile-use-outline-path 'title) + (push (list (or (org-get-title-from-buffer) + (and f (file-name-nondirectory f))) f nil nil) tgs)) (org-with-wide-buffer (goto-char (point-min)) (setq org-outline-path-cache nil) @@ -343,7 +347,12 @@ converted to a headline before refiling." (and (buffer-file-name (buffer-base-buffer)) (file-name-nondirectory (buffer-file-name (buffer-base-buffer)))))) - (`full-file-path + (`title (list + (or (org-get-title-from-buffer) + (and (buffer-file-name (buffer-base-buffer)) + (file-name-nondirectory + (buffer-file-name (buffer-base-buffer))))))) + (`full-file-path (list (buffer-file-name (buffer-base-buffer)))) (`buffer-name @@ -631,7 +640,7 @@ this function appends the default value from (tbl (mapcar (lambda (x) (if (and (not (member org-refile-use-outline-path - '(file full-file-path))) + '(file full-file-path title))) (not (equal filename (nth 1 x)))) (cons (concat (car x) extra " (" (file-name-nondirectory (nth 1 x)) ")") diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index b14cbeb26..b85dd7dea 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -6728,7 +6728,42 @@ Paragraph" (org-test-with-temp-text "* H1" (let* ((org-refile-use-outline-path 'buffer-name) (org-refile-targets `((nil :level . 1)))) - (member (buffer-name) (mapcar #'car (org-refile-get-targets))))))) + (member (buffer-name) (mapcar #'car (org-refile-get-targets)))))) + ;; When `org-refile-use-outline-path' is `title', return extracted + ;; document title + (should + (equal '("T" "T/H1") + (org-test-with-temp-text-in-file "#+title: T\n* H1" + (let* ((org-refile-use-outline-path 'title) + (org-refile-targets `((nil :level . 1)))) + (mapcar #'car (org-refile-get-targets)))))) + ;; When `org-refile-use-outline-path' is `title' validate that + ;; deeper levels are correctly reported too (the same behaviour as + ;; 'file) + (should + (equal '("T" "T/H1" "T/H1/H2" "T/H1/H2/H3" "T/H1") + (org-test-with-temp-text-in-file "#+title: T\n* H1\n** H2\n*** H3\n* H1" + (let ((org-refile-use-outline-path 'title) + (org-refile-targets `((nil :maxlevel . 3)))) + (mapcar #'car (org-refile-get-targets)))))) + ;; When `org-refile-use-outline-path' is `title' and document do not + ;; have an extracted document title, return just the file name + (should + (org-test-with-temp-text-in-file "* H1" + (let* ((filename (buffer-file-name)) + (org-refile-use-outline-path 'title) + (org-refile-targets `((nil :level . 1)))) + (member (file-name-nondirectory filename) + (mapcar #'car (org-refile-get-targets)))))) + ;; When `org-refile-use-outline-path' is `title' and document is a + ;; temporary buffer without a file, it is still possible to extract + ;; a title + (should + (equal '("T" "T/H1") + (org-test-with-temp-text "#+title: T\n* H1\n** H2" + (let* ((org-refile-use-outline-path 'title) + (org-refile-targets `((nil :level . 1)))) + (mapcar #'car (org-refile-get-targets))))))) -- 2.35.1 --=-=-=--