summary refs log tree commit diff stats
path: root/lisp/acdw.el
blob: 30c4f443d85e49803507cafa188231ca08673067 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
;;; acdw.el --- Basic emacs shit for acdw -*- lexical-binding: t -*-

;;; Code:

(require 'acdw-funs)			; Extra functions
(require 'acdw-macs)			; Extra macros

(defdir etc/ (locate-user-emacs-file "etc")
  "Directory for package configuration files.
See `no-littering' for examples.")

(defdir var/ etc/
  "Directory for package data file.
See `no-littering' for examples.")

(defdir cache/ (if-let ((xdg-cache (getenv "XDG_CACHE_HOME")))
                   (expand-file-name "emacs/" xdg-cache)
                 etc/)
  "Directory for cache files.")

(setq native-compile-target-directory (cache/ "eln" t))
(when (fboundp 'startup-redirect-eln-cache)
  (startup-redirect-eln-cache (cache/ "eln" t)))

(defdir sync/ (expand-file-name "/home/case/Sync")
  "My Syncthing directory.")

(defdir private/ (sync/ "emacs/private"))
(add-to-list 'load-path private/)

(require 'acdw-defaults)		; Sane defaults
(require '_acdw)			; Private stuff
(require '+lisp)			; Lispy goodness

(setc enable-recursive-minibuffers t
      completions-detailed t
      completion-ignore-case t
      read-buffer-completion-ignore-case t
      read-file-name-completion-ignore-case t
      initial-buffer-choice #'+initial-buffer
      initial-scratch-message
      (format "%s\n\n"
              (comment-lines
               (shell-command-to-string "fortune")
               ";; "))
      sentence-end-double-space nil
      save-silently t)

(defkeys t
  "M-o" #'other-window|switch-buffer
  "C-x 0" #'delete-window|bury-buffer
  "C-M-;" #'+lisp-comment-or-uncomment-sexp
  "M-SPC" #'+cycle-spacing
  "C-x C-k" #'kill-this-buffer)

(defkeys t
  "M-u" #'universal-argument)

(defkeys universal-argument-map
  "M-u" #'universal-argument-more)

(define-advice switch-to-buffer (:after (&rest _) normal-mode)
  "Automatically determine the mode for created non-file buffers."
  (when-let ((_ (and (eq major-mode 'fundamental-mode)))
             (buffer-file-name (buffer-name)))
    (normal-mode)))

(define-advice canonically-space-region
    (:around (orig &rest args) double-space-sentences)
  (let ((sentence-end-double-space t))
    (apply orig args)))

(with-region-or-buffer indent-region)

(winner-mode)

(provide 'acdw)

;;; acdw.el ends here