From 665651c7366ba4a6efe6f549170ffddfc80ef688 Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Fri, 25 Aug 2023 11:13:47 +0800 Subject: [PATCH] emacs: remove outdated doc about package initialization Since Emacs 27[1], there is no need to call package-initialize in the init file. [1]: https://git.savannah.gnu.org/cgit/emacs.git/tree/etc/NEWS.27?id=cae528457cb862dc886a34240c9d4c73035b6659#n227 --- doc/builders/packages/emacs.section.md | 4 ---- nixos/modules/services/editors/emacs.md | 18 ++---------------- pkgs/top-level/emacs-packages.nix | 7 ------- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/doc/builders/packages/emacs.section.md b/doc/builders/packages/emacs.section.md index d1b0dab33db9..c50c7815537d 100644 --- a/doc/builders/packages/emacs.section.md +++ b/doc/builders/packages/emacs.section.md @@ -26,10 +26,6 @@ You can install it like any other packages via `nix-env -iA myEmacs`. However, t { packageOverrides = pkgs: with pkgs; rec { myEmacsConfig = writeText "default.el" '' - ;; initialize package - - (require 'package) - (package-initialize 'noactivate) (eval-when-compile (require 'use-package)) diff --git a/nixos/modules/services/editors/emacs.md b/nixos/modules/services/editors/emacs.md index 2fe25f5e3f43..9db1bd594175 100644 --- a/nixos/modules/services/editors/emacs.md +++ b/nixos/modules/services/editors/emacs.md @@ -339,22 +339,8 @@ This will add the symlink ## Configuring Emacs {#module-services-emacs-configuring} -The Emacs init file should be changed to load the extension packages at -startup: - -::: {.example #module-services-emacs-package-initialisation} -### Package initialization in `.emacs` - -``` -(require 'package) - -;; optional. makes unpure packages archives unavailable -(setq package-archives nil) - -(setq package-enable-at-startup nil) -(package-initialize) -``` -::: +If you want to only use extension packages from Nixpkgs, you can add +`(setq package-archives nil)` to your init file. After the declarative Emacs package configuration has been tested, previously downloaded packages can be cleaned up by removing diff --git a/pkgs/top-level/emacs-packages.nix b/pkgs/top-level/emacs-packages.nix index 3f61bc2229d0..609d27a8d8d6 100644 --- a/pkgs/top-level/emacs-packages.nix +++ b/pkgs/top-level/emacs-packages.nix @@ -7,18 +7,11 @@ # Alternative: use `emacs`, install everything to a system or user profile # and then add this at the start your `init.el`: /* - (require 'package) - - ;; optional. makes unpure packages archives unavailable - (setq package-archives nil) - ;; optional. use this if you install emacs packages to the system profile (add-to-list 'package-directory-list "/run/current-system/sw/share/emacs/site-lisp/elpa") ;; optional. use this if you install emacs packages to user profiles (with nix-env) (add-to-list 'package-directory-list "~/.nix-profile/share/emacs/site-lisp/elpa") - - (package-initialize) */ { pkgs'