Skip to content

Commit

Permalink
Fix #248: Unable to kill *scratch* while starting Emacs.
Browse files Browse the repository at this point in the history
Check if "*scratch*" and "*Messages*" buffers exist while setting the mode-line
for them.
  • Loading branch information
seagle0128 committed Nov 4, 2019
1 parent 3eeb090 commit 95809a1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions doom-modeline.el
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,9 @@ If DEFAULT is non-nil, set the default mode-line for all buffers."
(doom-modeline-set-main-modeline t) ; set default mode-line
;; These buffers are already created and don't get modelines
(dolist (bname '("*scratch*" "*Messages*"))
(with-current-buffer bname
(doom-modeline-set-main-modeline)))
(if (buffer-live-p bname)
(with-current-buffer bname
(doom-modeline-set-main-modeline))))
;; Add hooks
(add-hook 'Info-mode-hook #'doom-modeline-set-info-modeline)
(add-hook 'dired-mode-hook #'doom-modeline-set-project-modeline)
Expand All @@ -235,8 +236,9 @@ If DEFAULT is non-nil, set the default mode-line for all buffers."
;; Restore mode-line
(setq-default mode-line-format doom-modeline--old-format)
(dolist (bname '("*scratch*" "*Messages*"))
(with-current-buffer bname
(setq mode-line-format doom-modeline--old-format)))
(if (buffer-live-p bname)
(with-current-buffer bname
(setq mode-line-format doom-modeline--old-format))))
;; Remove hooks
(remove-hook 'Info-mode-hook #'doom-modeline-set-info-modeline)
(remove-hook 'dired-mode-hook #'doom-modeline-set-project-modeline)
Expand Down

0 comments on commit 95809a1

Please sign in to comment.