Re: [O] org-tree-to-indirect-buffer - naming and prefix in define keyboard key

2015-06-10 Thread Rainer M Krug
Alan Schmitt alan.schm...@polytechnique.org writes:

 On 2015-06-09 10:36, Rainer M Krug rai...@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:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


signature.asc
Description: PGP signature


[O] org-tree-to-indirect-buffer - naming and prefix in define keyboard key

2015-06-09 Thread Rainer M Krug
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:  rai...@krugs.de

Skype:  RMkrug

PGP: 0x0F52F982


signature.asc
Description: PGP signature


Re: [O] org-tree-to-indirect-buffer - naming and prefix in define keyboard key

2015-06-09 Thread Alan Schmitt
On 2015-06-09 10:36, Rainer M Krug rai...@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


signature.asc
Description: PGP signature