* org-tree-to-indirect-buffer: multiple buffers; buffer name containing ID
@ 2013-10-25 7:54 Karl Voit
2013-11-06 12:51 ` Bastien
0 siblings, 1 reply; 5+ messages in thread
From: Karl Voit @ 2013-10-25 7:54 UTC (permalink / raw)
To: emacs-orgmode
Hi!
When someone uses the (very cool) feature
org-tree-to-indirect-buffer[1] with multiple indirect buffers in
parallel (using a prefix) instead of narrowing/widening to work -
which I very much plan to do more often[2] -, you end up with a
buffers like:
- myorgmode.org-1
- myorgmode.org-2
- myorgmode.org-3
This is not very satisfying to me because I tend to forget, which
sub-folder I can expect in myorgmode.org-2 ...
How about using IDs of the sub-tree headings (if found) in order to
name the buffer? In case someone is using custom IDs (like me), the
list would look like:
- myorgmode.org-1 (-> no ID found for this sub-heading)
- myorgmode.org-project-foobar (-> :ID: project-foobar)
- myorgmode.org-2013-10-25-customerX (-> :ID: 2013-10-25-customerX)
In case there is a similar issue somewhere else in Org-mode where a
condensed string is generated out of the heading line, this should
be a viable option instead of the ID as well.
I guess, this should be not that hard to implement and it brings
much more usability (differ the buffers according to their name) to
the user.
Thanks!
1. http://orgmode.org/org.html#Global-and-local-cycling
2. I found the feature yesterday via Emacs Org-mode menu item :-)
--
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
> get Memacs from https://github.com/novoid/Memacs <
https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-tree-to-indirect-buffer: multiple buffers; buffer name containing ID
2013-10-25 7:54 org-tree-to-indirect-buffer: multiple buffers; buffer name containing ID Karl Voit
@ 2013-11-06 12:51 ` Bastien
2013-11-06 16:53 ` Adam Porter
2013-11-13 13:04 ` Bastien
0 siblings, 2 replies; 5+ messages in thread
From: Bastien @ 2013-11-06 12:51 UTC (permalink / raw)
To: Karl Voit; +Cc: news1142, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 572 bytes --]
Hi Karl,
Karl Voit <devnull@Karl-Voit.at> writes:
> How about using IDs of the sub-tree headings (if found) in order to
> name the buffer? In case someone is using custom IDs (like me), the
> list would look like:
>
> - myorgmode.org-1 (-> no ID found for this sub-heading)
> - myorgmode.org-project-foobar (-> :ID: project-foobar)
> - myorgmode.org-2013-10-25-customerX (-> :ID: 2013-10-25-customerX)
The attached patch does name indirect buffers after the current tree
heading -- thanks for this idea.
Would anyone else find this useful?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org.el-org-get-indirect-buffer-New-argument-heading.patch --]
[-- Type: text/x-diff, Size: 1664 bytes --]
From b5da8fa8ad7c9dc7b4f3c2d177c1aada685e520c Mon Sep 17 00:00:00 2001
From: Bastien Guerry <bzg@altern.org>
Date: Wed, 6 Nov 2013 13:50:39 +0100
Subject: [PATCH] org.el (org-get-indirect-buffer): New argument `heading'
* org.el (org-get-indirect-buffer): New argument `heading'
to name the buffer after the current tree heading.
(org-tree-to-indirect-buffer): Use `org-get-indirect-buffer'
with a `heading' argument.
Thanks to Karl Voit for suggesting this.
---
lisp/org.el | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 7c2a316..7e47891 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7466,7 +7466,7 @@ frame is not changed."
(not (eq org-indirect-buffer-display 'new-frame))
(not arg))
(kill-buffer org-last-indirect-buffer))
- (setq ibuf (org-get-indirect-buffer cbuf)
+ (setq ibuf (org-get-indirect-buffer cbuf heading)
org-last-indirect-buffer ibuf)
(cond
((or (eq org-indirect-buffer-display 'new-frame)
@@ -7497,11 +7497,11 @@ frame is not changed."
(run-hook-with-args 'org-cycle-hook 'all)
(and (window-live-p cwin) (select-window cwin))))
-(defun org-get-indirect-buffer (&optional buffer)
+(defun org-get-indirect-buffer (&optional buffer heading)
(setq buffer (or buffer (current-buffer)))
(let ((n 1) (base (buffer-name buffer)) bname)
(while (buffer-live-p
- (get-buffer (setq bname (concat base "-" (number-to-string n)))))
+ (get-buffer (setq bname (concat base "-" (or heading (number-to-string n))))))
(setq n (1+ n)))
(condition-case nil
(make-indirect-buffer buffer bname 'clone)
--
1.8.4.2
[-- Attachment #3: Type: text/plain, Size: 14 bytes --]
--
Bastien
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-11-13 14:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-25 7:54 org-tree-to-indirect-buffer: multiple buffers; buffer name containing ID Karl Voit
2013-11-06 12:51 ` Bastien
2013-11-06 16:53 ` Adam Porter
2013-11-13 13:04 ` Bastien
2013-11-13 14:01 ` Karl Voit
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).