diff-hl-margin-mode when in tty

This commit is contained in:
Andrea Ciceri 2023-03-26 13:23:57 +02:00
parent a59dbfd6a3
commit 79da59700b
Signed by: aciceri
SSH key fingerprint: SHA256:/AagBweyV4Hlfg9u092n8hbHwD5fcB6A3qhDiDA65Rg

38
init.el
View file

@ -37,7 +37,6 @@
(global-ligature-mode 't) (global-ligature-mode 't)
) )
(setup flycheck (setup flycheck
(:require flycheck) (:require flycheck)
(:hook-into prog-mode) (:hook-into prog-mode)
@ -58,12 +57,9 @@
backup-directory-alist `(("." . ,temporary-file-directory)) backup-directory-alist `(("." . ,temporary-file-directory))
auto-save-files-name-transforms `((".*" ,temporary-file-directory t)) auto-save-files-name-transforms `((".*" ,temporary-file-directory t))
backup-by-copying t) backup-by-copying t)
(defun fix-vertical-border-background-face (&rest args)
(set-face-background 'vertical-border (face-background 'default)))
(advice-add 'load-theme :after #'fix-vertical-border-background-face)
(defun ccr/set-faces () (defun ccr/set-faces ()
(set-face-attribute 'default nil :font "Fira Code 12") (set-face-attribute 'default nil :font "Fira Code 12")
(fix-vertical-border-background-face) (set-face-background 'vertical-border (face-background 'default))
(meow--prepare-face) (meow--prepare-face)
(set-display-table-slot standard-display-table 'vertical-border (make-glyph-code ?┃))) (set-display-table-slot standard-display-table 'vertical-border (make-glyph-code ?┃)))
(if (daemonp) (if (daemonp)
@ -76,16 +72,16 @@
(global-auto-revert-mode t) (global-auto-revert-mode t)
(show-paren-mode 1) (show-paren-mode 1)
(column-number-mode 1) (column-number-mode 1)
(unless (display-graphic-p) ;; FIXME make it work when starting Emacs as daemon (advice-add 'enable-theme
(advice-add 'enable-theme :after
:after #'(lambda (&rest rest)
#'(lambda (&rest rest) (set-face-background 'vertical-border (face-background 'default))
(let* ((bg-color (face-attribute 'default :background)) (let* ((bg-color (face-attribute 'default :background))
(ansi-command (format "\033]11;#%s\007" (ansi-command (format "\033]11;#%s\007"
(string-remove-prefix "#" bg-color)))) (string-remove-prefix "#" bg-color))))
(send-string-to-terminal ansi-command)))) (send-string-to-terminal ansi-command))))
(defun reset-terminal () (send-string-to-terminal "\033c")) (defun reset-terminal () (send-string-to-terminal "\033c"))
(add-hook 'kill-emacs-hook #'reset-terminal)) (add-hook 'kill-emacs-hook #'reset-terminal)
(ef-themes-select 'ef-day) (ef-themes-select 'ef-day)
(defun ccr/reload-emacs () (defun ccr/reload-emacs ()
@ -418,12 +414,16 @@
"C-c n j" org-roam-dailies-capture-today) "C-c n j" org-roam-dailies-capture-today)
(org-roam-db-autosync-mode)) (org-roam-db-autosync-mode))
(setup diff-hl (setup diff-hl
(global-diff-hl-mode 1) (global-diff-hl-mode 1)
(defun maybe-diff-hl-margin-local-mode () (defun maybe-diff-hl-margin-mode ()
(unless (display-graphic-p) (diff-hl-margin-local-mode))) (unless (display-graphic-p) (diff-hl-margin-mode)))
(if (daemonp) (when (daemonp)
(add-hook 'server-after-make-frame-hook #'maybe-diff-hl-margin-local-mode))) ;; FIXME not optimal, after the first time that a client creates a frame all the other frames
;; will use `diff-hl-margin-mode`, even if they are graphical
(add-hook 'server-after-make-frame-hook #'maybe-diff-hl-margin-mode)))
(setup dirvish (setup dirvish
(dirvish-override-dired-mode) (dirvish-override-dired-mode)