all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: torys.anderson@gmail.com, Emacs Help List <help-gnu-emacs@gnu.org>
Subject: RE: Syntax to use (let...) in key binding
Date: Mon, 2 Mar 2015 07:55:03 -0800 (PST)	[thread overview]
Message-ID: <5941d5ad-f672-43bb-be2c-e9b6d3573546@default> (raw)
In-Reply-To: <87r3t7quk1.fsf@gmail.com>

> 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	other threads:[~2015-03-02 15:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-02 15:37 Syntax to use (let...) in key binding Tory S. Anderson
2015-03-02 15:55 ` Drew Adams [this message]
     [not found] <mailman.1150.1425310684.31049.help-gnu-emacs@gnu.org>
2015-03-02 23:49 ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5941d5ad-f672-43bb-be2c-e9b6d3573546@default \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=torys.anderson@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.