branch: externals/logos commit 706fd80eecd752f3525182e7d6f50c11ebb94952 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Add logos-hide-fringe user option It "hides" the fringe by making it use the same background as the default face. It does not change fringe-mode. --- README.org | 13 +++++++++---- logos.el | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/README.org b/README.org index f06977af01..2d74fbd5e1 100644 --- a/README.org +++ b/README.org @@ -106,15 +106,19 @@ to narrow effectively. Such users may still want to bind it to a key. #+vindex: logos-indicate-buffer-boundaries #+vindex: logos-buffer-read-only #+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 the mode line (~logos-hide-mode-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~), and center the buffer in its window if the -=olivetti= package is installed (~logos-olivetti~). All these variables -are buffer-local. +(~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 +buffer-local. + +[ ~logos-hide-fringe~ is part of {{{development-version}}} ] Logos is the familiar word derived from Greek (watch my presentation on philosophy about Cosmos, Logos, and the living universe: @@ -214,7 +218,8 @@ changes out-of-the-box ([[#h:2bb57369-352a-43bf-afe3-0bed2fcc7359][Extra tweaks] logos-variable-pitch nil logos-indicate-buffer-boundaries nil logos-buffer-read-only nil - logos-olivetti nil) + logos-olivetti nil + logos-hide-fringe nil) (let ((map global-map)) (define-key map [remap narrow-to-region] #'logos-narrow-dwim) diff --git a/logos.el b/logos.el index 3a5277f983..eb4ba0588f 100644 --- a/logos.el +++ b/logos.el @@ -47,8 +47,8 @@ ;; The `logos-focus-mode' tweaks the aesthetics of the current buffer. ;; When enabled it sets the buffer-local value of these user options: ;; `logos-scroll-lock', `logos-variable-pitch',`logos-hide-mode-line', -;; `logos-indicate-buffer-boundaries', `logos-buffer-read-only', and -;; `logos-olivetti'. +;; `logos-indicate-buffer-boundaries', `logos-buffer-read-only', +;; `logos-olivetti', and `logos-hide-fringe'. ;; ;; Logos is the familiar word derived from Greek (watch my presentation ;; on philosophy about Cosmos, Logos, and the living universe: @@ -142,6 +142,13 @@ This is only relevant when `logos-focus-mode' is enabled." :group 'logos :local t) +(defcustom logos-hide-fringe nil + "If non-nil make the `fringe' face the same as `default' background. +This is only relevant when `logos-focus-mode' is enabled." + :type 'boolean + :group 'logos + :local t) + ;;;; General utilities (defun logos--focus-p () @@ -335,11 +342,12 @@ alternate, thus toggling MODE." When enabled it sets the buffer-local value of these user options: `logos-scroll-lock', `logos-variable-pitch', `logos-hide-mode-line', `logos-indicate-buffer-boundaries', -`logos-buffer-read-only', `logos-olivetti'." +`logos-buffer-read-only', `logos-olivetti', `logos-hide-fringe'." :init-value nil :global nil :lighter " Λ" ; lambda majuscule (mapc #'funcall logos--restore) + (logos--remove-fringe-remap) (setq logos--restore nil) (when logos-focus-mode (logos--setup))) @@ -353,7 +361,9 @@ options: `logos-scroll-lock', `logos-variable-pitch', ;; variables (logos--hide-mode-line) (logos--indicate-buffer-boundaries) - (logos--buffer-read-only)) + (logos--buffer-read-only) + ;; faces + (logos--hide-fringe)) (defun logos--variable-pitch () "Set `logos-variable-pitch'." @@ -392,5 +402,22 @@ options: `logos-scroll-lock', `logos-variable-pitch', (when (and logos-olivetti (require 'olivetti nil t)) (logos--mode 'olivetti-mode 1))) +(defvar-local logos--fringe-remap-cookie nil + "Cookie of remapped `fringe' face.") + +(declare-function face-remap-add-relative "face-remap" (face &rest specs)) +(declare-function face-remap-remove-relative "face-remap" (cookie)) + +(defun logos--hide-fringe () + "Set buffer-local `fringe' to the same background as `default'." + (when logos-hide-fringe + (setq logos--fringe-remap-cookie + (face-remap-add-relative 'fringe :background (face-background 'default))))) + +(defun logos--remove-fringe-remap () + "Remove effect of `logos--hide-fringe'." + (when logos--fringe-remap-cookie + (face-remap-remove-relative logos--fringe-remap-cookie))) + (provide 'logos) ;;; logos.el ends here