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

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

Re: How to test if symbol from string exists?


From: Gregory Heytings
Subject: Re: How to test if symbol from string exists?
Date: Fri, 16 Apr 2021 09:20:13 +0000



I would like to test if symbol exists. So I am trying this:

(bound-and-true-p (intern "rcd-db-people-mode-map"))

and I get error:

Wrong type argument: symbolp, (intern "rcd-db-people-mode-map")


That's because bound-and-true-p quotes its argument. You can use another macro for that:

(defmacro bound-and-true-symbol-p (name)
  "Return the value of symbol with name NAME if it is bound, else nil."
  `(and (boundp (intern ,name)) (symbol-value (intern ,name))))



reply via email to

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