spacemacs/layers/+spacemacs/spacemacs-modeline/funcs.el
syl20bnr e2e532bb49 core: change <function>p to <function>-p suffixes for consistency
Also defined aliases for backward compatibility with `usedp` functions.
2017-07-02 10:09:39 -04:00

54 lines
1.9 KiB
EmacsLisp
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;; funcs.el --- Spacemacs Mode-line Layer functions File
;;
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;; spaceline
(defun spacemacs/customize-powerline-faces ()
"Alter powerline face to make them work with more themes."
(when (boundp 'powerline-inactive2)
(set-face-attribute 'powerline-inactive2 nil
:inherit 'font-lock-comment-face)))
(defun spacemacs//evil-state-face ()
(let ((state (if (eq 'operator evil-state) evil-previous-state evil-state)))
(intern (format "spacemacs-%S-face" state))))
(defun spacemacs//restore-powerline (buffer)
"Restore the powerline in buffer"
(with-current-buffer buffer
(setq-local mode-line-format (default-value 'mode-line-format))
(powerline-set-selected-window)
(powerline-reset)))
(defun spacemacs//set-powerline-for-startup-buffers ()
"Set the powerline for buffers created when Emacs starts."
(dolist (buffer '("*Messages*" "*spacemacs*" "*Compile-Log*"))
(when (and (get-buffer buffer)
(configuration-layer/package-used-p 'spaceline))
(spacemacs//restore-powerline buffer))))
(defun spacemacs//prepare-diminish ()
(when spaceline-minor-modes-p
(let ((unicodep (dotspacemacs|symbol-value
dotspacemacs-mode-line-unicode-symbols)))
(setq spaceline-minor-modes-separator
(if unicodep (if (display-graphic-p) "" " ") "|"))
(dolist (mm spacemacs--diminished-minor-modes)
(let ((mode (car mm)))
(when (and (boundp mode) (symbol-value mode))
(let* ((unicode (cadr mm))
(ascii (caddr mm))
(dim (if unicodep
unicode
(if ascii ascii unicode))))
(diminish mode dim))))))))