XEmacs 21.4.8 "Honest Recruiter" configured for `alpha-dec-osf5.1'.
I've been looking at buffer tabs and gutter-items.el recently, and I'm
confused.
1. Is the documentation for `buffers-tab-selection-function' wrong?
It says:
Documentation:
*If non-nil, a function specifying the buffers to select from the
buffers tab. This is passed two buffers and should return non-nil if
the second buffer should be selected. The default value
`select-buffers-tab-buffers-by-mode' groups buffers by major mode and
by `buffers-tab-grouping-regexp'.
Should line 3 really say "the *first* buffer should be selected"? I
haven't actually tried to understand what
`select-buffers-tab-buffers-by-mode' does, but here is the start of
the defun (from gutter-items.el):
(defun select-buffers-tab-buffers-by-mode (buffer-to-select buf1)
Note that the first argument is `buffer-to-select', which is
suggestive...
While we're talking about documentation, this is confusing, the word
"select" in particular. This variable is helping to control which
tabs are displayed, right? It has nothing to do with selecting
buffers by clicking on the tabs, and that's sort of what it sounds
like.
I would suggest changing the documentation for
buffers-tab-filter-functions to say something like this:
*If non-nil, a list of functions specifying the buffers to display
in the buffers tab, depending on the context...
or
*If non-nil, a list of functions specifying the buffers for which to
display tabs, depending on the context...
2. Do we need all of these customizations? We have
buffers-tab-selection-function, default value
select-buffers-tab-buffers-by-mode,
buffers-tab-filter-functions, default value
(list buffers-tab-selection-function). As far as I can tell,
this is the only appearance of buffers-tab-selection-function.
I think it would make sense to just keep the second of these as a
customizable variable (keeping the first as a defvar for backwards
compatibility), and have its default value be
(list select-buffers-tab-buffers-by-mode). As far as I can tell from
the lisp code in gutter-items.el, if you remove
buffers-tab-selection-function from the list
buffers-tab-filter-functions, then buffers-tab-selection-function is
not used. So it looks redundant.
Another reason for doing this is that as it stands, the customization
options are really confusing, and also buggy. Do
M-x customize-group buffers-tab
and from the documentation, try to understand the difference between
"Selection function" and "Filter functions".
Here's the bug: if you set both buffers-tab-selection-function and
buffers-tab-filter-functions to nil and save the customizations, then
if you go to buffers-tab-filter-functions and say "Reset to standard
settings", it resets it to (list buffers-tab-selection-function), but
it evaluates this, so it gets set to '(nil). Then you get errors
whenever you do anything, because every time the buffer tabs get
redisplayed, the nonexistent function `nil' gets called.
If you agree with my suggestion of removing the customizable variable
buffers-tab-selection-function, should it be kept as a defvar, or as a
defcustom with some other group (is there a customization group for
obsolete options?), or as a defcustom in the current group, but
labeled as obsolete? (I like the defvar choice, personally.)
3. Furthermore, I think the customization type for
buffers-tab-filter-functions should be
:type '(repeat function)
instead of
:type '(choice (const :tag "None" nil)
sexp)
4. Finally, there was some discussion in comp.emacs.xemacs about
changing the default behavior for buffer tabs -- in particular, to
change the default value for buffers-tab-filter-functions to nil.
Opinions on whether to do that?
Comments? Should I submit a patch with these changes, or am I
completely confused and things are actually perfect as they are?
(I suppose if I don't hear anything, I'll submit a patch.)
--
J. H. Palmieri
Dept of Mathematics, Box 354350 mailto:palmieriļ¼ math.washington.edu
University of Washington
http://www.math.washington.edu/~palmieri/
Seattle, WA 98195-4350