2022-06-19 19:05:40 -08:00
|
|
|
;;; init.el --- basic initial declarations
|
|
|
|
;;; Commentary:
|
|
|
|
;; _ _ _ _
|
|
|
|
;; (_) _ __ (_)| |_ ___ | |
|
|
|
|
;; | || '_ \ | || __| / _ \| |
|
|
|
|
;; | || | | || || |_ _| __/| |
|
|
|
|
;; |_||_| |_||_| \__|(_)\___||_|
|
|
|
|
;;
|
|
|
|
;; '((above text graphic generated with command `figlet -k "init.el"'))
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
;; Speed up loading/finding files
|
|
|
|
(let
|
2022-08-24 19:11:42 -08:00
|
|
|
(
|
|
|
|
(file-name-handler-alist nil)
|
|
|
|
)
|
2022-06-19 19:05:40 -08:00
|
|
|
|
|
|
|
;; Don't set this, fix the actual issue and use a POSIX-ish shell (or CMD):
|
|
|
|
;; (setq shell-file-name "/bin/sh")
|
|
|
|
|
|
|
|
;; Load the files that I put my settings in...
|
|
|
|
(defvar mitch-directory
|
|
|
|
(directory-file-name
|
|
|
|
(concat user-emacs-directory
|
|
|
|
(convert-standard-filename "lisp/"))))
|
|
|
|
(setq load-path
|
|
|
|
(cons mitch-directory load-path))
|
|
|
|
(setq custom-theme-directory mitch-directory)
|
|
|
|
|
|
|
|
(require 'mitch-defuns)
|
|
|
|
;; (require 'webkit) ; see https://github.com/akirakyle/emacs-webkit
|
|
|
|
(require 'man-plus)
|
|
|
|
|
|
|
|
;; minify yes/no prompts
|
|
|
|
;; (if (>= (string-to-number emacs-version) 28)
|
|
|
|
;; (defvar use-short-answers t))
|
|
|
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
|
|
|
|
|
|
|
;; do the things
|
|
|
|
(add-hook 'server-after-make-frame-hook #'mitch/graphical-setup)
|
|
|
|
(if (display-graphic-p) (mitch/graphical-setup))
|
|
|
|
|
|
|
|
;; Control backups/swapfiles
|
|
|
|
(defvar backup-directory
|
|
|
|
(expand-file-name "emacs-backups"
|
|
|
|
(or (getenv "XDG_CACHE_HOME")
|
|
|
|
(expand-file-name
|
|
|
|
".cache" "~"))))
|
|
|
|
(if (not (file-exists-p backup-directory))
|
|
|
|
(make-directory backup-directory t))
|
|
|
|
(setq backup-directory-alist `(("." . ,backup-directory)))
|
|
|
|
;; auto-save-mode doesn't create the path automatically!
|
|
|
|
(defvar auto-save-directory
|
|
|
|
(expand-file-name "tmp/auto-saves/" backup-directory))
|
|
|
|
(make-directory auto-save-directory t)
|
|
|
|
(setq auto-save-list-file-prefix
|
|
|
|
(expand-file-name "sessions/" auto-save-directory)
|
|
|
|
auto-save-file-name-transforms
|
|
|
|
`((".*" ,auto-save-directory t)))
|
|
|
|
(setq create-lockfiles nil)
|
|
|
|
|
|
|
|
;; remove auto-generated bits
|
|
|
|
(setq custom-file (expand-file-name "custom.el" backup-directory))
|
|
|
|
(if (not (file-exists-p custom-file))
|
|
|
|
(make-empty-file custom-file t))
|
|
|
|
(load custom-file)
|
|
|
|
|
|
|
|
;; straight.el: the better package manager?
|
|
|
|
;; minified bootstrap (split lines if you want) (or not)
|
2022-07-11 17:59:39 -08:00
|
|
|
(defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (straight-use-package 'use-package) (setq straight-use-package-by-default t)
|
2022-06-19 19:05:40 -08:00
|
|
|
|
|
|
|
(require 'mitch-packages)
|
|
|
|
|
|
|
|
;; Absolute line numbers. Relative ones are an annoyance to set up, sadly.
|
2022-06-22 06:31:32 -08:00
|
|
|
;; (global-display-line-numbers-mode)
|
|
|
|
;; (defvar display-line-numbers-width-start t)
|
|
|
|
|
2022-06-19 19:05:40 -08:00
|
|
|
|
|
|
|
;; scroll step stuff
|
|
|
|
(setq scroll-margin 2
|
|
|
|
scroll-conservatively 100
|
|
|
|
scroll-up-aggressively 0.01
|
|
|
|
scroll-down-aggressively 0.01)
|
|
|
|
(global-visual-line-mode t)
|
|
|
|
|
|
|
|
;; UTF-8 supremacy (Snippet from https://github.com/doomemacs/doomemacs/blob/master/early-init.el)
|
|
|
|
(set-language-environment "UTF-8")
|
|
|
|
|
|
|
|
;; Toggle Japanese with `qq'
|
|
|
|
;; Sample text: 進撃 の 巨人
|
|
|
|
;; (shingeki no kyojin (attack on titan))
|
2022-07-22 16:22:17 -08:00
|
|
|
(setq default-input-method "japanese")
|
|
|
|
(general-define-key
|
|
|
|
:states 'insert
|
|
|
|
"q" (general-key-dispatch 'self-insert-command
|
2022-08-18 18:09:07 -08:00
|
|
|
:timeout 0.25
|
2022-07-22 16:22:17 -08:00
|
|
|
"q" 'toggle-input-method))
|
2022-06-19 19:05:40 -08:00
|
|
|
;; DISABLED because something broke and I didn't bother figuring out what...
|
|
|
|
|
2022-08-18 18:09:07 -08:00
|
|
|
;; Don't barf out emacs errors as they are encountered
|
2022-07-17 10:47:53 -08:00
|
|
|
(setq debug-on-error nil)
|
2022-06-19 19:05:40 -08:00
|
|
|
|
|
|
|
;; Speed up scrolling down (why is this even a thing?)
|
|
|
|
(setq auto-window-vscroll nil)
|
|
|
|
|
|
|
|
;; save place in all files
|
|
|
|
(save-place-mode t)
|
|
|
|
(defvar save-place-file
|
|
|
|
(expand-file-name "file-position-save" backup-directory))
|
|
|
|
|
|
|
|
;; load eshell stuff when we start eshell
|
|
|
|
(add-hook 'eshell-mode-hook #'(lambda () (require 'eshell-settings)))
|
|
|
|
;; Display "labmda" as λ
|
|
|
|
(global-prettify-symbols-mode 1)
|
|
|
|
|
2022-06-19 19:16:32 -08:00
|
|
|
;; ...and finally, sync files with disk changes
|
|
|
|
(global-auto-revert-mode)
|
|
|
|
(diminish 'auto-revert-mode)
|
2022-06-19 19:05:40 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
;; lower gc threshold again
|
|
|
|
(setq gc-cons-threshold (* 2 1000 1000))
|
2022-06-25 10:59:43 -08:00
|
|
|
;; (add-function :before #'after-focus-change-function #'garbage-collect)
|
2022-06-19 19:05:40 -08:00
|
|
|
|
2022-06-27 18:58:48 -08:00
|
|
|
;; Smallen buffer if windows
|
|
|
|
(if (equal (window-system) 'w32)
|
|
|
|
(text-scale-decrease 2))
|
|
|
|
|
2022-06-19 19:05:40 -08:00
|
|
|
;;; init.el ends here
|