init.el (3936B)
1 ;; Initial bootstrap 2 ;; Start in fullscreen mode 3 (message (concat "Starting: " (emacs-uptime))) 4 5 ;; Garbage collection 6 (setq gc-cons-percentage 1.0) 7 (add-hook 'focus-out-hook #'garbage-collect) 8 9 ;; prevent emacs trying to resize itself. maybe a startup time boost. 10 ;; see here 11 ;; https://tony-zorman.com/posts/2022-10-22-emacs-potpourri.html 12 (setq frame-inhibit-implied-resize t) 13 14 ;; Get rid of all bars 15 ;; Note: this hinders discoverability! Not a problem for me, because 16 ;; counsel-M-x gives discoverability with fuzzy-finding and 17 ;; tmm-menubar still lets me use the menubar when needed. But this is 18 ;; worth considering. 19 (when (or window-system (daemonp)) 20 (menu-bar-mode -1) 21 (tool-bar-mode -1) 22 (scroll-bar-mode -1) 23 (tooltip-mode -1)) 24 25 ;; If we have native compilation, disable showing them, they get 26 ;; annoying (but still want to log them) 27 (if (native-comp-available-p) 28 (setq native-comp-async-report-warnings-errors 'silent)) 29 30 ;; Hide 'package CL is deprecated' warning 31 (setq byte-compile-warnings '(cl-functions)) 32 33 ;; Set up custom opener command 34 (defun za/open (what) 35 "Use ~/.scripts/open to open a file" 36 (shell-command (concat "~/.scripts/open " what))) 37 38 ;; If there's a problem verifying certs: 39 ;; (when (string-equal system-type "darwin") 40 ;; (setq package-check-signature nil)) 41 42 ;; Also some problems connecting to package repos on Mac & a specific version 43 ;; https://emacs.stackexchange.com/questions/68288/error-retrieving-https-elpa-gnu-org-packages-archive-contents 44 (when (and (equal emacs-version "27.2") 45 (eql system-type 'darwin)) 46 (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")) 47 48 ;; Replace "yes/no" with "y"/"no" 49 (when (fboundp 'y-or-n-p) 50 (fset 'yes-or-no-p 'y-or-n-p)) 51 52 ;; Set up packages 53 (require 'package) 54 (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) 55 (add-to-list 'package-archives '("nongnu" . "https://elpa.nongnu.org/nongnu/") t) 56 (customize-set-variable 'package-install-upgrade-built-in t "Upgrade built-in packages") 57 (package-initialize) 58 59 ;; Custom lisp files directory 60 (defconst za/manually-installed-package-dir (concat user-emacs-directory "lisp/") "The directory for packages (.lisp) that I manually install.") 61 (make-directory za/manually-installed-package-dir t) 62 (add-to-list 'load-path za/manually-installed-package-dir) 63 (let ((default-directory za/manually-installed-package-dir)) 64 (normal-top-level-add-subdirs-to-load-path)) 65 66 ;; Install and load use-package 67 (unless (package-installed-p 'use-package) 68 (package-install 'use-package)) 69 (eval-when-compile (require 'use-package)) 70 71 ;; Profiling - enable, then run `use-package-report` 72 ;; (setq use-package-compute-statistics t) 73 74 ;; Always auto-install packages: 75 (require 'use-package-ensure) 76 (setq use-package-always-ensure nil) 77 78 (defun za/ignore-builtin (pkg) 79 "Ignore built-in package PKG." 80 (assq-delete-all pkg package--builtins) 81 (assq-delete-all pkg package--builtin-versions)) 82 (za/ignore-builtin 'org) 83 (use-package org) 84 85 ;; Follow symlinks without prompting (the org file is a symlink) 86 (setq vc-follow-symlinks t) 87 88 ;; Some config should not be public, so it's in a separate file: 89 (load-file (file-truename (concat user-emacs-directory "secret.el"))) 90 91 ;; Load all other customization from the org file, only compile if necessary 92 (let* ((.org (file-truename (concat user-emacs-directory "config.org"))) ; the .org file will be in VC 93 (.el (concat user-emacs-directory "config.el")) ; config.el is generated, so won't be in VC 94 (.org-modification-time (file-attribute-modification-time (file-attributes .org))) 95 (.el-modification-time (file-attribute-modification-time (file-attributes .el))) 96 (config-unchanged-p (and (file-exists-p .el) (time-less-p .org-modification-time .el-modification-time)))) 97 98 (require 'org-macs) 99 (unless config-unchanged-p 100 (require 'ob-tangle) 101 (org-babel-tangle-file .org .el "emacs-lisp")) 102 (load-file .el))