all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Applying intern-soft to a symbol
@ 2017-04-24 15:07 N. Raghavendra
  2017-04-24 17:41 ` John Mastro
  0 siblings, 1 reply; 4+ messages in thread
From: N. Raghavendra @ 2017-04-24 15:07 UTC (permalink / raw)
  To: help-gnu-emacs

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/



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-25 23:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-24 15:07 Applying intern-soft to a symbol N. Raghavendra
2017-04-24 17:41 ` John Mastro
2017-04-25 19:51   ` N. Raghavendra
2017-04-25 23:20     ` Emanuel Berg

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.