emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Add org-agenda-show-indirect variable
@ 2019-08-23  2:53 tumashu
  2019-09-01 14:28 ` Adam Porter
  0 siblings, 1 reply; 4+ messages in thread
From: tumashu @ 2019-08-23  2:53 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #1.2: Type: text/html, Size: 86 bytes --]

[-- Attachment #2: 0001-Add-org-agenda-show-indirect-variable.patch --]
[-- Type: application/octet-stream, Size: 2060 bytes --]

From d4f47d380cc976e6257a10d415811b6e5fde61d2 Mon Sep 17 00:00:00 2001
From: Feng Shu <tumashu@163.com>
Date: Fri, 23 Aug 2019 10:41:13 +0800
Subject: [PATCH] Add org-agenda-show-indirect variable.

* etc/ORG-NEWS (New variable: ~org-agenda-show-indirect~): Add variable news.
* lisp/org-agenda.el (org-agenda-show-indirect): New variable.
(org-agenda-show-and-scroll-up): Using org-agenda-show-indirect.
---
 etc/ORG-NEWS       |  4 ++++
 lisp/org-agenda.el | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 089f62995..0bc3f6f9a 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -415,6 +415,10 @@ leave unfolded subtrees unfolded.
 I.e. treat the whole file as if it was a subtree.
 
 *** Respect narrowing when agenda command is restricted to buffer
+*** New variable: ~org-agenda-show-indirect~
+
+This variable let ~org-agenda-show-and-scroll-up~ show current item in
+indirect buffer.
 
 * Version 9.2
 ** Incompatible changes
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index c446f155e..67689d058 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1031,6 +1031,13 @@ current item's tree, in an indirect buffer."
   :version "24.1"
   :type 'boolean)
 
+(defcustom org-agenda-show-indirect nil
+  "Non-nil means `org-agenda-show-and-scroll-up' displays only the
+current item's tree, in an indirect buffer."
+  :group 'org-agenda
+  :version "26.4"
+  :type 'boolean)
+
 (defcustom org-agenda-show-outline-path t
   "Non-nil means show outline path in echo area after line motion."
   :group 'org-agenda-startup
@@ -8744,6 +8751,11 @@ fold drawers."
 	  (ignore-errors (scroll-up)))
       (org-agenda-goto t)
       (org-show-entry)
+      (when org-agenda-show-indirect
+	(let ((org-indirect-buffer-display 'current-window))
+	  (org-tree-to-indirect-buffer)
+	  ;; hide indirect buffer in ibuffer
+	  (rename-buffer (concat " " (buffer-name)))))
       (if arg (org-cycle-hide-drawers 'children)
 	(org-with-wide-buffer
 	 (narrow-to-region (org-entry-beginning-position)
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-11 15:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-23  2:53 [PATCH] Add org-agenda-show-indirect variable tumashu
2019-09-01 14:28 ` Adam Porter
2019-09-02  0:59   ` tumashu
2020-02-11 15:41     ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).