[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Syntax to use (let...) in key binding

From: Drew Adams
Subject: RE: Syntax to use (let...) in key binding
Date: Mon, 2 Mar 2015 07:55:03 -0800 (PST)

> I'm guessing it's some stupid mistake, but why doesn't this work?
> (global-set-key [f10] '(let ((b "*Bookmark List*")) (if (get-buffer b)
> '(switch-to-buffer b) 'bookmark-bmenu-list)))
> This results in:
> command-execute: Wrong type argument: commandp, (let ((b "*Bookmark List*"))
> Is the "let" not returning a command like I want it to? debug-on-error
> doesn't seem to be helping me understand this.

What gets bound (or tries to be bound) to the key is the sexp (let...),
not its value (which is a command).  That sexp is not a command.

Remove the quote to have the (let...) be evaluated, and bind its value.

But that is likely not what you want.  I'm guessing that you want to
bind the key to a command (which you would write) that would, itself,
bind `b' etc. and then invoke whatever other code you want.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]