GNU bug report logs - #11295
24.0.95; New ibuffer filter derived-mode

Previous Next

Package: emacs;

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ivan Andrus <darthandrus <at> gmail.com>
Cc: 11295 <at> debbugs.gnu.org
Subject: bug#11295: 24.0.95; New ibuffer filter derived-mode
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




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.