Function: macroexp-const-p

macroexp-const-p is a byte-compiled function defined in macroexp.el.gz.

Signature

(macroexp-const-p EXP)

Documentation

Return non-nil if EXP will always evaluate to the same value.

Aliases

hack-one-local-variable-constantp (obsolete since 29.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/macroexp.el.gz
(defun macroexp-const-p (exp)
  "Return non-nil if EXP will always evaluate to the same value."
  (cond ((consp exp) (or (eq (car exp) 'quote)
                         (and (eq (car exp) 'function)
                              (symbolp (cadr exp)))))
        ;; It would sometimes make sense to pass `any-value', but it's not
        ;; always safe since a "constant" variable may not actually always have
        ;; the same value.
        ((symbolp exp) (macroexp--const-symbol-p exp))
        (t t)))