102

GitHub - hlissner/emacs-solaire-mode: If only certain buffers could be so grossl...

 5 years ago
source link: https://github.com/hlissner/emacs-solaire-mode
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

Release tag MIT MELPA

Solaire mode

If only certain buffers could be so grossly incandescent.

praise.jpg

solaire-mode is an aesthetic plugin that helps visually distinguish file-visiting windows from other types of windows (like popups or sidebars) by giving them a slightly different -- often brighter -- background.

Praise the sun.

Note:

  • Uses face-remapping-alist, which other plugins may overwrite.
  • Tested mainly on Emacs 25.1+
  • This was once a part of doom-themes as doom-buffer-mode
  • Try jumping.

Screenshot

solaire-mode at work

Install

M-x package-install RET solaire-mode

(require 'solaire-mode)

;; Enable solaire-mode anywhere it can be enabled
(solaire-global-mode +1)
;; To enable solaire-mode unconditionally for certain modes:
(add-hook 'ediff-prepare-buffer-hook #'solaire-mode)

;; ...if you use auto-revert-mode, this prevents solaire-mode from turning
;; itself off every time Emacs reverts the file
(add-hook 'after-revert-hook #'turn-on-solaire-mode)

;; highlight the minibuffer when it is activated:
(add-hook 'minibuffer-setup-hook #'solaire-mode-in-minibuffer)

;; if the bright and dark background colors are the wrong way around, use this
;; to switch the backgrounds of the `default` and `solaire-default-face` faces.
;; This should be used *after* you load the active theme!
;;
;; NOTE: This is necessary for themes in the doom-themes package!
(solaire-mode-swap-bg)

;; An alternative for `use-package' users:
(use-package solaire-mode
  :hook
  ((change-major-mode after-revert ediff-prepare-buffer) . turn-on-solaire-mode)
  (minibuffer-setup . solaire-mode-in-minibuffer)
  :config
  (solaire-mode-swap-bg))

Configuration

  • By default, solaire-mode's effects will be invisible. Its faces must be defined:

    • solaire-default-face
    • solaire-minibuffer-face
    • solaire-line-number-face
    • solaire-hl-line-face
    • solaire-org-hide-face
    • solaire-mode-line-face
    • solaire-mode-line-inactive-face

    The only theme(s) that supports this, that I know of, is doom-themes.

  • What faces get remapped is controlled by solaire-mode-remap-faces and solaire-mode-remap-modeline.

    By default, these faces are affected:

    • default
    • hl-line
    • linum
    • org-hide
    • mode-line
    • mode-line-inactive
  • The function in solaire-mode-real-buffer-fn determines if a buffer should be brightened or not.

  • solaire-mode-remap-fringe controls whether the fringe's background is changed (and maintained) when solaire-mode is active. Setting it to nil will disable this behavior. To change what background it is changed to, modify the solaire-fringe-face face's :background.

Jolly cooperation with other plugins

  • By default, solaire-mode remaps the mode-line faces. This interferes with certain mode-line packages like telephone-line or powerline. You can undo this with:

    (setq solaire-mode-remap-modeline nil)
  • When persp-mode loads a perspective from file, it doesn't restore solaire-mode. The function solaire-mode-restore-persp-mode-buffers is available for this:

    (advice-add #'persp-load-state-from-file :after #'solaire-mode-restore-persp-mode-buffers)
  • Don't trust Patches!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK