emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-tree-to-indirect-buffer - naming and prefix in define keyboard key
@ 2015-06-09  8:36 Rainer M Krug
  2015-06-09 12:38 ` Alan Schmitt
  0 siblings, 1 reply; 3+ messages in thread
From: Rainer M Krug @ 2015-06-09  8:36 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi

I just discovered the function ~org-tree-to-indirect-buffer~ and really
love it as I have a large org file (nearly 10 000 lines, R code,
analysis, simulation, ...) and this makes navigating and editing much
easier.

While writing this, I discovered the C-u prefix to keep the last opened
indirect buffer open.

But I still have two question:

1) How can I map the command C-u M-x ~org-tree-to-indirect-buffer~ to a
keyboard shortcut?

2) Can I change the naming of the indirect buffer? To prefix the .org
buffer name makes sense, but is cluttering my tabbar (yes - I still use
it) - so I would prefer to simply use the name of the subtree.

Thanks,

Rainer

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug

PGP: 0x0F52F982

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 494 bytes --]

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

* Re: org-tree-to-indirect-buffer - naming and prefix in define keyboard key
  2015-06-09  8:36 org-tree-to-indirect-buffer - naming and prefix in define keyboard key Rainer M Krug
@ 2015-06-09 12:38 ` Alan Schmitt
  2015-06-10 12:59   ` Rainer M Krug
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Schmitt @ 2015-06-09 12:38 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode

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

On 2015-06-09 10:36, Rainer M Krug <Rainer@krugs.de> writes:

> While writing this, I discovered the C-u prefix to keep the last opened
> indirect buffer open.
>
> But I still have two question:
>
> 1) How can I map the command C-u M-x ~org-tree-to-indirect-buffer~ to a
> keyboard shortcut?

According to http://ergoemacs.org/emacs/elisp_universal_argument.html
the universal argument corresponds to an argument '(4). So you could
try:

#+begin_src emacs-lisp
(global-set-key
 (kbd "<f8>")
 (lambda ()
   (interactive)
   (org-tree-to-indirect-buffer '(4))))
#+end_src

> 2) Can I change the naming of the indirect buffer? To prefix the .org
> buffer name makes sense, but is cluttering my tabbar (yes - I still use
> it) - so I would prefer to simply use the name of the subtree.

The buffer name is set by the function `org-get-indirect-buffer'.
You could try to change the name after calling the function … for
instance by doing
#+begin_src emacs-lisp
(rename-buffer (org-get-heading) t)
#+end_src
(the t at the end makes sure the name is unique), but for this to work
you need to go to the buffer that was just created, and I don't know how
to do that.

Alan

-- 
OpenPGP Key ID : 040D0A3B4ED2E5C7
Weekly CO₂ average (2015-05-30, Mauna Loa Observatory): 403.41 ppm

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

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

* Re: org-tree-to-indirect-buffer - naming and prefix in define keyboard key
  2015-06-09 12:38 ` Alan Schmitt
@ 2015-06-10 12:59   ` Rainer M Krug
  0 siblings, 0 replies; 3+ messages in thread
From: Rainer M Krug @ 2015-06-10 12:59 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

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

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> On 2015-06-09 10:36, Rainer M Krug <Rainer@krugs.de> writes:
>
>> While writing this, I discovered the C-u prefix to keep the last opened
>> indirect buffer open.
>>
>> But I still have two question:
>>
>> 1) How can I map the command C-u M-x ~org-tree-to-indirect-buffer~ to a
>> keyboard shortcut?
>
> According to http://ergoemacs.org/emacs/elisp_universal_argument.html
> the universal argument corresponds to an argument '(4). So you could
> try:
>
> #+begin_src emacs-lisp
> (global-set-key
>  (kbd "<f8>")
>  (lambda ()
>    (interactive)
>    (org-tree-to-indirect-buffer '(4))))
> #+end_src

Thanks - works perfectly. I just used

#+begin_src emacs-lisp
(define-key org-mode-map "\C-ci" (lambda ()
                                   (interactive)
                                   (org-tree-to-indirect-buffer '(4))))
#+end_src

as it only makes sense in org files (or can I use it in other files as
well?).

>
>> 2) Can I change the naming of the indirect buffer? To prefix the .org
>> buffer name makes sense, but is cluttering my tabbar (yes - I still use
>> it) - so I would prefer to simply use the name of the subtree.
>
> The buffer name is set by the function `org-get-indirect-buffer'.
> You could try to change the name after calling the function … for
> instance by doing
> #+begin_src emacs-lisp
> (rename-buffer (org-get-heading) t)
> #+end_src
> (the t at the end makes sure the name is unique), but for this to work
> you need to go to the buffer that was just created, and I don't know how
> to do that.

Thanks - I will look into this and post a new question.

Thanks a lot,

Rainer

>
> Alan

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug

PGP: 0x0F52F982

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 494 bytes --]

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

end of thread, other threads:[~2015-06-10 13:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-09  8:36 org-tree-to-indirect-buffer - naming and prefix in define keyboard key Rainer M Krug
2015-06-09 12:38 ` Alan Schmitt
2015-06-10 12:59   ` Rainer M Krug

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).