Properly show function arguments in the modeline
When one is working in the minibuffer, using eval, the function arguments are shown in the modeline. This normally messes up the modeline when using an SVG modeline, but with this function it should show it properly.
This commit is contained in:
parent
6b25025611
commit
1eee0de460
1 changed files with 34 additions and 1 deletions
|
@ -45,6 +45,36 @@
|
|||
(not (equal jabber-activity-mode-string "")))
|
||||
(concat jabber-activity-mode-string " "))))
|
||||
|
||||
;;; TODO Turn:
|
||||
;; #("message: (FORMAT-STRING &rest ARGS)"
|
||||
;; 0 7 (face font-lock-function-name-face)
|
||||
;; 10 23 (face eldoc-highlight-function-argument))
|
||||
;;; into:
|
||||
;;; (tspan (tspan :fill (fg-color font-lock-function-name-face) "message:")
|
||||
;;; " ("
|
||||
;;; (tspan :fill (fg-color highlight-function-argument) "FORMAT-STRING")
|
||||
;;; " &rest ARGS)")
|
||||
(defun my-smt-eldoc-minibuffer-message (format-string &rest args)
|
||||
(if (minibufferp)
|
||||
(progn
|
||||
(add-hook 'minibuffer-exit-hook
|
||||
(lambda () (setq my-smt-eldoc-message nil
|
||||
eldoc-mode-line-string nil
|
||||
eldoc-last-message nil))
|
||||
nil t)
|
||||
(setq my-smt-eldoc-message
|
||||
(when (stringp format-string)
|
||||
(apply 'format format-string args)))
|
||||
(force-mode-line-update t))
|
||||
(apply 'message format-string args)))
|
||||
|
||||
(defvar my-smt-eldoc-message nil)
|
||||
(smt/defwidget my-smt-eldoc-message
|
||||
:text (lambda (widget)
|
||||
(ignore widget)
|
||||
(when my-smt-eldoc-message
|
||||
`(tspan :fill "#bfbfbf" " (" (tspan :fill "#5476a8" ,my-smt-eldoc-message) ")"))))
|
||||
|
||||
(defun my-smt-yoshi-title-style (widget)
|
||||
"Fill color for either active or inactive windows.
|
||||
|
||||
|
@ -112,7 +142,7 @@ WIDGET is ignored."
|
|||
(smt/defrow my-smt-left
|
||||
:prototype 'default-left
|
||||
:widgets '(buffer-info my-smt-buffer-identification my-smt-po-counters
|
||||
which-function))
|
||||
which-function my-smt-eldoc-message))
|
||||
|
||||
(smt/defrow my-smt-position
|
||||
:prototype 'default-position
|
||||
|
@ -131,5 +161,8 @@ WIDGET is ignored."
|
|||
:style 'my-smt-major-mode-style)))
|
||||
:rows '(my-smt-left my-smt-position my-smt-right))
|
||||
|
||||
(add-function :override (symbol-function 'eldoc-minibuffer-message)
|
||||
#'my-smt-eldoc-minibuffer-message)
|
||||
|
||||
(provide 'my-smt)
|
||||
;;; my-smt.el ends here
|
||||
|
|
Loading…
Reference in a new issue