diff options
author | jao <jao@gnu.org> | 2024-03-27 01:02:42 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2024-03-27 01:02:42 +0000 |
commit | 059b84a559da1219a79aabfdac7485ce755fd159 (patch) | |
tree | 4b6c771103d3ae0b282e70dc64a61ddf289ba52c | |
parent | 7dbdc86499fa858239b85883ad2cf09dbcb903e5 (diff) | |
download | elibs-059b84a559da1219a79aabfdac7485ce755fd159.tar.gz elibs-059b84a559da1219a79aabfdac7485ce755fd159.tar.bz2 |
better mode-line in minibuffer
-rw-r--r-- | init.el | 4 | ||||
-rw-r--r-- | lib/eos/jao-minibuffer.el | 7 | ||||
-rw-r--r-- | lib/eos/jao-mode-line.el | 29 |
3 files changed, 32 insertions, 8 deletions
@@ -466,7 +466,7 @@ (column-number-mode -1) ;;;; jao-mode-line -(defvar jao-mode-line-in-minibuffer nil) +(defvar jao-mode-line-in-minibuffer t) (use-package jao-mode-line :commands (jao-mode-line-add-to-minibuffer @@ -475,7 +475,7 @@ (add-hook 'after-init-hook (lambda () (when jao-mode-line-in-minibuffer - (jao-mode-line-add-to-minibuffer 90)))) + (jao-mode-line-add-to-minibuffer-left 90)))) ;;;; time display (setq world-clock-list diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el index a2d9f16..71d5976 100644 --- a/lib/eos/jao-minibuffer.el +++ b/lib/eos/jao-minibuffer.el @@ -86,7 +86,12 @@ (concat prefix (jao-minibuffer--aligned (+ 3 w)) " " msg)))) (defun jao-minibuffer--set-message (msg) - (when jao-minibuffer-mode (jao-minibuffer--format-msg (or msg "")))) + (when jao-minibuffer-mode + (let* ((info (when jao-minibuffer-msg-info + (jao-minibuffer--format-info jao-minibuffer-msg-info))) + (info (when info (propertize info 'face 'jao-themes-dimm))) + (msg (if info (format "%s - %s" info msg) msg))) + (jao-minibuffer--format-msg (or msg ""))))) (setq set-message-function #'jao-minibuffer--set-message) diff --git a/lib/eos/jao-mode-line.el b/lib/eos/jao-mode-line.el index 843e0b4..5d2bcd9 100644 --- a/lib/eos/jao-mode-line.el +++ b/lib/eos/jao-mode-line.el @@ -48,10 +48,17 @@ (interactive "P") (jao-mode-line--face-height 'mode-line-inactive all)) +(defun jao-mode-line--old-str () + (thread-first (format-mode-line jao-mode-line--old-format) + (substring-no-properties) + (string-trim))) + ;;;###autoload (defun jao-mode-line-echo () (interactive) - (message "%s" (format-mode-line mode-line-format))) + (message "%s" (jao-mode-line--old-str)) + (setq-local header-line-format + (if header-line-format nil jao-mode-line--old-format))) ;;;###autoload (defun jao-mode-line-hide-inactive (frame) @@ -133,18 +140,29 @@ ;; :overline bg :underline ul :extend t))) -;;;###autoload -(defun jao-mode-line-add-to-minibuffer (&optional order) +(defun jao-mode-line--add-to-minibuffer (order msg-p) (interactive) (setq jao-mode-line--old-format mode-line-format) (setq-default mode-line-format '(" ")) (setq-default mode-line-position jao-mode-line--position) (dolist (b (buffer-list)) (with-current-buffer b (setq-local mode-line-format '(" ")))) - (jao-minibuffer-add-variable 'jao-mode-line--format (or order 90)) + (if msg-p + (jao-minibuffer-add-msg-variable '(jao-mode-line--old-str) (or order 90)) + (jao-minibuffer-add-variable 'jao-mode-line--format (or order 90))) (jao-mode-line-adjust-faces)) ;;;###autoload +(defun jao-mode-line-add-to-minibuffer-right (&optional order) + (interactive) + (jao-mode-line--add-to-minibuffer order nil)) + +;;;###autoload +(defun jao-mode-line-add-to-minibuffer-left (&optional order) + (interactive) + (jao-mode-line--add-to-minibuffer order t)) + +;;;###autoload (defun jao-mode-line-remove-from-minibuffer () (interactive) (jao-mode-line--revert-face nil) @@ -153,7 +171,8 @@ (dolist (b (buffer-list)) (with-current-buffer b (setq-local mode-line-format jao-mode-line--old-format))) - (jao-minibuffer-remove-variable 'jao-mode-line--format)) + (jao-minibuffer-remove-variable 'jao-mode-line--format) + (jao-minibuffer-remove-variable '(jao-mode-line--old-str))) (provide 'jao-mode-line) |