When I run the following three lines with eval-region

(defcustom custom-var "some-custom-value" "for testing only")
(setq indirectRef (make-symbol "custom-var"))
(message "ref=%s, is bound=%s" indirectRef (boundp indirectRef))

the output is

`ref=custom-var, is bound=nil`

Why does boundp not return t?


1 Answer 1


You're mixing up a few things.

  • Your (defcustom...) is essentially irrelevant to the rest, except that it sets the value of variable custom-var to a given string.
  • You need to C-h f make-symbol and C-h f intern. And see (elisp) Creating Symbols.

make-symbol is a built-in function in ‘C source code’.

(make-symbol NAME)

Return a newly allocated uninterned symbol whose name is NAME.

Its value is void, and its function definition and property list are nil.

intern is a built-in function in ‘C source code’.

(intern STRING &optional OBARRAY)

Return the canonical symbol whose name is STRING.

If there is none, one is created by this function and returned.

A second optional argument specifies the obarray to use; it defaults to the value of obarray.

(boundp 'custom-var)                ; => t, since you did the `defcustom`.
(boundp (intern "custom-var"))      ; => t, since `intern` returns the same symbol.
(boundp (make-symbol "custom-var")) ; => nil. `make-symbol` returns an uninterned symbol.

More succinctly:

(eq (intern "custom-var") (make-symbol "custom-var"))      ; => nil.
(eq (make-symbol "custom-var") (make-symbol "custom-var")) ; => nil.
(eq (intern "custom-var") (intern "custom-var"))           ; => t.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.