2023-05-27 04:22:26 +00:00
|
|
|
(package-initialize)
|
2023-05-27 03:03:31 +00:00
|
|
|
(use-package use-package)
|
|
|
|
|
2022-10-20 04:03:56 +00:00
|
|
|
(add-to-list 'package-archives
|
|
|
|
'("melpa" . "https://melpa.org/packages/")
|
|
|
|
)
|
|
|
|
|
|
|
|
(use-package auto-package-update
|
|
|
|
:ensure t
|
|
|
|
:config
|
|
|
|
(setq auto-package-update-delete-old-versions t
|
|
|
|
auto-package-update-interval 14)
|
|
|
|
(auto-package-update-maybe))
|
|
|
|
|
|
|
|
(defun assert-directory (p)
|
|
|
|
(unless (file-exists-p p) (make-directory p t))
|
|
|
|
p
|
|
|
|
)
|
2023-09-09 04:33:17 +00:00
|
|
|
|
|
|
|
(defconst private-dir (expand-file-name "private" user-emacs-directory))
|
|
|
|
(defconst temp-dir (format "%s/cache" private-dir)
|
|
|
|
"Hostname-based elisp temp directories")
|
2022-10-20 04:03:56 +00:00
|
|
|
(assert-directory (concat temp-dir "/auto-save-list/"))
|
|
|
|
(setq autoload-directory (concat user-emacs-directory (file-name-as-directory "elisp") (file-name-as-directory "autoload")))
|
|
|
|
(add-to-list 'load-path (assert-directory autoload-directory))
|
|
|
|
|
2023-09-09 04:33:17 +00:00
|
|
|
(setq-default
|
2023-09-09 05:44:01 +00:00
|
|
|
;; Disable backup files and lockfiles
|
2023-09-09 04:33:17 +00:00
|
|
|
make-backup-files nil
|
|
|
|
auto-save-default nil
|
2023-09-09 05:44:01 +00:00
|
|
|
create-lockfiles nil
|
|
|
|
;; Unless otherwise specified, always install packages if they are absent.
|
|
|
|
use-package-always-ensure t
|
|
|
|
;; Point custom-file at /dev/null so emacs does not write any settings to my dotfiles.
|
|
|
|
custom-file "/dev/null"
|
|
|
|
;; Don't pop up a small window at the bottom of emacs at launch.
|
|
|
|
inhibit-startup-screen t
|
|
|
|
inhibit-startup-message t
|
2024-01-27 02:21:09 +00:00
|
|
|
;; Don't show the list of buffers when opening many files.
|
|
|
|
inhibit-startup-buffer-menu t
|
2023-09-09 05:44:01 +00:00
|
|
|
;; Give the scratch buffer a clean slate.
|
|
|
|
initial-major-mode 'fundamental-mode
|
|
|
|
initial-scratch-message nil
|
|
|
|
;; Send prompts to mini-buffer not the GUI
|
|
|
|
use-dialog-box nil
|
|
|
|
;; End files with line break
|
|
|
|
require-final-newline t
|
|
|
|
;; Use spaces, not tabs
|
|
|
|
indent-tabs-mode nil
|
|
|
|
;; Use a better frame title
|
|
|
|
frame-title-format '("" invocation-name ": "(:eval (if (buffer-file-name)
|
|
|
|
(abbreviate-file-name (buffer-file-name))
|
|
|
|
"%b")))
|
|
|
|
;; Use 'y' or 'n' instead of 'yes' or 'no'
|
|
|
|
use-short-answers t
|
|
|
|
;; Natively compile packages
|
|
|
|
package-native-compile t
|
2023-09-09 08:41:24 +00:00
|
|
|
;; Confirm when opening a file that does not exist
|
|
|
|
confirm-nonexistent-file-or-buffer t
|
2023-10-12 18:28:28 +00:00
|
|
|
;; Do not require double space to end a sentence.
|
|
|
|
sentence-end-double-space nil
|
|
|
|
;; Show trailing whitespace
|
|
|
|
show-trailing-whitespace t
|
|
|
|
;; Remove the line when killing it with ctrl-k
|
|
|
|
kill-whole-line t
|
2023-09-09 05:44:01 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
;; (setq-default fringes-outside-margins t)
|
|
|
|
|
2023-09-27 19:01:43 +00:00
|
|
|
;; Per-pixel scrolling instead of per-line
|
2023-09-09 05:44:01 +00:00
|
|
|
(pixel-scroll-precision-mode)
|
2023-09-09 04:33:17 +00:00
|
|
|
|
2023-09-27 19:01:43 +00:00
|
|
|
;; Typed text replaces selection
|
|
|
|
(delete-selection-mode)
|
|
|
|
|
|
|
|
|
2022-10-20 04:03:56 +00:00
|
|
|
;; Delete trailing whitespace before save
|
|
|
|
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
|
|
|
|
2023-12-17 16:51:41 +00:00
|
|
|
;; If the underlying file changes, reload it automatically. This is useful for moving around in git without confusing language servers.
|
|
|
|
(setopt auto-revert-avoid-polling t)
|
|
|
|
(setopt auto-revert-interval 5)
|
|
|
|
(setopt auto-revert-check-vc-info t)
|
|
|
|
(global-auto-revert-mode)
|
|
|
|
|
2024-01-27 02:21:09 +00:00
|
|
|
;;;;; Performance
|
|
|
|
;; Run garbage collect when emacs is idle
|
|
|
|
(run-with-idle-timer 5 t (lambda () (garbage-collect)))
|
|
|
|
(add-function :after after-focus-change-function
|
|
|
|
(lambda ()
|
|
|
|
(unless (frame-focus-state)
|
|
|
|
(garbage-collect))))
|
|
|
|
|
2022-10-20 04:03:56 +00:00
|
|
|
(provide 'base)
|