emacs-devel
[Top][All Lists]
Advanced

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

`buffer-list' and the frame-parameter `buffer-predicate'


From: Oliver Scholz
Subject: `buffer-list' and the frame-parameter `buffer-predicate'
Date: Fri, 16 Aug 2002 20:27:00 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i686-pc-linux-gnu)

I tried to write a frame-local minor mode that was intended to provide
a feature to deal with the metric tons of buffers and that could be
useful -- in my humble opinion -- especially for beginners.

In the middle of writing this package I discovered that the whole
approach has a bug which makes it unusable. I can think of no way to
get around this, except for a change in Emacs itself. (But I may, of
course, be missing something.)

So this is the feature that I want to implement: it should be possible
to "dedicate" a frame to a certain pre-configured type of
buffers. That means that this special frame hides all buffers that it
doesn't cover.

I think, it is best explained with an example of the possible
usage. Say, I want to have two frames, one for Gnus and the other one
for all the rest of my editing. The effect of my mode should be that
all functions for buffer-listing or buffer-switching in the Gnus-frame
show only resp. apply only to the *Group*, *Summary*, *Article* and
the message-buffers, while exactly those buffer are not visible in the
other frame. In other words: it would seem as if Gnus were running in
a separate instance of Emacs, while, of course, it still _is_ the same
instance with all the benefits implied by this.

The same could be useful for Emacs/W3 (separate browser-frame), dired
(separate file-manager frame), shell-mode (separate Emacs-terms) or
whatever. I could even think of, say, frames dedicated to a certain
programming-project.

Now, my approach is to add a predicate-function to the frame-parameter
`buffer-predicate' and to advise the function `buffer-list' to return
only buffers for which this predicate function returns non-nil. This
way the mode bypasses the myriads of available buffer-switch- and
-list-functions.

The big, big problem is that this bypasses functions like
`save-buffers-kill-emacs', too. And exactly this makes it unusable.

So here is my petition: change `buffer-list' to return _always_ only
buffers for which the function in the frame-paramter 'buffer-predicate
returns non-nil. And add a second, underlying function for the
internal use in functions like `save-buffers-kill-emacs'.  Provided,
of course, that you find this feature useful enough, that you want to
add it to Emacs.

I have attached the unfinished code that I have written so far; so you
can see what I am aiming at. Or at least, that I am serious about
this.

[BTW: one thing that puzzles me: this works for functions like
`iswitchb-mode' or the according function in `ido' or for
`bs-show' and -- unfortunately -- for `save-buffers-kill-emacs'. But
not for `switch-to-buffer'.]

    -- Oliver

Attachment: sframes.el
Description: application/emacs-lisp

-- 
29 Thermidor an 210 de la Révolution
Liberté, Egalité, Fraternité!

reply via email to

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