From: "Drew Adams" <drew.adams@oracle.com>
To: "'Matt Price'" <moptop99@gmail.com>, <help-gnu-emacs@gnu.org>
Subject: RE: basic help evaluating function in an alist
Date: Sat, 1 Dec 2012 15:12:02 -0800 [thread overview]
Message-ID: <DFCEFC16EFE84DFEB0E23A63E0BE84AC@us.oracle.com> (raw)
In-Reply-To: <CAN_Dec846b5Q0SfxWbhCKgfS-SU9BpRpeuOTR_ge6PvtUKZbMg@mail.gmail.com>
> i'm trying to figure out what's wrong with this simple code:
> (add-to-list 'my-winlist
> '(guide . (selected-window)))
> (windmove-right)
> (select-window(cdr(assoc 'guide my-winlist)) )
Break it down. Forget about `windmove-right'. Just check the value of
`my-winlist' after you added the element.
(setq my-winlist ())
(add-to-list 'my-winlist
'(guide . (selected-window)))
`C-h v my-winlist' shows:
((guide selected-window))
That's the same as ((guide . (selected-window)))
Already you can see the problem: no window, just a list with the symbol
`selected-window' as its sole element.
If you want, try `M-: (cdr (assoc 'guide my-winlist))', to see that element:
(selected-window).
You need to evaluate `(selected-window)', not just use that list as the cdr of
your element. Here's what you need:
(setq my-winlist ())
(add-to-list 'my-winlist
(cons 'guide (selected-window)))
`C-h v my-winlist' shows a list with one element, which is a dotted pair (aka
cons cell), whose cdr is a window:
((guide . #<window 84 on *scratch*>))
With backquote syntax you can express the same thing this way:
(setq my-winlist ())
(add-to-list 'my-winlist
`(guide ,(selected-window)))
I recommend that you read this manual that comes with Emacs (use `C-h i'):
`Emacs Lisp Intro'. HTH.
next prev parent reply other threads:[~2012-12-01 23:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-01 22:57 basic help evaluating function in an alist Matt Price
2012-12-01 23:12 ` Drew Adams [this message]
2012-12-02 2:40 ` Matt Price
2012-12-02 3:44 ` Drew Adams
2012-12-04 14:41 ` Matt Price
[not found] <mailman.14266.1354402640.855.help-gnu-emacs@gnu.org>
2012-12-01 23:12 ` WJ
2012-12-02 1:06 ` WJ
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=DFCEFC16EFE84DFEB0E23A63E0BE84AC@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=moptop99@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.