From 49f4461daa4dc2b02b0769d5d6f737b4e3cb8f46 Mon Sep 17 00:00:00 2001 From: Nikita Bloshchanevich Date: Sun, 29 Nov 2020 09:32:52 +0100 Subject: [PATCH] Elisp `eldoc': fix "Invalid format operation %-" In `+emacs-lisp-append-value-to-eldoc-a', if the `frame-width' of the minibuffer is smaller than the length of the documentation + " [...]" + 1, a negative maximum %s bound is passed, causing the error in the title. Fix this by clamping the computed LIMIT to 0. --- modules/lang/emacs-lisp/config.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lang/emacs-lisp/config.el b/modules/lang/emacs-lisp/config.el index 1a97e1c27..4de223f83 100644 --- a/modules/lang/emacs-lisp/config.el +++ b/modules/lang/emacs-lisp/config.el @@ -105,7 +105,7 @@ employed so that flycheck still does *some* helpful linting.") (str (symbol-value sym)) (str (prin1-to-string str)) (limit (- (frame-width) (length ret) (length truncated) 1))) - (format (format "%%0.%ds%%s" limit) + (format (format "%%0.%ds%%s" (min limit 0)) (propertize str 'face 'warning) (if (< (length str) limit) "" truncated))))))