diff --git a/early-init.el b/early-init.el deleted file mode 100644 index 7deaf39..0000000 --- a/early-init.el +++ /dev/null @@ -1,67 +0,0 @@ -;;; Bootstrap elpaca -(setq package-enable-at-startup nil) - -;; for guix emacs-next packages you can find the date with -;; ➜ stat /gnu/store/*emacs-next-[23]*.drv | rg Birth | cut -d' ' -f3 | tr -d '-' -;; 20240727 -;; -;; it is possible there are more so probably the most recent one is the one to use. - -(when emacs-build-time - (setq elpaca-core-date (format-time-string "%Y%m%d" emacs-build-time))) -(defvar elpaca-installer-version 0.11) -(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) -(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) -(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory)) -(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git" - :ref nil :depth 1 - :files (:defaults "elpaca-test.el" (:exclude "extensions")) - :build (:not elpaca--activate-package))) -(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory)) - (build (expand-file-name "elpaca/" elpaca-builds-directory)) - (order (cdr elpaca-order)) - (default-directory repo)) - (add-to-list 'load-path (if (file-exists-p build) build repo)) - (unless (file-exists-p repo) - (make-directory repo t) - (when (< emacs-major-version 28) (require 'subr-x)) - (condition-case-unless-debug err - (if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*")) - ((zerop (apply #'call-process `("git" nil ,buffer t "clone" - ,@(when-let* ((depth (plist-get order :depth))) - (list (format "--depth=%d" depth) "--no-single-branch")) - ,(plist-get order :repo) ,repo)))) - ((zerop (call-process "git" nil buffer t "checkout" - (or (plist-get order :ref) "--")))) - (emacs (concat invocation-directory invocation-name)) - ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch" - "--eval" "(byte-recompile-directory \".\" 0 'force)"))) - ((require 'elpaca)) - ((elpaca-generate-autoloads "elpaca" repo))) - (progn (message "%s" (buffer-string)) (kill-buffer buffer)) - (error "%s" (with-current-buffer buffer (buffer-string)))) - ((error) (warn "%s" err) (delete-directory repo 'recursive)))) - (unless (require 'elpaca-autoloads nil t) - (require 'elpaca) - (elpaca-generate-autoloads "elpaca" repo) - (load "./elpaca-autoloads"))) -(add-hook 'after-init-hook #'elpaca-process-queues) -(elpaca `(,@elpaca-order)) - -;; Enable :elpaca use-package keyword. -(elpaca elpaca-use-package - (elpaca-use-package-mode)) - -;; tangling to generate scripts for the local bin directory. This -;; causes the name of the scripts to be returned in the car of the -;; tangle command which is used to load the file. The net result is -;; that not the initialization is loaded, but the first exported -;; script. -(use-package ob-tangle) -(let ((src (concat user-emacs-directory "init.org")) - (tgt (concat user-emacs-directory "init.el")) - (enable-local-variables nil)) ;; disable local variables to prevent asking confirmation before frame is available - (when (file-newer-than-file-p src tgt) - (message "tangling init.org") - (delete-file tgt) - (org-babel-tangle-file src tgt "emacs-lisp"))) diff --git a/init.org b/init.org index 71888f1..731fe17 100644 --- a/init.org +++ b/init.org @@ -35,11 +35,33 @@ one to use. - [[https://github.com/jwiegley/dot-emacs/blob/master/init.org][John Wiegley's .emacs file]] - [[https://github.com/TheBB/dotemacs/blob/master/init.el][Eivind Fonn's init.el]] +** Make tangled file read-only + +Add a preamble to the file to ensure some global settings, most +importantly make the file read-only to avoid editing the tangled file by +accident instead of the source in the org-mode file. + +#+BEGIN_SRC emacs-lisp + ;; init.el --- Literate configuration for Emacs -*- lexical-binding: t; read-only-mode: t; -*- + ;; + ;;; Commentary: + ;; + ;; DO NOT EDIT!!! + ;; + ;; This file is automatically generated from the source in *init.org*. + ;; +#+END_SRC + +Also immediately set lexical binding mode. ** Global Configuration #+BEGIN_SRC emacs-lisp (setq snm-enable-evil t) ;; enable evil bindings (setq snm-docker-executable 'podman) ;; use docker or podman + + (use-package org + :ensure t) + #+END_SRC * First Things First @@ -47,6 +69,7 @@ one to use. ** Bootstrapping Emacs Configuration #+BEGIN_SRC emacs-lisp :tangle "early-init.el" + ;; early-init.el --- Bootstrap Emacs -*- lexical-binding: t; read-only-mode: t; -*- ;;; Bootstrap elpaca (setq package-enable-at-startup nil) @@ -111,7 +134,7 @@ configuration on multiple machines and fetch changes with a ~git pull~ outside emacs so there is on opportunity to tangle the new file. If I see it is outdated I tangle it. -#+BEGIN_SRC emacs-lisp :tangle "early-init.el" +#+BEGIN_SRC emacs-lisp :tangle no ;; tangling to generate scripts for the local bin directory. This ;; causes the name of the scripts to be returned in the car of the ;; tangle command which is used to load the file. The net result is @@ -128,24 +151,6 @@ I see it is outdated I tangle it. #+END_SRC -** Make tangled file read-only - -Add a preamble to the file to ensure some global settings, most -importantly make the file read-only to avoid editing the tangled file by -accident instead of the source in the org-mode file. - -#+BEGIN_SRC emacs-lisp - ;; init.el --- Literate configuration for Emacs -*- lexical-binding: t; read-only-mode: t; -*- - ;; - ;;; Commentary: - ;; - ;; DO NOT EDIT!!! - ;; - ;; This file is automatically generated from the source in *init.org*. - ;; -#+END_SRC - -Also immediately set lexical binding mode. ** Set the garbage collector threshold, to avoid collections The emacs history goes back to times where memory was counted in @@ -1221,8 +1226,8 @@ see also [[https://www.masteringemacs.org/article/how-to-get-started-tree-sitter #+END_SRC *** Rust Support -#+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp ;; configure rust support (let* ((release-date "2023-10-30") (os (pcase system-type @@ -1232,10 +1237,12 @@ see also [[https://www.masteringemacs.org/article/how-to-get-started-tree-sitter (_ "unknown"))) (releases-url "https://github.com/rust-lang/rust-analyzer/releases/download/") (download-url (concat releases-url release-date "/rust-analyzer-" os ".gz")) - (rust-analyzer - (file-name-concat - user-emacs-directory - (concat "lsp/rust-analyzer" (if (eq system-type 'windows-nt) ".exe" ""))))) + (rust-analyzer (file-name-concat + user-emacs-directory + (concat "lsp/rust-analyzer" + (if (eq system-type 'windows-nt) + ".exe" + ""))))) (if (not (file-exists-p rust-analyzer)) (let ((rust-analyzer-archive (concat rust-analyzer ".gz" ))) (message "install rust-analyzer from %s at %s" download-url rust-analyzer) @@ -1247,9 +1254,10 @@ see also [[https://www.masteringemacs.org/article/how-to-get-started-tree-sitter (use-package rustic :ensure t - :init - (setq rustic-lsp-client 'eglot)) + :after (flymake flycheck eglot) + :init (setq rustic-lsp-client 'eglot)) #+END_SRC + *** OCaml Support #+BEGIN_SRC emacs-lisp ;; configure Ocaml support @@ -1862,6 +1870,25 @@ templates to be generated. By default it uses #+END_SRC ** Org Mode + +*** Configure Org Mode + +#+BEGIN_SRC emacs-lisp + (use-package org-mode + :mode "\\.org$" + :ensure nil + :after org + :config + (progn + (setq org-log-done 'time) + (setq org-confirm-babel-evaluate nil) + (setq org-export-babel-evaluate nil) + (setq org-html-validation-link nil) + ;; ... more stuff + ) + ) +#+END_SRC + *** Mixed Pitch Support by Default in Org #+BEGIN_SRC emacs-lisp (defun snm-org-mode-config () @@ -2869,7 +2896,7 @@ integration in Emacs. (report-time-since-load "Programming - Copilot Support") #+END_SRC -#+BEGIN_SRC emacs-lisp :tangle yes +#+BEGIN_SRC emacs-lisp :tangle no (use-package copilot :ensure (copilot :host github :repo "zerolfx/copilot.el" :branch "main" @@ -3344,7 +3371,7 @@ inspiration :user-name ,(concat (auth-source-pass--get-attr "user" data) "@" - (car (s-split "\\." (system-name) ))) + (car (string-split (system-name) "\\."))) :password ,(auth-source-pass--get-attr 'secret data) :channels '("#emacs" "#erc"