help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Applying intern-soft to a symbol


From: N. Raghavendra
Subject: Applying intern-soft to a symbol
Date: Mon, 24 Apr 2017 20:37:35 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]