This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+spacemacs/spacemacs-modeline/funcs.el
syl20bnr 30d7beb277 Refactor spacemacs-ui and spacemacs-ui-visual layers
Create new layers:
- spacemacs-navigation: contains packages whose principal goal is navigation
- spacemacs-modeline: contains packages about mode line

Merge spacemacs-ui and spacemacs-ui-visual into layer spacemacs-visual.
2017-04-11 23:09:35 -04:00

53 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-usedp '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))))))))