core: add optional parameter to spacemacs/set-mode-line

redisplay: it non nil then force refresh of the display
This commit is contained in:
syl20bnr 2017-10-29 21:43:43 -04:00
parent b53b23adff
commit e63febeafd
3 changed files with 15 additions and 18 deletions

View File

@ -1267,8 +1267,7 @@ discovery."
;; `dotspacemacs-directory' override the private directory if it exists.
(when refresh-index
(setq configuration-layer--indexed-layers (make-hash-table :size 1024)))
(spacemacs-buffer/set-mode-line "Indexing layers...")
(spacemacs//redisplay)
(spacemacs-buffer/set-mode-line "Indexing layers..." t)
(let ((search-paths (append
;; layers shipped with spacemacs
(list configuration-layer-directory)
@ -1637,8 +1636,7 @@ RNAME is the name symbol of another existing layer."
installed-count)
;; installation
(when upkg-names
(spacemacs-buffer/set-mode-line "Installing packages...")
(spacemacs//redisplay)
(spacemacs-buffer/set-mode-line "Installing packages..." t)
(let ((delayed-warnings-backup delayed-warnings-list))
(spacemacs-buffer/append
(format "Found %s new package(s) to install...\n"
@ -2216,8 +2214,7 @@ depends on it."
;; (message "orphans: %s" orphans)
(if orphans
(progn
(spacemacs-buffer/set-mode-line "Uninstalling unused packages...")
(spacemacs//redisplay)
(spacemacs-buffer/set-mode-line "Uninstalling unused packages..." t)
(spacemacs-buffer/append
(format "Found %s orphan package(s) to delete...\n"
orphans-count))
@ -2457,8 +2454,7 @@ ELPA stable repository."
(local (configuration-layer//stable-elpa-tarball-local-file)))
(spacemacs-buffer/set-mode-line
(format "Downloading stable ELPA repository: %s..."
configuration-layer--stable-elpa-name))
(spacemacs//redisplay)
configuration-layer--stable-elpa-name) t)
(if (and (spacemacs/system-is-mswindows)
(not (executable-find "gzip")))
;; additional check on Windows platform as tarball are not handled

View File

@ -539,8 +539,7 @@ a display strng and the value is the actual value to return."
(defun dotspacemacs/maybe-install-dotfile ()
"Install the dotfile if it does not exist."
(unless (file-exists-p dotspacemacs-filepath)
(spacemacs-buffer/set-mode-line "Dotfile wizard installer")
(spacemacs//redisplay)
(spacemacs-buffer/set-mode-line "Dotfile wizard installer" t)
(when (dotspacemacs/install 'with-wizard)
(configuration-layer/load))))

View File

@ -509,11 +509,13 @@ allowed types are `quickhelp' and `release-note'"
(message "Unknown note type: %s" 'type))))
(setq spacemacs-buffer--current-note-type nil)))
(defun spacemacs-buffer/set-mode-line (format)
(defun spacemacs-buffer/set-mode-line (format &optional redisplay)
"Set mode-line format for spacemacs buffer.
FORMAT: the `mode-line-format' variable Emacs will use to build the mode-line."
FORMAT: the `mode-line-format' variable Emacs will use to build the mode-line.
If REDISPLAY is non-nil then force a redisplay as well"
(with-current-buffer (get-buffer-create spacemacs-buffer-name)
(setq mode-line-format format)))
(setq mode-line-format format))
(when redisplay (spacemacs//redisplay)))
(defun spacemacs-buffer/message (msg &rest args)
"Display MSG in *Messages* prepended with '(Spacemacs)'.
@ -576,8 +578,8 @@ If MESSAGEBUF is not nil then MSG is also written in message buffer."
spacemacs-loading-dots-chunk-threshold)))
(length suffix)))
spacemacs-loading-char))
(spacemacs-buffer/set-mode-line (concat spacemacs-loading-string
suffix)))
(spacemacs-buffer/set-mode-line
(concat spacemacs-loading-string suffix)))
(spacemacs//redisplay))))
(defmacro spacemacs-buffer||add-shortcut
@ -993,13 +995,13 @@ SEQ, START and END are the same arguments as for `cl-subseq'"
(if configuration-layer-error-count
(progn
(spacemacs-buffer-mode)
(face-remap-add-relative 'mode-line
'((:background "red") mode-line))
(spacemacs-buffer/set-mode-line
(format
(concat "%s error(s) at startup! "
"Spacemacs may not be able to operate properly.")
configuration-layer-error-count))
(face-remap-add-relative 'mode-line
'((:background "red") mode-line)))
configuration-layer-error-count) t))
(spacemacs-buffer/set-mode-line spacemacs--default-mode-line)
(spacemacs-buffer-mode))
(force-mode-line-update)