mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-27 11:09:52 +00:00
Add new mode: doom-modeline-mode.
doom-modeline-init is obsolete.
This commit is contained in:
parent
fdc20c7e00
commit
868f1bb00b
2 changed files with 42 additions and 22 deletions
|
@ -98,7 +98,7 @@ In `init.el`,
|
||||||
|
|
||||||
``` emacs-lisp
|
``` emacs-lisp
|
||||||
(require 'doom-modeline)
|
(require 'doom-modeline)
|
||||||
(doom-modeline-init)
|
(doom-modeline-mode 1)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Use-package
|
### Use-package
|
||||||
|
@ -106,7 +106,7 @@ In `init.el`,
|
||||||
``` emacs-lisp
|
``` emacs-lisp
|
||||||
(use-package doom-modeline
|
(use-package doom-modeline
|
||||||
:ensure t
|
:ensure t
|
||||||
:hook (after-init . doom-modeline-init))
|
:hook (after-init . doom-modeline-mode))
|
||||||
```
|
```
|
||||||
|
|
||||||
This package requires the fonts included with `all-the-icons` to be installed.
|
This package requires the fonts included with `all-the-icons` to be installed.
|
||||||
|
|
|
@ -64,11 +64,11 @@
|
||||||
;; From melpa, `M-x package-install RET doom-modeline RET`.
|
;; From melpa, `M-x package-install RET doom-modeline RET`.
|
||||||
;; In `init.el`,
|
;; In `init.el`,
|
||||||
;; (require 'doom-modeline)
|
;; (require 'doom-modeline)
|
||||||
;; (doom-modeline-init)
|
;; (doom-modeline-mode 1)
|
||||||
;; or
|
;; or
|
||||||
;; (use-package doom-modeline
|
;; (use-package doom-modeline
|
||||||
;; :ensure t
|
;; :ensure t
|
||||||
;; :hook (after-init . doom-modeline-init))
|
;; :hook (after-init . doom-modeline-mode))
|
||||||
;;
|
;;
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
@ -107,25 +107,20 @@
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Hooks
|
;; Interfaces
|
||||||
;;
|
;;
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-modeline-init ()
|
(defun doom-modeline-init ()
|
||||||
"Initialize doom mode-line."
|
"Initialize doom mode-line."
|
||||||
;; Create bars
|
(doom-modeline-mode 1))
|
||||||
(doom-modeline-refresh-bars)
|
(make-obsolete 'doom-modeline-init 'doom-modeline-mode "1.6.0")
|
||||||
(unless after-init-time
|
|
||||||
;; These buffers are already created and don't get modelines. For the love
|
|
||||||
;; of Emacs, someone give the man a modeline!
|
|
||||||
(dolist (bname '("*scratch*" "*Messages*"))
|
|
||||||
(with-current-buffer bname
|
|
||||||
(doom-modeline-set-main-modeline)))))
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-modeline-set-main-modeline ()
|
(defun doom-modeline-set-main-modeline (&optional default)
|
||||||
"Set main mode-line."
|
"Set main mode-line.
|
||||||
(doom-modeline-set-modeline 'main))
|
If DEFAULT is non-nil, set the default mode-line for all buffers."
|
||||||
|
(doom-modeline-set-modeline 'main default))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-modeline-set-minimal-modeline ()
|
(defun doom-modeline-set-minimal-modeline ()
|
||||||
|
@ -154,15 +149,40 @@
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Bootstrap
|
;; Mode
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(doom-modeline-set-modeline 'main t) ; set default modeline
|
(defvar doom-modeline--default-mode-line mode-line-format)
|
||||||
|
|
||||||
(add-hook 'dashboard-mode-hook #'doom-modeline-set-project-modeline)
|
;;;###autoload
|
||||||
(add-hook 'image-mode-hook #'doom-modeline-set-media-modeline)
|
(define-minor-mode doom-modeline-mode
|
||||||
(add-hook 'circe-mode-hook #'doom-modeline-set-special-modeline)
|
"Toggle doom-modeline on or off."
|
||||||
(add-hook 'pdf-tools-enabled-hook #'doom-modeline-set-pdf-modeline)
|
:group 'doom-modeline
|
||||||
|
:global t
|
||||||
|
:lighter nil
|
||||||
|
(if doom-modeline-mode
|
||||||
|
(progn
|
||||||
|
(doom-modeline-refresh-bars) ; create bars
|
||||||
|
(doom-modeline-set-main-modeline t) ; set default mode-line.
|
||||||
|
(unless after-init-time
|
||||||
|
;; These buffers are already created and don't get modelines. For the love
|
||||||
|
;; of Emacs, someone give the man a modeline!
|
||||||
|
(dolist (bname '("*scratch*" "*Messages*"))
|
||||||
|
(with-current-buffer bname
|
||||||
|
(doom-modeline-set-main-modeline))))
|
||||||
|
;; Add hooks
|
||||||
|
(add-hook 'dashboard-mode-hook #'doom-modeline-set-project-modeline)
|
||||||
|
(add-hook 'image-mode-hook #'doom-modeline-set-media-modeline)
|
||||||
|
(add-hook 'circe-mode-hook #'doom-modeline-set-special-modeline)
|
||||||
|
(add-hook 'pdf-tools-enabled-hook #'doom-modeline-set-pdf-modeline))
|
||||||
|
(progn
|
||||||
|
;; Restore mode-line
|
||||||
|
(setq-default mode-line-format doom-modeline--default-mode-line)
|
||||||
|
;; Remove hooks
|
||||||
|
(remove-hook 'dashboard-mode-hook #'doom-modeline-set-project-modeline)
|
||||||
|
(remove-hook 'image-mode-hook #'doom-modeline-set-media-modeline)
|
||||||
|
(remove-hook 'circe-mode-hook #'doom-modeline-set-special-modeline)
|
||||||
|
(remove-hook 'pdf-tools-enabled-hook #'doom-modeline-set-pdf-modeline))))
|
||||||
|
|
||||||
(provide 'doom-modeline)
|
(provide 'doom-modeline)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue