Function: help-fns--analyze-function

help-fns--analyze-function is a byte-compiled function defined in help-fns.el.gz.

Signature

(help-fns--analyze-function FUNCTION)

Documentation

Return information about FUNCTION.

Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF).

Source Code

;; Defined in /usr/src/emacs/lisp/help-fns.el.gz
(defun help-fns--analyze-function (function)
  ;; FIXME: Document/explain the differences between FUNCTION,
  ;; REAL-FUNCTION, DEF, and REAL-DEF.
  "Return information about FUNCTION.
Returns a list of the form (REAL-FUNCTION DEF ALIASED REAL-DEF)."
  (let* ((advised (and (symbolp function)
		       (advice--p (advice--symbol-function function))))
	 ;; If the function is advised, use the symbol that has the
	 ;; real definition, if that symbol is already set up.
	 (real-function
	  (or (and advised
                   (advice--cd*r (advice--symbol-function function)))
	      function))
	 ;; Get the real definition, if any.
	 (def (if (symbolp real-function)
                  (cond ((symbol-function real-function))
                        ((get real-function 'function-documentation)
                         nil)
                        (t (signal 'void-function (list real-function))))
		real-function))
	 (aliased (and def
                       (or (symbolp def)
                           ;; Advised & aliased function.
                           (and advised (symbolp real-function)
                                (not (eq 'autoload (car-safe def))))
                           (and (subrp def) (symbolp function)
                                (not (string= (subr-name def)
                                              (symbol-name function)))))))
	 (real-def (cond
                    ((and aliased (not (subrp def)))
                     (let ((f real-function))
                       (while (and (fboundp f)
                                   (symbolp (symbol-function f)))
                         (setq f (symbol-function f)))
                       f))
		    ((subrp def) (intern (subr-name def)))
                    (t def))))

    ;; If we don't have a doc string, then try to load the file.
    (when (and help-enable-symbol-autoload
               (autoloadp real-def)
               ;; Empty documentation slot.
               (not (nth 2 real-def)))
      (condition-case err
          (autoload-do-load real-def)
        (error (message "Error while autoloading: %S" err))))

    (list real-function def aliased real-def)))