From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id MGnwAqlIFmMZcQAAbAwnHQ (envelope-from ) for ; Mon, 05 Sep 2022 21:06:17 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id mPj4AqlIFmNXggAA9RJhRA (envelope-from ) for ; Mon, 05 Sep 2022 21:06:17 +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 E35E82CCA8 for ; Mon, 5 Sep 2022 21:06:15 +0200 (CEST) Received: from localhost ([::1]:49604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVHQF-0004ZR-0d for larch@yhetil.org; Mon, 05 Sep 2022 15:06:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVHN6-0004Wp-9p for emacs-orgmode@gnu.org; Mon, 05 Sep 2022 15:03:13 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:45567) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVHN3-0008Lz-91 for emacs-orgmode@gnu.org; Mon, 05 Sep 2022 15:02:59 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 581265C004E; Mon, 5 Sep 2022 15:02:54 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 05 Sep 2022 15:02:54 -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=1662404574; x=1662490974; bh=0kCp6RaGI0 Y4bC5UTi56pAkb956sn4j1kkh2CbWQIoE=; b=AqfXaDiCb2bZKrr49DRW/GRQTU Z266LQkJwHOr9nHMTgq/7b9sxNe/zVlWaNBUpfAcXBOwWWgVpsQI0HcC7lR8wtfz Rcy3WsSp3+9K0HXqtc5VHxpc9T3xIg0seN8D1mXdBAE5JvSWIZKHKWrxw4IEUGDS nVmP81b3XEa49/P0hqfKoqQQxyU3VP5cJT/m35ussJMtivFJ0e0DuUfhxPqHtudC 8Ox57g85i/aIKLqO0ddzEBGqsl2ybrBw7zXK9DbhbUcDPewHwvhc6EWergFWk2OW PFxNGFGIdxy81JIAcBA/zdUwCnwbEbc3a82cJu5so5Dctv7nb7AVxd911OGQ== 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=1662404574; x=1662490974; bh=0kCp6RaGI0Y4bC5UTi56pAkb956s n4j1kkh2CbWQIoE=; b=CgAc1ba50FhPakzcHFqryzAImz2sweCrLqGEsUsY80tB HcIw6y/ksLIa44Jfe59Kg/dAd4QZFVnEVGEQOYHmClVRXQep5Im/sQ3q3JItKvPc 9BgrCZyDMpVU7n473JhuBWDa1yIGGPQR5Dea4XT4HEPK7wGGBhbkNnijear9zGdw TH89ZZ/9sKGWaqnv4vj+OGEj1FYKmkN5NJkRuGi38jjuA9cg+NyTLpbgke8maPKv PRqF5zsPfHdk5PvR60Qm6onA42N4fZprX8k7m9xK9/j9ZWyYhxGCDmkxE/xOeZI7 jHh6OQjN+F64hGbJo8YZmPP1/iK8tD9rDMb0LaZiiA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdeliedgudefjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculddutddmnecujfgurhephffvvefuffhffggjkfggtgesmhdtreer tderjeenucfhrhhomhepofhikhhhrghilhcuufhkohhriihhihhsnhhkihhiuceomhhskh horhiihhhinhhskhhiihesvghmlhdrtggtqeenucggtffrrghtthgvrhhnpeeuheeuvdel geekleelleelteejleffjeekffduvdehgffhieeghfdtiefhvdeutdenucffohhmrghinh epohhrghhmohguvgdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpehmshhkohhriihhihhnshhkihhisegvmhhlrdgttg X-ME-Proxy: Feedback-ID: i171146f6:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 5 Sep 2022 15:02:53 -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:50:48 +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> <87v8q8obqs.fsf@localhost> User-agent: mu4e 1.8.7; emacs 29.0.50 In-reply-to: <87v8q8obqs.fsf@localhost> Message-ID: <87y1ux3awf.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=0kCp6RaGI0Y4bC5UTi56pAkb956sn4j1kkh2CbWQIoE=; b=FsV9rarRBtnnIMbbVm1pcfz+Q0ZBFvpXm78LIYpja/x/XN4nkJmCVuL8EFBb9bi3hQ0CeC q28V3sDvRBLX2tfof6LOReyQzN/zy/+F7Q6oFFm96i4Wxss8hnPXHvjzJv2f3mGMHkbchn tu1QCAg3ePb6M/RfdE9JLBF3Iwq5QWmoZKSeR03RvmQr3C/0YMqvlqDJ9JCuCQ+2JmKgBT p/gLO1GxManhBBNv/iVOVf8IHoFseZZp7Xmmkeg+gc3beav/YStEiy0HDEUQp/91bwQOxM TNWtKHH/X9ik8gdfutoNxyK1QInXxJ5q0GlmdMbioQUVQgrTDfPBCcV4QJQdzg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1662404776; a=rsa-sha256; cv=none; b=UfdGo63kFy8sVOcnPPQnuu5wZYUdnCrE9rjligcrP4JbB5l6L6z7nAneM+qzf/Nl3bWwj2 7yfAwqAQnkpx9Z/vXJ/OWf5eARwDM7WQh54E0GeLC1GNBFnKuWpfQhfokIrGzIVdjuF0vi jduXyh89gfABn+zkNY3Kvra19OrqMC/TbyRCq0vjFwK8CXZycoJDbH05qrMjDdi28q5aHb cgLOPpA0fPRcAX5S/CkODVJrAAPwRZ8S/Rh9vgNOLn6DSMjvhhn06jURoTv1q8ROCzjeh/ 4sTqCbXlWZGoTF4n4C2+MkI1LdJX+ASio0JJv6bpAl8nzVmcCfJ7QzCgqDsAXA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=eml.cc header.s=fm1 header.b=AqfXaDiC; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm1 header.b=CgAc1ba5; 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.82 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=eml.cc header.s=fm1 header.b=AqfXaDiC; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm1 header.b=CgAc1ba5; 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: E35E82CCA8 X-Spam-Score: 7.82 X-Migadu-Scanner: scn1.migadu.com X-TUID: 9B1Ufv8yHySQ --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Thanks for your comment, Ihor. I have addressed your comments, see some com= ments inline. Attaching new version of the patch. Ihor Radchenko writes: > Mikhail Skorzhisnkii writes: > >> I have signed FSF papers. Attaching a rebased patch with additional chan= ges to >> ORG-NEWS > > Thanks! > >> Subject: [PATCH 1/2] org-agenda.el: customize outline path in echo area >> >> * lisp/org-agenda.el (org-agenda-show-outline-path): add an option to >> show document title in outline path (instead of file name) > > Please follow the commit message conventions as described in > In > particular, start sentences from capital letters, end them with =E2=80=9C= .=E2=80=9D, > separate sentences with double space, and quote lisp symbols as > `symbol=E2=80=99. > >> * lisp/org.el (org-get-title-from-buffer): a function to collect the > New >> document title from the org-mode buffer > . Sorry =E2=80=94 missed these rules. Fixed now. >> * lisp/org.el (org-display-outline-path): add logic that will collect a >> document title and put it into the outline path if >> org-agenda-show-outline-path set to =E2=80=99title > > This is not what the patch does. From this message, it looks like > `org-agenda-show-outline-path=E2=80=99 is affecting the output of > `org-display-outline-path=E2=80=99, which is not true. Hm, for me it doesn=E2=80=99t look like it from my perspectrive, but my com= mand of the English is not that good. I have reworded it. Is it better now? Feel free to reword it on final apply or let me know if you would like to improve =E2=80=94 I will someone to proofread it. >> (defcustom org-agenda-show-outline-path t >> - =E2=80=9CNon-nil means show outline path in echo area after line moti= on.=E2=80=9D >> + =E2=80=9CNon-nil means show outline path in echo area after line moti= on. >> + >> +If set to =E2=80=98title, show document title.=E2=80=9D > > This is not very clear. I=E2=80=99d rather put more detailed explanation = as in > the defcustom :type spec below. Fixed. >> :group =E2=80=99org-agenda-startup >> - :type =E2=80=99boolean) >> + :type =E2=80=99(choice >> + (const :tag =E2=80=9CDon=E2=80=99t show outline path in agenda view.= =E2=80=9D nil) >> + (const :tag =E2=80=9CShow outline path with prepended file name.=E2= =80=9D t) >> + (const :tag =E2=80=9CShow outline path with prepended document title. = Fallback to >> file name is no title is present.=E2=80=9D title))) >> -(defun org-display-outline-path (&optional file current separator just-= return-string) >> +(defun org-get-title-from-buffer (&optional buffer) >> + =E2=80=9CCollect title from the provided `org-mode=E2=80=99 BUFFER.= =E2=80=9D >> + (let* ((buffer (or buffer (current-buffer))) >> + (buffer (or (buffer-base-buffer buffer) >> + buffer)) > > Why not just > > (or (buffer-base-buffer buffer) > buffer > (current-buffer)) Applied your suggestion. >> + title) >> + (with-current-buffer buffer >> + (pcase (org-collect-keywords =E2=80=99(=E2=80=9CTITLE=E2=80=9D)) >> + (`((=E2=80=9CTITLE=E2=80=9D . ,val)) >> + (setq title (car val))))) >> + title)) > > Extra `title=E2=80=99 variable is unnecessary here. You can simply do > > (with-current-buffer buffer > (pcase (org-collect-keywords =E2=80=99(=E2=80=9CTITLE=E2=80=9D)) > (`((=E2=80=9CTITLE=E2=80=9D ,val . _)) > val))) Indeed =E2=80=94 remnant of previous implementation iteration. Applied your= suggestion. > Also, what will happen in a file like > > #+TITLE: Begin title > #+TITLE: .. end title > > ? Hm, never did this myself. Now concatenate the list of property values. I h= ave tested it and space as a separator looks good, if the intention of several titles is to have one big title. But what if several titles are title and subtitles? We can provide a way co= ntrol that behaviour, but my gut feeling that it would be a rather confusing. >> +(defun org-display-outline-path (&optional file-or-title current separa= tor just-return-string) >> =E2=80=9CDisplay the current outline path in the echo area. >> >> -If FILE is non-nil, prepend the output with the file name. >> +If FILE-OR-TITLE is =E2=80=98title, prepend outline with file title. If >> +it is non-nil or title is not present in document, prepend >> +outline path with the file name. >> If CURRENT is non-nil, append the current heading to the output. >> SEPARATOR is passed through to `org-format-outline-path=E2=80=99. It s= eparates >> the different parts of the path and defaults to \=E2=80=9D/\=E2=80=9C. >> @@ -7407,6 +7421,8 @@ If JUST-RETURN-STRING is non-nil, return a string,= don=E2=80=99t display a message.=E2=80=9D >> (interactive =E2=80=9CP=E2=80=9D) >> (let* (case-fold-search >> (bfn (buffer-file-name (buffer-base-buffer))) >> + (title-prop (when (and file-or-title (eq file-or-title =E2=80= =99title)) > > can be simply (eq file-or-title =E2=80=99title) Indeed. Fixed. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-org-agenda.el-customize-outline-path-in-echo-area.patch >From ebad0bb39221217233283905f39b99644b07f36b Mon Sep 17 00:00:00 2001 From: Mikhail Skorzhinskii Date: Sat, 12 Sep 2020 18:10:05 +0200 Subject: [PATCH 1/2] org-agenda.el: customize outline path in echo area * lisp/org-agenda.el (org-agenda-show-outline-path): Add an option to show document title in outline path (instead of file name). * lisp/org.el (org-get-title-from-buffer): A new function to collect the document title from the org-mode buffer. * lisp/org.el (org-display-outline-path): Show document title (#+TITLE value) and outline path in echo area if customisation option is set to 'title. Fallback to file name if there is document title is absent. --- etc/ORG-NEWS | 10 ++++++++++ lisp/org-agenda.el | 12 +++++++++--- lisp/org.el | 25 ++++++++++++++++++++++--- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 7dae03dc6..529fea41a 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-agenda-show-outline-path= to show document title + +Setting =org-agenda-show-outline-path= to ='title= will show title +instead of the file name at the beginning of the outline. The title of +the document can be set by special keyword =#+title:=. + *** A new custom setting =org-hide-drawer-startup= to control initial folding state of drawers Previously, all the drawers were always folded when opening an Org @@ -320,6 +326,10 @@ event time when the alarm time is set to 0. The default value is nil -- do not create alarms at the event time. ** New functions and changes in function arguments +*** New function ~org-get-title-from-buffer~ to get ~#+TITLE:~ property + +A function to collect the document title from the org-mode buffer. + *** ~org-fold-show-entry~ does not fold drawers by default anymore ~org-fold-show-entry~ now accepts an optional argument HIDE-DRAWERS. diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index b98041ea8..aad7f279e 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -1058,9 +1058,15 @@ current item's tree, in an indirect buffer." :type 'boolean) (defcustom org-agenda-show-outline-path t - "Non-nil means show outline path in echo area after line motion." + "Non-nil means show outline path in echo area after line motion. + +If set to 'title, show outline path with prepended document +title. Fallback to file name is no title is present." :group 'org-agenda-startup - :type 'boolean) + :type '(choice + (const :tag "Don't show outline path in agenda view." nil) + (const :tag "Show outline path with prepended file name." t) + (const :tag "Show outline path with prepended document title. Fallback to file name is no title is present." title))) (defcustom org-agenda-start-with-entry-text-mode nil "The initial value of entry-text-mode in a newly created agenda window." @@ -9424,7 +9430,7 @@ When called with a prefix argument, include all archive files as well." (org-agenda-tree-to-indirect-buffer nil) (org-agenda-show))) (and org-agenda-show-outline-path - (org-with-point-at m (org-display-outline-path t)))))) + (org-with-point-at m (org-display-outline-path org-agenda-show-outline-path)))))) (defun org-agenda-show-tags () "Show the tags applicable to the current item." diff --git a/lisp/org.el b/lisp/org.el index 858123e67..1babd5d8d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7396,10 +7396,24 @@ the default is \"/\"." (setf (substring fpath (- width 2)) ".."))) fpath)) -(defun org-display-outline-path (&optional file current separator just-return-string) +(defun org-get-title-from-buffer (&optional buffer) + "Collect title from the provided `org-mode' BUFFER. + +Returns nil if there are no #+TITLE property." + (let ((buffer (or (buffer-base-buffer) + buffer + (current-buffer)))) + (with-current-buffer buffer + (pcase (org-collect-keywords '("TITLE")) + (`(("TITLE" . ,val)) + (mapconcat 'identity val " ")))))) + +(defun org-display-outline-path (&optional file-or-title current separator just-return-string) "Display the current outline path in the echo area. -If FILE is non-nil, prepend the output with the file name. +If FILE-OR-TITLE is 'title, prepend outline with file title. If +it is non-nil or title is not present in document, prepend +outline path with the file name. If CURRENT is non-nil, append the current heading to the output. SEPARATOR is passed through to `org-format-outline-path'. It separates the different parts of the path and defaults to \"/\". @@ -7407,6 +7421,8 @@ If JUST-RETURN-STRING is non-nil, return a string, don't display a message." (interactive "P") (let* (case-fold-search (bfn (buffer-file-name (buffer-base-buffer))) + (title-prop (when (eq file-or-title 'title) + (org-get-title-from-buffer))) (path (and (derived-mode-p 'org-mode) (org-get-outline-path))) res) (when current (setq path (append path @@ -7418,7 +7434,10 @@ If JUST-RETURN-STRING is non-nil, return a string, don't display a message." (org-format-outline-path path (1- (frame-width)) - (and file bfn (concat (file-name-nondirectory bfn) separator)) + (and file-or-title bfn (concat (if (and (eq file-or-title 'title) title-prop) + title-prop + (file-name-nondirectory bfn)) + separator)) separator)) (add-face-text-property 0 (length res) `(:height ,(face-attribute 'default :height)) -- 2.35.1 --=-=-=--