* Binding a key to an ibuffer filter
@ 2009-02-28 17:19 etay.meiri
2009-02-28 17:50 ` Drew Adams
[not found] ` <mailman.2094.1235843417.31690.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 4+ messages in thread
From: etay.meiri @ 2009-02-28 17:19 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
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?
Thanks,
-Etay Meiri
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Binding a key to an ibuffer filter
2009-02-28 17:19 Binding a key to an ibuffer filter etay.meiri
@ 2009-02-28 17:50 ` Drew Adams
[not found] ` <mailman.2094.1235843417.31690.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 4+ messages in thread
From: Drew Adams @ 2009-02-28 17:50 UTC (permalink / raw)
To: etay.meiri, help-gnu-emacs
> 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. ;-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Binding a key to an ibuffer filter
[not found] ` <mailman.2094.1235843417.31690.help-gnu-emacs@gnu.org>
@ 2009-02-28 18:49 ` etay.meiri
2009-02-28 19:54 ` Drew Adams
0 siblings, 1 reply; 4+ messages in thread
From: etay.meiri @ 2009-02-28 18:49 UTC (permalink / raw)
To: help-gnu-emacs
Thanks a lot.
Looks like some progress was made.
Now when I click F1 I get an error: "Symbol's function definition is
void: c"
My filter definition is as follow:
'(ibuffer-saved-filters (quote (("c" ((mode . c++-mode))) ("gnus" ((or
(mode . message-mode) (mode . mail-mode) (mode . gnus-group-mode)
(mode . gnus-summary-mode) (mode . gnus-article-mode))))
("programming" ((or (mode . emacs-lisp-mode) (mode . cperl-mode)
(mode . c-mode) (mode . java-mode) (mode . idl-mode) (mode . lisp-
mode)))))))
And I'm calling the switch function using:
(ibuffer-switch-to-saved-filters "c")
Maybe I'm not passing the parameter correctly?
Thanks,
-Etay
On Feb 28, 7:50 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > 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-filters "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. ;-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Binding a key to an ibuffer filter
2009-02-28 18:49 ` etay.meiri
@ 2009-02-28 19:54 ` Drew Adams
0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2009-02-28 19:54 UTC (permalink / raw)
To: etay.meiri, help-gnu-emacs
> > > 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-filters "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. ;-)> Thanks a lot.
>
> Looks like some progress was made.
> Now when I click F1 I get an error: "Symbol's function definition is
> void: c"
>
> My filter definition is as follow:
> '(ibuffer-saved-filters (quote (("c" ((mode . c++-mode))) ("gnus" ((or
> (mode . message-mode) (mode . mail-mode) (mode . gnus-group-mode)
> (mode . gnus-summary-mode) (mode . gnus-article-mode))))
> ("programming" ((or (mode . emacs-lisp-mode) (mode . cperl-mode)
> (mode . c-mode) (mode . java-mode) (mode . idl-mode) (mode . lisp-
> mode)))))))
>
> And I'm calling the switch function using:
> (ibuffer-switch-to-saved-filters "c")
> Maybe I'm not passing the parameter correctly?
I'm not familiar with Ibuffer; perhaps someone else can help here. The error
message is telling you that `c' is not a function.
If someone else doesn't have a suggestion, try: (1) loading the source files
(e.g. ibuf-ext.el), not the byte-compiled files (e.g. ibuf-ext.elc), and then
(2) `M-x debug-on-entry RET ibuffer-switch-to-saved-filters'. Then step through
the debugger using `d' and `c', to see where the problem is.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-28 19:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-28 17:19 Binding a key to an ibuffer filter etay.meiri
2009-02-28 17:50 ` Drew Adams
[not found] ` <mailman.2094.1235843417.31690.help-gnu-emacs@gnu.org>
2009-02-28 18:49 ` etay.meiri
2009-02-28 19:54 ` Drew Adams
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).