summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--config.org48
-rw-r--r--early-init.el4
-rw-r--r--init.el14
3 files changed, 17 insertions, 49 deletions
diff --git a/config.org b/config.org index 27cfb10..c622e62 100644 --- a/config.org +++ b/config.org
@@ -1421,24 +1421,18 @@ from [[https://karthinks.com/software/more-batteries-included-with-emacs/#regexp
1421 :header-args: :tangle init.el 1421 :header-args: :tangle init.el
1422 :END: 1422 :END:
1423 1423
1424 #+begin_src emacs-lisp :comments no 1424I realized I didn’t need =early-init.el=, since it really only set =load-prefer-newer=. So I’ve set that here, and wrapped the actual loading of config in a =let*= form that speeds up init, and loads the newer of either =config.org= or =config.el=.
1425 ;; init.el -*- lexical-binding: t -*-
1426 #+end_src
1427 1425
1428**** Speed up init 1426 #+BEGIN_SRC emacs-lisp
1427 ;; init.el -*- lexical-binding: t -*-
1429 1428
1430#+begin_src emacs-lisp 1429 (setq load-prefer-newer t)
1431 (setq gc-cons-threshold most-positive-fixnum)
1432 (defvar old-file-name-handler file-name-handler-alist)
1433 (setq file-name-handler-alist nil)
1434#+end_src
1435
1436**** Load config
1437
1438 inspired by [[https://protesilaos.com/dotemacs/#h:584c3604-55a1-49d0-9c31-abe46cb1f028][Protesilaos Stavrou]].
1439 1430
1440 #+begin_src emacs-lisp 1431 (let* (;; Speed up init
1441 (let* ((conf (expand-file-name "config" 1432 (gc-cons-threshold most-positive-fixnum)
1433 (file-name-handler-alist nil)
1434 ;; Config file names
1435 (conf (expand-file-name "config"
1442 user-emacs-directory)) 1436 user-emacs-directory))
1443 (conf-el (concat conf ".el")) 1437 (conf-el (concat conf ".el"))
1444 (conf-org (concat conf ".org"))) 1438 (conf-org (concat conf ".org")))
@@ -1446,31 +1440,11 @@ from [[https://karthinks.com/software/more-batteries-included-with-emacs/#regexp
1446 (load conf 'no-error)) 1440 (load conf 'no-error))
1447 (require 'org) 1441 (require 'org)
1448 (org-babel-load-file conf-org))) 1442 (org-babel-load-file conf-org)))
1449 #+end_src 1443 #+END_SRC
1450
1451**** Reset for normal operation
1452
1453#+begin_src emacs-lisp
1454 (setq gc-cons-threshold 16777216 ; 16mb
1455 gc-cons-percentage 0.1
1456 file-name-handler-alist old-file-name-handler)
1457#+end_src
1458
1459*** early-init.el
1460 :PROPERTIES:
1461 :header-args: :tangle early-init.el
1462 :END:
1463
1464 #+begin_src emacs-lisp :comments no
1465 ;; early-init.el -*- lexical-binding: t; no-byte-compile: t; -*-
1466
1467 (setq load-prefer-newer t)
1468 (setq frame-inhibit-implied-resize t)
1469 #+end_src
1470 1444
1471** Ease tangling and loading of Emacs' init 1445** Ease tangling and loading of Emacs' init
1472 1446
1473 #+begin_src emacs-lisp 1447 #+BEGIN_SRC emacs-lisp
1474 (defun refresh-emacs (&optional disable-load) 1448 (defun refresh-emacs (&optional disable-load)
1475 "Tangle `config.org', then byte-compile the resulting files. 1449 "Tangle `config.org', then byte-compile the resulting files.
1476 Then, load the byte-compilations unless passed with a prefix argument." 1450 Then, load the byte-compilations unless passed with a prefix argument."
diff --git a/early-init.el b/early-init.el deleted file mode 100644 index f9d4a97..0000000 --- a/early-init.el +++ /dev/null
@@ -1,4 +0,0 @@
1;; early-init.el -*- lexical-binding: t; no-byte-compile: t; -*-
2
3(setq load-prefer-newer t)
4(setq frame-inhibit-implied-resize t)
diff --git a/init.el b/init.el index fadf705..faef4d4 100644 --- a/init.el +++ b/init.el
@@ -1,10 +1,12 @@
1;; init.el -*- lexical-binding: t -*- 1;; init.el -*- lexical-binding: t -*-
2 2
3(setq gc-cons-threshold most-positive-fixnum) 3(setq load-prefer-newer t)
4(defvar old-file-name-handler file-name-handler-alist)
5(setq file-name-handler-alist nil)
6 4
7(let* ((conf (expand-file-name "config" 5(let* (;; Speed up init
6 (gc-cons-threshold most-positive-fixnum)
7 (file-name-handler-alist nil)
8 ;; Config file names
9 (conf (expand-file-name "config"
8 user-emacs-directory)) 10 user-emacs-directory))
9 (conf-el (concat conf ".el")) 11 (conf-el (concat conf ".el"))
10 (conf-org (concat conf ".org"))) 12 (conf-org (concat conf ".org")))
@@ -12,7 +14,3 @@
12 (load conf 'no-error)) 14 (load conf 'no-error))
13 (require 'org) 15 (require 'org)
14 (org-babel-load-file conf-org))) 16 (org-babel-load-file conf-org)))
15
16(setq gc-cons-threshold 16777216 ; 16mb
17 gc-cons-percentage 0.1
18 file-name-handler-alist old-file-name-handler)