summaryrefslogtreecommitdiffhomepage
path: root/lib/eos
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-05-15 00:29:12 +0100
committerjao <jao@gnu.org>2021-05-15 00:29:12 +0100
commitd9e8bf0f91732ff6993a048d063ed5e6349f1036 (patch)
treeb7bfdf9fd6e7e16827a7cb1970a1dbdd32493558 /lib/eos
parent9c490d02512b86c95aa9020d000daba947415a74 (diff)
downloadelibs-d9e8bf0f91732ff6993a048d063ed5e6349f1036.tar.gz
elibs-d9e8bf0f91732ff6993a048d063ed5e6349f1036.tar.bz2
jao-minibuffer: wee refactorings
Diffstat (limited to 'lib/eos')
-rw-r--r--lib/eos/jao-minibuffer.el50
1 files changed, 27 insertions, 23 deletions
diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el
index 2dae445..cb2fd25 100644
--- a/lib/eos/jao-minibuffer.el
+++ b/lib/eos/jao-minibuffer.el
@@ -76,21 +76,26 @@
(w (- mw w jao-minibuffer-right-margin)))
(if (> w 0) (jao-minibuffer--trim msg w) "")))))
-(defun jao-minibuffer--set-message (msg)
- (if (bound-and-true-p current-minibuffer-command)
- msg
- (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 ""))))
- (concat (jao-minibuffer--aligned (+ 3 (string-width (or msg ""))))
- " " msg)))))
-
(defun jao-minibuffer--insert (msg)
(with-current-buffer jao-minibuffer--name
(erase-buffer)
(insert msg)))
+(defun jao-minibuffer--format-msg (msg)
+ (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 ""))))
+ (concat (jao-minibuffer--aligned (+ 3 (string-width (or msg ""))))
+ " " msg))))
+
+(defun jao-minibuffer--set-message (msg)
+ (if (and msg
+ (not (string-blank-p msg))
+ (bound-and-true-p current-minibuffer-command))
+ msg
+ (jao-minibuffer--format-msg msg)))
+
(defconst jao-minibuffer--size
'(:eval (format "/%d" (line-number-at-pos (point-max)))))
@@ -101,7 +106,7 @@
(defvar w3m-current-title nil)
(defvar jao-minibuffer--mode-line-format
- `(" %["
+ `("%["
(:eval (cond ((derived-mode-p 'gnus-group-mode
'gnus-article-mode
'gnus-summary-mode)
@@ -111,7 +116,6 @@
"%]"
(:propertize ,jao-minibuffer--circe face jao-themes-dimm)
" %+ "
- (repeat-in-progress repeat-echo-mode-line-string)
(:propertize mode-name face jao-themes-f00)
(:propertize ("" minor-mode-alist (vc-mode vc-mode)) face jao-themes-f11)
(:propertize (doc-view-doc-type
@@ -120,15 +124,6 @@
face jao-themes-f12)
global-mode-string))
-;;;###autoload
-(defun jao-minibuffer-refresh (&rest _ignore)
- (interactive)
- (when jao-minibuffer-enabled-p
- (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 "")))))
-
(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))
@@ -149,7 +144,7 @@
:background jao-minibuffer-active-buffer-line-color)
(set-face-attribute 'mode-line-inactive nil :box nil :height 1
:background jao-minibuffer-inactive-buffer-line-color)
- ;; (advice-add 'force-mode-line-update :after #'jao-minibuffer-refresh)
+ (advice-add 'force-mode-line-update :after #'jao-minibuffer-refresh)
(add-hook 'buffer-list-update-hook #'jao-minibuffer-refresh)
(jao-minibuffer-add-variable 'jao-minibuffer--mode-line-format order))
@@ -161,7 +156,16 @@
(jao-minibuffer-refresh)
(jao-minibuffer--insert "")))
-(setq set-message-function #'jao-minibuffer--set-message)
+;;;###autoload
+(defun jao-minibuffer-refresh (&rest _ignore)
+ (interactive)
+ (when jao-minibuffer-enabled-p
+ (let* ((jao-minibuffer-enabled-p nil)
+ (msg (jao-minibuffer--format-info jao-minibuffer-msg-info))
+ (msg (jao-minibuffer--format-msg (or msg ""))))
+ (jao-minibuffer--insert (or msg "")))))
+
+(setq set-message-function #'jao-minibuffer--format-msg)
(setq clear-message-function #'jao-minibuffer-refresh)
(provide 'jao-minibuffer)