Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ignore file-missing errors during diff-refined font-locking
* lisp/vc/diff-mode.el (diff--font-lock-refined): Ignore file-missing
errors (bug#49197).
  • Loading branch information
jimporter authored and larsmagne committed Jun 24, 2021
1 parent f85ee6d commit ed30a72
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions lisp/vc/diff-mode.el
Expand Up @@ -2265,17 +2265,20 @@ Call FUN with two args (BEG and END) for each hunk."
;; same hunk.
(goto-char (next-single-char-property-change
(point) 'diff--font-lock-refined nil max)))
(diff--iterate-hunks
max
(lambda (beg end)
(unless (get-char-property beg 'diff--font-lock-refined)
(diff--refine-hunk beg end)
(let ((ol (make-overlay beg end)))
(overlay-put ol 'diff--font-lock-refined t)
(overlay-put ol 'diff-mode 'fine)
(overlay-put ol 'evaporate t)
(overlay-put ol 'modification-hooks
'(diff--overlay-auto-delete))))))))
;; Ignore errors that diff cannot be found so that custom font-lock
;; keywords after `diff--font-lock-refined' can still be evaluated.
(ignore-error file-missing
(diff--iterate-hunks
max
(lambda (beg end)
(unless (get-char-property beg 'diff--font-lock-refined)
(diff--refine-hunk beg end)
(let ((ol (make-overlay beg end)))
(overlay-put ol 'diff--font-lock-refined t)
(overlay-put ol 'diff-mode 'fine)
(overlay-put ol 'evaporate t)
(overlay-put ol 'modification-hooks
'(diff--overlay-auto-delete)))))))))

(defun diff--overlay-auto-delete (ol _after _beg _end &optional _len)
(delete-overlay ol))
Expand Down

0 comments on commit ed30a72

Please sign in to comment.