Function: function-alias-p

function-alias-p is a byte-compiled function defined in subr.el.gz.

Signature

(function-alias-p FUNC &optional NOERROR)

Documentation

Return nil if FUNC is not a function alias.

If FUNC is a function alias, return the function alias chain.

If the function alias chain contains loops, an error will be signaled. If NOERROR, the non-loop parts of the chain is returned.

View in manual

Probably introduced at or before Emacs version 29.1.

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun function-alias-p (func &optional noerror)
  "Return nil if FUNC is not a function alias.
If FUNC is a function alias, return the function alias chain.

If the function alias chain contains loops, an error will be
signaled.  If NOERROR, the non-loop parts of the chain is returned."
  (declare (side-effect-free t))
  (let ((chain nil)
        (orig-func func))
    (nreverse
     (catch 'loop
       (while (and (symbolp func)
                   (setq func (symbol-function func))
                   (symbolp func))
         (when (or (memq func chain)
                   (eq func orig-func))
           (if noerror
               (throw 'loop chain)
             (signal 'cyclic-function-indirection (list orig-func))))
         (push func chain))
       chain))))