emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tumashu  <tumashu@163.com>
To: Adam Porter <adam@alphapapa.net>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] Add org-agenda-show-indirect variable
Date: Mon, 2 Sep 2019 08:59:59 +0800 (CST)	[thread overview]
Message-ID: <7221fb96.336d.16cef7c5791.Coremail.tumashu@163.com> (raw)
In-Reply-To: <87pnkkjdlb.fsf@alphapapa.net>











At 2019-09-01 22:28:00, "Adam Porter" <adam@alphapapa.net> wrote:
>tumashu <tumashu@163.com> writes:
>
>> +      (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)))))
>
>1.  That does not affect only ibuffer, but most any code that lists
>buffers.
>
>2.  Please don't hide indirect buffers this way.  The user won't be able
>to switch back to it without enabling the display of hidden buffers.
>That will be unexpected, and many users wouldn't even know that such a
>thing can be done.  So if the user was working in that indirect buffer,
>how will he get back to it?

>Also, indirect buffers are not automatically cleaned up; according to
>the manual, if their base buffer is killed, they merely cannot be made
>active again, so hiding them is not a good idea.

In this condition,  indirect buffer is regard as a kind of *tmp* buffer, it should
be showed only when org-agenda-show-and-scroll-up is called, so hide 
indirect buffers should be a good idea.



>
>3.  What if such an indirect buffer already exists?  i.e. what if the
>user activates the command more than once?  It would be good to avoid
>creating multiple indirect buffers pointing to the same subtree.

Seem to no this problem, org-tree-to-indirect-buffer can deal with this .

>
>4.  You could give the indirect buffer a useful name, which would also
>make it possible to reuse indirect buffers if the user activates the
>command more than once.  For example, I use this code in my config:

Do not reuse indirect buffer. for it is a kind of "tmp" buffer.

>
>#+BEGIN_SRC elisp
>(defun ap/org-tree-to-indirect-buffer (&optional arg)
>  "Create indirect buffer and narrow it to current subtree.
>The buffer is named after the subtree heading, with the filename
>appended.  If a buffer by that name already exists, it is
>selected instead of creating a new buffer."
>  (interactive "P")
>  (let* ((new-buffer-p)
>         (buffer-name
>          (let* ((level (org-outline-level))
>                 (heading-string (org-link-display-format
>                                  (org-get-heading t t))))
>            (concat heading-string "::" (buffer-name))))
>         (new-buffer
>          (or (get-buffer buffer-name)
>              (prog1 (condition-case nil
>                         (make-indirect-buffer (current-buffer)
>                                               buffer-name 'clone)
>                       (error (make-indirect-buffer (current-buffer)
>                                                    buffer-name)))
>                (setq new-buffer-p t)))))
>    (switch-to-buffer new-buffer)
>    (when new-buffer-p
>      (rename-buffer buffer-name)
>      (org-narrow-to-subtree))))
>
>(advice-add 'org-tree-to-indirect-buffer
>            :override 'ap/org-tree-to-indirect-buffer)
>#+END_SRC
>

  reply	other threads:[~2019-09-02  1:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=7221fb96.336d.16cef7c5791.Coremail.tumashu@163.com \
    --to=tumashu@163.com \
    --cc=adam@alphapapa.net \
    --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).