summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-01-24 02:20:39 +0000
committerjao <jao@gnu.org>2022-01-24 02:20:39 +0000
commitfbac51c07d4a76cbabfcbcd43e5357d08f6089d2 (patch)
treeb7d943f36711b91986d819a67257f244eb9d15de
parent87679ecdd18f3315a38c81178077bf52c456a1ba (diff)
downloadelibs-fbac51c07d4a76cbabfcbcd43e5357d08f6089d2.tar.gz
elibs-fbac51c07d4a76cbabfcbcd43e5357d08f6089d2.tar.bz2
jao-minibuffer: outsmarting magit
-rw-r--r--lib/eos/jao-minibuffer.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el
index dabd822..8982011 100644
--- a/lib/eos/jao-minibuffer.el
+++ b/lib/eos/jao-minibuffer.el
@@ -81,11 +81,18 @@
(insert msg)
(when hack (other-window 1) (other-window -1)))))
- (defun jao-minibuffer--format-msg (msg)
+(defun jao-minibuffer--strip-previous (msg)
+ (if-let* ((l (length msg))
+ (n (text-property-any 0 l :minibuffer-message t msg)))
+ (string-trim (substring msg 0 n))
+ msg))
+
+(defun jao-minibuffer--format-msg (msg)
(let* ((msgs (split-string msg "\n"))
(prefix (when-let (p (string-join (butlast msgs) "\n"))
(unless (string-blank-p p) (concat p "\n"))))
(msg (car (last msgs)))
+ (msg (jao-minibuffer--strip-previous msg))
(msg (if (string-blank-p msg) msg (concat msg " "))))
(if jao-minibuffer-align-right-p
(concat prefix msg (jao-minibuffer--aligned (length msg)))