blob: e1594956ade37f15e2d8c3150bf72e886b6e548f (
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
;; Time-stamp: <2026-07-03 09h32 BST (anker)>
;; -----------------------------------------------------------------------------
;; Interface
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(fset 'yes-or-no-p 'y-or-n-p)
(setq select-enable-clipboard t
select-enable-primary t
save-interprogram-paste-before-kill t
require-final-newline t
visible-bell nil)
(setq echo-keystrokes 0.1
confirm-kill-emacs 'y-or-n-p
disabled-command-function nil
ring-bell-function 'ignore)
(size-indication-mode t)
(defun enlarge-to-fill ()
"Stretch the buffer to accomodate `fill-column` many columns."
(interactive)
(let ((ww (window-width)))
(when (< ww (+ 1 fill-column))
(enlarge-window-horizontally (- (+ 1 fill-column) ww)))))
(global-set-key (kbd "C-c 3") (lambda ()
(interactive)
(split-window-horizontally)
(enlarge-to-fill)))
(when (display-graphic-p)
(add-to-list 'custom-theme-load-path "~/.config/emacs/themes/")
;; listen for theme changes
(defconst dark-theme 'dracula)
(defconst light-theme 'acme)
(defun my-switch-to-light ()
(disable-theme dark-theme)
(load-theme light-theme t))
(defun my-switch-to-dark ()
(disable-theme light-theme)
(load-theme dark-theme t))
(require 'dbus)
(pcase (caar (dbus-ignore-errors
(dbus-call-method
:session
"org.freedesktop.portal.Desktop"
"/org/freedesktop/portal/desktop"
"org.freedesktop.portal.Settings" "Read"
"org.freedesktop.appearance" "color-scheme")))
(1 (my-switch-to-dark))
(2 (my-switch-to-light)))
(dbus-register-signal
:session
"org.freedesktop.portal.Desktop"
"/org/freedesktop/portal/desktop"
"org.freedesktop.portal.Settings"
"SettingChanged"
(lambda (path var val)
(when (and (string= path "org.freedesktop.appearance")
(string= var "color-scheme"))
(pcase (car val)
(1 (my-switch-to-dark))
(2 (my-switch-to-light))))))
;; fonts
(progn
(setq my-font "Commit Mono-14")
(setq my-font "Sudo-14")
(setq my-font "PxPlus IBM VGA 9x16-14")
(setq my-font "Myna-14")
(setq my-font "BQN386 Unicode DZ-16")
(setq my-font "Berkeley Mono-16")
(setq my-font "Iosevka Term Slab-18")
(setq my-font "Iosevka Etoile-18")
(setq my-font "Monaspace Krypton-14")
(setq my-font "Crimson Pro-20")
(setq my-font "Readerly-18")
(setq my-font "Libron-16")
(set-frame-font my-font)
(set-fontset-font t 'unicode
(font-spec :family "EB Garamond"))
(set-fontset-font t 'unicode
(font-spec :family "Libron")
nil
'prepend)
(set-fontset-font t 'mathematical
(font-spec :family "Garamond-Math")
nil
'prepend)
(set-fontset-font t 'symbol
(font-spec :family "Garamond-Math")
nil
'prepend)
(set-face-attribute 'font-lock-comment-face nil :slant 'italic))
)
(setq-default line-spacing nil)
(blink-cursor-mode 0)
(setq cursor-type 'box)
;; (set-cursor-color "orange")
(set-fringe-style 0)
;; (set-fringe-mode 128)
;; -----------------------------------------------------------------------------
;; Backups
(setq backup-by-copying t
backup-directory-alist '(("." . "/home/user/store/backups/"))
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t)
(setq create-lockfiles nil)
;; -----------------------------------------------------------------------------
;; Defaults
(setq fill-column 80)
(setq standard-indent 4)
(setq-default tab-width 4
indent-tabs-mode nil)
(add-hook 'before-save-hook #'whitespace-cleanup)
(show-paren-mode t)
(setq-default truncate-lines t
truncate-partial-width-windows nil)
(setq scroll-step 1
scroll-margin 5)
(setq next-line-add-newlines nil)
(setq enable-dir-local-variables nil)
(global-auto-revert-mode 1)
;; -----------------------------------------------------------------------------
;; Basic packages
(use-package recentf
:demand t
:config
(setq recentf-max-saved-items 42)
(recentf-mode))
(use-package uniquify
:config
(setq uniquify-buffer-name-style 'forward))
(use-package tramp
:defer
:config
(setq tramp-use-ssh-controlmaster-options nil)
(setq tramp-ssh-controlmaster-options "-o ControlMaster=no -tt")
(add-to-list 'tramp-connection-properties
(list "/ssh:.*-vm:" "remote-shell" "/usr/bin/dash")))
(require 'saveplace)
(save-place-mode)
(use-package ctrlf
:ensure t
:config
(ctrlf-mode 1))
;; -----------------------------------------------------------------------------
;; Scratch buffer
(defun immortal-scratch ()
(if (eq (current-buffer) (get-buffer "*scratch*"))
(progn (bury-buffer) nil) t))
(add-hook 'kill-buffer-query-functions 'immortal-scratch)
;; I couldn't understand the config options, so this is the next best thing
(defun display-startup-echo-area-message () nil)
(setq initial-scratch-message nil
inhibit-startup-screen t
initial-buffer-choice nil)
(add-hook 'after-init-hook
(lambda ()
(setq default-directory "~/")))
|