all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <emacs-devel@gnu.org>
Subject: why does `variable-at-point' return 0?
Date: Fri, 6 Apr 2012 17:23:07 -0700	[thread overview]
Message-ID: <2F0E226322EE44669007194BC8389F81@us.oracle.com> (raw)

Just curious.  Why doesn't `variable-at-point' return nil if there is no
variable at point?

All I can think of is that for some reason someone wanted to test using
`symbolp' instead of testing using `not' (or `and').  But I cannot imagine why.

Checking how `variable-at-point' is actually used in the source code did not
enlighten me.  Each use just checks whether the value is `symbolp' and goes on
from there.  An actual value of zero is never used AFAICT, except to serve as a
non-symbol.

There is no special need to distinguish nil from any variable - in Emacs Lisp
you cannot give the symbol nil a symbol-value other than nil.

It is true that (boundp nil) is true, so `boundp' is not a test of variableness.
But I don't see why it wouldn't be just as easy to test whether the value is nil
instead of testing whether it is a symbol.  What am I missing?




             reply	other threads:[~2012-04-07  0:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-07  0:23 Drew Adams [this message]
2012-04-16 18:07 ` why does `variable-at-point' return 0? Drew Adams
2012-04-19 19:50   ` Štěpán Němec
2012-04-19 21:28     ` Drew Adams
2012-04-19 21:52   ` Stefan Monnier
2012-04-19 22:56     ` Juanma Barranquero
2012-04-20 18:14     ` Štěpán Němec
2012-04-20 22:57       ` Juanma Barranquero
2012-04-21  2:24       ` 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=2F0E226322EE44669007194BC8389F81@us.oracle.com \
    --to=drew.adams@oracle.com \
    --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.