From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#11295: 24.0.95; New ibuffer filter derived-mode Date: Sat, 21 Apr 2012 10:24:54 -0400 Message-ID: References: <5DACA6C4-9C85-4464-B488-5FEEB6919839@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1335018339 2366 80.91.229.3 (21 Apr 2012 14:25:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 21 Apr 2012 14:25:39 +0000 (UTC) Cc: 11295@debbugs.gnu.org To: Ivan Andrus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 21 16:25:38 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SLbFp-00079l-KG for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Apr 2012 16:25:37 +0200 Original-Received: from localhost ([::1]:38664 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SLbFo-0004wP-Sc for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Apr 2012 10:25:36 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SLbFl-0004wJ-N5 for bug-gnu-emacs@gnu.org; Sat, 21 Apr 2012 10:25:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SLbFk-0001Cm-0j for bug-gnu-emacs@gnu.org; Sat, 21 Apr 2012 10:25:33 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44757) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SLbFj-0001CT-T3 for bug-gnu-emacs@gnu.org; Sat, 21 Apr 2012 10:25:31 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SLbGE-0001VI-3k for bug-gnu-emacs@gnu.org; Sat, 21 Apr 2012 10:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Apr 2012 14:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11295 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11295-submit@debbugs.gnu.org id=B11295.13350183345735 (code B ref 11295); Sat, 21 Apr 2012 14:26:02 +0000 Original-Received: (at 11295) by debbugs.gnu.org; 21 Apr 2012 14:25:34 +0000 Original-Received: from localhost ([127.0.0.1]:45790 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SLbFm-0001UR-4W for submit@debbugs.gnu.org; Sat, 21 Apr 2012 10:25:34 -0400 Original-Received: from ironport-out.teksavvy.com ([206.248.143.162]:58687) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SLbFj-0001UB-NI for 11295@debbugs.gnu.org; Sat, 21 Apr 2012 10:25:31 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjIKACxOgk/O+K5t/2dsb2JhbABDtheCDAOBDIEIggkBAQQBViMFCwsOJhIUGA0kiBwFtjKLYYR5BKRFgV2DAw X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="175740678" Original-Received: from 206-248-174-109.dsl.teksavvy.com (HELO pastel.home) ([206.248.174.109]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 21 Apr 2012 10:24:55 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id D4C0258D2D; Sat, 21 Apr 2012 10:24:54 -0400 (EDT) In-Reply-To: <5DACA6C4-9C85-4464-B488-5FEEB6919839@gmail.com> (Ivan Andrus's message of "Sat, 21 Apr 2012 13:11:35 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:59355 Archived-At: > (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