summary refs log tree commit diff stats
path: root/user
diff options
context:
space:
mode:
authorAlan Pearce2023-04-13 10:19:44 +0200
committerAlan Pearce2023-04-14 18:05:49 +0200
commit47d22f977ac751ce56dc7068de76dd1502d3957c (patch)
treeca27ad10063a2c9b58775a882311ed33aa8a8108 /user
parent7f796b77e04708b7ddb407b4dd05d91c2ebd135e (diff)
downloadnixfiles-47d22f977ac751ce56dc7068de76dd1502d3957c.tar.lz
nixfiles-47d22f977ac751ce56dc7068de76dd1502d3957c.tar.zst
nixfiles-47d22f977ac751ce56dc7068de76dd1502d3957c.zip
emacs: fix some minor warnings
Diffstat (limited to 'user')
-rw-r--r--user/emacs/init.el33
1 files changed, 19 insertions, 14 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index fde80501..ce1e5eea 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -1,17 +1,23 @@
 ;;; init --- user init file  -*- lexical-binding: t; -*-
 (eval '(setq inhibit-startup-echo-area-message "alan"))
-(let ((default-gc-cons-threshold (* 16 1024 1024))
-      (default-file-name-handler-alist file-name-handler-alist))
-  (setq gc-cons-threshold most-positive-fixnum
-        gc-cons-percentage 0.6
-        file-name-handler-alist nil)
-  (add-hook 'minibuffer-setup-hook (lambda () (setq gc-cons-threshold most-positive-fixnum)))
-  (add-hook 'minibuffer-exit-hook (lambda () (setq gc-cons-threshold default-gc-cons-threshold)))
-  (add-hook 'emacs-startup-hook (lambda () (setq file-name-handler-alist default-file-name-handler-alist)))
-  (add-hook 'after-init-hook (lambda ()
-                               (server-start)
-                               (setq gc-cons-threshold default-gc-cons-threshold
-                                     gc-cons-percentage 0.1))))
+(setq gc-cons-threshold most-positive-fixnum
+      gc-cons-percentage 0.6
+      file-name-handler-alist nil)
+(defun set-max-gc-cons ()
+  (setq gc-cons-threshold most-positive-fixnum))
+(defun set-default-gc-cons ()
+  (setq gc-cons-threshold (* 16 1024 1024)
+        gc-cons-percentage 0.1))
+(add-hook 'minibuffer-setup-hook #'set-max-gc-cons)
+(add-hook 'minibuffer-exit-hook #'set-default-gc-cons)
+(add-hook 'after-init-hook #'set-default-gc-cons)
+
+(defvar default-file-name-handler-alist file-name-handler-alist)
+(defun restore-file-name-handler-alist ()
+  (setq file-name-handler-alist default-file-name-handler-alist))
+(add-hook 'emacs-startup-hook #'restore-file-name-handler-alist)
+
+(add-hook 'after-init-hook #'server-start)
 
 (eval-when-compile (require 'fringe-helper))
 
@@ -87,7 +93,7 @@
 (setq font-lock-maximum-decoration '((t . 1)))
 
 (when (and (eq system-type 'darwin)
-           (fboundp #'mac-mouse-wheel-mode))
+           (fboundp 'mac-mouse-wheel-mode))
   (mac-mouse-wheel-mode +1))
 (context-menu-mode +1)
 
@@ -451,7 +457,6 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
   :ghook ('org-mode-hook #'evil-org-mode)
   :gfhook #'evil-org-set-key-theme)
 
-
 ;;; Completion
 
 (use-package company