help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Grouping related buffers


From: Scott Frazer
Subject: Re: Grouping related buffers
Date: Mon, 10 Nov 2008 14:00:58 -0500
User-agent: Thunderbird 2.0.0.17 (Windows/20080914)

Corey Foote wrote:
Hi everybody,

As you probably already know, modern window managers support virtual desktops, which extend the workspace to multiple desktop areas. This allows users to spread the windows they have open across multiple workspaces, as an alternative to crowding them all on to one screen. I find this helpful because I work on multiple projects at a time, and having multiple desktops allows me to group the windows for each project together in separate desktops.

I was wondering if there was a way to group related buffers in Emacs through the use of, say, multiple buffer workspaces. For example, it would be nice if when I display a list of existing buffers by typing C-x C-b it would be possible to group the buffers in the list, and when I called C-x b only the buffers in the current grouping would be available. (To get at the others it would be necessary to change the current buffer workspace.)

I'd suggest using the buffer-show package.  Here's some skeleton code
that works but is pretty lame (no completion, showing of current or
all tags, etc. is left as an exercise for the student :) ):

(require 'bs)

(defvar bs-group-buffer-tags nil
  "*List of group tags for a buffer")
(make-variable-buffer-local 'bs-group-buffer-tags)

(defvar bs-group-active-tag nil
  "*Active tag for showing buffer list")

(defun bs-group-add-buffer-tag (tag)
  (interactive "sAdd buffer tag: ")
  (setq bs-group-buffer-tags (add-to-list 'bs-group-buffer-tags tag)))

(defun bs-group-delete-buffer-tag (tag)
  (interactive "sRemove buffer tag: ")
  (setq bs-group-buffer-tags (delete tag bs-group-buffer-tags)))

(defun bs-group-set-active-tag (tag)
  (interactive "sSet active tag: ")
  (setq bs-group-active-tag tag))

(defun bs-group-must-show-function (buf)
  (save-excursion
    (set-buffer buf)
    (member bs-group-active-tag bs-group-buffer-tags)))

(defun bs-group-dont-show-function (buf)
  (not (bs-group-must-show-function buf)))

(setq bs-configurations
      (add-to-list 'bs-configurations
                   '("tagged"
                     nil bs-group-must-show-function
                     nil bs-group-dont-show-function
                     nil)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]