From 7abc17e5f5752689bfe52fb494e3db490a6609f5 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Sat, 1 Oct 2022 23:01:47 -0700 Subject: [PATCH] Use string-pixel-width to measure bar width Finally we can get ride of the silent buffer modification. * valign.el (valign--table-2): Change to use string-pixel-width. --- valign.el | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/valign.el b/valign.el index cec7ce0..124d194 100644 --- a/valign.el +++ b/valign.el @@ -899,11 +899,8 @@ Assumes point is at (2). (_ (valign--clean-text-property table-beg table-end)) ;; Measure char width after cleaning text properties. ;; Otherwise the measurement is not accurate. - (char-width (with-silent-modifications - (insert (valign-box-char 'h ucharset)) - (prog1 (valign--pixel-width-from-to - (1- (point)) (point)) - (backward-delete-char 1)))) + (char-width (string-pixel-width + (valign-box-char 'h ucharset))) (column-width-list ;; Make every width multiples of CHAR-WIDTH. (mapcar (lambda (x)