Toggle hl-line-mode in original buf when cloning

This commit is contained in:
TEC 2022-10-18 02:05:41 +08:00
parent acfc52d09c
commit 49490a4a23
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 10 additions and 6 deletions

View File

@ -292,12 +292,16 @@ and the line number of the first line of the region."
(defun screenshot--narrowed-clone-buffer (beg end)
"Create a clone of the current buffer, narrowed to the region from BEG to END.
This buffer then then set up to be used for a screenshot."
(with-current-buffer (clone-indirect-buffer " *screenshot-clone" nil t)
(narrow-to-region beg end)
(screenshot--setup-buffer)
(buffer-face-set :family screenshot-font-family
:height (* 10 screenshot-font-size))
(current-buffer)))
(let ((hl (bound-and-true-p hl-line-mode)))
(when hl (hl-line-mode -1))
(prog1
(with-current-buffer (clone-indirect-buffer " *screenshot-clone" nil t)
(narrow-to-region beg end)
(screenshot--setup-buffer)
(buffer-face-set :family screenshot-font-family
:height (* 10 screenshot-font-size))
(current-buffer))
(when hl (hl-line-mode 1)))))
(defun screenshot--max-line-length (&optional buffer)
"Find the maximum line length in BUFFER."