GNU bug report logs -
#11295
24.0.95; New ibuffer filter derived-mode
Previous Next
Reported by: Ivan Andrus <darthandrus <at> gmail.com>
Date: Sat, 21 Apr 2012 11:13:01 UTC
Severity: wishlist
Found in version 24.0.95
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Apr 21, 2012, at 4:24 PM, Stefan Monnier wrote:
>> (define-ibuffer-filter derived-mode
>> "Toggle current view to buffers whose major mode inherits from QUALIFIER."
>> (:description "major mode"
>> :reader
>> (intern
>> (completing-read "Filter by major mode: " obarray
>> #'(lambda (e)
>> (string-match "-mode$"
>> (symbol-name e)))
>
> This completion table doesn't sound very good. Much better would be to
> collect all major modes in use and all their parents.
That is a much better idea. As I said, I just copy/pasted without thinking too much. My main use case is for `ibuffer-saved-filter-groups' so completion doesn't matter at all there.
>> t
>> (let ((buf (ibuffer-current-buffer)))
>> (if (and buf (buffer-live-p buf))
>> (symbol-name (buffer-local-value 'major-mode buf))
>> "")))))
>> (let ((parent (buffer-local-value 'major-mode buf)))
>> (while (and (not (eq parent qualifier))
>> (setq parent (get parent 'derived-mode-parent))))
>> (eq parent qualifier)))
>
> Why not use (with-current-buffer buf (derived-mode-p parent))?
Uh. That would have been too easy. :-)
> Another question: couldn't it simply *replace* the existing mode filter?
> I guess it could be a bit annoying if you want to see fundamental-mode
> buffers (since most modes derive from it), but that's the only downside
> I can think of.
I thought about it, but I do in fact filter by fundamental-mode (and a few other modes) to hide "useless" buffers.
-Ivan
This bug report was last modified 13 years and 90 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.