From dc1ebade6e706f652b43a459cff1ed571a096b29 Mon Sep 17 00:00:00 2001 From: jao Date: Tue, 11 Jan 2022 23:49:54 +0000 Subject: jao-minibuffer: emacs28 compat (string-pixel-width is 29) --- lib/eos/jao-minibuffer.el | 12 +++++++----- 1 file 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 ;; 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 -- cgit v1.2.3