Function: cl--map-methods-documentation

cl--map-methods-documentation is a byte-compiled function defined in cl-generic.el.gz.

Signature

(cl--map-methods-documentation FUNNAME METNAME-PRINTER)

Documentation

Iterate on FUNNAME's methods documentation at point.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-generic.el.gz
(defun cl--map-methods-documentation (funname metname-printer)
  "Iterate on FUNNAME's methods documentation at point."
  ;; Supposedly this is called from help-fns, so help-fns should be loaded at
  ;; this point.
  (require 'help-fns)
  (declare-function help-fns-short-filename "help-fns" (filename))
  (let ((generic (if (symbolp funname) (cl--generic funname))))
    (when generic
      (require 'help-mode)              ;Needed for `help-function-def' button!
      ;; Loop over fanciful generics
      (dolist (method (cl--generic-method-table generic))
        (pcase-let*
            ((`(,qualifiers ,args ,doc) (cl--generic-method-info method))
             ;; FIXME: Add hyperlinks for the types as well.
             (quals (if (length> qualifiers 0)
                        (concat (substring qualifiers
                                           0 (string-match " *\\'"
                                                           qualifiers))
                                "\n")
                      ""))
             (met-name (cl--generic-load-hist-format
                        funname
                        (cl--generic-method-qualifiers method)
                        (cl--generic-method-specializers method)))
             (file (find-lisp-object-file-name met-name 'cl-defmethod)))
          (funcall metname-printer
                   quals
                   (cons funname
                         (cl--generic-upcase-formal-args args))
                   (when file
                     (make-text-button (help-fns-short-filename file) nil
                                       'type 'help-function-def
                                       'help-args
                                       (list met-name file 'cl-defmethod)))
                   doc))))))