From 1f7b9cd28e7d05be63c7a9e2c45e17643a4fa0b8 Mon Sep 17 00:00:00 2001 From: James Patrick Date: Fri, 2 Apr 2021 15:52:30 -0400 Subject: [PATCH] Don't tell me if a file is UTF8. Everything's UTF8 Do let me know when things aren't UTF8 though. --- emacs/+modeline.el | 12 ++++++++++++ emacs/config.el | 1 + 2 files changed, 13 insertions(+) create mode 100644 emacs/+modeline.el diff --git a/emacs/+modeline.el b/emacs/+modeline.el new file mode 100644 index 0000000..1821bbe --- /dev/null +++ b/emacs/+modeline.el @@ -0,0 +1,12 @@ +;;; +modeline.el -*- lexical-binding: t; -*- + +;; Only let us know when the encoding is NOT LF UTF-8. +(defun doom-modeline-conditional-buffer-encoding () + "We expect the encoding to be LF UTF-8, so only show the modeline when this is not the case" + (setq-local doom-modeline-buffer-encoding + (unless (and (memq (plist-get (coding-system-plist buffer-file-coding-system) :category) + '(coding-category-undecided coding-category-utf-8)) + (not (memq (coding-system-eol-type buffer-file-coding-system) '(1 2)))) + t))) + +(add-hook 'after-change-major-mode-hook #'doom-modeline-conditional-buffer-encoding) diff --git a/emacs/config.el b/emacs/config.el index 6523353..108214d 100644 --- a/emacs/config.el +++ b/emacs/config.el @@ -22,3 +22,4 @@ (load! "+mail") (load! "+org") (load! "+company") +(load! "+modeline")