all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ian Eure <ian@digg.com>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: "(setq name)": Is this a bug?
Date: Tue, 14 Jul 2009 09:47:20 -0700	[thread overview]
Message-ID: <836C4588-D402-4BCB-8E8D-574413B65B7E@digg.com> (raw)
In-Reply-To: <20090714160146.GB1718@muc.de>

On Jul 14, 2009, at 9:01 AM, Alan Mackenzie wrote:

> Hi, Emacs,
>
> In .../lisp/files.el, function set-auto-mode, L2553, appears the  
> strange
> invocation:
>
>    (setq name)
>
> .  One of my analysis tools tripped up on it.  According to setq's doc
> string, this is invalid.  In each [SYM VAL] in (setq [SYM VAL] ...),  
> the
> VAL is not optional.  Surely?
>
I suspect the documentation just isn't clear. From a brief reading of  
the source, setq supports 0/1/odd arguments, with `nil' being used in  
the case of non-mod-two argument arity.

In a nutshell, it loops over the arguments two at a time until they're  
empty, setting the car of the args_left to the evaluated cadr of  
args_left. If you're at the end of a list, the cdr is `nil', and the  
car of `nil' is also `nil'.

So if you give it an odd number of arguments, the last value will be  
nil.

  - Ian




  reply	other threads:[~2009-07-14 16:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-14 16:01 "(setq name)": Is this a bug? Alan Mackenzie
2009-07-14 16:47 ` Ian Eure [this message]
2009-07-14 18:49 ` Stefan Monnier

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=836C4588-D402-4BCB-8E8D-574413B65B7E@digg.com \
    --to=ian@digg.com \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /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.