Emacs: Set the right colors for ruler in server mode.

This commit is contained in:
tastytea 2020-11-29 09:12:26 +01:00
parent 97ccaa3a29
commit c25c3bbe77

View File

@ -1,6 +1,6 @@
;;; common.el --- Common settings for text files. -*- lexical-binding: t; -*- ;;; common.el --- Common settings for text files. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-11-26T13:04:50+0100> ;; Time-stamp: <2020-11-29T09:08:31+0100>
;;; Commentary: ;;; Commentary:
@ -49,27 +49,30 @@
;; Ruler with fill-column marker. ;; Ruler with fill-column marker.
(use-package ruler-mode (use-package ruler-mode
:after (doom-themes) :after (doom-themes display-line-numbers)
:demand t
:config (progn :config (progn
(set-face-background 'ruler-mode-default (defun my/ruler-set-colors ()
(face-foreground 'line-number)) (set-face-background 'ruler-mode-default
(set-face-foreground 'ruler-mode-default (face-foreground 'line-number))
(face-background 'default)) (set-face-foreground 'ruler-mode-default
(set-face-foreground 'ruler-mode-column-number (face-background 'default))
(face-background 'default)) (set-face-foreground 'ruler-mode-column-number
(if (and (window-system) (face-background 'default))
(>= emacs-major-version 27)) (if (and (window-system)
(>= emacs-major-version 27))
(set-face-foreground 'ruler-mode-fill-column
(face-foreground
'fill-column-indicator nil t))
(set-face-foreground 'ruler-mode-fill-column (set-face-foreground 'ruler-mode-fill-column
(face-foreground (face-foreground 'shadow)))
'fill-column-indicator nil t)) (set-face-foreground 'ruler-mode-comment-column
(set-face-foreground 'ruler-mode-fill-column (face-foreground 'ruler-mode-fill-column))
(face-foreground 'shadow))) (set-face-foreground 'ruler-mode-goal-column
(set-face-foreground 'ruler-mode-comment-column (face-foreground 'ruler-mode-fill-column))
(face-foreground 'ruler-mode-fill-column)) (set-face-foreground 'ruler-mode-current-column
(set-face-foreground 'ruler-mode-goal-column (face-foreground 'line-number-current-line)))
(face-foreground 'ruler-mode-fill-column)) (my/ruler-set-colors)
(set-face-foreground 'ruler-mode-current-column
(face-foreground 'line-number-current-line))
(defun my/ruler-on () (defun my/ruler-on ()
"Turn `ruler-mode' on." "Turn `ruler-mode' on."
@ -77,7 +80,8 @@
:custom-face (ruler-mode-default ((t (:inherit·default :custom-face (ruler-mode-default ((t (:inherit·default
:box·nil)))) :box·nil))))
:hook ((find-file . my/ruler-on) :hook ((find-file . my/ruler-on)
(text-mode . my/ruler-on))) ; For the scratch buffer. (text-mode . my/ruler-on) ; For the scratch buffer.
(server-after-make-frame . my/ruler-set-colors)))
;; Show a fill-column indicator vertically across the buffer. ;; Show a fill-column indicator vertically across the buffer.
(when (>= emacs-major-version 27) (when (>= emacs-major-version 27)