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
I have often wished to be able to use derived-mode instead of mode when
filtering in ibuffer. This allows, for example, grouping all make files
without specifying each variant make file mode individually. I finally
looked into adding this and it's very easy.
I have attached one possible implemention below. I feel it's definitely
a trivial addition (I don't have papers on file with the FSF) since it
consists mostly of copy/paste from `derived-mode-p' and the `mode'
ibuffer-filter. If, however, you disagree that it's not trivial, please
reimplement as needed. You can also contact me about papers, though it
seems like a lot of work for such a small addition.
(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)))
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)))
In GNU Emacs 24.0.95.1 (i386-apple-darwin10.8.0, NS apple-appkit-1038.36)
of 2012-04-07 on oroszlan.local
This bug report was last modified 13 years and 92 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.