Fix #149: hang while changing `doom-modeline-icon' from nil to t.

Don't delay load all-the-icons for this case:
  Load Emacs daemon and enable doom-modeline-icon in Emacs clients.
This commit is contained in:
Vincent Zhang 2019-03-17 22:21:50 +07:00
parent 48bf1f26b7
commit 3b704ee080
3 changed files with 3 additions and 18 deletions

View file

@ -28,6 +28,7 @@
;;; Code: ;;; Code:
(require 'all-the-icons)
(require 'eldoc-eval) (require 'eldoc-eval)
(require 'shrink-path) (require 'shrink-path)
(require 'subr-x) (require 'subr-x)
@ -234,14 +235,6 @@ The icons may not be showed correctly in terminal.")
;; Externals ;; Externals
;; ;;
(defvar all-the-icons-scale-factor)
(declare-function all-the-icons-alltheicon 'all-the-icons)
(declare-function all-the-icons-faicon 'all-the-icons)
(declare-function all-the-icons-icon-for-file 'all-the-icons)
(declare-function all-the-icons-icon-for-mode 'all-the-icons)
(declare-function all-the-icons-material 'all-the-icons)
(declare-function all-the-icons-octicon 'all-the-icons)
(declare-function face-remap-remove-relative 'face-remap) (declare-function face-remap-remove-relative 'face-remap)
(declare-function project-roots 'project) (declare-function project-roots 'project)
(declare-function projectile-project-root 'projectile) (declare-function projectile-project-root 'projectile)

View file

@ -29,18 +29,16 @@
;;; Code: ;;; Code:
(require 'all-the-icons)
(require 'subr-x) (require 'subr-x)
(require 'doom-modeline-core) (require 'doom-modeline-core)
(require 'doom-modeline-env) (require 'doom-modeline-env)
(when (bound-and-true-p doom-modeline-icon)
(require 'all-the-icons))
;; ;;
;; Externals ;; Externals
;; ;;
(defvar all-the-icons-scale-factor)
(defvar anzu--cached-count) (defvar anzu--cached-count)
(defvar anzu--current-position) (defvar anzu--current-position)
(defvar anzu--overflow-p) (defvar anzu--overflow-p)
@ -81,8 +79,6 @@
(defvar winum-auto-setup-mode-line) (defvar winum-auto-setup-mode-line)
(defvar xah-fly-insert-state-q) (defvar xah-fly-insert-state-q)
(declare-function all-the-icons-auto-mode-match? 'all-the-icons)
(declare-function all-the-icons-icon-family 'all-the-icons)
(declare-function anzu--reset-status 'anzu) (declare-function anzu--reset-status 'anzu)
(declare-function anzu--where-is-here 'anzu) (declare-function anzu--where-is-here 'anzu)
(declare-function async-inject-variables 'async) (declare-function async-inject-variables 'async)
@ -223,10 +219,6 @@ buffer where knowing the current project directory is important."
(lambda (_sym val op _where) (lambda (_sym val op _where)
(when (eq op 'set) (when (eq op 'set)
(setq doom-modeline-icon val) (setq doom-modeline-icon val)
;; Fix #149: hang while changing `doom-modeline-icon' from nil to t
(if (and doom-modeline-icon
(not (featurep 'all-the-icons)))
(require 'all-the-icons))
(dolist (buf (buffer-list)) (dolist (buf (buffer-list))
(with-current-buffer buf (with-current-buffer buf
(doom-modeline-update-buffer-file-icon)))))) (doom-modeline-update-buffer-file-icon))))))

View file

@ -4,7 +4,7 @@
;; Author: Vincent Zhang <seagle0128@gmail.com> ;; Author: Vincent Zhang <seagle0128@gmail.com>
;; Homepage: https://github.com/seagle0128/doom-modeline ;; Homepage: https://github.com/seagle0128/doom-modeline
;; Version: 1.9.3 ;; Version: 1.9.4
;; Package-Requires: ((emacs "25.1") (all-the-icons "1.0.0") (shrink-path "0.2.0") (eldoc-eval "0.1") (dash "2.11.0")) ;; Package-Requires: ((emacs "25.1") (all-the-icons "1.0.0") (shrink-path "0.2.0") (eldoc-eval "0.1") (dash "2.11.0"))
;; Keywords: faces mode-line ;; Keywords: faces mode-line