all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "N. Raghavendra" <nyraghu27132@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Applying intern-soft to a symbol
Date: Mon, 24 Apr 2017 20:37:35 +0530	[thread overview]
Message-ID: <87fugxkfns.fsf@gmail.com> (raw)

I am confused about the following Emacs Lisp interaction, where I've
numbered the prompts for ease of reference.

*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP1> (intern-soft "quux")
nil
ELISP2> (intern-soft 'quux)
quux
ELISP3> (intern-soft "quux")
quux
ELISP4>

As I understand, the value of ELISP1 indicates that `quux' is not an
interned symbol in the default obarray.  The value of ELISP2 indicates
that `quux' is now an interned symbol in the default obarray, and the
value of ELISP3 confirms this.

Now, the Emacs Lisp manual says the following about intern-soft:

----------------------------------------------------------------------
Function: intern-soft name &optional obarray
  This function returns the symbol in OBARRAY whose name is NAME, or
  ‘nil’ if OBARRAY has no symbol with that name.  Therefore, you can
  use ‘intern-soft’ to test whether a symbol with a given name is
  already interned.  If OBARRAY is omitted, the value of the global
  variable ‘obarray’ is used.

  The argument NAME may also be a symbol; in that case, the function
  returns NAME if NAME is interned in the specified obarray, and
  otherwise ‘nil’.
----------------------------------------------------------------------

According to the second paragraph of this description, ELISP2 should
have returned nil, because the symbol `quux' was then not interned in
the default obarray.  Can someone please explain why ELISP2 returns
`quux' instead of nil?

Raghu.

--
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/



             reply	other threads:[~2017-04-24 15:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24 15:07 N. Raghavendra [this message]
2017-04-24 17:41 ` Applying intern-soft to a symbol John Mastro
2017-04-25 19:51   ` N. Raghavendra
2017-04-25 23:20     ` 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=87fugxkfns.fsf@gmail.com \
    --to=nyraghu27132@gmail.com \
    --cc=help-gnu-emacs@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.