Emacs: logos version 1.2.0

This package provides a simple approach to setting up a “focus mode”. It uses the page-delimiter (typically ^L) or the outline together with some commands to move between pages whether narrowing is in effect or not. It also provides some optional aesthetic tweaks which come into effect when the buffer-local logos-focus-mode is enabled. The manual shows how to extend the code to achieve the desired result.

(all my videos since early 2022 where I show parts of code use logos).

Below are the release notes.


Version 1.2.0 on 2024-09-03

This version introduces minor refinements to an already stable package.

The logos-update-fringe-in-buffers works with enable-theme-functions

It is possible to hide the fringes when logos-focus-mode is enabled by setting the user option logos-hide-fringe to a non-nil value. To make sure that the proper colours are applied when the theme changes, users must also set up the logos-update-fringe-in-buffers to run after the theme is loaded.

In versions of Emacs before 29 there was no standard way to do this (my themes (Modus, Ef, Standard) have always had the relevant “post load” hook). With Emacs 29, users can now use the enable-theme-functions to make this work with all themes:

(add-hook 'enable-theme-functions #'logos-update-fringe-in-buffers)

New logos-hide-header-line user option for logos-focus-mode

Users can now optionally hide the header-line when logos-focus-mode is enabled in the current buffer. This is done by setting logos-hide-header-line to a non-nil value and then enabling the mode.

[ Remember to read the manual for all such options. ]

Documented how to conditionally toggle org-indent-mode

The logos-focus-mode operates in the current buffer to make the changes that are needed for a more “focused” editing experience. Here we extend it to work with Org’s virtual indentation.

It disables org-indent-mode when logos-focus-mode is enabled and restores it when logos-focus-mode is disabled. The logos-set-mode-arg function takes care of the technicalities.

(defun my-logos-org-indent ()
  (when logos-focus-mode
    (logos-set-mode-arg 'org-indent-mode -1)))

(add-hook 'logos-focus-mode-hook #'my-logos-org-indent)

Documented how to toggle the menu-bar, tool-bar, tab-bar, and tab-line

Continuing from above, the following code block below shows how to disable the menu-bar-mode, tool-bar-mode, tab-bar-mode, and tab-line-mode when logos-focus-mode is enabled. If the given mode is already disabled, the corresponding function does nothing. Otherwise, it toggles the mode off/on when logos-focus-mode is enabled/disabled.

(defun my-logos-hide-menu-bar ()
  (when logos-focus-mode
    (logos-set-mode-arg 'menu-bar-mode -1)))

(add-hook 'logos-focus-mode-hook #'my-logos-hide-menu-bar)

;; Assuming the `tool-bar-mode' is enabled by default...
(defun my-logos-hide-tool-bar ()
  (when logos-focus-mode
    (logos-set-mode-arg 'tool-bar-mode -1)))

(add-hook 'logos-focus-mode-hook #'my-logos-hide-tool-bar)

;; Assuming the `tab-bar-mode' is enabled by default...
(defun my-logos-hide-tab-bar ()
  (when logos-focus-mode
    (logos-set-mode-arg 'tab-bar-mode -1)))

(add-hook 'logos-focus-mode-hook #'my-logos-hide-tab-bar)

;; Assuming the `tab-line-mode' is enabled by default...
(defun my-logos-hide-tab-line ()
  (when logos-focus-mode
    (logos-set-mode-arg 'tab-line-mode -1)))

(add-hook 'logos-focus-mode-hook #'my-logos-hide-tab-line)

Fixed a malformed cond

This was affecting the logos-narrow-dwim function in some cases. Thanks to Edgar Vincent for the contribution, which happened in the now-defunct mailing list.