summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-01-24 01:03:38 +0000
committerjao <jao@gnu.org>2022-01-24 01:03:38 +0000
commit797a98a2ee82ead7eef12c015373766f5b635b3d (patch)
treedf2551760fe79266e3ae34363a883045f973793d
parent3f1ea614b89fd763d0f8cba2f23c3eb12ba49534 (diff)
downloadelibs-797a98a2ee82ead7eef12c015373766f5b635b3d.tar.gz
elibs-797a98a2ee82ead7eef12c015373766f5b635b3d.tar.bz2
jao-minibuffer: all workarounds together
-rw-r--r--lib/eos/jao-minibuffer.el34
1 files changed, 12 insertions, 22 deletions
diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el
index 7e21db0..47aa3ea 100644
--- a/lib/eos/jao-minibuffer.el
+++ b/lib/eos/jao-minibuffer.el
@@ -37,15 +37,6 @@
(defconst jao-minibuffer--name " *Minibuf-0*")
-(defun jao-minibuffer--text-with-padding (text)
- "Return TEXT with padding on the left."
- (let* ((len (+ (string-pixel-width text)
- (string-pixel-width jao-minibuffer-right-margin)))
- (padding (propertize
- "-" 'display
- `(space :align-to (- (+ right right-margin) (,len))))))
- (concat padding text jao-minibuffer-right-margin)))
-
(defun jao-minibuffer--trim (s w)
(if (<= (string-width (or s "")) w)
(format (format "%%%ds" (if jao-minibuffer-align-right-p w (- w))) s)
@@ -79,19 +70,17 @@
(string-trim-left msg)))
(msg (propertize msg :minibuffer-message t)))
(when (not (string-empty-p msg))
- (if (and (fboundp 'string-pixel-width)
- window-system
- jao-minibuffer-align-right-p)
- (jao-minibuffer--text-with-padding msg)
- (let* ((mw (jao-minibuffer--width))
- (w (mod (or w (string-width (or (current-message) ""))) mw))
- (w (- mw w (length jao-minibuffer-right-margin))))
- (if (> w 0) (jao-minibuffer--trim msg w) ""))))))
+ (let* ((mw (jao-minibuffer--width))
+ (w (mod (or w (string-width (or (current-message) ""))) mw))
+ (w (- mw w (length jao-minibuffer-right-margin))))
+ (if (> w 0) (jao-minibuffer--trim msg w) "")))))
(defun jao-minibuffer--insert (msg)
- (with-current-buffer jao-minibuffer--name
- (erase-buffer)
- (insert msg)))
+ (let ((hack (derived-mode-p 'pdf-view-mode 'doc-view-mode)))
+ (with-current-buffer jao-minibuffer--name
+ (delete-region (point-min) (point-max))
+ (insert msg)
+ (when hack (other-window 1) (other-window -1)))))
(defun jao-minibuffer--format-msg (msg)
(let* ((msgs (split-string msg "\n"))
@@ -211,6 +200,8 @@
(define-minor-mode jao-minibuffer-mode
"Show minibuffer status"
:global t
+ :lighter ""
+ :group 'jao
(if jao-minibuffer-mode
(jao-minibuffer-turn-on)
(jao-minibuffer-turn-off)))
@@ -218,8 +209,7 @@
;;;###autoload
(defun jao-minibuffer-refresh (&rest _ignore)
(interactive)
- (when (and jao-minibuffer-mode
- (not (bound-and-true-p current-minibuffer-command)))
+ (when jao-minibuffer-mode
(let* ((jao-minibuffer-mode nil)
(window-selection-change-functions nil)
(msg (jao-minibuffer--format-info jao-minibuffer-msg-info))