Subject: Re: bug#11295: 24.0.95; New ibuffer filter derived-mode

From: Stefan Monnier <[email-masked]>
Date: Sat, 21 Apr 2012 10:24:54 -0400

>   (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.

>                                     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))?

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.

        Stefan