From 8839cc1e2933b162499ddb0a53c7c844a78da8cd Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 23 Mar 2022 07:13:49 -0700 Subject: init: start to simplify the configuration Update the settings for the garbage collector when we start Emacs, to make things go faster. Also drop a few things that we don't care about anymore (the gnutls configuration). Be specific about the path to the library. --- emacs/init.el | 105 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 51 insertions(+), 54 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index 40e9925..1af31de 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -1,61 +1,58 @@ -;;; init.el -- initialize my emacs configuration +;;; init.el --- Initialize my Emacs configuration ;;; Commentary: ;;; Code: -;; Initialize the package system first of all. -(require 'gnutls) + +(setq gc-cons-threshold 64000000) +(add-hook 'after-init-hook #'(lambda () + ;; restore after startup + (setq gc-cons-threshold 800000))) + (require 'package) -;; see https://github.com/melpa/melpa/issues/7238 -;; without this I'm unable to contact melpa on macos -(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") - -(setq package-archives '(("melpa" . "https://melpa.org/packages/"))) - -;; and now we load custom configurations -(eval-and-compile - (add-to-list 'load-path (expand-file-name "custom" user-emacs-directory)) - (add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory)) - - (require 'fcuny-vars) - - ;; where to store compiled files - (when (boundp 'native-comp-eln-load-path) - (add-to-list 'native-comp-eln-load-path (expand-file-name "eln-cache" fcuny/path-emacs-var))) - - ;; where to store the packages - (setq package-user-dir fcuny/path-emacs-elpa) - - ;; initialize it - (setq package-enable-at-startup nil) - (package-initialize) - - ;; if use-package is not present, we install it - (unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package)) - (require 'use-package) - (setq use-package-verbose t)) - -(require 'fcuny-settings) -(require 'fcuny-ui) -(require 'fcuny-navigation) -(require 'fcuny-edit) -(require 'fcuny-text) -(require 'fcuny-git) -(require 'fcuny-org) -(require 'fcuny-conf) -(require 'fcuny-prog) -(require 'fcuny-eshell) -(require 'fcuny-tramp) -(require 'fcuny-notmuch) - -(require 'fcuny-defuns) -(require 'fcuny-commands) -(require 'my-work) - -;; once we're done initializing the configuration, we start a shell -;; session with eshell. -(fcuny/eshell-main) +(add-to-list 'package-archives + '("melpa" . + "https://melpa.org/packages/")) + +(progn + (message "initializing package") + (package-initialize)) + +(unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package)) + +(eval-when-compile (require 'use-package)) + +(setq use-package-verbose t) +(setq use-package-always-ensure nil) + +(defun my/package-install-refresh-contents (&rest args) + "Refresh the package content, takes an optional ARGS." + ;; Whenever use-package statements use ensure (directly or via + ;; use-package-always-ensure), we need to refresh the package contents first, + ;; as installation fails otherwise: + ;; https://github.com/jwiegley/use-package/issues/256#issuecomment-263313693 + (package-refresh-contents) + (advice-remove 'package-install 'my/package-install-refresh-contents)) + +(advice-add 'package-install :before 'my/package-install-refresh-contents) + +(require 'fcuny-settings (expand-file-name "custom/fcuny-settings" user-emacs-directory)) +(require 'fcuny-ui (expand-file-name "custom/fcuny-ui" user-emacs-directory)) +(require 'fcuny-navigation (expand-file-name "custom/fcuny-navigation" user-emacs-directory)) +(require 'fcuny-edit (expand-file-name "custom/fcuny-edit" user-emacs-directory)) +(require 'fcuny-text (expand-file-name "custom/fcuny-text" user-emacs-directory)) +(require 'fcuny-git (expand-file-name "custom/fcuny-git" user-emacs-directory)) +(require 'fcuny-org (expand-file-name "custom/fcuny-org" user-emacs-directory)) +(require 'fcuny-conf (expand-file-name "custom/fcuny-conf" user-emacs-directory)) +(require 'fcuny-prog (expand-file-name "custom/fcuny-prog" user-emacs-directory)) +(require 'fcuny-eshell (expand-file-name "custom/fcuny-eshell" user-emacs-directory)) +(require 'fcuny-tramp (expand-file-name "custom/fcuny-tramp" user-emacs-directory)) +(require 'fcuny-notmuch (expand-file-name "custom/fcuny-notmuch" user-emacs-directory)) + +;; ;; (require 'fcuny-defuns) +;; ;; (require 'fcuny-commands) +;; ;; (require 'my-work) ;;; init.el ends here -- cgit 1.4.1