From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: Binding a key to an ibuffer filter Date: Sat, 28 Feb 2009 09:50:11 -0800 Message-ID: <000501c999cd$00ed8000$0200a8c0@us.oracle.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1235843458 24990 80.91.229.12 (28 Feb 2009 17:50:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 28 Feb 2009 17:50:58 +0000 (UTC) To: , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 28 18:52:15 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LdTM4-0004Rc-Pw for geh-help-gnu-emacs@m.gmane.org; Sat, 28 Feb 2009 18:52:10 +0100 Original-Received: from localhost ([127.0.0.1]:34275 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LdTKi-0004XB-60 for geh-help-gnu-emacs@m.gmane.org; Sat, 28 Feb 2009 12:50:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LdTKJ-0004Uu-Q4 for help-gnu-emacs@gnu.org; Sat, 28 Feb 2009 12:50:15 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LdTKF-0004Rd-0A for help-gnu-emacs@gnu.org; Sat, 28 Feb 2009 12:50:15 -0500 Original-Received: from [199.232.76.173] (port=39208 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LdTKE-0004Ra-RE for help-gnu-emacs@gnu.org; Sat, 28 Feb 2009 12:50:10 -0500 Original-Received: from rcsinet11.oracle.com ([148.87.113.123]:26637 helo=rgminet11.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LdTKD-0000ch-Gu for help-gnu-emacs@gnu.org; Sat, 28 Feb 2009 12:50:10 -0500 Original-Received: from rgminet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rgminet11.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n1SHqZic009099 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 28 Feb 2009 17:52:36 GMT Original-Received: from acsmt706.oracle.com (acsmt706.oracle.com [141.146.40.84]) by rgminet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n1SHnxxR031337; Sat, 28 Feb 2009 17:50:00 GMT Original-Received: from dradamslap1 (/141.144.72.79) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 28 Feb 2009 09:49:56 -0800 X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcmZy7TyOtSHQ2RHRBKqtiYF/M1zPAAARQkg In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Source-IP: acsmt706.oracle.com [141.146.40.84] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A01020A.49A97946.0089:SCFSTAT928724,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:62481 Archived-At: > I'm trying to bind a key to a filter in ibuffer-mode. I created a > filter to display only C/C++ source files and it works ok manually (I > can switch to it using ibuffer-switch-to-saved-filter). I also added > the following code to .emacs: > > (defun ibuffer-display-source-files () > (ibuffer-switch-to-saved-filter "c")) > > (define-key ibuffer-mode-map [f1] 'ibuffer-display-source-files) > > However, when I click F1 in ibuffer I get the following error: > > Wrong type argument: commandp, ibuffer-display-source-files > > Any idea? The error message is telling you that `ibuffer-display-source-files' is not a command. A command in Emacs is a function that has an `interactive' spec. So do this: (defun ibuffer-display-source-files () (interactive) ; <==== MISSING (ibuffer-switch-to-saved-filter "c")) Consider also adding a doc string, for your users. ;-)