From 89d55ba2eb0ad172dc6aae81ce5d1cb340a632d2 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Sun, 24 Mar 2024 18:58:08 +0100 Subject: Refresh .emacs prologue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stuff about package-initialize is flat out wrong: (a) package-initialize is _not_ called automatically at startup; (b) for all that, customizations seem none the worse for wear. '(elisp) Packaging Basics' suggests that Emacs does automatically call 'package-activate-all' (unless asked otherwise in the early init file) so it's really not clear what that business with package-initialize was about 🤷 Add some more up-to-date commentary regarding other topics. --- .emacs | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/.emacs b/.emacs index 479eb81..59a8b92 100644 --- a/.emacs +++ b/.emacs @@ -1,21 +1,14 @@ ;;; -*- lexical-binding: t -*- -;;; Packages and Custom initialization. - -;; Letting Custom run *before* initializing packages seems to result -;; in packages resetting some of their variables, eg page-break-lines -;; resets global-page-break-lines-mode to nil. Cue Custom shrugging, -;; "changed outside Customize". - -;; Emacs≥27 automatically calls package-initialize before loading the -;; user's init file, unless package-enable-at-startup is set to nil in -;; the early init file. -(unless (>= emacs-major-version 27) - (package-initialize)) +;;; "Custom"ization & theming. +;; Trying to migrate to use-package instead of Custom's serialized +;; forms. It's a long-term project; until that's done, start by +;; setting and loading the `custom-file'. (setq custom-file "~/.emacs-custom.el") (load custom-file) +;; Compatibility shim for setopt. (if (fboundp 'setopt) (defalias 'my/setopt 'setopt) (defmacro my/setopt (&rest pairs) @@ -23,12 +16,15 @@ (while pairs (customize-set-variable (pop pairs) (pop pairs)))))) -;; Some list variables I don't set via Custom. I can't tell Custom -;; "add this element, take those two away": I need to "set in stone" -;; an exhaustive list that will make me (1) scratch my head a few -;; months later when I try to remember which of those items I added, -;; and which were part of the default list (2) miss out on additions -;; to the default list, unless I cautiously audit every release. +;; Helper for customizing list options. +;; +;; None of Emacs's customization tools (Custom, setopt, use-package) +;; can be told "add this element, take those two away": I need to "set +;; in stone" an exhaustive list that will make me (1) scratch my head +;; a few months later when I try to remember which of those items I +;; deliberately added vs which were part of the default list (2) miss +;; out on additions to the default list, unless I cautiously audit +;; every release of every package. ;; ;; Examples: erc-modules, git-commit-setup-hook, package-archives. (defmacro my/setopt-update-list (l to-add &optional to-remove) -- cgit v1.2.3