From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Ivan Andrus <darthandrus@gmail.com>
Cc: 11295@debbugs.gnu.org
Subject: bug#11295: 24.0.95; New ibuffer filter derived-mode
Date: Sat, 21 Apr 2012 10:24:54 -0400 [thread overview]
Message-ID: <jwvk419qi8q.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <5DACA6C4-9C85-4464-B488-5FEEB6919839@gmail.com> (Ivan Andrus's message of "Sat, 21 Apr 2012 13:11:35 +0200")
> (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
next prev parent reply other threads:[~2012-04-21 14:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-21 11:11 bug#11295: 24.0.95; New ibuffer filter derived-mode Ivan Andrus
2012-04-21 14:24 ` Stefan Monnier [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvk419qi8q.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=11295@debbugs.gnu.org \
--cc=darthandrus@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).