about summary refs log tree commit diff stats
path: root/.emacs.d
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/README.md1
-rw-r--r--.emacs.d/early-init.el26
-rw-r--r--.emacs.d/lisp/init-dired.el2
-rw-r--r--.emacs.d/lisp/init-editor.el28
-rw-r--r--.emacs.d/lisp/init-emacs-lisp.el4
-rw-r--r--.emacs.d/lisp/init-kill.el1
-rw-r--r--.emacs.d/lisp/init-minibuffer.el2
-rw-r--r--.emacs.d/lisp/init-search.el1
-rw-r--r--.emacs.d/lisp/init-ui.el19
9 files changed, 72 insertions, 12 deletions
diff --git a/.emacs.d/README.md b/.emacs.d/README.md
index 965a718..0f006b6 100644
--- a/.emacs.d/README.md
+++ b/.emacs.d/README.md
@@ -10,6 +10,7 @@ My Emacs Configuration, inspired by Prelude (https://github.com/bbatsov/prelude)
 - https://gitlab.com/protesilaos/dotfiles
 - https://gitlab.com/buildfunthings/emacs-config
 - https://www.emacswiki.org/emacs
+- https://github.com/jamescherti/minimal-emacs.d
 
 As well as the github READMEs and wikis for corfu, vertico, orderless, consult, embark, marginalia, and other places too.
 
diff --git a/.emacs.d/early-init.el b/.emacs.d/early-init.el
index 1608f02..1dd7a01 100644
--- a/.emacs.d/early-init.el
+++ b/.emacs.d/early-init.el
@@ -7,7 +7,9 @@
 
 (setq load-prefer-newer t
       native-comp-async-report-warnings-errors nil
+      native-comp-warning-on-missing-source nil
       warning-suppress-log-types '((comp) (bytecomp))
+      byte-compile-verbose nil
       byte-compile-warnings '(not free-vars unresolved noruntime lexical make-local obsolete))
 
 (push '(menu-bar-lines . 0) default-frame-alist)
@@ -27,8 +29,19 @@
 (when window-system
   (tool-bar-mode -1)
   (scroll-bar-mode -1)
+  (tooltip-mode -1)
   (horizontal-scroll-bar-mode -1))
 
+;; Copied from https://github.com/jamescherti/minimal-emacs.d
+;; Some features that are not represented as packages can be found in
+;; `features', but this can be inconsistent. The following enforce consistency:
+(if (fboundp #'json-parse-string)
+    (push 'jansson features))
+(if (string-match-p "HARFBUZZ" system-configuration-features) ; no alternative
+    (push 'harfbuzz features))
+(if (bound-and-true-p module-file-suffix)
+    (push 'dynamic-modules features))
+
 (setq package-enable-at-startup nil)
 
 ;; Some optimizations from doom.el (some of these probably don't belong here!)
@@ -43,6 +56,19 @@
 (setq inhibit-compacting-font-caches t)
 (setq redisplay-skip-fontification-on-input t)
 
+;; Copied/modified from https://github.com/jamescherti/minimal-emacs.d
+(setq ad-redefinition-action 'accept
+      warning-suppress-types '((lexical-binding))
+      inhibit-startup-buffer-menu t
+      inhibit-x-resources t
+      use-file-dialog nil
+      use-dialog-box nil)
+(advice-add #'display-startup-screen :override #'ignore)
+(unless (eq system-type 'darwin)
+  (setq command-line-ns-option-alist nil))
+(unless (memq initial-window-system '(x pgtk))
+  (setq command-line-x-option-alist nil))
+
 (define-advice load-file (:override (file) silence)
   (load file nil 'nomessage))
 (define-advice startup--load-user-init-file (:before (&rest _) undo-silence)
diff --git a/.emacs.d/lisp/init-dired.el b/.emacs.d/lisp/init-dired.el
index 5ec6531..6a6f821 100644
--- a/.emacs.d/lisp/init-dired.el
+++ b/.emacs.d/lisp/init-dired.el
@@ -13,6 +13,8 @@
   (dired-kill-when-opening-new-dired-buffer t)
   (wdired-use-dired-vertical-movement 'sometimes)
   (dired-vc-rename-file t)
+  (dired-clean-confirm-killing-deleted-buffers nil)
+  (dired-create-destination-dirs 'ask)
   :bind (:map dired-mode-map
               ("M-o" . dired-omit-mode)
               ("E" . wdired-change-to-wdired-mode)))
diff --git a/.emacs.d/lisp/init-editor.el b/.emacs.d/lisp/init-editor.el
index 4f5a437..4d4c9b3 100644
--- a/.emacs.d/lisp/init-editor.el
+++ b/.emacs.d/lisp/init-editor.el
@@ -33,14 +33,24 @@
   (setq comment-auto-fill-only-comments t)
   (setq large-file-warning-threshold 100000000)
   (setq create-lockfiles nil)
-  (setq global-auto-revert-non-file-buffers t)
-  (setq backup-by-copying t)
+  (setq global-auto-revert-non-file-buffers t
+        revert-without-query (list ".")
+        auto-revert-stop-on-user-input nil)
+  (setq backup-by-copying t
+        delete-old-versions t
+        version-control t
+        kept-new-versions 5
+        kept-old-versions 5)
   (setq backup-directory-alist
         `((".*" . ,temporary-file-directory))
         auto-save-file-name-transforms
-        `((".*" ,temporary-file-directory t)))
+        `((".*" ,temporary-file-directory t))
+        auto-save-include-big-deletions t)
+  (setq comment-multi-line t
+        comment-empty-lines t)
 
-  (setq save-place-file (expand-file-name "saveplace" save-dir))
+  (setq save-place-file (expand-file-name "saveplace" save-dir)
+        save-place-limit 800)
   ;; https://git.sr.ht/~technomancy/better-defaults/tree/master/item/better-defaults.el
   (setq save-interprogram-paste-before-kill t
         apropos-do-all t
@@ -50,11 +60,12 @@
   (setq ffap-machine-p-local 'accept
         ffap-machine-p-known 'reject
         ffap-machine-p-unkown 'reject)
-  ;; https://github.com/natecox/dotfiles/blob/master/workspaces/shared/symlinks/emacs/.emacs.d/nathancox.org
+
   (setq sentence-end-double-space nil)
-  (set-charset-priority 'unicode)
-  (setq locale-coding-system 'utf-8)
-  (setq default-process-coding-system '(utf-8-unix . utf-8-unix))
+  (set-language-environment "UTF-8")
+  ;; TODO is this needed? (See https://github.com/jamescherti/minimal-emacs.d)
+  ;; (setq default-input-method nil)
+
   (set-default 'imenu-auto-rescan t))
 
 (use-package move-text
@@ -72,6 +83,7 @@
   (savehist-additional-variables '(search-ring regexp-search-ring))
   (savehist-autosave-interval 60)
   (savehist-file (expand-file-name "savehist" save-dir))
+  (history-length 300)
   :hook (elpaca-after-init . savehist-mode))
 
 (use-package super-save
diff --git a/.emacs.d/lisp/init-emacs-lisp.el b/.emacs.d/lisp/init-emacs-lisp.el
index 4ca010a..e32ee31 100644
--- a/.emacs.d/lisp/init-emacs-lisp.el
+++ b/.emacs.d/lisp/init-emacs-lisp.el
@@ -10,6 +10,10 @@
   :diminish)
 
 (use-feature emacs
+  :custom
+  ;; These don't really belong here, but do affect ielm
+  (comint-prompt-read-only t)
+  (comint-buffer-maximum-size 2048)
   :config
   ;; Based on prelude-emacs-lisp.el
   (defun recompile-init-lisp ()
diff --git a/.emacs.d/lisp/init-kill.el b/.emacs.d/lisp/init-kill.el
index 37103e3..d72f776 100644
--- a/.emacs.d/lisp/init-kill.el
+++ b/.emacs.d/lisp/init-kill.el
@@ -16,6 +16,7 @@
   (:map easy-kill-base-map ("C-=" . easy-kill-expand)))
 
 (use-feature emacs
+  :custom (kill-do-not-save-duplicates t)
   :hook
   (elpaca-after-init . (lambda ()
                          ;; Based on code in prelude-editor.el
diff --git a/.emacs.d/lisp/init-minibuffer.el b/.emacs.d/lisp/init-minibuffer.el
index 3094654..2ae4944 100644
--- a/.emacs.d/lisp/init-minibuffer.el
+++ b/.emacs.d/lisp/init-minibuffer.el
@@ -12,7 +12,7 @@
   :config
   ;; Do not allow the cursor in the minibuffer prompt
   (setq minibuffer-prompt-properties
-        '(read-only t cursor-intangible t face minibuffer-prompt))
+        '(read-only t cursor-intangible t intangible t face minibuffer-prompt))
   (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
   (setq enable-recursive-minibuffers t)
   (minibuffer-depth-indicate-mode t)
diff --git a/.emacs.d/lisp/init-search.el b/.emacs.d/lisp/init-search.el
index f471d0e..b42e49f 100644
--- a/.emacs.d/lisp/init-search.el
+++ b/.emacs.d/lisp/init-search.el
@@ -112,6 +112,7 @@
   (isearch-lazy-count t)
   (lazy-count-prefix-format nil)
   (lazy-count-suffix-format "   (%s/%s)")
+  (lazy-highlight-initial-delay 0)
   (isearch-message-properties '(read-only t cursor-intangible t face isearch-prompt))
   :bind-keymap ("C-c s" . search-map) ;; M-s clashes with paredit/smartparens bindings
   :bind
diff --git a/.emacs.d/lisp/init-ui.el b/.emacs.d/lisp/init-ui.el
index 1cfde4f..e3b94fd 100644
--- a/.emacs.d/lisp/init-ui.el
+++ b/.emacs.d/lisp/init-ui.el
@@ -47,6 +47,7 @@
                         (define-key view-mode-map (kbd "p") 'scroll-down-command)
                         (define-key view-mode-map (kbd "n") 'scroll-up-command)))))
   :config
+  (setq-default display-line-numbers-widen t)
   ;; https://github.com/rougier/elegant-emacs/blob/master/sanity.el
   (setq inhibit-startup-screen t
         inhibit-startup-echo-area-message t
@@ -65,13 +66,22 @@
                              (run-with-timer 0.05 nil 'invert-face 'mode-line))
         visible-bell t)
 
-  ;; TODO do we want these? (copied from prelude)
+  ;; A combination of settings from prelude and minimal-emacs.d, may need tweaking
   (setq scroll-margin 0
         scroll-conservatively 100000
-        scroll-preserve-screen-position 1)
+        scroll-preserve-screen-position 1
+        hscroll-margin 2
+        hscroll-step 1
+        auto-window-vscroll nil)
   (setq pixel-scroll-precision-mode t)
+  (setq-default word-wrap t
+                truncate-lines t
+                fill-column 80)
+  ;; If enabled and `truncate-lines' is disabled, soft wrapping will not occur
+  ;; when the window is narrower than `truncate-partial-width-windows' characters.
+  (setq truncate-partial-width-windows nil)
 
-  (fset 'yes-or-no-p 'y-or-n-p)
+  (setq use-short-answers t)
 
   (setq frame-title-format
         '("Emacs: " (:eval (if (buffer-file-name)
@@ -134,6 +144,9 @@
   :hook (prog-mode . idle-highlight-mode))
 
 (use-feature paren
+  :custom
+  (show-paren-when-point-inside-paren t)
+  (show-paren-when-point-in-periphery t)
   :config
   (show-paren-mode +1))