161 lines
4.8 KiB
EmacsLisp
161 lines
4.8 KiB
EmacsLisp
;;; appearance.el --- Configure appearance. -*- lexical-binding: t; -*-
|
|
|
|
;; Time-stamp: <2019-10-27T20:04:51+00:00>
|
|
|
|
;;; Commentary:
|
|
|
|
;;; Code:
|
|
|
|
(require 'basics/global-variables)
|
|
|
|
(use-package emacs
|
|
:ensure nil
|
|
|
|
:config
|
|
(tool-bar-mode -1) ; Hide toolbar.
|
|
(if (display-graphic-p)
|
|
(set-scroll-bar-mode 'right)) ; Put scrollbar to the right side.
|
|
(add-to-list 'default-frame-alist ; Set default font.
|
|
'(font . "Source Code Pro-10"))
|
|
(global-hl-line-mode t) ; Highlight current line.
|
|
(show-paren-mode t) ; Visualize matching parens.
|
|
)
|
|
|
|
;; Icon font (required by doom and others).
|
|
(use-package all-the-icons
|
|
:config
|
|
(unless (file-exists-p "~/.local/share/fonts/all-the-icons.ttf")
|
|
(all-the-icons-install-fonts t))
|
|
)
|
|
|
|
;; Themes for doom-modeline.
|
|
(unless slow-computer
|
|
(use-package doom-themes
|
|
:after (all-the-icons)
|
|
|
|
:config
|
|
(load-theme 'doom-molokai t)
|
|
|
|
:custom-face
|
|
(font-lock-comment-face ((t (:inherit font-lock-comment-face
|
|
:foreground "#667755"))))
|
|
)
|
|
) ; unless slow-computer.
|
|
|
|
;; Neat modeline.
|
|
(use-package doom-modeline
|
|
:after (all-the-icons)
|
|
|
|
:init
|
|
(column-number-mode t) ; Show column numbers in modeline.
|
|
(size-indication-mode) ; Buffer size display in the modeline.
|
|
|
|
:config
|
|
(setq doom-modeline-minor-modes nil
|
|
;; doom-modeline-buffer-file-name-style 'relative-to-project
|
|
doom-modeline-buffer-file-name-style 'truncate-except-project)
|
|
:hook
|
|
(after-init . doom-modeline-mode)
|
|
)
|
|
|
|
;; If 2 files have the same name, append directory name after the filename.
|
|
(use-package uniquify
|
|
:ensure nil ; Builtin.
|
|
|
|
:custom
|
|
(uniquify-after-kill-buffer-p t)
|
|
(uniquify-buffer-name-style 'post-forward)
|
|
(uniquify-strip-common-suffix t)
|
|
)
|
|
|
|
;; Show line numbers on the left side of the buffer.
|
|
(use-package display-line-numbers
|
|
:if (>= emacs-major-version 26)
|
|
|
|
:config
|
|
(global-display-line-numbers-mode)
|
|
)
|
|
|
|
;; Visualize whitespace.
|
|
(use-package whitespace
|
|
:after (company)
|
|
:functions (my/whitespace-mode-enabled-p my/on-off-whitespace-before-company)
|
|
|
|
:custom
|
|
(whitespace-line-column nil) ; Set to fill-column.
|
|
|
|
:config
|
|
(delete 'newline-mark whitespace-style) ; Don't paint $ at eol.
|
|
(delete 'lines whitespace-style) ; Don't mark whole overly long lines.
|
|
(add-to-list 'whitespace-style 'lines-tail) ; Mark end of overly long lines.
|
|
|
|
;; Workaround to not show dots in popup menus.
|
|
(defun my/whitespace-mode-enabled-p ()
|
|
(symbol-value 'whitespace-mode))
|
|
(defvar-local my/ws-enabled nil)
|
|
|
|
;; company:
|
|
(defun my/on-off-whitespace-before-company(command)
|
|
(when (string= "show" command)
|
|
(setq-local my/ws-enabled (my/whitespace-mode-enabled-p))
|
|
(if my/ws-enabled
|
|
(whitespace-mode -1)))
|
|
(when (string= "hide" command)
|
|
(if my/ws-enabled
|
|
(whitespace-mode t))))
|
|
(advice-add 'company-call-frontends
|
|
:before #'my/on-off-whitespace-before-company)
|
|
|
|
(defun my/whitespace-mode-off ()
|
|
(setq-local my/ws-enabled (my/whitespace-mode-enabled-p))
|
|
(if my/ws-enabled
|
|
(whitespace-mode -1)))
|
|
(defun my/whitespace-mode-on ()
|
|
(if my/ws-enabled
|
|
(whitespace-mode t)))
|
|
|
|
;; popup:
|
|
(defadvice popup-create (before my/popup-suppress-whitespace-mode activate)
|
|
"Suspend whitespace-mode while popups are visible."
|
|
(my/whitespace-mode-off))
|
|
(defadvice popup-delete (after my/popup-restore-whitespace-mode activate)
|
|
"Restore whitespace-mode when all popups have closed."
|
|
(my/whitespace-mode-on))
|
|
|
|
(if (display-graphic-p)
|
|
(custom-set-faces
|
|
'(whitespace-line ((t (:inherit whitespace-line
|
|
:weight normal
|
|
:foreground nil
|
|
:background nil
|
|
:box (:line-width 1 :color "dark red")
|
|
;; :underline (:color "dark red")
|
|
)))))
|
|
(custom-set-faces ; else
|
|
'(whitespace-line ((t (:inherit whitespace-line
|
|
:background nil
|
|
:underline t
|
|
)))))
|
|
)
|
|
|
|
(defun my/ws-load-local-vars-first ()
|
|
"Loads local variables (fill-column) before enabling whitespace-mode."
|
|
(hack-local-variables)
|
|
(whitespace-mode)
|
|
)
|
|
|
|
:bind
|
|
("C-x w" . whitespace-mode)
|
|
|
|
:hook
|
|
(prog-mode . my/ws-load-local-vars-first)
|
|
(conf-mode . my/ws-load-local-vars-first)
|
|
(text-mode . my/ws-load-local-vars-first)
|
|
|
|
:custom-face
|
|
(whitespace-space ((nil :foreground "gray18")))
|
|
)
|
|
|
|
(provide 'basics/appearance)
|
|
;;; appearance.el ends here
|