Commit b3d4a30c2e70

Vincent Demeester <vincent@sbr.pm>
2020-02-03 14:44:57
emacs.org: have early-init code in init.el…
… in case of Emacs major version is under 27. Also add horizontal-scroll-bar-mode to early-init. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 5f15044
lisp/setup-style.el
@@ -60,10 +60,6 @@
                              ("Asia/Calcutta" "Bangalore")
                              ("Australia/Brisbane" "Brisbane")))
   :config
-  (menu-bar-mode -1)
-  (tool-bar-mode -1)
-  (scroll-bar-mode -1)
-  (horizontal-scroll-bar-mode -1)
   (line-number-mode 1)
   (column-number-mode 1)
   (global-hl-line-mode 1)
early-init.el
@@ -5,6 +5,7 @@
 (menu-bar-mode -1)
 (tool-bar-mode -1)
 (scroll-bar-mode -1)
+(horizontal-scroll-bar-mode -1)
 
 (setq gc-cons-threshold 402653184
       gc-cons-percentage 0.6)
@@ -14,5 +15,3 @@
              (setq gc-cons-threshold 16777216 ; 16mb
                    gc-cons-percentage 0.1)
              (garbage-collect)) t)
-
-(provide 'early-init)
emacs.org
@@ -117,6 +117,7 @@
     (menu-bar-mode -1)
     (tool-bar-mode -1)
     (scroll-bar-mode -1)
+    (horizontal-scroll-bar-mode -1)
   #+end_src
 
 - Finally we can try to avoid garbage collection at startup. The garbage collector can
@@ -143,6 +144,28 @@
 One thing though, I am currently not necessarily running Emacs 27, so I am going to need
 to have the same configuration in ~init.el~ for a little bit of time.
 
+#+begin_src emacs-lisp :tangle init.el
+  (when (< emacs-major-version 27)
+    (setq package-enable-at-startup nil)
+
+    (setq frame-inhibit-implied-resize)
+
+    (menu-bar-mode -1)
+    (tool-bar-mode -1)
+    (scroll-bar-mode -1)
+    (horizontal-scroll-bar-mode -1)
+
+    (setq gc-cons-threshold 402653184
+          gc-cons-percentage 0.6)
+
+    (add-hook 'after-init-hook
+              `(lambda ()
+                 (setq gc-cons-threshold 16777216 ; 16mb
+                       gc-cons-percentage 0.1)
+                 (garbage-collect)) t))
+#+end_src
+
+
 * TODO Selection candidates and search methods
 :PROPERTIES:
 :CUSTOM_ID: h:571cf8bc-a359-4d75-9d56-b35c22126cf2
@@ -187,20 +210,10 @@
   (defconst emacs-start-time (current-time))
   (defvar file-name-handler-alist-old file-name-handler-alist)
 
-  (setq package-enable-at-startup nil
-        file-name-handler-alist nil
+  (setq file-name-handler-alist nil
         message-log-max 16384
-        gc-cons-threshold 402653184
-        gc-cons-percentage 0.6
         auto-window-vscroll nil)
 
-  (add-hook 'after-init-hook
-            `(lambda ()
-               (setq file-name-handler-alist file-name-handler-alist-old
-                     gc-cons-threshold 800000
-                     gc-cons-percentage 0.1)
-               (garbage-collect)) t)
-
   (let ((minver 25))
     (unless (>= emacs-major-version minver)
       (error "Your Emacs is too old -- this configuration requrise v%s or higher" minver)))
@@ -3065,10 +3078,6 @@
                                ("Asia/Calcutta" "Bangalore")
                                ("Australia/Brisbane" "Brisbane")))
     :config
-    (menu-bar-mode -1)
-    (tool-bar-mode -1)
-    (scroll-bar-mode -1)
-    (horizontal-scroll-bar-mode -1)
     (line-number-mode 1)
     (column-number-mode 1)
     (global-hl-line-mode 1)
init.el
@@ -1,21 +1,30 @@
+(when (< emacs-major-version 27)
+  (setq package-enable-at-startup nil)
+
+  (setq frame-inhibit-implied-resize)
+
+  (menu-bar-mode -1)
+  (tool-bar-mode -1)
+  (scroll-bar-mode -1)
+  (horizontal-scroll-bar-mode -1)
+
+  (setq gc-cons-threshold 402653184
+        gc-cons-percentage 0.6)
+
+  (add-hook 'after-init-hook
+            `(lambda ()
+               (setq gc-cons-threshold 16777216 ; 16mb
+                     gc-cons-percentage 0.1)
+               (garbage-collect)) t))
+
 ;;; -*- lexical-binding: t; -*-
 (defconst emacs-start-time (current-time))
 (defvar file-name-handler-alist-old file-name-handler-alist)
 
-(setq package-enable-at-startup nil
-      file-name-handler-alist nil
+(setq file-name-handler-alist nil
       message-log-max 16384
-      gc-cons-threshold 402653184
-      gc-cons-percentage 0.6
       auto-window-vscroll nil)
 
-(add-hook 'after-init-hook
-          `(lambda ()
-             (setq file-name-handler-alist file-name-handler-alist-old
-                   gc-cons-threshold 800000
-                   gc-cons-percentage 0.1)
-             (garbage-collect)) t)
-
 (let ((minver 25))
   (unless (>= emacs-major-version minver)
     (error "Your Emacs is too old -- this configuration requrise v%s or higher" minver)))