Blame


1 678b3cb3 2022-03-16 op (defconst op/backup-dir
2 678b3cb3 2022-03-16 op (expand-file-name "backups" user-emacs-directory))
3 678b3cb3 2022-03-16 op (unless (file-exists-p op/backup-dir)
4 678b3cb3 2022-03-16 op (make-directory op/backup-dir))
5 678b3cb3 2022-03-16 op (setq backup-directory-alist `(("." . ,op/backup-dir)))
6 678b3cb3 2022-03-16 op
7 678b3cb3 2022-03-16 op (setq use-dialog-box nil
8 678b3cb3 2022-03-16 op x-stretch-cursor t
9 678b3cb3 2022-03-16 op require-final-newline t
10 678b3cb3 2022-03-16 op visible-bell nil
11 678b3cb3 2022-03-16 op load-prefer-newer t
12 678b3cb3 2022-03-16 op tab-bar-show 1
13 678b3cb3 2022-03-16 op enable-recursive-minibuffers t
14 678b3cb3 2022-03-16 op imenu-auto-rescan 1)
15 678b3cb3 2022-03-16 op
16 678b3cb3 2022-03-16 op (setq completion-ignore-case t
17 678b3cb3 2022-03-16 op read-file-name-completion-ignore-case t
18 678b3cb3 2022-03-16 op read-buffer-completion-ignore-case t)
19 678b3cb3 2022-03-16 op
20 678b3cb3 2022-03-16 op (define-key global-map (kbd "C-x C-b") #'ibuffer)
21 678b3cb3 2022-03-16 op (define-key global-map (kbd "M-g i") #'imenu)
22 678b3cb3 2022-03-16 op
23 678b3cb3 2022-03-16 op ;; mg-like
24 678b3cb3 2022-03-16 op (define-key minibuffer-mode-map (kbd "C-w") #'backward-kill-word)
25 678b3cb3 2022-03-16 op
26 678b3cb3 2022-03-16 op (setq uniquify-buffer-name-style 'forward
27 678b3cb3 2022-03-16 op uniquify-strip-common-suffix t)
28 678b3cb3 2022-03-16 op
29 678b3cb3 2022-03-16 op (setq-default scroll-up-aggressively 0.0
30 678b3cb3 2022-03-16 op scroll-down-aggressively 0.0
31 678b3cb3 2022-03-16 op scroll-preserve-screen-position t
32 678b3cb3 2022-03-16 op next-screen-context-lines 1)
33 678b3cb3 2022-03-16 op
34 678b3cb3 2022-03-16 op (define-key global-map (kbd "M-z") #'zap-up-to-char)
35 678b3cb3 2022-03-16 op
36 678b3cb3 2022-03-16 op (require 'whitespace)
37 678b3cb3 2022-03-16 op (setq whitespace-style '(face trailing)
38 678b3cb3 2022-03-16 op backward-delete-char-untabify-method 'hungry
39 678b3cb3 2022-03-16 op tab-always-indent 'complete
40 678b3cb3 2022-03-16 op tab-width 8
41 678b3cb3 2022-03-16 op sentence-end-double-space t)
42 678b3cb3 2022-03-16 op (setq-default indent-tabs-mode t)
43 678b3cb3 2022-03-16 op
44 678b3cb3 2022-03-16 op (defun op/enable-tabs ()
45 678b3cb3 2022-03-16 op "Enable `indent-tabs-mode' in the current buffer."
46 678b3cb3 2022-03-16 op (interactive)
47 678b3cb3 2022-03-16 op (setq-local indent-tabs-mode t))
48 678b3cb3 2022-03-16 op
49 678b3cb3 2022-03-16 op (defun op/disable-tabs ()
50 678b3cb3 2022-03-16 op "Disable `indent-tabs-mode' in the current buffer."
51 678b3cb3 2022-03-16 op (interactive)
52 678b3cb3 2022-03-16 op (setq-local indent-tabs-mode nil))
53 678b3cb3 2022-03-16 op
54 678b3cb3 2022-03-16 op (add-hook 'conf-mode-hook #'op/enable-tabs)
55 678b3cb3 2022-03-16 op (add-hook 'text-mode-hook #'op/enable-tabs)
56 678b3cb3 2022-03-16 op (add-hook 'prog-mode-hook #'op/enable-tabs)
57 678b3cb3 2022-03-16 op (add-hook 'prog-mode-hook #'whitespace-mode)
58 678b3cb3 2022-03-16 op (add-hook 'text-mode-hook #'whitespace-mode)
59 678b3cb3 2022-03-16 op
60 23efdfd9 2022-03-17 op (dolist (hook '(emacs-lisp-mode-hook
61 23efdfd9 2022-03-17 op clojure-mode-hook
62 23efdfd9 2022-03-17 op clojurescript-mode-hook
63 23efdfd9 2022-03-17 op clojurec-mode-hook
64 23efdfd9 2022-03-17 op scss-mode-hook))
65 23efdfd9 2022-03-17 op (add-hook hook #'op/disable-tabs))
66 23efdfd9 2022-03-17 op
67 678b3cb3 2022-03-16 op (with-eval-after-load 'log-edit
68 678b3cb3 2022-03-16 op (add-hook 'log-edit-mode #'auto-fill-mode))
69 678b3cb3 2022-03-16 op
70 678b3cb3 2022-03-16 op ;; free the c-z binding
71 678b3cb3 2022-03-16 op (define-key global-map (kbd "C-z") nil)
72 678b3cb3 2022-03-16 op (define-key global-map (kbd "C-z V") #'variable-pitch-mode)
73 678b3cb3 2022-03-16 op (define-key global-map (kbd "C-z n") #'display-line-numbers-mode)
74 678b3cb3 2022-03-16 op
75 678b3cb3 2022-03-16 op (define-key global-map (kbd "M-SPC") #'cycle-spacing)
76 678b3cb3 2022-03-16 op (define-key global-map (kbd "M-u") #'upcase-dwim)
77 678b3cb3 2022-03-16 op (define-key global-map (kbd "M-l") #'downcase-dwim)
78 678b3cb3 2022-03-16 op (define-key global-map (kbd "M-c") #'capitalize-dwim)
79 678b3cb3 2022-03-16 op
80 678b3cb3 2022-03-16 op (let ((font "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1"))
81 678b3cb3 2022-03-16 op (set-frame-font font nil t)
82 678b3cb3 2022-03-16 op (add-to-list 'default-frame-alist `(font . ,font)))
83 678b3cb3 2022-03-16 op
84 678b3cb3 2022-03-16 op ;; some cool stuff
85 678b3cb3 2022-03-16 op (save-place-mode +1)
86 678b3cb3 2022-03-16 op (savehist-mode +1)
87 678b3cb3 2022-03-16 op (setq history-delete-duplicates t
88 678b3cb3 2022-03-16 op history-length 1000
89 678b3cb3 2022-03-16 op savehist-save-minibuffer-history t)
90 678b3cb3 2022-03-16 op (electric-pair-mode +1)
91 678b3cb3 2022-03-16 op
92 678b3cb3 2022-03-16 op (define-key global-map (kbd "M-/") #'hippie-expand)
93 678b3cb3 2022-03-16 op (setq hippie-expand-try-functions-list
94 678b3cb3 2022-03-16 op '(try-expand-dabbrev
95 678b3cb3 2022-03-16 op try-expand-dabbrev-all-buffers
96 678b3cb3 2022-03-16 op try-expand-dabbrev-from-kill
97 678b3cb3 2022-03-16 op try-complete-file-name-partially
98 678b3cb3 2022-03-16 op try-complete-file-name
99 678b3cb3 2022-03-16 op try-expand-all-abbrevs
100 678b3cb3 2022-03-16 op try-expand-list
101 678b3cb3 2022-03-16 op try-expand-line
102 678b3cb3 2022-03-16 op try-complete-lisp-symbol-partially
103 678b3cb3 2022-03-16 op try-complete-lisp-symbol))
104 678b3cb3 2022-03-16 op
105 678b3cb3 2022-03-16 op (setq isearch-lazy-count t
106 678b3cb3 2022-03-16 op search-whitespace-regexp ".*?"
107 678b3cb3 2022-03-16 op isearch-allow-scroll 'unlimited)
108 678b3cb3 2022-03-16 op
109 678b3cb3 2022-03-16 op (defun op/buffer-to-side-window (place)
110 678b3cb3 2022-03-16 op "Place the current buffer in the side window at PLACE."
111 678b3cb3 2022-03-16 op (interactive (list (intern
112 678b3cb3 2022-03-16 op (completing-read "Which side: "
113 678b3cb3 2022-03-16 op '(top left right bottom)))))
114 678b3cb3 2022-03-16 op (let ((buf (current-buffer)))
115 678b3cb3 2022-03-16 op (display-buffer-in-side-window
116 678b3cb3 2022-03-16 op buf `((window-height . 0.15)
117 678b3cb3 2022-03-16 op (side . ,place)
118 678b3cb3 2022-03-16 op (slot . -1)
119 678b3cb3 2022-03-16 op (window-parameters . ((no-delete-other-windows . t)))))
120 678b3cb3 2022-03-16 op (delete-window)))
121 678b3cb3 2022-03-16 op
122 678b3cb3 2022-03-16 op (defun op/fill-or-unfill (fn &optional justify region)
123 678b3cb3 2022-03-16 op "Meant to be an adviced :around `fill-paragraph'.
124 678b3cb3 2022-03-16 op FN is the original `fill-column'. If `last-command' is
125 678b3cb3 2022-03-16 op `fill-paragraph', unfill it, fill it otherwise. Inspired from a
126 678b3cb3 2022-03-16 op post on endless parentheses. Optional argument JUSTIFY and
127 678b3cb3 2022-03-16 op REGION are passed to `fill-paragraph'."
128 678b3cb3 2022-03-16 op (let ((fill-column
129 678b3cb3 2022-03-16 op (if (eq last-command 'fill-paragraph)
130 678b3cb3 2022-03-16 op (progn (setq this-command nil)
131 678b3cb3 2022-03-16 op (point-max))
132 678b3cb3 2022-03-16 op fill-column)))
133 678b3cb3 2022-03-16 op (funcall fn justify region)))
134 678b3cb3 2022-03-16 op (advice-add 'fill-paragraph :around #'op/fill-or-unfill)
135 678b3cb3 2022-03-16 op
136 678b3cb3 2022-03-16 op (defmacro op/deftranspose (name scope key doc)
137 678b3cb3 2022-03-16 op "Macro to produce transposition functions.
138 678b3cb3 2022-03-16 op NAME is the function's symbol. SCOPE is the text object to
139 678b3cb3 2022-03-16 op operate on. Optional DOC is the function's docstring.
140 678b3cb3 2022-03-16 op
141 678b3cb3 2022-03-16 op Transposition over an active region will swap the object at
142 678b3cb3 2022-03-16 op mark (region beginning) with the one at point (region end).
143 678b3cb3 2022-03-16 op
144 678b3cb3 2022-03-16 op It can optionally define a key for the defined function in the
145 678b3cb3 2022-03-16 op `global-map' if KEY is passed.
146 678b3cb3 2022-03-16 op
147 678b3cb3 2022-03-16 op Originally from protesilaos' dotemacs."
148 678b3cb3 2022-03-16 op (declare (indent defun))
149 678b3cb3 2022-03-16 op `(progn
150 678b3cb3 2022-03-16 op (defun ,name (arg)
151 678b3cb3 2022-03-16 op ,doc
152 678b3cb3 2022-03-16 op (interactive "p")
153 678b3cb3 2022-03-16 op (let ((x (intern (format "transpose-%s" ,scope))))
154 678b3cb3 2022-03-16 op (if (use-region-p)
155 678b3cb3 2022-03-16 op (funcall x 0)
156 678b3cb3 2022-03-16 op (funcall x arg))))
157 678b3cb3 2022-03-16 op ,(when key
158 678b3cb3 2022-03-16 op `(define-key global-map (kbd ,key) #',name))))
159 678b3cb3 2022-03-16 op
160 678b3cb3 2022-03-16 op (op/deftranspose op/transpose-lines "lines" "C-x C-t"
161 678b3cb3 2022-03-16 op "Transpose lines or swap over active region.")
162 678b3cb3 2022-03-16 op
163 678b3cb3 2022-03-16 op (op/deftranspose op/transpose-paragraphs "paragraphs" "C-S-t"
164 678b3cb3 2022-03-16 op "Transpose paragraph or swap over active region.")
165 678b3cb3 2022-03-16 op
166 678b3cb3 2022-03-16 op (op/deftranspose op/transpose-sentences "sentences" "C-x M-t"
167 678b3cb3 2022-03-16 op "Transpose sentences or swap over active region.")
168 678b3cb3 2022-03-16 op
169 678b3cb3 2022-03-16 op (op/deftranspose op/transpose-sexps "sexps" "C-M-t"
170 678b3cb3 2022-03-16 op "Transpose sexps or swap over active region.")
171 678b3cb3 2022-03-16 op
172 678b3cb3 2022-03-16 op (op/deftranspose op/transpose-words "words" "M-t"
173 678b3cb3 2022-03-16 op "Transpose words or swap over active region.")
174 678b3cb3 2022-03-16 op
175 678b3cb3 2022-03-16 op (defun op/narrow-or-widen-dwim (p)
176 678b3cb3 2022-03-16 op "Widen if the buffer is narrowed, narrow-dwim otherwise.
177 678b3cb3 2022-03-16 op Dwim means: region, org-src-block, org-subtree or defun,
178 678b3cb3 2022-03-16 op whichever applies first. Narrowing to org-src-blocks actually
179 678b3cb3 2022-03-16 op calls `org-edit-src-code'.
180 678b3cb3 2022-03-16 op
181 678b3cb3 2022-03-16 op With prefix P, don't widen, just narrow even if buffer is already
182 678b3cb3 2022-03-16 op narrowed. With P being -, narrow to page instead of to defun.
183 678b3cb3 2022-03-16 op
184 678b3cb3 2022-03-16 op Taken from endless parentheses."
185 678b3cb3 2022-03-16 op (interactive "P")
186 678b3cb3 2022-03-16 op (declare (interactive-only))
187 678b3cb3 2022-03-16 op (cond ((and (buffer-narrowed-p) (not p)) (widen))
188 678b3cb3 2022-03-16 op ((region-active-p)
189 678b3cb3 2022-03-16 op (narrow-to-region (region-beginning)
190 678b3cb3 2022-03-16 op (region-end)))
191 678b3cb3 2022-03-16 op ((derived-mode-p 'org-mode)
192 678b3cb3 2022-03-16 op ;; `org-edit-src-code' isn't a real narrowing
193 678b3cb3 2022-03-16 op (cond ((ignore-errors (org-edit-src-code) t))
194 678b3cb3 2022-03-16 op ((ignore-errors (org-narrow-to-block) t))
195 678b3cb3 2022-03-16 op (t (org-narrow-to-subtree))))
196 678b3cb3 2022-03-16 op ((eql p '-) (narrow-to-page))
197 678b3cb3 2022-03-16 op (t (narrow-to-defun))))
198 678b3cb3 2022-03-16 op
199 678b3cb3 2022-03-16 op (define-key global-map (kbd "C-c w") #'op/narrow-or-widen-dwim)
200 678b3cb3 2022-03-16 op
201 678b3cb3 2022-03-16 op (with-eval-after-load 'dired
202 678b3cb3 2022-03-16 op (add-hook 'dired-mode-hook #'dired-hide-details-mode)
203 678b3cb3 2022-03-16 op (add-hook 'dired-mode-hook #'dired-omit-mode)
204 678b3cb3 2022-03-16 op
205 678b3cb3 2022-03-16 op (define-key dired-mode-map (kbd "C-c w") #'wdired-change-to-wdired-mode)
206 678b3cb3 2022-03-16 op
207 678b3cb3 2022-03-16 op (require 'dired-x)
208 678b3cb3 2022-03-16 op (setq dired-listing-switches "-lahF"
209 678b3cb3 2022-03-16 op dired-dwim-target t
210 678b3cb3 2022-03-16 op dired-deletion-confirmer #'y-or-n-p))
211 678b3cb3 2022-03-16 op
212 678b3cb3 2022-03-16 op ;; just like telescope!
213 678b3cb3 2022-03-16 op (with-eval-after-load 'diff-mode
214 678b3cb3 2022-03-16 op (define-key diff-mode-map (kbd "M-SPC") #'scroll-down-command))
215 678b3cb3 2022-03-16 op
216 678b3cb3 2022-03-16 op (with-eval-after-load 'elisp-mode
217 678b3cb3 2022-03-16 op (add-hook 'emacs-lisp-mode-hook #'checkdoc-minor-mode)
218 678b3cb3 2022-03-16 op (add-hook 'emacs-lisp-mode-hook #'prettify-symbols-mode)
219 678b3cb3 2022-03-16 op (let ((map emacs-lisp-mode-map))
220 678b3cb3 2022-03-16 op (define-key map (kbd "C-c C-k") #'eval-buffer)
221 678b3cb3 2022-03-16 op (define-key map (kbd "C-c k") #'op/ert-all)
222 678b3cb3 2022-03-16 op (define-key map (kbd "C-c C-z") #'op/ielm-repl)))
223 678b3cb3 2022-03-16 op
224 678b3cb3 2022-03-16 op (with-eval-after-load 'help
225 678b3cb3 2022-03-16 op (add-hook 'help-mode-hook #'visual-line-mode))
226 678b3cb3 2022-03-16 op
227 678b3cb3 2022-03-16 op ;; add melpa
228 678b3cb3 2022-03-16 op (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
229 678b3cb3 2022-03-16 op
230 678b3cb3 2022-03-16 op ;; packages that i want to be installed
231 678b3cb3 2022-03-16 op (dolist (pkg '(vc-got pdf-tools eglot nameless sly cider go-mode web-mode
232 678b3cb3 2022-03-16 op lua-mode markdown-mode elfeed form-feed shackle
233 23efdfd9 2022-03-17 op embark mct marginalia puni))
234 678b3cb3 2022-03-16 op (unless (package-installed-p pkg)
235 678b3cb3 2022-03-16 op (message "Installing %s" pkg)
236 678b3cb3 2022-03-16 op (package-install pkg)))
237 678b3cb3 2022-03-16 op
238 678b3cb3 2022-03-16 op (global-form-feed-mode +1)
239 678b3cb3 2022-03-16 op
240 23efdfd9 2022-03-17 op (add-hook 'text-mode-hook #'puni-mode)
241 23efdfd9 2022-03-17 op (add-hook 'prog-mode-hook #'puni-mode)
242 23efdfd9 2022-03-17 op (define-key puni-mode-map (kbd "C-)") #'puni-slurp-forward)
243 23efdfd9 2022-03-17 op (define-key puni-mode-map (kbd "C-(") #'puni-barf-forward)
244 23efdfd9 2022-03-17 op
245 678b3cb3 2022-03-16 op (setq completion-styles '(basic substring initials flex partial-completion))
246 678b3cb3 2022-03-16 op
247 678b3cb3 2022-03-16 op (marginalia-mode +1)
248 678b3cb3 2022-03-16 op (mct-minibuffer-mode +1)
249 678b3cb3 2022-03-16 op (mct-region-mode +1)
250 678b3cb3 2022-03-16 op (setq mct-remove-shadowed-file-names t
251 678b3cb3 2022-03-16 op mct-completions-format 'one-column
252 678b3cb3 2022-03-16 op mct-completion-passlist '(Info-goto-node
253 678b3cb3 2022-03-16 op Info-index
254 678b3cb3 2022-03-16 op Info-menu
255 678b3cb3 2022-03-16 op vc-retrieve-tag
256 678b3cb3 2022-03-16 op imenu
257 678b3cb3 2022-03-16 op file
258 678b3cb3 2022-03-16 op buffer
259 678b3cb3 2022-03-16 op kill-ring))
260 678b3cb3 2022-03-16 op
261 23efdfd9 2022-03-17 op (with-eval-after-load 'go-mode
262 23efdfd9 2022-03-17 op (add-hook 'go-mode-hook #'subword-mode))
263 23efdfd9 2022-03-17 op
264 678b3cb3 2022-03-16 op (with-eval-after-load 'eglot
265 678b3cb3 2022-03-16 op (define-key eglot-mode-map (kbd "<f1>") #'eglot-code-actions)
266 678b3cb3 2022-03-16 op (define-key eglot-mode-map (kbd "<f2>") #'eglot-format)
267 678b3cb3 2022-03-16 op (add-to-list 'eglot-ignored-server-capabilites
268 678b3cb3 2022-03-16 op :documentHighlightProvider)
269 678b3cb3 2022-03-16 op (add-to-list 'eglot-server-programs
270 678b3cb3 2022-03-16 op '(c-mode . ("clangd" "--header-insertion=never"))))
271 678b3cb3 2022-03-16 op
272 678b3cb3 2022-03-16 op (with-eval-after-load 'nameless
273 678b3cb3 2022-03-16 op (add-hook 'emacs-lisp-mode #'nameless-mode)
274 678b3cb3 2022-03-16 op (setq nameless-private-prefix t
275 678b3cb3 2022-03-16 op nameless-affect-indentation-and-filling nil)
276 678b3cb3 2022-03-16 op (define-key emacs-lisp-mode-map (kbd "_") #'nameless-insert-name-or-self-insert))
277 678b3cb3 2022-03-16 op
278 678b3cb3 2022-03-16 op (with-eval-after-load 'web-mode
279 678b3cb3 2022-03-16 op (setq web-mode-markup-indent-offset 2
280 678b3cb3 2022-03-16 op web-mode-css-indent-offset 2
281 678b3cb3 2022-03-16 op web-mode-style-padding 0
282 678b3cb3 2022-03-16 op web-mode-enable-engine-detection t)
283 678b3cb3 2022-03-16 op (add-hook 'web-mode-hook #'op/disable-tabs))
284 678b3cb3 2022-03-16 op
285 678b3cb3 2022-03-16 op (with-eval-after-load 'css-mode
286 678b3cb3 2022-03-16 op (add-hook 'css-mode-hook #'op/disable-tabs))
287 678b3cb3 2022-03-16 op
288 678b3cb3 2022-03-16 op (with-eval-after-load 'cc-mode
289 678b3cb3 2022-03-16 op (setq c-basic-offset 8
290 678b3cb3 2022-03-16 op c-default-style "K&R"
291 678b3cb3 2022-03-16 op c-file-offsets '((arglist-intro . +)
292 678b3cb3 2022-03-16 op (arglist-cont-nonempty . *)))
293 678b3cb3 2022-03-16 op (dolist (hook '(c-mode-hook c++-mode-hook))
294 678b3cb3 2022-03-16 op (add-hook hook #'abbrev-mode)
295 678b3cb3 2022-03-16 op (add-hook hook #'subword-mode))
296 678b3cb3 2022-03-16 op
297 678b3cb3 2022-03-16 op ;; TODO: improve it!
298 678b3cb3 2022-03-16 op (defun op/c-add-include (path &optional localp)
299 678b3cb3 2022-03-16 op "Include PATH at the start of the file.
300 678b3cb3 2022-03-16 op If LOCALP is non-nil, the include will be \"local\"."
301 678b3cb3 2022-03-16 op (interactive "Mheader to include: \nP")
302 678b3cb3 2022-03-16 op (save-excursion
303 678b3cb3 2022-03-16 op (let ((re (if localp
304 678b3cb3 2022-03-16 op "^#[ \t]*include[ \t]*\""
305 678b3cb3 2022-03-16 op "^#[ \t]*include[ \t]*<"))
306 678b3cb3 2022-03-16 op (ignore-re "^#include \"compat.h\"")
307 678b3cb3 2022-03-16 op start)
308 678b3cb3 2022-03-16 op (goto-char (point-min))
309 678b3cb3 2022-03-16 op (while (not (or (and (looking-at re)
310 678b3cb3 2022-03-16 op (not (looking-at ignore-re)))
311 678b3cb3 2022-03-16 op (eobp)))
312 678b3cb3 2022-03-16 op (forward-line))
313 678b3cb3 2022-03-16 op (when (eobp)
314 678b3cb3 2022-03-16 op (error "Don't know where to insert the header"))
315 678b3cb3 2022-03-16 op (open-line 1)
316 678b3cb3 2022-03-16 op (insert "#include " (if localp "\"\"" "<>"))
317 678b3cb3 2022-03-16 op (backward-char)
318 678b3cb3 2022-03-16 op (insert path)
319 678b3cb3 2022-03-16 op (move-beginning-of-line 1)
320 678b3cb3 2022-03-16 op (setq start (point))
321 678b3cb3 2022-03-16 op (forward-line)
322 678b3cb3 2022-03-16 op (while (and (looking-at re)
323 678b3cb3 2022-03-16 op (not (eobp)))
324 678b3cb3 2022-03-16 op (forward-line))
325 678b3cb3 2022-03-16 op (sort-lines nil start (point)))))
326 678b3cb3 2022-03-16 op (define-key c-mode-map (kbd "C-c C-a") #'op/c-add-include))
327 678b3cb3 2022-03-16 op
328 678b3cb3 2022-03-16 op (with-eval-after-load 'perl-mode
329 678b3cb3 2022-03-16 op (setq perl-indent-level 8))
330 678b3cb3 2022-03-16 op
331 678b3cb3 2022-03-16 op (with-eval-after-load 'sh-script
332 678b3cb3 2022-03-16 op (setq sh-basic-offset 8
333 678b3cb3 2022-03-16 op sh-indent-after-loop-construct 8
334 678b3cb3 2022-03-16 op sh-indent-after-continuation nil))
335 678b3cb3 2022-03-16 op
336 678b3cb3 2022-03-16 op
337 678b3cb3 2022-03-16 op
338 678b3cb3 2022-03-16 op (defun op/eshell-bufname (dir)
339 678b3cb3 2022-03-16 op (concat "*eshell " (expand-file-name dir) "*"))
340 678b3cb3 2022-03-16 op
341 678b3cb3 2022-03-16 op (defun op/eshell (arg)
342 678b3cb3 2022-03-16 op "Run or jump to eshell in current project.
343 678b3cb3 2022-03-16 op If called with prefix argument ARG always create a new eshell
344 678b3cb3 2022-03-16 op buffer."
345 678b3cb3 2022-03-16 op (interactive "P")
346 678b3cb3 2022-03-16 op (let* ((proj (project-current))
347 678b3cb3 2022-03-16 op (dir (if (and proj (not arg))
348 678b3cb3 2022-03-16 op (project-root proj)
349 678b3cb3 2022-03-16 op default-directory))
350 678b3cb3 2022-03-16 op (default-directory dir)
351 678b3cb3 2022-03-16 op (eshell-buffer-name (let ((name (op/eshell-bufname dir)))
352 678b3cb3 2022-03-16 op (if arg
353 678b3cb3 2022-03-16 op (generate-new-buffer name)
354 678b3cb3 2022-03-16 op name))))
355 678b3cb3 2022-03-16 op (eshell)))
356 678b3cb3 2022-03-16 op (define-key global-map (kbd "C-c e") #'op/eshell)
357 678b3cb3 2022-03-16 op
358 678b3cb3 2022-03-16 op (with-eval-after-load 'eshell
359 678b3cb3 2022-03-16 op (setq eshell-save-history-on-exit t
360 678b3cb3 2022-03-16 op eshell-history-size 1024
361 678b3cb3 2022-03-16 op
362 678b3cb3 2022-03-16 op eshell-compl-dir-ignore
363 678b3cb3 2022-03-16 op "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\|\\.got\\)/\\'")
364 678b3cb3 2022-03-16 op
365 678b3cb3 2022-03-16 op (defun op/eshell-after-cd (&rest _)
366 678b3cb3 2022-03-16 op (rename-buffer (op/eshell-bufname default-directory) t))
367 678b3cb3 2022-03-16 op
368 678b3cb3 2022-03-16 op (advice-add #'eshell/cd :after #'op/eshell-after-cd)
369 678b3cb3 2022-03-16 op
370 678b3cb3 2022-03-16 op (defun op/clear-eshell ()
371 678b3cb3 2022-03-16 op (interactive "")
372 678b3cb3 2022-03-16 op (let ((inhibit-read-only t))
373 678b3cb3 2022-03-16 op (erase-buffer)
374 678b3cb3 2022-03-16 op (eshell-send-input)))
375 678b3cb3 2022-03-16 op
376 678b3cb3 2022-03-16 op (defun op/eshell-hook ()
377 678b3cb3 2022-03-16 op "Because eshell is stupid."
378 678b3cb3 2022-03-16 op (define-key eshell-mode-map (kbd "C-x M-o") #'op/clear-eshell))
379 678b3cb3 2022-03-16 op (add-hook 'eshell-mode-hook #'op/eshell-hook))
380 678b3cb3 2022-03-16 op
381 678b3cb3 2022-03-16 op
382 678b3cb3 2022-03-16 op ;; sndio.el
383 678b3cb3 2022-03-16 op (unless (package-installed-p 'sndio)
384 678b3cb3 2022-03-16 op (package-install-file "~/w/sndio.el/sndio.el"))
385 678b3cb3 2022-03-16 op
386 678b3cb3 2022-03-16 op
387 678b3cb3 2022-03-16 op ;; saturn
388 678b3cb3 2022-03-16 op (unless (package-installed-p 'saturn)
389 678b3cb3 2022-03-16 op (package-install-file "~/w/saturn/GUI/saturn.el"))
390 678b3cb3 2022-03-16 op
391 678b3cb3 2022-03-16 op
392 678b3cb3 2022-03-16 op ;; simple-pass
393 678b3cb3 2022-03-16 op (unless (package-installed-p 'simple-pass)
394 678b3cb3 2022-03-16 op (package-install-file "~/.emacs.d/simple-pass.el"))
395 678b3cb3 2022-03-16 op (define-key global-map (kbd "C-z p") #'simple-pass-copy)
396 678b3cb3 2022-03-16 op
397 678b3cb3 2022-03-16 op
398 678b3cb3 2022-03-16 op
399 678b3cb3 2022-03-16 op ;; elfeed
400 678b3cb3 2022-03-16 op
401 678b3cb3 2022-03-16 op (define-key global-map (kbd "C-x w") #'elfeed)
402 678b3cb3 2022-03-16 op (with-eval-after-load 'elfeed
403 678b3cb3 2022-03-16 op (define-key elfeed-show-mode-map (kbd "q") #'delete-window)
404 678b3cb3 2022-03-16 op (define-key elfeed-show-mode-map (kbd "S-SPC") #'scroll-down-command)
405 678b3cb3 2022-03-16 op (define-key elfeed-show-mode-map (kbd "M-SPC") #'scroll-down-command)
406 678b3cb3 2022-03-16 op (setq elfeed-show-entry-switch #'pop-to-buffer
407 678b3cb3 2022-03-16 op elfeed-feeds
408 678b3cb3 2022-03-16 op '("https://undeadly.org/cgi?action=rss&full=yes&items=10"
409 678b3cb3 2022-03-16 op "http://www.tedunangst.com/flak/rss"
410 678b3cb3 2022-03-16 op "https://www.dragonflydigest.com/feed"
411 678b3cb3 2022-03-16 op "https://www.mirbsd.org/news.rss"
412 678b3cb3 2022-03-16 op "https://www.mirbsd.org/announce.rss"
413 678b3cb3 2022-03-16 op "https://bentsukun.ch/index.xml"
414 678b3cb3 2022-03-16 op "https://drewdevault.com/feed.xml"
415 678b3cb3 2022-03-16 op "https://www.cambus.net/atom.xml"
416 678b3cb3 2022-03-16 op "https://dataswamp.org/~solene/rss.xml"
417 678b3cb3 2022-03-16 op "https://briancallahan.net/blog/feed.xml"
418 678b3cb3 2022-03-16 op "https://www.poolp.org/index.xml"
419 678b3cb3 2022-03-16 op "https://jcs.org/rss"
420 678b3cb3 2022-03-16 op "https://sanctum.geek.nz/arabesque/feed/"
421 678b3cb3 2022-03-16 op "https://tech.toryanderson.com/"
422 678b3cb3 2022-03-16 op "https://alexschroeder.ch/wiki?action=journal;search=-tag:rpg -tag:rsp;lang=en;title=English Diary without RPG Pages"
423 678b3cb3 2022-03-16 op "http://boston.conman.org/bostondiaries.rss"
424 678b3cb3 2022-03-16 op "https://emacsninja.com/feed.atom"
425 678b3cb3 2022-03-16 op "https://bsdly.blogspot.com/feeds/posts/default"
426 678b3cb3 2022-03-16 op "https://crawshaw.io/atom.xml"
427 678b3cb3 2022-03-16 op "https://nullprogram.com/feed/"
428 678b3cb3 2022-03-16 op "http://pragmaticemacs.com/feed/"
429 678b3cb3 2022-03-16 op "https://emacsnotes.wordpress.com/feed/"
430 678b3cb3 2022-03-16 op "https://metaredux.com/feed.xml"
431 678b3cb3 2022-03-16 op "https://emacsredux.com/atom.xml"
432 678b3cb3 2022-03-16 op "https://endlessparentheses.com/atom.xml"
433 678b3cb3 2022-03-16 op "https://www.masteringemacs.org/feed"
434 678b3cb3 2022-03-16 op "https://cestlaz.github.io/rss.xml"
435 678b3cb3 2022-03-16 op "https://utcc.utoronto.ca/~cks/space/blog/?atom"
436 678b3cb3 2022-03-16 op "https://irreal.org/blog/?feed=rss2"
437 678b3cb3 2022-03-16 op "https://jao.io/blog/rss.xml"
438 678b3cb3 2022-03-16 op "https://planet.lisp.org/rss20.xml"
439 678b3cb3 2022-03-16 op "https://insideclojure.org/feed.xml"
440 678b3cb3 2022-03-16 op "https://tech.toryanderson.com/index.xml"
441 678b3cb3 2022-03-16 op "https://vermaden.wordpress.com/feed/"
442 678b3cb3 2022-03-16 op "https://www.arp242.net/feed.xml"
443 678b3cb3 2022-03-16 op "https://tymoon.eu/api/reader/atom"
444 678b3cb3 2022-03-16 op "https://venam.nixers.net/blog/feed.xml"
445 678b3cb3 2022-03-16 op "https://www.omarpolo.com/rss.xml"
446 678b3cb3 2022-03-16 op "https://owarisubs.lacumpa.biz/feed/"
447 678b3cb3 2022-03-16 op "https://asenshi.moe/feed/"
448 678b3cb3 2022-03-16 op "https://godotengine.org/rss.xml"
449 678b3cb3 2022-03-16 op
450 678b3cb3 2022-03-16 op "https://adventofcomputing.libsyn.com/rss"
451 678b3cb3 2022-03-16 op
452 678b3cb3 2022-03-16 op "https://github.com/go-gitea/gitea/releases.atom"
453 678b3cb3 2022-03-16 op
454 678b3cb3 2022-03-16 op "https://nitter.pussthecat.org/NanoRaptor/rss"
455 678b3cb3 2022-03-16 op
456 678b3cb3 2022-03-16 op "https://github.com/yshui/picom/releases.atom"
457 678b3cb3 2022-03-16 op "https://github.com/vslavik/poedit/releases.atom"
458 678b3cb3 2022-03-16 op "https://github.com/TokTok/c-toxcore/releases.atom"
459 678b3cb3 2022-03-16 op "https://github.com/alexander-akhmetov/python-telegram/releases.atom"
460 678b3cb3 2022-03-16 op "https://github.com/paul-nameless/tg/releases.atom"
461 678b3cb3 2022-03-16 op "https://github.com/YACReader/yacreader/releases.atom"
462 678b3cb3 2022-03-16 op "https://github.com/luarocks/luarocks/releases.atom"
463 678b3cb3 2022-03-16 op "https://github.com/okbob/pspg/releases.atom"
464 678b3cb3 2022-03-16 op "https://github.com/taisei-project/taisei/releases.atom"
465 678b3cb3 2022-03-16 op "https://github.com/recp/cglm/releases.atom"
466 678b3cb3 2022-03-16 op
467 678b3cb3 2022-03-16 op "https://causal.agency/list/pounce.atom"
468 678b3cb3 2022-03-16 op
469 678b3cb3 2022-03-16 op "https://www.crimsonmagic.me/feed/"
470 678b3cb3 2022-03-16 op "https://fullybookedtls.wordpress.com/feed/")))
471 678b3cb3 2022-03-16 op
472 678b3cb3 2022-03-16 op (setq shackle-default-rule nil
473 678b3cb3 2022-03-16 op shackle-rules
474 678b3cb3 2022-03-16 op (let ((repls "\\*\\(cider-repl\\|sly-mrepl\\|ielm\\)")
475 678b3cb3 2022-03-16 op (godot "\\*godot - .*\\*")
476 678b3cb3 2022-03-16 op (vcs "\\*\\(Flymake\\|Package-Lint\\|vc-\\(git\\|got\\) :\\).*")
477 678b3cb3 2022-03-16 op (elfeed "\\*elfeed-entry\\*")
478 678b3cb3 2022-03-16 op (vmd "\\*vmd console .*"))
479 678b3cb3 2022-03-16 op `((compilation-mode :noselect t
480 678b3cb3 2022-03-16 op :align above
481 678b3cb3 2022-03-16 op :size 0.2)
482 678b3cb3 2022-03-16 op ("*Async Shell Command*" :ignore t)
483 678b3cb3 2022-03-16 op (,repls :regexp t
484 678b3cb3 2022-03-16 op :align below
485 678b3cb3 2022-03-16 op :size 0.3)
486 678b3cb3 2022-03-16 op (,godot :regexp t
487 678b3cb3 2022-03-16 op :align t
488 678b3cb3 2022-03-16 op :size 0.3)
489 678b3cb3 2022-03-16 op (occur-mode :select t
490 678b3cb3 2022-03-16 op :align right
491 678b3cb3 2022-03-16 op :size 0.3)
492 678b3cb3 2022-03-16 op (diff-mode :select t)
493 678b3cb3 2022-03-16 op (help-mode :select t
494 678b3cb3 2022-03-16 op :align left
495 678b3cb3 2022-03-16 op :size 0.3)
496 678b3cb3 2022-03-16 op (,vcs :regexp t
497 678b3cb3 2022-03-16 op :align above
498 678b3cb3 2022-03-16 op :size 0.15
499 678b3cb3 2022-03-16 op :select t)
500 678b3cb3 2022-03-16 op (,elfeed :regexp t
501 678b3cb3 2022-03-16 op :align t
502 678b3cb3 2022-03-16 op :select t
503 678b3cb3 2022-03-16 op :size 0.75)
504 678b3cb3 2022-03-16 op (,vmd :regexp t
505 678b3cb3 2022-03-16 op :align below
506 678b3cb3 2022-03-16 op :select t
507 678b3cb3 2022-03-16 op :size 0.3))))
508 678b3cb3 2022-03-16 op (shackle-mode +1)
509 678b3cb3 2022-03-16 op
510 678b3cb3 2022-03-16 op (define-key global-map (kbd "M-g e") #'embark-act)