all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ivan Andrus <darthandrus@gmail.com>
To: 11295@debbugs.gnu.org
Subject: bug#11295: 24.0.95; New ibuffer filter derived-mode
Date: Sat, 21 Apr 2012 13:11:35 +0200	[thread overview]
Message-ID: <5DACA6C4-9C85-4464-B488-5FEEB6919839@gmail.com> (raw)

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





             reply	other threads:[~2012-04-21 11:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-21 11:11 Ivan Andrus [this message]
2012-04-21 14:24 ` bug#11295: 24.0.95; New ibuffer filter derived-mode 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5DACA6C4-9C85-4464-B488-5FEEB6919839@gmail.com \
    --to=darthandrus@gmail.com \
    --cc=11295@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.