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: Syntax to use (let...) in key binding Date: Mon, 2 Mar 2015 07:55:03 -0800 (PST) Message-ID: <5941d5ad-f672-43bb-be2c-e9b6d3573546@default> References: <87r3t7quk1.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1425311745 17492 80.91.229.3 (2 Mar 2015 15:55:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Mar 2015 15:55:45 +0000 (UTC) To: torys.anderson@gmail.com, Emacs Help List Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 02 16:55:33 2015 Return-path: Envelope-to: geh-help-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 1YSSgu-0005xO-J2 for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Mar 2015 16:55:32 +0100 Original-Received: from localhost ([::1]:57804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSSgt-0004ud-RK for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Mar 2015 10:55:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSSgf-0004th-A5 for help-gnu-emacs@gnu.org; Mon, 02 Mar 2015 10:55:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YSSga-00081y-C4 for help-gnu-emacs@gnu.org; Mon, 02 Mar 2015 10:55:17 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:42160) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSSga-00081d-5g for help-gnu-emacs@gnu.org; Mon, 02 Mar 2015 10:55:12 -0500 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t22Ft99x013453 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 2 Mar 2015 15:55:10 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t22Ft81B022130 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 2 Mar 2015 15:55:09 GMT Original-Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id t22Ft8uu010036; Mon, 2 Mar 2015 15:55:08 GMT In-Reply-To: <87r3t7quk1.fsf@gmail.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8.2 (807160) [OL 12.0.6691.5000 (x86)] X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:102983 Archived-At: > 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))) >=20 > This results in: > command-execute: Wrong type argument: commandp, (let ((b "*Bookmark List*= ")) >=20 > 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.