emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tumashu <tumashu@163.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: [PATCH] Add org-agenda-show-indirect variable
Date: Fri, 23 Aug 2019 10:53:27 +0800 (CST)	[thread overview]
Message-ID: <4fcd74a5.5b9d.16cbc64a272.Coremail.tumashu@163.com> (raw)


[-- 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


             reply	other threads:[~2019-08-23  3:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23  2:53 tumashu [this message]
2019-09-01 14:28 ` [PATCH] Add org-agenda-show-indirect variable Adam Porter
2019-09-02  0:59   ` tumashu
2020-02-11 15:41     ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4fcd74a5.5b9d.16cbc64a272.Coremail.tumashu@163.com \
    --to=tumashu@163.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).