summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-01-11 23:49:54 +0000
committerjao <jao@gnu.org>2022-01-11 23:49:54 +0000
commitdc1ebade6e706f652b43a459cff1ed571a096b29 (patch)
treeb771f04c23250f8115c77c191004f4b545cf6ffa
parenta88c31559e748afb805148865853af433261ce4d (diff)
downloadelibs-dc1ebade6e706f652b43a459cff1ed571a096b29.tar.gz
elibs-dc1ebade6e706f652b43a459cff1ed571a096b29.tar.bz2
jao-minibuffer: emacs28 compat (string-pixel-width is 29)
-rw-r--r--lib/eos/jao-minibuffer.el12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el
index 36c5238..6445393 100644
--- a/lib/eos/jao-minibuffer.el
+++ b/lib/eos/jao-minibuffer.el
@@ -1,6 +1,6 @@
;;; jao-minibuffer.el --- using the minibuffer to report status -*- lexical-binding: t; -*-
-;; Copyright (C) 2020, 2021 jao
+;; Copyright (C) 2020, 2021, 2022 jao
;; Author: jao <mail@jao.io>
;; Keywords: extensions
@@ -81,12 +81,14 @@ The padding pushes TEXT to the right edge of the mode-line."
(string-trim-left msg)))
(msg (propertize msg :minibuffer-message t)))
(when (not (string-empty-p msg))
- (if (and window-system jao-minibuffer-align-right-p)
+ (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) ""))))))
+ (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