From c1338de74c20fd3c408424437d81583840d3cbe9 Mon Sep 17 00:00:00 2001 From: James Cherti <60946298+jamescherti@users.noreply.github.com> Date: Tue, 12 Aug 2025 15:05:27 -0400 Subject: [PATCH] Add persist text scale --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index ae3e157..6f9b6ac 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ In addition to *minimal-emacs.d*, startup speed is influenced by your computer's - [Enhancing the Elisp development experience](#enhancing-the-elisp-development-experience) - [Showing the tab-bar](#showing-the-tab-bar) - [Changing the Default Font](#changing-the-default-font) + - [Persist Text Scale](#persist-text-scale) - [Loading the custom.el file](#loading-the-customel-file) - [Which other customizations can be interesting to add?](#which-other-customizations-can-be-interesting-to-add) - [Customizations: pre-early-init.el](#customizations-pre-early-initel) @@ -1520,6 +1521,28 @@ On Linux, you can display a comprehensive list of all installed font families by fc-list : family | sed 's/,/\n/g' | sort -u ``` +### Persist Text Scale + +The [persist-text-scale](https://github.com/jamescherti/persist-text-scale.el) Emacs package provides `persist-text-scale-mode`, which ensures that all adjustments made with `text-scale-increase` and `text-scale-decrease` are persisted and restored across sessions. As a result, the text size in each buffer remains consistent, even after restarting Emacs. + +This package also facilitates grouping buffers into categories, allowing buffers within the same category to share a consistent text scale. This ensures uniform font sizes when adjusting text scaling. By default: +- Each file-visiting buffer has its own independent text scale. +- Special buffers, identified by their buffer names, each retain their own text scale setting. +- All Dired buffers maintain the same font size, treating Dired as a unified "file explorer" where the text scale remains consistent across different buffers. + +This category-based behavior can be further customized by assigning a function to the `persist-text-scale-buffer-category-function` variable. The function determines how buffers are categorized by returning a category identifier (string) based on the buffer's context. Buffers within the same category will share the same text scale. + +```elisp +(use-package persist-text-scale + :commands (persist-text-scale-mode + persist-text-scale-restore) + + :hook (after-init . persist-text-scale-mode) + + :custom + (text-scale-mode-step 1.07)) +``` + ### Loading the custom.el file **NOTE:** The author advises against loading `custom.el`. To disable it, set `custom-file` to the null device using `(setq custom-file null-device)`. Users are instead encouraged to define their configuration programmatically in files such as `post-init.el`. Maintaining configuration programmatically offers several advantages: it ensures reproducibility and facilitates version control. This makes it easier to understand, audit, and evolve the configuration over time.