all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'MON KEY'" <monkey@sandpframing.com>, <emacs-devel@gnu.org>
Subject: RE: keywordp & :killing-the-cat
Date: Sat, 5 Sep 2009 14:14:46 -0700	[thread overview]
Message-ID: <9C86F0EAC52544628CBA55A43FF2F935@us.oracle.com> (raw)
In-Reply-To: <d2afcfda0909051337j34e5bf6ar5851f148a66e1595@mail.gmail.com>

> (keywordp :killing-the-cat-with-epr) ;=> t
> (unintern :killing-the-cat-with-epr) ;=> t
> 
> (mapatoms (lambda (x)
> 	    (when (eq x :killing-the-cat-with-epr)
> 		(prin1 `(found ,x))))
> 	    	  obarray)

Evaluating (actually, Lisp reading) that sexp creates and interns a symbol
`:killing-the-cat-with-epr'.

Try this instead:

(mapatoms (lambda (x)
	      (when (string= (symbol-name x)
                           ":killing-the-cat-with-epr")
		  (prin1 `(found ,x))))
          obarray)

Replace ":killing-the-cat-with-epr" by the name of an existing symbol, e.g.
"forward-char", to see the difference.

> how does one use keywordp to test if a (possibly
> non-existent) keyword is interned without interning it?

You don't use keywordp for that. keywordp:

 Return t if OBJECT is a keyword.
 This means that it is a symbol with a print name beginning with `:'
 interned in the initial obarray.

IOW, keywordp returns non-nil only for an interned symbol (whose print name
starts with `:').

If you want to check whether a symbol is interned, use `intern-soft':

(intern-soft ":killing-the-cat-with-epr") -> nil
(intern-soft "forward-char") -> forward-char






      reply	other threads:[~2009-09-05 21:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-05 20:37 keywordp & :killing-the-cat MON KEY
2009-09-05 21:14 ` Drew Adams [this message]

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=9C86F0EAC52544628CBA55A43FF2F935@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=monkey@sandpframing.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.