all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#11295: 24.0.95; New ibuffer filter derived-mode
@ 2012-04-21 11:11 Ivan Andrus
  2012-04-21 14:24 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Ivan Andrus @ 2012-04-21 11:11 UTC (permalink / raw)
  To: 11295

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





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-04-24  3:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-21 11:11 bug#11295: 24.0.95; New ibuffer filter derived-mode Ivan Andrus
2012-04-21 14:24 ` Stefan Monnier
2012-04-21 15:24   ` Ivan Andrus
2012-04-21 19:44     ` Stefan Monnier
2012-04-23 18:51       ` Ivan Andrus
2012-04-24  3:46         ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.