mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
Append elisp variable's value to eldoc
This commit is contained in:
@ -84,6 +84,24 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
|
|||||||
;; Recenter window after following definition
|
;; Recenter window after following definition
|
||||||
(advice-add #'elisp-def :after #'doom-recenter-a)
|
(advice-add #'elisp-def :after #'doom-recenter-a)
|
||||||
|
|
||||||
|
(defadvice! +emacs-lisp-append-value-to-eldoc-a (orig-fn sym)
|
||||||
|
"Display variable value next to documentation in eldoc."
|
||||||
|
:around #'elisp-get-var-docstring
|
||||||
|
(when-let (ret (funcall orig-fn sym))
|
||||||
|
(concat ret " "
|
||||||
|
(let* ((truncated " [...]")
|
||||||
|
(limit (- (frame-width) (length ret) (length truncated) 1))
|
||||||
|
(str (symbol-value sym))
|
||||||
|
(str (prin1-to-string
|
||||||
|
(if (stringp str)
|
||||||
|
(replace-regexp-in-string "\n" "
|
||||||
|
" str)
|
||||||
|
str)))
|
||||||
|
(str-length (length str))
|
||||||
|
(short (< str-length limit)))
|
||||||
|
(concat (substring (propertize str 'face 'warning)
|
||||||
|
0 (if short str-length limit))
|
||||||
|
(unless short truncated))))))
|
||||||
|
|
||||||
(map! :localleader
|
(map! :localleader
|
||||||
:map emacs-lisp-mode-map
|
:map emacs-lisp-mode-map
|
||||||
|
Reference in New Issue
Block a user