From 7bbeac11001c6156d90be7085c57b1860b9008cd Mon Sep 17 00:00:00 2001 From: noa@gaiwan.org Date: Wed, 12 Jun 2024 21:46:15 +0000 Subject: Add further information about my header line configuration --- emacs/init.el | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index a213127..59d7bde 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -80,27 +80,27 @@ ((buffer-modified-p) "**") (t "RW"))) +;;; Replace the mode line with a header line + +;; First, we set the mode line to nil. On my graphical display, this collapses it so all i get is a thin black line separating the buffer from the echo area. +(setq-default mode-line-format nil) +;; But the mode line still holds some useful information that i want to see. I would rather that be in the header line, because to me it makes sense for this kind of metadata to be /above/ the buffer it is describing. (setq-default header-line-format '( + ;; First, in white on black text, i want the information about the state of the file. This will show three hyphens in the top left corner of the header line. The first two hyphens mean that the file is both writable and unchanged. If the buffer has been changed, they will change to two asterisks. If the buffer is read only, they will change two percentage symbols. And if the buffer is read only and has been changed, the first will change to a percentage symbol, and the second will change to an asterisk. The final hyphen represents that the file is local, specifically that the default-directory variable is local. If it is remote, an at symbol will be displayed instead. (:propertize - ( - "" - mode-line-modified - mode-line-remote - ) + ("" mode-line-modified mode-line-remote) face highlight ) - " " - "%b" + ;; Next, we want to display the buffer name. For buffers which belong to files, this will usually be the file name, but it is likely to be something more informative for special buffers. + " %b" + ;; Below that, show a line and column coördinate. There are special minor modes that will enable or disable this for the default mode line, but i ignore that and put the formatting code here directly. The docstring for the mode-line-format variable suggests that the column might not be displayed correctly in some situations without enabling the minor mode, but i haven't noticed that yet so i don't bother. This column number is zero-indexed; a capital c would make it one-indexed. For now i stick with zero-indexed as that's the emacs default and i'm not sure which is better. I guess it makes a bit more sense that the first character on a line is labeled "1". ":%l,%c" " " - ;; (vc-mode vc-mode) - ;; " " - ;; mode-line-modes + ;; I don't know exactly what this variable covers, so i keep it here so that if something shows up i know that it gets put here. Because i have a global mode line in my tab bar, some of the things that would otherwise be here (like the time, battery percentage, and notifications for chat buffers) don't show up. mode-line-misc-info mode-line-end-spaces ) ) -(setq-default mode-line-format nil) (use-package nano-modeline :disabled t -- cgit 1.4.1-2-gfad0