Re: [Orgmode] Using Org for browsing and managing buffers

2010-04-19 Thread Dan Davison
 On this topic, one suggestion (which might be difficult to implement,
 however): the best thing is about org is the hierarchical nature of
 headlines.  This would seem to map well to the hierarchical nature of
 modes.  For instance, org mode is also a text mode.  Would it make
 sense to have all text mode buffers grouped with sub-modes (for want
 of a better word) as subheadings?  On the other hand, I'm not sure
 what this would add so probably ignore this... :-)

Other groupings might be good too. E.g. the comint process buffer for a
language grouped with the code files; all magit buffers in a magit tree;
all gnus buffers (summary, group, article) in a gnus tree. It seems that
the best thing might be to have a flexible way of specifying the tree
structure. E.g some way to specify projects for which all buffers
should be grouped together. Not sure how to implement that though.

I've also been wondering about adding recentf files (buffers you might
want, in addition to buffers you have). Then it might make sense to
present them in a hierarchy based on the filesystem location. That's
also true when grouping buffers by their directory (B def RET).

So making it work with  2 levels of hierarchy is definitely something
worth thinking about, especially if someone has a good idea how to
specify the desired tree structure a priori.

A year or two ago someone posted code to preserve folding state of an
org buffer using an auxiliary file. Don't think it's in contrib. But I
might try to dig that out also. Anyone know where it is?


  I ask because I
don't understand what functionality it adds and the default binding
(h) conflicts with my speed keys (I use vi-like bindings for speed
motion keys).
 
 I overlooked that before. I've moved it to H.

 Doesn't seem to work for me (pulled from git this morning, 8am BST):

Fixed, thanks!

Dan


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Using Org for browsing and managing buffers

2010-04-18 Thread Dan Davison
http://github.com/dandavison/org-buffers
http://github.com/dandavison/org-buffers/raw/master/org-buffers.el

Hi Eric,

Eric S Fraga ucec...@ucl.ac.uk writes:
[...]
 - I like the fact I can customise RET or, more to the point, that it
   be consistent with the rest of org-mode.  I personally would set
   org-buffers-follow-link-method to 'current-window but then it would
   be nice to have SPC, say, open the buffer in another window, to
   behave consistently with org-agenda?

I've added the SPACE binding you suggest. And, although it would be
out-of-keeping with other org-mode links, it looks like there's a good
argument for making RET switch to the buffer in the same window, like
dired et al. I've done that. I've put a table at the end comparing
these bindings across a few different major modes.

 - I would prefer some consistency or symmetry in the creation and
   burying of the buffer: given that (by default) org-buffers-list
   brings up a new window in the current frame, quitting that buffer
   should also delete the window;  otherwise, I would like it to not
   split the frame.  Does that make sense?

Yes. This is all to do with pop-to-buffer versus switch-to-buffer, my
understanding of which was shaky. I have now changed to using
switch-to-buffer by default, and I think this gives behaviour
consistent with what you requested. I've also introduced a variable
org-buffers-switch-to-buffer-function which can be set to
'pop-to-buffer, in which case the variables pop-up-windows and
pop-up-frames, amongst others, become relevant.

 - what's the point of orb-buffers-toggle-heading? 

Cleaner (less starry) appearance, seeing as many buffers are named
*Like This*.

 I ask because I
   don't understand what functionality it adds and the default binding
   (h) conflicts with my speed keys (I use vi-like bindings for speed
   motion keys).

I overlooked that before. I've moved it to H.

 - In column view mode (which I also have not figured out why it would
   be used...), the heading uses a different font size than the normal
   entries so the headings don't line up at all.  This may be my fault,
   however.

I don't see this.

I've changed the column view binding to T (tabular) so that the
standard speed commands c and C are available. As for the point, it kind
of comes full circle to the list-buffers / ibuffers appearance, thus
showing that most things are a subset of org.

 - if I bring up the buffers list a second time, having created a new
   buffer in the meantime, the new buffer does not appear until I hit
   'g'.  I think any invocation of org-buffers-list should do an
   automatic update of the list.

A C-u prefix to org-buffers-list now forces update. I don't think I
agree that it should be default. Speed is my concern -- I'd like it to
show the listing immediately when possible. I believe we're both using
atom-powered netbooks, and mine at least is a little sluggish at
generating the listing. I notice dired says The directory has changed
on disk, use g to update so maybe I could do the same.


 - Lastly, it would be nice to either avoid the single blank line at
   the start of the buffer or have point be at the first heading.
   Having point at the first (empty) line seems to cause some problems
   with speed motion keys sometimes...  it also wastes a line!

I've made point go to the first heading when the listing is
created. However, I am wary about getting rid of that initial line, as I
believe Carsten has said that Org/outline.el isn't always happy with
first heading on first line. Certainly, I'm not inserting that newline
character explicitly -- it appears via my (ab)use of Carsten's
functions.

   Actually, I think it might be useful to have point be placed at the
   heading that corresponds to the buffer currently being visited when
   the org-buffers-list command is invoked.  A thought.

Yes I like that and I've done it. It will only happen with a fresh
listing though (first time, or C-u prefix), Otherwise buffer point is
maintained.

Along similar lines, I've made it so that if you invoke C-x f
(find-file) or C-x d (dired), the minibuffer prompt will start from the
directory of the buffer on the current line, rather than whatever
directory is associated with the listings buffer. I've found this useful
(only works for the keybindings currently, not for M-x or from menu).

Also you can now flag buffers for reversion (i.e. revert-buffer) using
r[6], and a few other changes.

Thanks, your suggestions have been really helpful.

Dan

This table is with (setq pop-up-windows t), which is default in emacs23.
|  | switch   | switch  | display other-window |
   |
|  | same window  | other window| without switch   | next 
item |
|  |  | (pop-to-buffer) |  |
   |
|--+--+-+--+---|
| dired| RET  | o   | 

Re: [Orgmode] Using Org for browsing and managing buffers

2010-04-16 Thread Dan Davison
Livin Stephen Sharma livin.step...@gmail.com writes:

 yep, now it works!
 Thanks

 About moving up/down:
  I was a bit surprised that 'p' was not a counterpart of 'n' (the latter works
 exactly like 'n' in Org-Agenda)

 Then I saw that in my setup (*no* customizations), there is some duplication 
 in
 the functions mapped to 'p' and 'P':

Hi,

I've been working on improving the key bindings, in discussion with Eric
Fraga. It looks like you have loaded the new code into a system already
running the old code, and the keymap has ended up as a hybrid between
the two. The simplest thing would be to restart emacs. I don't know of
another way to reliably make sure that all the necessary variables get
reset. With the new bindings you will have p and n for movement as well
as a bunch of other bindings from `org-speed-commands-default'.

Thanks for trying it out!

Dan





 key             binding

 ---             ---



 SPC org-buffers-display-buffer

 . org-buffers-switch-to-buffer

 ? org-buffers-help

 B org-buffers-list:by

 H org-buffers-toggle-headings

 P org-buffers-toggle-properties

 T org-buffers-columns-view

 b org-buffers-list:by

 c org-buffers-columns-view

 d org-buffers-tag-for-deletion

 g org-buffers-list:refresh

 h org-buffers-toggle-headings

 o org-buffers-switch-to-buffer-other-window

 p org-buffers-toggle-properties

 q bury-buffer

 u org-buffers-remove-tags

 x org-buffers-execute-pending-operations

 return org-buffers-follow-link




 On 16 April 2010 02:51, Dan Davison davi...@stats.ox.ac.uk wrote:

 Livin Stephen Sharma livin.step...@gmail.com writes:

  Am I the only one encountering:
 
      org-buffers-list: Invalid function: org-buffers-state-get

 I haven't seen that error, but I may have been doing something incorrect
 (with macros). I've got rid of them now; let me know if you still get
 the error.

 Code file: http://github.com/dandavison/org-buffers/raw/master/
 org-buffers.el
 Git repo:  http://github.com/dandavison/org-buffers

 Thanks,

 Dan


 
 
 
  I do see many people are using this successfully
  :)
 
  Livin Stephen
 
 
 
  On Apr 09, 2010, at 06:47:20 , Dan Davison wrote:
 
 
      I've been working on an Org tool to browse Emacs buffers. Emacs has
 the
      function list-buffers (C-x C-b), where you can view a list of
 buffers,
      delete buffers, etc. This is intended to be a replacement for
      list-buffers, implemented in Org-mode.
 
      The code is attached, and there's a git repo at
      http://github.com/dandavison/org-buffers
 
      After putting the code in your load-path and doing
      (require 'org-buffers), use the function `org-buffers-list' to 
 create
      the listing buffer. This is a read-only Org-mode buffer populated
 with
      links to open buffers. Information is stored for each buffer using
      properties. By default, the buffers are grouped by major mode. 
 Here's
 a
      screenshot.
 
      http://www.princeton.edu/~ddavison/org-buffers/by-major-mode.png
 
      The buffer has some special key-bindings:
 
      +--+
      | ?   | Show all keybindings                                   |
      |-+|
      | g   | Update buffer (prefix arg does hard reset)             |
      |-+|
      | b   | Select a different property to group by                |
      |-+|
      | RET | follow link to buffer on this line                     |
      |-+|
      | d   | Mark buffer for deletion                               |
      |-+|
      | u   | Remove mark                                            |
      |-+|
      | x   | Delete marked buffers                                  |
      |-+|
      | o   | Like RET (see variable org-buffers-follow-link-method) |
      |-+|
      | .   | Like RET but switch to buffer in same window           |
      |-+|
      | h   | toggle between headings and plain entries for buffers  |
      |-+|
      | p   | toggle in-buffer properties on/off                     |
      

Re: [Orgmode] Using Org for browsing and managing buffers

2010-04-15 Thread Eric S Fraga
On Thu, 15 Apr 2010 00:20:31 -0400, Dan Davison davi...@stats.ox.ac.uk wrote:

[...]

 This does also mean that various inappropriate speed commands become
 exposed (but then pressing random keys is a strategy that should be
 confined to gnus).

;-)

 I've made them narrower by default, and introduced a customizable
 variable org-buffers-columns-format.

Excellent.

 Noted. On the other hand o in Org speed commands is bound to
 org-open-at-point. I've got rid of my binding and am allowing it to fall
 through to the speed command default but I'd welcome any further
 suggestions. Note that the variable org-buffers-follow-link-method can
 be used so specify the behaviour of RET on a line with a buffer link.

Some more comments:

- I like the fact I can customise RET or, more to the point, that it
  be consistent with the rest of org-mode.  I personally would set
  org-buffers-follow-link-method to 'current-window but then it would
  be nice to have SPC, say, open the buffer in another window, to
  behave consistently with org-agenda?

- I would prefer some consistency or symmetry in the creation and
  burying of the buffer: given that (by default) org-buffers-list
  brings up a new window in the current frame, quitting that buffer
  should also delete the window;  otherwise, I would like it to not
  split the frame.  Does that make sense?

- what's the point of orb-buffers-toggle-heading?  I ask because I
  don't understand what functionality it adds and the default binding
  (h) conflicts with my speed keys (I use vi-like bindings for speed
  motion keys).

- In column view mode (which I also have not figured out why it would
  be used...), the heading uses a different font size than the normal
  entries so the headings don't line up at all.  This may be my fault,
  however.

- if I bring up the buffers list a second time, having created a new
  buffer in the meantime, the new buffer does not appear until I hit
  'g'.  I think any invocation of org-buffers-list should do an
  automatic update of the list.

- Lastly, it would be nice to either avoid the single blank line at
  the start of the buffer or have point be at the first heading.
  Having point at the first (empty) line seems to cause some problems
  with speed motion keys sometimes...  it also wastes a line!

  Actually, I think it might be useful to have point be placed at the
  heading that corresponds to the buffer currently being visited when
  the org-buffers-list command is invoked.  A thought.

In any case, it's almost ready for me to replace my current C-xC-b
binding... :)

 I haven't used bs-show. It might be interesting to try to get some

bs-show has a nice feature which allows different classes of buffers
to be shown and to cycle through the different views easily.


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Using Org for browsing and managing buffers

2010-04-15 Thread Dan Davison
Livin Stephen Sharma livin.step...@gmail.com writes:

 Am I the only one encountering:

 org-buffers-list: Invalid function: org-buffers-state-get

I haven't seen that error, but I may have been doing something incorrect
(with macros). I've got rid of them now; let me know if you still get
the error.

Code file: http://github.com/dandavison/org-buffers/raw/master/org-buffers.el
Git repo:  http://github.com/dandavison/org-buffers

Thanks,

Dan





 I do see many people are using this successfully
 :)

 Livin Stephen



 On Apr 09, 2010, at 06:47:20 , Dan Davison wrote:


 I've been working on an Org tool to browse Emacs buffers. Emacs has the
 function list-buffers (C-x C-b), where you can view a list of buffers,
 delete buffers, etc. This is intended to be a replacement for
 list-buffers, implemented in Org-mode.

 The code is attached, and there's a git repo at
 http://github.com/dandavison/org-buffers

 After putting the code in your load-path and doing
 (require 'org-buffers), use the function `org-buffers-list' to create
 the listing buffer. This is a read-only Org-mode buffer populated with
 links to open buffers. Information is stored for each buffer using
 properties. By default, the buffers are grouped by major mode. Here's a
 screenshot.

 http://www.princeton.edu/~ddavison/org-buffers/by-major-mode.png

 The buffer has some special key-bindings:

 +--+
 | ?   | Show all keybindings   |
 |-+|
 | g   | Update buffer (prefix arg does hard reset) |
 |-+|
 | b   | Select a different property to group by|
 |-+|
 | RET | follow link to buffer on this line |
 |-+|
 | d   | Mark buffer for deletion   |
 |-+|
 | u   | Remove mark|
 |-+|
 | x   | Delete marked buffers  |
 |-+|
 | o   | Like RET (see variable org-buffers-follow-link-method) |
 |-+|
 | .   | Like RET but switch to buffer in same window   |
 |-+|
 | h   | toggle between headings and plain entries for buffers  |
 |-+|
 | p   | toggle in-buffer properties on/off |
 |-+|
 | c   | Switch to column-view  |
 +--+

 If there's an active region, d and u operate on all buffers in the
 region.

 Some variables that can be configured:
 - org-buffers-buffer-properties
 - org-buffers-excluded-modes
 - org-buffers-excluded-buffers
 - org-buffers-follow-link-method
 - org-buffers-mode-hook
 - org-buffers-buffer-name

 Some possible extensions:
 - Browse recent files using recentf
 - Allow several buffers to be marked for side-by-side display
 - Maintain folding configuration across buffer updates
 - Make faster

 As always, any feedback, suggestions and patches will be very welcome!

 Dan

 p.s. The column-view mode works for following links, but does need
 further attention.

 ;;; org-buffers.el --- An Org-mode tool for buffer management

 ;; Copyright (C) 2010  Dan Davison

 ;; Author: Dan Davison dandavison0 at gmail dot com
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org

 ;;; License:

 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 ;;
 ;; This program is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; GNU General Public License for more details.
 ;;
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 ;; Boston, MA 02110-1301, 

Re: [Orgmode] Using Org for browsing and managing buffers

2010-04-14 Thread Eric S Fraga
On Thu, 08 Apr 2010 21:17:20 -0400, Dan Davison davi...@stats.ox.ac.uk wrote:

 I've been working on an Org tool to browse Emacs buffers. Emacs has the
 function list-buffers (C-x C-b), where you can view a list of buffers,
 delete buffers, etc. This is intended to be a replacement for
 list-buffers, implemented in Org-mode.

Excellent!  I really like this.  I currently use both bs-show and ido
for buffer selection but I could easily be convinced to use this
instead of bs-show.  Some comments:

 The buffer has some special key-bindings:

I have a problem with the current bindings: you are (I guess) trying
to emulate dired to some degree (cf. bindings for RET, 'd', 'o' [1] and
'x').  It would be nice therefore to have movement bindings as well
('n' and 'p').  I can obviously bind these myself but 'p' is already
taken and it would be nice to be as consistent with the defaults as
possible.  Maybe 'P' for properties on/off?

When I tried column view, the default widths are much too wide for my
netbook.  Can these be changed?  More importantly, when I left column
view, the buffer view was now different than the original view.
Originally, I had two levels (mode + buffer) and now it was a single
level (buffer).  How do I get back to mode+buffer two level view?

Thanks again!

eric

Footnotes: 
[1]  I found 'o' initially annoying as knowing that I was in org, I
expected it to behave like 'o' in agenda (hide other window)...



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Using Org for browsing and managing buffers

2010-04-14 Thread Dan Davison
Eric S Fraga ucec...@ucl.ac.uk writes:

 On Thu, 08 Apr 2010 21:17:20 -0400, Dan Davison davi...@stats.ox.ac.uk 
 wrote:

 I've been working on an Org tool to browse Emacs buffers. Emacs has the
 function list-buffers (C-x C-b), where you can view a list of buffers,
 delete buffers, etc. This is intended to be a replacement for
 list-buffers, implemented in Org-mode.

 Excellent!  I really like this.  I currently use both bs-show and ido
 for buffer selection but I could easily be convinced to use this
 instead of bs-show.

Hi Eric,

  Some comments:

 The buffer has some special key-bindings:

 I have a problem with the current bindings: you are (I guess) trying
 to emulate dired to some degree (cf. bindings for RET, 'd', 'o' [1] and
 'x').  It would be nice therefore to have movement bindings as well
 ('n' and 'p').  I can obviously bind these myself but 'p' is already
 taken and it would be nice to be as consistent with the defaults as
 possible.  

Yes, I think I'm trying to emulate dired while still staying true to
Org. But I hadn't thought carefully about the keybindings yet and your
comments are very helpful.

As an experiment at least, I've now changed things so that Org speed
commands are turned on everywhere in the buffer. That means that we gain
all the commands listed in `org-speed-commands-default', including n, p,
f, b, u for movement. Another one I notice is useful is '.' for
outline-mark-subtree, so that '. d x' deletes a group of buffers

This does also mean that various inappropriate speed commands become
exposed (but then pressing random keys is a strategy that should be
confined to gnus).

 Maybe 'P' for properties on/off?

Done.

 When I tried column view, the default widths are much too wide for my
 netbook.  Can these be changed?

I've made them narrower by default, and introduced a customizable
variable org-buffers-columns-format.

  More importantly, when I left column
 view, the buffer view was now different than the original view.

Thanks. I've fixed that.

 Originally, I had two levels (mode + buffer) and now it was a single
 level (buffer).  How do I get back to mode+buffer two level view?

org-buffers-list:by, which is now bound to B (used to be b). It brings
up minibuffer completion for the property you want to group by, so

B maj RET

would be enough to regroup by major-mode (should you need to).


 Thanks again!

 eric

 Footnotes: 
 [1]  I found 'o' initially annoying as knowing that I was in org, I
 expected it to behave like 'o' in agenda (hide other window)...

Noted. On the other hand o in Org speed commands is bound to
org-open-at-point. I've got rid of my binding and am allowing it to fall
through to the speed command default but I'd welcome any further
suggestions. Note that the variable org-buffers-follow-link-method can
be used so specify the behaviour of RET on a line with a buffer link.

Thanks a lot for the comments. The columns view thing is a bit
experimental still; I'm not sure what to do about the key bindings, or
indeed quite what the purpose of it is in this context, but it did seem
like a natural buffer to allow it in.

I haven't used bs-show. It might be interesting to try to get some of
the power of ibuffer in this mode. But Org is better than the
alternatives at hierarchical grouping and tree navigation. And also, the
alternatives are very ugly.

Current code below and at http://github.com/dandavison/org-buffers.

Dan

;;; org-buffers.el --- An Org-mode tool for buffer management

;; Copyright (C) 2010  Dan Davison

;; Author: Dan Davison dandavison0 at gmail dot com
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: http://orgmode.org

;;; License:

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;;; Code:

(require 'org)
(require 'cl)

;;; Variables
(defvar org-buffers-buffer-name
  *Buffers*
  Name of buffer in which buffer list is displayed)

(defvar org-buffers-state
  '((:by . major-mode) (:atom . heading) (:properties . nil))
  Association list specifying the current state of org-buffers.)

(defvar org-buffers-follow-link-method 'org-open-at-point
  Method used to follow link with RET. Must be one of

'org-open-at-point :: use `org-open-at-point' to follow link.
'current-window:: use switch-to-buffer
'other-window  :: use