From 4d97bf35cf0f9d58b14d13a78172c15463820382 Mon Sep 17 00:00:00 2001 From: Kien Nguyen Date: Mon, 9 Mar 2020 13:13:19 +0900 Subject: [PATCH] fix: format error in earlier Emacs version (#21) --- mini-modeline.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mini-modeline.el b/mini-modeline.el index 2e1e605..a48e4f6 100755 --- a/mini-modeline.el +++ b/mini-modeline.el @@ -238,15 +238,16 @@ When ARG is: mini-modeline-right-padding) 0)) (required-width (string-width right))) + ;; (mini-modeline--log "a:%s r:%s\n" available-width required-width) (if (< available-width required-width) (if mini-modeline-truncate-p (cons - (format (format "%%s %%%1$d.%1$ds" available-width) left right) + ;; Emacs 25 cannot use position format + (format (format "%%s %%%d.%ds" available-width available-width) left right) 0) (cons - (format (format "%%%1$d.%1$ds\n%%s" (- (frame-width mini-modeline-frame) - mini-modeline-right-padding)) - right left) + (let ((available-width (+ available-width (string-width left)))) + (format (format "%%0.%ds\n%%s" available-width) right left)) 1)) (cons (format (format "%%s %%%ds" available-width) left right) 0))))