Add eldoc mode-line theme

This commit is contained in:
Henrik Lissner 2016-09-12 16:31:45 +02:00
parent c100bb0eb1
commit 878e3d9d07
2 changed files with 42 additions and 5 deletions

View File

@ -350,5 +350,47 @@ to be enabled."
(setq-default mode-line-format (doom-mode-line))
;; Eldoc support
(defun doom-eldoc-show-in-mode-line (input)
"Display string STR in the mode-line next to minibuffer."
(with-current-buffer (eldoc-current-buffer)
(let* ((max (window-width (selected-window)))
(str (and (stringp input) (concat " " input)))
(len (length str))
(tmp-str str)
(mode-line-format (or (and str (doom-eldoc-mode-line))
mode-line-format))
roll mode-line-in-non-selected-windows)
(catch 'break
(if (and (> len max) eldoc-mode-line-rolling-flag)
(progn
(while (setq roll (sit-for 0.3))
(setq tmp-str (substring tmp-str 2)
mode-line-format (concat tmp-str " [<]" str))
(force-mode-line-update)
(when (< (length tmp-str) 2) (setq tmp-str str)))
(unless roll
(when eldoc-mode-line-stop-rolling-on-input
(setq eldoc-mode-line-rolling-flag nil))
(throw 'break nil)))
(force-mode-line-update)
(sit-for eldoc-show-in-mode-line-delay))))
(force-mode-line-update)))
(defun doom-eldoc-mode-line ()
`(:eval
(let ((active (eq (selected-window) mode-line-selected-window)))
(list (list (propertize " " 'display mode-line-eldoc-bar)
(and (bound-and-true-p str) str))
(propertize
" " 'display `((space :align-to (1- (+ right right-fringe right-margin)))))))))
(use-package eldoc-eval
:config
(setq eldoc-in-minibuffer-show-fn 'doom-eldoc-show-in-mode-line)
(eldoc-in-minibuffer-mode +1))
(defvar eldoc-mode-line-format (doom-eldoc-mode-line))
(provide 'core-modeline)
;;; core-modeline.el ends here

View File

@ -76,11 +76,6 @@
(when (and (> emacs-major-version 24) (featurep 'eldoc))
(global-eldoc-mode -1))
(use-package eldoc-eval
:config
(setq eldoc-in-minibuffer-show-fn 'doom/eldoc-show-in-mode-line)
(eldoc-in-minibuffer-mode +1))
;; Highlight TODO/FIXME/NOTE tags
(add-hook! (prog-mode emacs-lisp-mode css-mode)
(font-lock-add-keywords