summaryrefslogtreecommitdiff
path: root/tw/home/files/emacs-init.el
diff options
context:
space:
mode:
Diffstat (limited to 'tw/home/files/emacs-init.el')
-rw-r--r--tw/home/files/emacs-init.el23
1 files changed, 17 insertions, 6 deletions
diff --git a/tw/home/files/emacs-init.el b/tw/home/files/emacs-init.el
index a5c73d8d..8fd624fc 100644
--- a/tw/home/files/emacs-init.el
+++ b/tw/home/files/emacs-init.el
@@ -38,31 +38,42 @@
(max-mini-window-height 3 "Let the echo area grow to a maximum of 3 lines, e.g. when using `eldoc-mode'.")
(scroll-up-aggressively 0.0 "Don't recenter the window if the point moves off the page.")
(scroll-down-aggressively 0.0 "Don't recenter the window if the point moves off the page.")
- ;; Indentation.
- (indent-tabs-mode nil "Always use spaces to indent.")
;; Niceties.
(tramp-default-method "scpx" "ssh and scp hang forever. scpx is faster than sshx for large files.")
(global-hl-line-mode t "Highlight the current line in all buffers.")
+ (indicate-empty-lines t "Show a little marker in the margin for lines past EOF.")
(column-number-mode t "Show the column number in the statusline.")
(electric-pair-mode t "Auto-pair suitable characters like parentheses.")
(completion-cycle-threshold 6 "Allow cycling through completions if there are 6 or fewer of them.")
(shell-kill-buffer-on-exit t "Kill *shell* buffers as soon as their shell session exits.")
- ;; Text formatting.
+ ;; Indentation, formatting.
+ (indent-tabs-mode nil "Always use spaces to indent.")
(sentence-end-double-space nil "Use a single space after a sentence.")
(fill-column 78 "Make hard-wrapped text a bit wider.")
+ (require-final-newline t "Always add a final newline on save, if there is none.")
+ (show-trailing-whitespace t "Always show trailing spaces.")
;; Make Emacs a good Guix citizen.
(package-archives nil "Don't fetch packages from the internet; only get them from Guix.")
- ;; Don't clutter the disk with backup files.
- (make-backup-files nil "Don't create backup files. Backup files break hardlinks.")
+ ;; Default mode.
+ (major-mode text-mode "Use `text-mode' by default in new buffers, not `fundamental-mode'.")
;; Recent files and history. Keep them out of ~/.config.
(package-user-dir ,(tw/xdg-emacs-subdir 'data "elpa") "Save ELPA-related files here.")
(auto-save-list-file-prefix ,(tw/xdg-emacs-subdir 'data "auto-save-list/saves-") "Put auto-save lists here.")
+ (make-backup-files nil "Don't create backup files. They're annoying.")
+ (backup-directory-alist (("." . ,(tw/xdg-emacs-subdir 'data "backup"))) "Put backup files in a sensible place.")
+ (backup-by-copying t "Avoid breaking hardlinks when making backup files.")
+ (auto-save-file-name-transforms
+ ;; `file-name-as-directory' is important, since Emacs takes the directory part when UNIQUIFY is t.
+ ((".*" ,(file-name-as-directory (tw/xdg-emacs-subdir 'data "auto-save")) t))
+ "Put auto-save #files# in a sensible directory.")
(recentf-max-saved-items 1000 "Save lots of recently-opened files.")
(recentf-save-file ,(tw/xdg-emacs-subdir 'data "recentf.el") "Save recently-opened files here.")
(recentf-mode t "Save recently-opened files.")
(savehist-file ,(tw/xdg-emacs-subdir 'data "savehist.el") "Save minibuffer history here.")
(savehist-mode t "Save minibuffer history on quit.")))
+(make-directory (cadr (assoc-string ".*" auto-save-file-name-transforms)) t)
+
(defalias 'yes-or-no-p #'y-or-n-p
"Always use `y-or-n-p' when asking for confirmation.")
@@ -213,7 +224,7 @@
:bind (("<leader>U" . undo-tree-visualize))
:custom
(undo-tree-history-directory-alist
- `(("." . ,(tw/xdg-emacs-subdir 'data "undo-tree-history/")))
+ `(("." . ,(file-name-as-directory (tw/xdg-emacs-subdir 'data "undo-tree-history"))))
"Store all `undo-tree' history in a single directory, instead of next to the associated file.")
:commands (global-undo-tree-mode)
:demand t ; this is required so that the :config stanza is actually run asap despite :bind