aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/init.el
blob: a07d86fd0dd86a679e34991693b65eaa216de6d5 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
;; package.el
(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/") t)

(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/") t)

(let ((backup-dir "~/.backup"))
  (unless (file-directory-p backup-dir)
    (make-directory backup-dir t))
  (setq backup-directory-alist `(("." . ,backup-dir))))

(setq
 backup-by-copying t    ; Don't delink hardlinks
 delete-old-versions t  ; Clean up the backups
 kept-new-versions 3    ; keep some new versions
 kept-old-versions 2   ; and some old ones, too
 version-control t)      ; Use version numbers on backups

;; Do not persist customizations
(setq custom-file (make-temp-file "emacs-custom-"))

(setq fill-column 79) ; Wrap lines
(setq mouse-yank-at-point t) ; Do not follow mouse curors when mouse-yanking

(setq-default indent-tabs-mode nil) ; No tabs when indenting
(setq-default tab-width 4) ; How many spaces a tab represents

(setq initial-scratch-message "")

(defalias 'yes-or-no-p 'y-or-n-p)

;; Only flash the mode line
(setq ring-bell-function
      (lambda ()
        (let ((orig-fg (face-foreground 'mode-line)))
          (set-face-foreground 'mode-line "#F2804F")
          (run-with-idle-timer 0.1 nil
                               (lambda (fg) (set-face-foreground 'mode-line fg))
                               orig-fg))))

;; Highlight parens
(setq show-paren-delay 0)
(show-paren-mode 1)

(savehist-mode 1) ; Save histories, including minibuffer

(save-place-mode 1) ; Remember and restore cursor information

(setq auto-save-no-message t) ; Do not print a message when auto-saving

(pixel-scroll-precision-mode 1) ; Precision scrolling


;; Source: https://protesilaos.com/codelog/2024-12-11-emacs-diff-save-some-buffers/
(add-to-list 'save-some-buffers-action-alist
             (list "d"
                   (lambda (buffer) (diff-buffer-with-file (buffer-file-name buffer)))
                   "show diff between the buffer and its file"))

;; Server
(require 'server)
(setq server-client-instructions nil) ; Keep it quiet when opening an ec

(unless (server-running-p)
  (server-start))

(dolist (path '("~/.emacs.d/rul-lisp/packages"))
  (add-to-list 'load-path path))

(when-let* ((file (locate-user-emacs-file "rul-pre-init.el"))
            ((file-exists-p file)))
  (load-file file))

(require 'rul-themes)
(require 'rul-bindings)
(require 'rul-completion)
(require 'rul-fm)
(require 'rul-fonts)
(require 'rul-io)
(require 'rul-mail)
(require 'rul-modeline)
(require 'rul-org)
(require 'rul-prog)
(require 'rul-terminals)
(require 'rul-vc)
(require 'rul-wm)
(require 'rul-write)

(when-let* ((file (locate-user-emacs-file "rul-post-init.el"))
            ((file-exists-p file)))
  (load-file file))

;; init.el ends here
nihil fit ex nihilo