Re: [O] multiple indirect buffers, and limiting to a drawer

2013-10-02 Thread Thorsten Jolitz
Matt Price  writes:

>> Although navigation inside the Org-modes buffers is quite convenient, its
>> somehow even more convenient to have a splitted screen and switch to the
>> read-only navi-buffer and use 1-key bindings for navigation, visibility
>> changes, all kinds of buffer views, and even a kind of remote control for
>> common copy, edit and search commands.
>>
>
> Wow, that is very cool.  I had never seen navi-mode before.  I  am
> looking at it and hoping I might be able to modify
> navi-narrow-to-subtree in a way that allows me to add a third window
> which will contain an indirect buffer, itself narrowed to the
> properties drawer for the current headline.  It seems like that might
> be possible?  I would need to figure out how navi-mode manages the
> window layouts, which I haven't looked at yet.


navi-mode only sets "twin-markers" in the code/org buffer and the navi-buffer
for quick buffer-switching. Its based on occur (i.e. replace.el), and there I
find something like: 

#+begin_src emacs-lisp
  (win (or (get-buffer-window buf)
   (display-buffer buf
   '(nil (inhibit-same-window . t)
 (inhibit-switch-frame . t)
#+end_src

and thats how its behaves: navi-buffer is not displayed in another frame, and
not in the same window as the code/org buffer. 

maybe my (constant) gnus window config (stolen somewhere) is helpful for you?


#+begin_src emacs-lisp
  ;  3 part window for Gnus
  (gnus-add-configuration '(article (horizontal 1.0 (vertical
  65 (group 1.0) ) (vertical 1.0 (summary 0.15 point) (article 1.0)
  
  
  (gnus-add-configuration '(summary (horizontal 1.0 (vertical
  65 (group 1.0) ) (vertical 1.0 (summary 1.0 point) 
#+end_src

`gnus-add-configuration' is defined in gnus-win.el. 

Here is what C-1 a (in *Navi-buffer*) shows me about this library, I
guess there are quite a lot of things to copy/reuse for you:

,-
|   1:;;; gnus-win.el --- window configuration functions for Gnus
|  23:;;; Commentary:
|  25:;;; Code:
|  32:(defgroup gnus-windows nil
|  36:(defcustom gnus-use-full-window t
|  41:(defcustom gnus-window-min-width 2
|  46:(defcustom gnus-window-min-height 1
|  51:(defcustom gnus-always-force-window-configuration nil
|  56:(defcustom gnus-use-frames-on-any-display nil
|  64:(defvar gnus-buffer-configuration
| 173:(defvar gnus-window-to-buffer
| 197:(defcustom gnus-configure-windows-hook nil
| 203:;;; Internal variables.
| 205:(defvar gnus-current-window-configuration nil
| 208:(defvar gnus-created-frames nil)
| 209:(defvar gnus-window-frame-focus nil)
| 211:(defun gnus-kill-gnus-frames ()
| 222:(defun gnus-add-configuration (conf)
| 228:(defvar gnus-frame-list nil)
| 230:(defun gnus-window-to-buffer-helper (obj)
| 240:(defun gnus-configure-frame (split &optional window)
| 358:(defvar gnus-frame-split-p nil)
| 360:(defun gnus-configure-windows (setting &optional force)
| 420:(defun gnus-delete-windows-in-gnusey-frames ()
| 438:(defun gnus-all-windows-visible-p (split)
| 479:(defun gnus-window-top-edge (&optional window)
| 483:(defun gnus-remove-some-windows ()
| 507:(defalias 'gnus-frames-on-display-list 'frames-on-display-list))
| 509:(defun gnus-frames-on-display-list ()
| 512:(defalias 'gnus-frames-on-display-list 'frame-list
| 514:(defun gnus-get-buffer-window (buffer &optional frame)
| 527:;;; gnus-win.el ends here
`-


-- 
cheers,
Thorsten




Re: [O] multiple indirect buffers, and limiting to a drawer

2013-10-02 Thread Matt Price
On Tue, Oct 1, 2013 at 1:19 PM, Thorsten Jolitz  wrote:
> Matt Price  writes:
>
> Hi,
>
>> (1) in a narrow window on the left, an outline of the whole org-file,
>> which I take to represent a major writing project
>>
>> (2) in the main window, a heading element in an indirect buffer
>>
>>
>> (3) in the right-hand panel, I'd like  to just show the properties
>> drawer of the currently active heading.
>>
>>
>> Can someone suggest the best way to create that third buffer (or more
>> precisely, that second indirect buffer)?  I guess I don't know the
>> best way to limit to a drawer, nor do I really understand how to make
>> multiple indirect buffers ( from what I can see,
>> org-tree-to-indirect-buffer will only permit one indirect buffer at a
>> time to be crate, which is fine, but which takes away the only tool I
>> sort of understand).
>>
>>
>> Another question: does emacs allow indirect buffers to have different
>> modes than their parents If so, I would like to write some trivial
>> minor modes that remap keybindings in each of the three windows, and
>> .e.g I would like to prohibit full unfolding of the outline in the
>> left-hand window if that's possible.
>
> Much of this is possible with
> [[https://github.com/tj64/navi][navi-mode.el]] (see screencast on
> [[http://www.youtube.com/watch?v%3DII-xYw5VGFM:][youtube]]), although
> you won't have 3 buffers, just 2: the Org file and the associated
> *Navi-buffer*, but the latter is very flexibel: with one key commands
> you can switch rapidly between multiple views of your Org file, change
> the visibility of the Org buffer, and more 'remote-control' like stuff.
>
> Just to give you an example using Bernt Hansen org-mode.org tutorial:
>
> 1. M-s n  -> fire up navi buffer showing level 1 headlines:
>
> ,
> | 19 matches for "^\* " in buffer: org-mode.org
> |  39:* Getting Started
> | 411:* Tasks and States
> | 566:* Adding New Tasks Quickly with Org Capture
> | 712:* Refiling Tasks ...
> `
>
> 2. move up and down with n an p, narrow and widen subtrees with r and w,
>change visibility of headline at point (whole buffer) with TAB (BACKTAB).
>use d to see the element at point in the Org-buffer, o (or s) to switch to
>it. use M-s M-s to switch back from Org-buffer to the navi-buffer.
>
> 3. type 2 or 3 to see headlines up to level 2 (3)
>
> ,--
> | 122 matches for "^\*\*? " in buffer: org-mode.org
> |  39:* Getting Started
> |  42:** Org-Mode Setup
> | 130:** Organizing Your Life Into Org Files
> | 184:** Agenda Setup
> | 233:** Org File Structure
> | 291:** Key bindings
> | 411:* Tasks and States
> | 425:** TODO keywords
> | 510:** Fast Todo Selection
> | 533:** TODO state triggers
> `--
>
> 4. type h to see all (currently) possible keyword-searches (and q to quit the
>help page)
>
> ,
> | [KEY] : [SEARCH]
> | 
> | b : srcblock
> | x : time
> | I : inline-srcblock
> | W : srcname-w-name
> | M : multilineheader
> | Y : priority
> | T : target
> | R : radiotarget
> | D : drawer
> | S : timestamp
> | N : srcname
> | U : result
> | Z : result-w-name
> | O : options
> | P : propertydrawer
> | A : deadline
> | H : scheduled-time-hour
> `
>
> 5. play around with the keyword searches, e.g. type b
>
> ,-
> |  51:#+begin_src emacs-lisp :tangle no
> |  65:#+begin_src emacs-lisp :tangle yes :exports none
> |  86:#+begin_src emacs-lisp :tangle yes
> | 103:#+begin_src emacs-lisp :tangle yes
> | 190:#+begin_src emacs-lisp :tangle no
> `-
>
>   type S
>
>,
>| 2130:  , SCHEDULED: <2009-05-18 Mon ++1w>
>| 3771:  ,   DEADLINE: <2009-07-01 Wed +1m -0d>
>| 3843:  ,  SCHEDULED: <2009-06-16 Tue +1w>
>| 4081:  ,  DEADLINE: <2009-07-01 Wed +1m -0d>
>| 4265:  ,   SCHEDULED: <2009-11-21 Sat .+7d/30d>
>`
>
>   and - for your use case - type P:
>
> ,
> |  43::PROPERTIES:
> |::CUSTOM_ID: Setup
> |::END:
> | 131::PROPERTIES:
> |::CUSTOM_ID: OrgFiles
> |::END:
> | 185::PROPERTIES:
> |   

Re: [O] multiple indirect buffers, and limiting to a drawer

2013-10-02 Thread Matt Price
On Tue, Oct 1, 2013 at 5:37 PM, Myles English  wrote:
>
> Hi Matt,
>
> mopto...@gmail.com writes:
>
>> (3) in the right-hand panel, I'd like  to just show the properties
>> drawer of the currently active heading.
>>
>>
>> Can someone suggest the best way to create that third buffer (or more
>> precisely, that second indirect buffer)?
>
> I can't, but your description of a windowed layout sounds like
> workgroups ( https://github.com/tlh/workgroups.el ), may be you can
> reuse some code?

that looks interesting and certainly more sophisticateed than what I
had put together, I'll check it out.
>
> Myles
>
>



Re: [O] multiple indirect buffers, and limiting to a drawer

2013-10-02 Thread Matt Price
On Tue, Oct 1, 2013 at 3:28 PM, Bob Newell  wrote:
> Aloha Matt,
>
> For some while I've been also working on my "writer-mode" for org-mode,
> and run into similar problems. (However, I don't think I ever intend
> writer-mode for general release; it will probably just remain something
> I use myself.)
>
> I ran into similar problems, trying to emulate Scrivener and others. I
> only seem to be able to figure out a thin nav panel on the left and a
> bigger text panel on the right. I didn't get around the problem with
> virtual buffers having the same modal properties as the main buffer. In
> particular, buffer-local key bindings carry over from the index buffer
> to the main buffer, which is A Royal Pain.

This in particular is something I wish could be solved.  Just reading
the documentation it looks as though using "mike-indirect-buffer"
instead of "clone-indirect-buffer" will permit one to set all the
modal properties of the new buffer independently, though it may be
frustrating to address the indirect bufffer in a function called from
the first buffer (maybe not, though?).  cf.
http://www.gnu.org/software/emacs/manual/html_node/elisp/Indirect-Buffers.html
and http://www.emacswiki.org/emacs/IndirectBuffers
>
> But perhaps I'm looking for different features than you are. Mainly, I
> wanted a template system for scenes, characters, etc. (easy enough), a
> lot of statistics, both global and per-story (not conceptually difficult
> but took much time), and a good darkroom mode (much more of a challenge
> than I expected, and seems to vary among environments/releases, etc.;
> that is to say, most of the published emacs darkroom code didn't work
> for me).
>
> I've also got some fluff such as typing sounds, word frequency analysis,
> a name generator, etc.
>
> It's nothing special but I use it every day. However, I'm more than
> willing to throw it over and use your code once it's developed! I'm sure
> you're coding it much, much better and with concepts that are better
> thought through.

That sounds pretty great, actually.  So, I would love to see what you have.

>
> A hui hou,
>
> --
> Bob Newell
> Honolulu, Hawai`i
lucky!



Re: [O] multiple indirect buffers, and limiting to a drawer

2013-10-01 Thread Myles English

Hi Matt,

mopto...@gmail.com writes:

> I am returning to my long-languishing idea of an "org writer's room"
> (https://github.com/titaniumbones/org-writers-room , see also gmail
> archives for a brief discussion about a year ago).  Coming to terms
> with some of my own coding limitations(!), I want to keep this
> relatively simple -- just a 3-paneled interface that shows
>
> (1) in a narrow window on the left, an outline of the whole org-file,
> which I take to represent a major writing project
>
> (2) in the main window, a heading element in an indirect buffer
>
>
> (3) in the right-hand panel, I'd like  to just show the properties
> drawer of the currently active heading.
>
>
> Can someone suggest the best way to create that third buffer (or more
> precisely, that second indirect buffer)?

I can't, but your description of a windowed layout sounds like
workgroups ( https://github.com/tlh/workgroups.el ), may be you can
reuse some code?

Myles





Re: [O] multiple indirect buffers, and limiting to a drawer

2013-10-01 Thread Thorsten Jolitz
Matt Price  writes:

Hi,

> (1) in a narrow window on the left, an outline of the whole org-file,
> which I take to represent a major writing project
>
> (2) in the main window, a heading element in an indirect buffer
>
>
> (3) in the right-hand panel, I'd like  to just show the properties
> drawer of the currently active heading.
>
>
> Can someone suggest the best way to create that third buffer (or more
> precisely, that second indirect buffer)?  I guess I don't know the
> best way to limit to a drawer, nor do I really understand how to make
> multiple indirect buffers ( from what I can see,
> org-tree-to-indirect-buffer will only permit one indirect buffer at a
> time to be crate, which is fine, but which takes away the only tool I
> sort of understand).
>
>
> Another question: does emacs allow indirect buffers to have different
> modes than their parents If so, I would like to write some trivial
> minor modes that remap keybindings in each of the three windows, and
> .e.g I would like to prohibit full unfolding of the outline in the
> left-hand window if that's possible.

Much of this is possible with
[[https://github.com/tj64/navi][navi-mode.el]] (see screencast on
[[http://www.youtube.com/watch?v%3DII-xYw5VGFM:][youtube]]), although
you won't have 3 buffers, just 2: the Org file and the associated
*Navi-buffer*, but the latter is very flexibel: with one key commands
you can switch rapidly between multiple views of your Org file, change
the visibility of the Org buffer, and more 'remote-control' like stuff.

Just to give you an example using Bernt Hansen org-mode.org tutorial:

1. M-s n  -> fire up navi buffer showing level 1 headlines:

,
| 19 matches for "^\* " in buffer: org-mode.org
|  39:* Getting Started
| 411:* Tasks and States
| 566:* Adding New Tasks Quickly with Org Capture
| 712:* Refiling Tasks ...
`

2. move up and down with n an p, narrow and widen subtrees with r and w,
   change visibility of headline at point (whole buffer) with TAB (BACKTAB).
   use d to see the element at point in the Org-buffer, o (or s) to switch to
   it. use M-s M-s to switch back from Org-buffer to the navi-buffer.

3. type 2 or 3 to see headlines up to level 2 (3)

,--
| 122 matches for "^\*\*? " in buffer: org-mode.org
|  39:* Getting Started
|  42:** Org-Mode Setup
| 130:** Organizing Your Life Into Org Files
| 184:** Agenda Setup
| 233:** Org File Structure
| 291:** Key bindings
| 411:* Tasks and States
| 425:** TODO keywords
| 510:** Fast Todo Selection
| 533:** TODO state triggers
`--

4. type h to see all (currently) possible keyword-searches (and q to quit the
   help page)

,
| [KEY] : [SEARCH]
| 
| b : srcblock
| x : time
| I : inline-srcblock
| W : srcname-w-name
| M : multilineheader
| Y : priority
| T : target
| R : radiotarget
| D : drawer
| S : timestamp
| N : srcname
| U : result
| Z : result-w-name
| O : options
| P : propertydrawer
| A : deadline
| H : scheduled-time-hour
`

5. play around with the keyword searches, e.g. type b

,-
|  51:#+begin_src emacs-lisp :tangle no
|  65:#+begin_src emacs-lisp :tangle yes :exports none
|  86:#+begin_src emacs-lisp :tangle yes
| 103:#+begin_src emacs-lisp :tangle yes
| 190:#+begin_src emacs-lisp :tangle no
`-

  type S

   ,
   | 2130:  , SCHEDULED: <2009-05-18 Mon ++1w> 
   | 3771:  ,   DEADLINE: <2009-07-01 Wed +1m -0d> 
   | 3843:  ,  SCHEDULED: <2009-06-16 Tue +1w>
   | 4081:  ,  DEADLINE: <2009-07-01 Wed +1m -0d>   
   | 4265:  ,   SCHEDULED: <2009-11-21 Sat .+7d/30d>
   `

  and - for your use case - type P:

,
|  43::PROPERTIES:
|::CUSTOM_ID: Setup
|::END:
| 131::PROPERTIES:
|::CUSTOM_ID: OrgFiles
|::END:
| 185::PROPERTIES:
|::CUSTOM_ID: AgendaSetup
|::END:
`

6. finally, combine headline and keyword searches:

  type C-1 S

   ,
   | 2100:* GTD stuff
   | 2130:  , SCHEDULED: <2009-05-18 Mon ++1