Skip to content

Commit f346a51

Browse files
author
vg
committed
Fix error on creating new file
1 parent 291c996 commit f346a51

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compact-blame.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,12 @@ to variables as a single unit"
528528
(message "Buffer %s is modified! Turning off compact-blame-mode"
529529
(current-buffer))
530530
(setq compact-blame-mode nil))
531+
;; 'git blame' won't show anything for empty file
532+
(message "min=%s max=%s" (point-min) (point-max))
533+
(when (and compact-blame-mode (= (point-min) (point-max)))
534+
(message "Empty file %s. Turning off compact-blame-mode"
535+
(current-buffer))
536+
(setq compact-blame-mode nil))
531537
(if compact-blame-mode
532538
(progn
533539
(set (make-local-variable 'compact-blame-saved-readonly)

0 commit comments

Comments
 (0)