Skip to content

Instantly share code, notes, and snippets.

@Rovanion
Last active March 4, 2020 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rovanion/a97fe3bbaf07f0fa2a5a1661e421c29d to your computer and use it in GitHub Desktop.
Save Rovanion/a97fe3bbaf07f0fa2a5a1661e421c29d to your computer and use it in GitHub Desktop.
(defun elisp-showdoc (f)
(interactive (list (thing-at-point 'symbol t)))
(message
"%s"
(let* ((doc-list (split-string (documentation (intern f)) "\n"))
(number-lines (min (- (floor (* max-mini-window-height (frame-height))) 2)
(- (length doc-list) 2)))
(subset (concatenate 'list
(last doc-list)
'("")
(subseq doc-list 0 number-lines)))
(pruned-subset (if (string-equal (car (last subset)) "")
(butlast subset)
subset)))
(mapconcat #'identity pruned-subset "\n"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment