diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/eos/jao-minibuffer.el | 30 | ||||
-rw-r--r-- | lib/media/jao-emms-info-track.el | 2 | ||||
-rw-r--r-- | lib/media/jao-mpris.el | 2 |
3 files changed, 22 insertions, 12 deletions
diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el index aa781a3..c88e591 100644 --- a/lib/eos/jao-minibuffer.el +++ b/lib/eos/jao-minibuffer.el @@ -25,6 +25,7 @@ ;;; Code: (defvar jao-minibuffer-info ()) +(defvar jao-minibuffer-msg-info '("")) (defvar jao-minibuffer-notification nil) (defvar jao-minibuffer-align-right-p t) (defvar jao-minibuffer-right-margin (if window-system 0 1)) @@ -51,13 +52,13 @@ (jao-minibuffer-maximized-frames-p (frame-width)) (t (min (frame-width) (window-width (minibuffer-window)))))) -(defun jao-minibuffer--format-info () +(defun jao-minibuffer--format-info (&optional info) (mapconcat 'string-trim (seq-filter (lambda (s) (not (string-blank-p s))) (mapcar 'format-mode-line (if jao-minibuffer-align-right-p - jao-minibuffer-info - (reverse jao-minibuffer-info)))) + (or info jao-minibuffer-info) + (reverse (or info jao-minibuffer-info))))) " ")) (defun jao-minibuffer--aligned (&optional w currentp) @@ -81,8 +82,8 @@ (let* ((msg (string-trim (replace-regexp-in-string "\n" " " msg))) (msg (if (string-blank-p msg) msg (concat msg " ")))) (if jao-minibuffer-align-right-p - (concat msg (jao-minibuffer--aligned (string-width (or msg "")) t)) - (concat (jao-minibuffer--aligned (+ 3 (string-width (or msg ""))) t) + (concat msg (jao-minibuffer--aligned (string-width (or msg "")))) + (concat (jao-minibuffer--aligned (+ 3 (string-width (or msg "")))) " " msg))))) (defun jao-minibuffer--insert (msg) @@ -123,14 +124,23 @@ (defun jao-minibuffer-refresh (&rest _ignore) (interactive) (when jao-minibuffer-enabled-p - (let ((jao-minibuffer-enabled-p nil)) - (jao-minibuffer--insert (or (jao-minibuffer--aligned) ""))))) + (let* ((jao-minibuffer-enabled-p nil) + (msg (jao-minibuffer--format-info jao-minibuffer-msg-info)) + (msg (jao-minibuffer--set-message (or msg "")))) + (jao-minibuffer--insert (or msg ""))))) -;;;###autoload -(defun jao-minibuffer-add-variable (variable-name &optional order) +(defun jao-minibuffer--add-variable (list-name variable-name &optional order) (let ((v `(:eval ,variable-name))) (setq jao-minibuffer-info (remove v jao-minibuffer-info)) - (add-to-ordered-list 'jao-minibuffer-info v order))) + (add-to-ordered-list list-name v order))) + +;;;###autoload +(defun jao-minibuffer-add-variable (variable-name &optional order) + (jao-minibuffer--add-variable 'jao-minibuffer-info variable-name order)) + +;;;###autoload +(defun jao-minibuffer-add-msg-variable (variable-name &optional order) + (jao-minibuffer--add-variable 'jao-minibuffer-msg-info variable-name order)) ;;;###autoload (defun jao-minibuffer-add-mode-line (order) diff --git a/lib/media/jao-emms-info-track.el b/lib/media/jao-emms-info-track.el index d848145..cf93625 100644 --- a/lib/media/jao-emms-info-track.el +++ b/lib/media/jao-emms-info-track.el @@ -189,7 +189,7 @@ (jao-emms--echo-string ""))) (defun jao-emms-enable-minibuffer (minibuffer-order) - (jao-minibuffer-add-variable 'jao-emms-echo-string minibuffer-order) + (jao-minibuffer-add-msg-variable 'jao-emms-echo-string minibuffer-order) (dolist (h '(emms-track-updated-functions emms-player-finished-hook emms-player-stopped-hook diff --git a/lib/media/jao-mpris.el b/lib/media/jao-mpris.el index 5551f03..597eb94 100644 --- a/lib/media/jao-mpris.el +++ b/lib/media/jao-mpris.el @@ -109,7 +109,7 @@ (jao-notify (format "%s: %s" (jao-mpris--get 'status) (jao-mpris--format))))) (defun jao-mpris-minibuffer-order (order) - (jao-minibuffer-add-variable 'jao-mpris-track-string order)) + (jao-minibuffer-add-msg-variable 'jao-mpris-track-string order)) (defun jao-mpris--handler (iname properties &rest args) (when properties |