From 1cab0eaef796058f6ed73112db1009213ad9bbc6 Mon Sep 17 00:00:00 2001 From: Protesilaos Stavrou Date: Fri, 24 Nov 2023 07:24:43 +0200 Subject: [PATCH] Add user option 'logos-hide-header-line' --- README.org | 19 ++++++++++++------- logos.el | 18 ++++++++++++++++-- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/README.org b/README.org index 3c12ffd..d3a477a 100644 --- a/README.org +++ b/README.org @@ -111,6 +111,7 @@ another command is invoked. #+findex: logos-focus-mode #+vindex: logos-hide-cursor #+vindex: logos-hide-mode-line +#+vindex: logos-hide-header-line #+vindex: logos-scroll-lock #+vindex: logos-variable-pitch #+vindex: logos-hide-buffer-boundaries @@ -118,15 +119,16 @@ another command is invoked. #+vindex: logos-olivetti #+vindex: logos-hide-fringe Logos provides some optional aesthetic tweaks which come into effect -when the buffer-local ~logos-focus-mode~ is enabled. These will hide +when the buffer-local ~logos-focus-mode~ is enabled. These will hide the cursor (~logos-hide-cursor~), hide the mode line -(~logos-hide-mode-line~), disable the buffer boundary indicators +(~logos-hide-mode-line~), hide the header line +(~logos-hide-header-line~), disable the buffer boundary indicators (~indicate-buffer-boundaries~), enable ~scroll-lock-mode~ (~logos-scroll-lock~), use ~variable-pitch-mode~ in non-programming buffers (~logos-variable-pitch~), make the buffer read-only (~logos-buffer-read-only~), center the buffer in its window if the =olivetti= package is installed (~logos-olivetti~), and hide the -~fringe~ face (~logos-hide-fringe~). All these variables are +~fringe~ face (~logos-hide-fringe~). All these variables are buffer-local. #+vindex: logos-focus-mode-map @@ -213,13 +215,15 @@ changes out-of-the-box ([[#h:2bb57369-352a-43bf-afe3-0bed2fcc7359][Extra tweaks] narrowing commands (otherwise it maps to =C-x n n= in this example, assuming the default keys). -+ To have quick access to ~logos-focus-mode~, bind it to a key. This - mode checks the variables ~logos-hide-cursor~, ~logos-hide-mode-line~, ++ To have quick access to ~logos-focus-mode~, bind it to a key. This + mode checks the variables ~logos-hide-cursor~, + ~logos-hide-mode-line~, ~logos-hide-header-line~, ~logos-scroll-lock~, ~logos-variable-pitch~, ~logos-hide-buffer-boundaries~, ~logos-buffer-read-only~, ~logos-olivetti~ (requires =olivetti= package) and applies their - effects if they are non-nil. Note that everything is buffer-local, so - it is possible to use file variables as described in the Emacs manual. + effects if they are non-nil. Note that everything is buffer-local, + so it is possible to use file variables as described in the Emacs + manual. #+begin_src emacs-lisp (require 'logos) @@ -237,6 +241,7 @@ changes out-of-the-box ([[#h:2bb57369-352a-43bf-afe3-0bed2fcc7359][Extra tweaks] ;; buffer-local. (setq-default logos-hide-cursor nil logos-hide-mode-line t + logos-hide-header-line t logos-hide-buffer-boundaries t logos-hide-fringe t logos-variable-pitch nil diff --git a/logos.el b/logos.el index dc63d64..f5df196 100644 --- a/logos.el +++ b/logos.el @@ -142,6 +142,14 @@ This is only relevant when `logos-focus-mode' is enabled." :package-version '(logos . "0.1.0") :local t) +(defcustom logos-hide-header-line nil + "When non-nil hide the header line. +This is only relevant when `logos-focus-mode' is enabled." + :type 'boolean + :group 'logos + :package-version '(logos . "1.2.0") + :local t) + (defcustom logos-scroll-lock nil "When non-nil, use `scroll-lock-mode'. This is only relevant when `logos-focus-mode' is enabled." @@ -460,8 +468,8 @@ alternate, thus toggling MODE." When enabled it sets the buffer-local value of these user options: `logos-scroll-lock', `logos-variable-pitch', `logos-hide-cursor', `logos-hide-mode-line', -`logos-hide-buffer-boundaries', `logos-buffer-read-only', -`logos-olivetti', `logos-hide-fringe'." +`logos-hide-header-line', `logos-hide-buffer-boundaries', +`logos-buffer-read-only', `logos-olivetti', `logos-hide-fringe'." :init-value nil :global nil :keymap logos-focus-mode-map @@ -482,6 +490,7 @@ options: `logos-scroll-lock', `logos-variable-pitch', ;; variables (logos--hide-cursor) (logos--hide-mode-line) + (logos--hide-header-line) (logos--indicate-buffer-boundaries) (logos--buffer-read-only) ;; faces @@ -523,6 +532,11 @@ options: `logos-scroll-lock', `logos-variable-pitch', (when logos-hide-mode-line (logos-set-buffer-local-value 'mode-line-format nil))) +(defun logos--hide-header-line () + "Set `logos-hide-header-line'." + (when logos-hide-header-line + (logos-set-buffer-local-value 'header-line-format nil))) + (defun logos--buffer-read-only () "Set `logos-buffer-read-only'." (when logos-buffer-read-only -- 2.45.2