diff options
author | Juri Linkov <juri@linkov.net> | 2022-11-20 20:02:20 +0200 |
---|---|---|
committer | Juri Linkov <juri@linkov.net> | 2022-11-20 20:02:20 +0200 |
commit | 5c709bd605d39032362a2850321615faed4d1eb3 (patch) | |
tree | 85f8bdc12c2f624b6577a4245ee578c9dd59c1ec /lisp/emacs-lisp/subr-x.el | |
parent | 79eca4652b4d84ea355587dd62caff7dff6cb141 (diff) | |
download | emacs-5c709bd605d39032362a2850321615faed4d1eb3.tar.gz emacs-5c709bd605d39032362a2850321615faed4d1eb3.tar.bz2 emacs-5c709bd605d39032362a2850321615faed4d1eb3.zip |
Disable display-line-numbers-mode in string-pixel-width (bug#59311)
* lisp/emacs-lisp/subr-x.el (string-pixel-width):
Turn off display-line-numbers-mode when it's enabled.
Diffstat (limited to 'lisp/emacs-lisp/subr-x.el')
-rw-r--r-- | lisp/emacs-lisp/subr-x.el | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 6e4d88b4df3..18087bc937f 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -322,6 +322,10 @@ as the new values of the bound variables in the recursive invocation." ;; Keeping a work buffer around is more efficient than creating a ;; new temporary buffer. (with-current-buffer (get-buffer-create " *string-pixel-width*") + ;; `display-line-numbers-mode' is enabled in internal buffers + ;; that breaks width calculation, so need to disable (bug#59311) + (when (bound-and-true-p display-line-numbers-mode) + (display-line-numbers-mode -1)) (delete-region (point-min) (point-max)) (insert string) (car (buffer-text-pixel-size nil nil t))))) |