Function: majutsu-diff--paint-hunk-whitespace
majutsu-diff--paint-hunk-whitespace is a natively compiled function
defined in majutsu-diff.el.
Signature
(majutsu-diff--paint-hunk-whitespace START END FILE)
Documentation
Paint tabs and trailing whitespace between START and END for FILE.
Source Code
;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-diff.el
(defun majutsu-diff--paint-hunk-whitespace (start end file)
"Paint tabs and trailing whitespace between START and END for FILE."
(when (and majutsu-diff-paint-whitespace
(or (not majutsu-diff-whitespace-max-chars)
(<= (- end start) majutsu-diff-whitespace-max-chars)))
(let ((tabw (majutsu-diff--tab-width file)))
(save-excursion
(goto-char start)
(while (< (point) end)
(let ((bol (line-beginning-position))
(eol (line-end-position)))
;; Skip the diff marker column when checking trailing whitespace so
;; blank diff lines like "+" or " " don't light up.
(when (and majutsu-diff-highlight-trailing
(< bol eol))
(save-excursion
(goto-char (min eol (1+ bol)))
(when (re-search-forward "[ \t]+$" eol t)
(let ((ov (make-overlay (match-beginning 0) (match-end 0) nil t)))
(overlay-put ov 'font-lock-face 'magit-diff-whitespace-warning)
(overlay-put ov 'evaporate t)
(overlay-put ov 'priority 2)))))
;; Paint tabs by giving them display width.
(goto-char bol)
(while (search-forward "\t" eol t)
(put-text-property (1- (point)) (point)
'display (list (list 'space :width tabw)))))
;; Paint tabs by giving them display width.
(forward-line 1))))))