summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2015-01-20 14:37:01 +0100
committerGravatar Tom Willemse2015-01-20 14:37:01 +0100
commit1eee0de460eb78be05538a03c7d1d904f211cab0 (patch)
tree0cb51658544178e393ee9cf57063f21417f662df
parent6b2502561125c16cafd76b8d21bb79c4ffdaf563 (diff)
downloaddotfiles-1eee0de460eb78be05538a03c7d1d904f211cab0.tar.gz
dotfiles-1eee0de460eb78be05538a03c7d1d904f211cab0.zip
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.
-rw-r--r--emacs/.emacs.d/site-lisp/my-smt.el35
1 files changed, 34 insertions, 1 deletions
diff --git a/emacs/.emacs.d/site-lisp/my-smt.el b/emacs/.emacs.d/site-lisp/my-smt.el
index afc2d59..5d81091 100644
--- a/emacs/.emacs.d/site-lisp/my-smt.el
+++ b/emacs/.emacs.d/site-lisp/my-smt.el
@@ -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