From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id HT2TO26naF8vMgAA0tVLHw (envelope-from ) for ; Mon, 21 Sep 2020 13:15:26 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id gMw/N26naF9PTAAA1q6Kng (envelope-from ) for ; Mon, 21 Sep 2020 13:15:26 +0000 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 94894940606 for ; Mon, 21 Sep 2020 13:15:24 +0000 (UTC) Received: from localhost ([::1]:34336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKLf8-0006Fk-Oh for larch@yhetil.org; Mon, 21 Sep 2020 09:15:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKLbH-0002un-2X for emacs-orgmode@gnu.org; Mon, 21 Sep 2020 09:11:23 -0400 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:44783) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKLb5-00087j-I1 for emacs-orgmode@gnu.org; Mon, 21 Sep 2020 09:11:19 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 2E06F4E5; Mon, 21 Sep 2020 09:11:09 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 21 Sep 2020 09:11:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eml.cc; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=fm1; bh= bnTuiV0AmNTDk68DkbdNPSnfLGu2TcjotfuhnaxAeWA=; b=M3VHOrtf6jfpYVR8 OMGbH1otYIMbumCVoDfjRjYzT17qrNkAUv7qd5/EDcJiRtIiqLCies5wYfKrSmwD sQwcym7SiZcJxhqu0bF5Fqxgk+S7vGib+WNVr7ZudNLKKF7INH7clVtUBSf2JMDe OyDlcYiddHAAxfckqk+CgKPAVettnQ92aelmiIzufLgaEw+2bZQZCIOsbYd9Muwj eIyhwnh6WKTfZJflUG2jH+QrtqBDGt1rVtmenSBEuElgXnJPmIHd4fPdqJFSjTs/ O0jePDGwePDvljXWz/2CVTm5T4zxHEWtrvBNLXm43I02v2x2DQEsGPTEmq75vuu9 pi3R9w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=bnTuiV0AmNTDk68DkbdNPSnfLGu2TcjotfuhnaxAe WA=; b=uoKzt7DUz9mRVqDrpwD2df8e4OrxsM7Xph9g2MC0noT/SdcEVWtGtHzJ4 9y+s7ENzYBm8843yCqH29UTLlW6VEGoGFZ251bN0zcS9NZ3k6LkxYloBbFiycjpn dTjUS9teDxGFrEosAIN2Fx3xAR3xQj1yHZ/NfxWFOmIVF4WGaup++Dvzv6+aCM/6 pXDBnpusg6eDtYmZjprYD6mvhXWoBhrN3ZMwswRUQE1JdCl39FC9WsHmWBX7uih4 ODQ9zDc58qWFjrvm9FTZLvpuyQjRTTQ/5du6eaRa3OJWcBnM8rPpwt2nzzDeXtj7 q2NymoaT4jTEiKpbSVoL/NzsAHSUQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddvgdeigecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdduhedmnecujfgurhephffvufffkfgjfhggtgfgsehmuferredttddv necuhfhrohhmpefoihhkhhgrihhlucfukhhorhiihhhinhhskhhiihcuoehmshhkohhrii hhihhnshhkihihsegvmhhlrdgttgeqnecuggftrfgrthhtvghrnhepjeeuiefgfeettdfg ffeljeefhedvffdulefhudehjeejieetkeduieduudeujeeknecuffhomhgrihhnpehgnh hurdhorhhgnecukfhppeejkedruddtjedrvddthedruddtnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhskhhorhiihhhinhhskhhihiesvg hmlhdrtggt X-ME-Proxy: Received: from trex230.localnet (78-107-205-10.broadband.corbina.ru [78.107.205.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 0724A306467E; Mon, 21 Sep 2020 09:11:07 -0400 (EDT) From: Mikhail Skorzhinskii To: Org-mode Org-Mode Subject: Re: [PATCHES 1, 2/2] allow to use document title in agenda and refile outline paths Date: Mon, 21 Sep 2020 15:11:20 +0200 Message-ID: <4640636.uU8C4vLvrc@trex230> In-Reply-To: <2028963.roqSQ0dz9K@trex230> References: <2028963.roqSQ0dz9K@trex230> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2064093.T5LTjk33Zs" Content-Transfer-Encoding: 7Bit Received-SPF: pass client-ip=64.147.123.19; envelope-from=mskorzhinskiy@eml.cc; helo=wout3-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/21 08:32:23 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yantar92@gmail.com Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=eml.cc header.s=fm1 header.b=M3VHOrtf; dkim=fail (rsa verify failed) header.d=messagingengine.com header.s=fm3 header.b=uoKzt7DU; dmarc=fail reason="SPF not aligned (relaxed)" header.from=eml.cc (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: 1.09 X-TUID: OfdV+YaKNfcc This is a multi-part message in MIME format. --nextPart2064093.T5LTjk33Zs Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" ... and of course I forgot to attach actual patches. On Monday, September 21, 2020 3:09:58 PM CEST Mikhail Skorzhinskii wrote: > Hello everyone, > > I've already submitted these features to the mailing list: > > https://lists.gnu.org/archive/html/emacs-orgmode/2020-09/msg00628.html > > But even if these changes are really tiny and minor, they are touching very > different functionality of org-mode. It wasn't good mixing my suggestions > for agenda and for ox-icalendar. So I'm starting a separate mail thread. > > Changes since v1: > - Allow to customise title path for the refile targets also (thanks to > Ihor Radchenko for suggestion); - Turn separate option into just an > additional value for org-agenda-show-outline-path. > > Kind regards, > Mikhail Skorzhinskii --nextPart2064093.T5LTjk33Zs Content-Disposition: attachment; filename="0002-org-refile.el-allow-to-start-refile-targets-with-doc.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="utf-8"; name="0002-org-refile.el-allow-to-start-refile-targets-with-doc.patch" >From ecdf571291c3a598fa1c767c6a73604ab95bfd02 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: allow to start refile targets with document title --- etc/ORG-NEWS | 2 ++ lisp/org-refile.el | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index e30336f45..6d3945d91 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -16,7 +16,9 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org. When set to 'title, will show document title in outline path in echo area instead of file name. +*** New option value for ~org-refile-use-outline-path~ +When set to 'title, will show document title in outline path of refile targets. * Version 9.4 ** Incompatible changes *** Possibly broken internal file links: please check and fix diff --git a/lisp/org-refile.el b/lisp/org-refile.el index 7eb0a9643..e3d17bc35 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. @@ -315,6 +316,8 @@ converted to a headline before refiling." (push (list (buffer-name (buffer-base-buffer)) f nil nil) tgs)) (when (eq org-refile-use-outline-path 'full-file-path) (push (list (file-truename (buffer-file-name (buffer-base-buffer))) f nil nil) tgs)) + (when (eq org-refile-use-outline-path 'title) + (push (list (org-get-title-from-file (file-truename (buffer-file-name (buffer-base-buffer))))))) (org-with-wide-buffer (goto-char (point-min)) (setq org-outline-path-cache nil) -- 2.28.0 --nextPart2064093.T5LTjk33Zs Content-Disposition: attachment; filename="0001-org-agenda.el-allow-to-customize-outline-path-in-ech.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="utf-8"; name="0001-org-agenda.el-allow-to-customize-outline-path-in-ech.patch" >From 4eb0c3011fecb69c6ac5867970e033c62352c2b2 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: allow to customize outline path in echo area Some of the org-mode data bases auto-generate file names, so they don't carry a lot of information and can be noisy. Allowing user to show document titles instead could be useful. Showing titles is disabled by default. --- etc/ORG-NEWS | 6 ++++++ lisp/org-agenda.el | 11 ++++++++--- lisp/org.el | 25 ++++++++++++++++++++++--- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 0ed626fb7..e30336f45 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -11,6 +11,12 @@ See the end of the file for license conditions. Please send Org bug reports to mailto:emacs-orgmode@gnu.org. * Version 9.5 (not yet released) +** New options and settings +*** New option value for ~org-agenda-show-outline-path~ + +When set to 'title, will show document title in outline path in echo +area instead of file name. + * Version 9.4 ** Incompatible changes *** Possibly broken internal file links: please check and fix diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 82fe6091c..17e189317 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -1040,9 +1040,14 @@ 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 document title." :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." @@ -8777,7 +8782,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 a9fdc7b77..191918860 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8023,10 +8023,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-file (file) + "Collect tilte from the provided `org-mode' FILE." + (let (title) + (when file + (with-current-buffer + (get-file-buffer file) + (pcase (org-collect-keywords '("TITLE")) + (`(("TITLE" . ,val)) + (setq title (car val))))) + title))) + + +(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 \"/\". @@ -8034,6 +8048,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 (when (and file-or-title (string= file-or-title 'title)) + (org-get-title-from-file bfn))) (path (and (derived-mode-p 'org-mode) (org-get-outline-path))) res) (when current (setq path (append path @@ -8045,7 +8061,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 (string= file-or-title 'title) title) + title + (file-name-nondirectory bfn)) + separator)) separator)) (add-face-text-property 0 (length res) `((t :height ,(face-attribute 'default :height))) -- 2.28.0 --nextPart2064093.T5LTjk33Zs--