Function: function-alias-p

function-alias-p is a byte-compiled function defined in compat-29.el.

Signature

(function-alias-p FUNC &optional NOERROR)

Documentation

[Compatibility function for function-alias-p, defined in Emacs 29.1. See
(compat) Emacs 29.1' for more details.]

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 signalled. If NOERROR, the non-loop parts of the chain is returned.

Source Code

;; Defined in ~/.emacs.d/elpa/compat-30.1.0.1/compat-29.el
(compat-defun function-alias-p (func &optional noerror) ;; <compat-tests:function-alias-p>
  "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
signalled.  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))))