Function: work-buffer--prepare-pixelwise
work-buffer--prepare-pixelwise is a byte-compiled function defined in
subr-x.el.gz.
Signature
(work-buffer--prepare-pixelwise STRING BUFFER)
Documentation
Set up the current buffer to correctly compute STRING's pixel width.
Call this with a work buffer as the current buffer. BUFFER is the originating buffer and if non-nil, make the current buffer's (work buffer) face remappings match it.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/subr-x.el.gz
(defun work-buffer--prepare-pixelwise (string buffer)
"Set up the current buffer to correctly compute STRING's pixel width.
Call this with a work buffer as the current buffer.
BUFFER is the originating buffer and if non-nil, make the current
buffer's (work buffer) face remappings match it."
(when buffer
(dolist (v '(face-remapping-alist
char-property-alias-alist
default-text-properties))
(if (local-variable-p v buffer)
(set (make-local-variable v)
(buffer-local-value v buffer)))))
;; Avoid deactivating the region as side effect.
(let (deactivate-mark)
(insert string))
;; If `display-line-numbers' is enabled in internal
;; buffers (e.g. globally), it breaks width calculation
;; (bug#59311). Disable `line-prefix' and `wrap-prefix',
;; for the same reason.
(add-text-properties
(point-min) (point-max)
'(display-line-numbers-disable t line-prefix "" wrap-prefix "")))