Function: eldoc--format-doc-buffer

eldoc--format-doc-buffer is a byte-compiled function defined in eldoc.el.gz.

Signature

(eldoc--format-doc-buffer DOCS)

Documentation

Ensure DOCS are displayed in an *eldoc* buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/eldoc.el.gz
(defun eldoc--format-doc-buffer (docs)
  "Ensure DOCS are displayed in an *eldoc* buffer."
  (with-current-buffer (if (buffer-live-p eldoc--doc-buffer)
                           eldoc--doc-buffer
                         (setq eldoc--doc-buffer
                               (get-buffer-create " *eldoc*")))
    (let ((inhibit-read-only t)
          (things-reported-on))
      (special-mode)
      (erase-buffer)
      (setq-local nobreak-char-display nil)
      (cl-loop for (docs . rest) on docs
               for (this-doc . plist) = docs
               for thing = (plist-get plist :thing)
               when thing do
               (cl-pushnew thing things-reported-on)
               (setq this-doc
                     (concat
                      (propertize (format "%s" thing)
                                  'face (plist-get plist :face))
                      ": "
                      this-doc))
               do (insert this-doc)
               when rest do
               (insert eldoc-doc-buffer-separator)
               finally (goto-char (point-min)))
      ;; Rename the buffer, taking into account whether it was
      ;; hidden or not
      (rename-buffer (format "%s*eldoc%s*"
                             (if (string-match "^ " (buffer-name)) " " "")
                             (if things-reported-on
                                 (format " for %s"
                                         (mapconcat
                                          (lambda (s) (format "%s" s))
                                          things-reported-on
                                          ", "))
                               "")))))
  eldoc--doc-buffer)