summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2023-01-16 12:46:27 -0600
committerCase Duckworth2023-01-16 12:46:27 -0600
commitb4e6518f7eff38d57d2ce5500fb6292d90e000f6 (patch)
tree7dfef6643619a1c187f0230e4f5db51d1fe5d4cb
parentWhitespace etc. (diff)
downloademacs-b4e6518f7eff38d57d2ce5500fb6292d90e000f6.tar.gz
emacs-b4e6518f7eff38d57d2ce5500fb6292d90e000f6.zip
KEY SMASHSHHHH
-rw-r--r--basics.el132
-rw-r--r--init.el237
-rw-r--r--lisp/acdw-shell0
-rw-r--r--lisp/acdw-shell.el141
-rw-r--r--lisp/acdw-web.el28
5 files changed, 346 insertions, 192 deletions
diff --git a/basics.el b/basics.el index 7b4b1fd..24e5047 100644 --- a/basics.el +++ b/basics.el
@@ -31,6 +31,7 @@
31 (setq-default no-littering-etc-directory etc/ 31 (setq-default no-littering-etc-directory etc/
32 no-littering-var-directory etc/)) 32 no-littering-var-directory etc/))
33 33
34
34;;; Settings 35;;; Settings
35 36
36;; Async 37;; Async
@@ -38,18 +39,17 @@
38 async-shell-command-display-buffer nil) 39 async-shell-command-display-buffer nil)
39 40
40;; Scrolling 41;; Scrolling
41(setq-default auto-hscroll-mode t 42(setq-default auto-hscroll-mode t
42 auto-window-vscroll nil 43 auto-window-vscroll nil
43 fast-but-imprecise-scrolling t 44 fast-but-imprecise-scrolling t
44 hscroll-margin 1 45 hscroll-margin 1
45 hscroll-step 1 46 hscroll-step 1
46 scroll-conservatively 25 47 scroll-conservatively 25
47 scroll-margin 0 48 scroll-margin 0
48 scroll-preserve-screen-position 1 49 scroll-preserve-screen-position 1
49 scroll-step 1) 50 scroll-step 1)
50(scroll-bar-mode -1) 51(scroll-bar-mode -1)
51(horizontal-scroll-bar-mode -1) 52(horizontal-scroll-bar-mode -1)
52(pixel-scroll-precision-mode)
53 53
54;; Cursor 54;; Cursor
55(setq-default cursor-in-non-selected-windows 'hollow 55(setq-default cursor-in-non-selected-windows 'hollow
@@ -95,7 +95,6 @@
95 95
96(add-hook 'minibuffer-setup-hook #'truncate-lines-local-mode) 96(add-hook 'minibuffer-setup-hook #'truncate-lines-local-mode)
97 97
98
99(require 'savehist) 98(require 'savehist)
100(setq-default history-length 1024 99(setq-default history-length 1024
101 history-delete-duplicates t 100 history-delete-duplicates t
@@ -233,8 +232,15 @@
233;; Whitespace 232;; Whitespace
234(require 'whitespace) 233(require 'whitespace)
235(setq-default whitespace-style 234(setq-default whitespace-style
236 '(face trailing tabs space-after-tab space-before-tab tab-mark)) 235 '(face trailing tabs tab-mark))
237(global-whitespace-mode) 236(global-whitespace-mode)
237(add-hook 'before-save-hook
238 (defun delete-trailing-whitespace-except-current-line ()
239 (save-excursion
240 (delete-trailing-whitespace (point-min)
241 (line-beginning-position))
242 (delete-trailing-whitespace (line-end-position)
243 (point-max)))))
238 244
239;; Native compilation 245;; Native compilation
240(setq-default native-comp-async-report-warnings-errors 'silent 246(setq-default native-comp-async-report-warnings-errors 'silent
@@ -261,6 +267,7 @@
261;; Winner 267;; Winner
262(winner-mode) 268(winner-mode)
263 269
270
264;;; Keybindings 271;;; Keybindings
265 272
266(defun other-window|switch-buffer (arg) 273(defun other-window|switch-buffer (arg)
@@ -321,6 +328,7 @@ N spaces."
321 328
322(global-set-key (kbd "C-x C-b") #'ibuffer) 329(global-set-key (kbd "C-x C-b") #'ibuffer)
323 330
331
324;;; Hooks 332;;; Hooks
325 333
326(add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) 334(add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p)
@@ -338,6 +346,7 @@ N spaces."
338 (when (file-remote-p (buffer-file-name)) 346 (when (file-remote-p (buffer-file-name))
339 (setq-local vc-handled-backends nil)))) 347 (setq-local vc-handled-backends nil))))
340 348
349
341;;; Advice 350;;; Advice
342 351
343(define-advice switch-to-buffer (:after (&rest _) normal-mode) 352(define-advice switch-to-buffer (:after (&rest _) normal-mode)
@@ -352,51 +361,7 @@ N spaces."
352 (let ((sentence-end-double-space t)) 361 (let ((sentence-end-double-space t))
353 (apply orig args))) 362 (apply orig args)))
354 363
355;; With region or ... 364
356(defun advise-region-or-buffer (&rest _)
357 "`:before' advice to work on the active region or whole buffer.
358See also `with-region-or-buffer'."
359 (interactive (if mark-active
360 (list (region-beginning) (region-end))
361 (list (point-min) (point-max)))))
362
363(defun advise-region-or-line (&rest _)
364 "`:before' advice to work on the active region or whole line.
365See also `with-region-or-line'."
366 (interactive (if mark-active
367 (list (region-beginning) (region-end))
368 (list (line-beginning-position) (line-end-position)))))
369
370(defun advise-region-or-to-eol (&rest _)
371 "`:before' advice to work on the active region or to end of line.
372See also `with-region-or-to-eol'."
373 (INTERACTIVE (if mark-active
374 (list (region-beginning) (region-end))
375 (list (point) (line-end-position)))))
376
377(defmacro with-region-or-buffer (&rest funcs)
378 "Advise FUNCS with `advise-region-or-buffer'."
379 `(progn
380 ,@(cl-loop for fn in funcs
381 collect
382 `(advice-add ',fn :before #'advise-region-or-buffer))))
383
384(defmacro with-region-or-line (&rest funcs)
385 "Advise FUNCS with `advise-region-or-line'."
386 `(progn
387 ,@(cl-loop for fn in funcs
388 collect
389 `(advice-add ',fn :before #'advise-region-or-line))))
390
391(defmacro with-region-or-to-eol (&rest funcs)
392 "Advise FUNCS with `advise-region-or-to-eol'."
393 `(progn
394 ,@(cl-loop for fn in funcs
395 collect
396 `(advice-add ',fn :before #'advise-region-or-to-eol))))
397
398(with-region-or-buffer indent-region)
399
400;;; Packages 365;;; Packages
401 366
402(use-package _acdw 367(use-package _acdw
@@ -460,23 +425,23 @@ See also `with-region-or-to-eol'."
460 ("C-c k" . consult-kmacro) 425 ("C-c k" . consult-kmacro)
461 ;; C-x bindings (ctl-x-map) 426 ;; C-x bindings (ctl-x-map)
462 ("C-x M-:" . consult-complex-command) 427 ("C-x M-:" . consult-complex-command)
463 ("C-x b" . consult-buffer) 428 ("C-x b" . consult-buffer)
464 ("C-x 4 b" . consult-buffer-other-window) 429 ("C-x 4 b" . consult-buffer-other-window)
465 ("C-x 5 b" . consult-buffer-other-frame) 430 ("C-x 5 b" . consult-buffer-other-frame)
466 ("C-x r b" . consult-bookmark) 431 ("C-x r b" . consult-bookmark)
467 ("C-x p b" . consult-project-buffer) 432 ("C-x p b" . consult-project-buffer)
468 ;; Custom M-# bindings for fast register access 433 ;; Custom M-# bindings for fast register access
469 ("M-#" . consult-register-load) 434 ("M-#" . consult-register-load)
470 ("M-'" . consult-register-store) 435 ("M-'" . consult-register-store)
471 ("C-M-#" . consult-register) 436 ("C-M-#" . consult-register)
472 ;; Other custom bindings 437 ;; Other custom bindings
473 ("M-y" . consult-yank-pop) 438 ("M-y" . consult-yank-pop)
474 ;; M-g bindings (goto-map) 439 ;; M-g bindings (goto-map)
475 ("M-g e" . consult-compile-error) 440 ("M-g e" . consult-compile-error)
476 ("M-g f" . consult-flymake) 441 ("M-g f" . consult-flymake)
477 ("M-g g" . consult-goto-line) 442 ("M-g g" . consult-goto-line)
478 ("M-g M-g" . consult-goto-line) 443 ("M-g M-g" . consult-goto-line)
479 ("M-g o" . consult-outline) 444 ("M-g o" . consult-outline)
480 ("M-g m" . consult-mark) 445 ("M-g m" . consult-mark)
481 ("M-g k" . consult-global-mark) 446 ("M-g k" . consult-global-mark)
482 ("M-g i" . consult-imenu) 447 ("M-g i" . consult-imenu)
@@ -494,14 +459,14 @@ See also `with-region-or-to-eol'."
494 ;; Isearch integration 459 ;; Isearch integration
495 ("M-s e" . consult-isearch-history) 460 ("M-s e" . consult-isearch-history)
496 :map isearch-mode-map 461 :map isearch-mode-map
497 ("M-e" . consult-isearch-history) 462 ("M-e" . consult-isearch-history)
498 ("M-s e" . consult-isearch-history) 463 ("M-s e" . consult-isearch-history)
499 ("M-s l" . consult-line) 464 ("M-s l" . consult-line)
500 ("M-s L" . consult-line-multi) 465 ("M-s L" . consult-line-multi)
501 ;; Minibuffer history 466 ;; Minibuffer history
502 :map minibuffer-local-map 467 :map minibuffer-local-map
503 ("M-s" . consult-history) 468 ("M-s" . consult-history)
504 ("M-r" . consult-history)) 469 ("M-r" . consult-history))
505 470
506 ;; Enable automatic preview at point in the *Completions* buffer. This is 471 ;; Enable automatic preview at point in the *Completions* buffer. This is
507 ;; relevant when you use the default completion UI. 472 ;; relevant when you use the default completion UI.
@@ -603,4 +568,25 @@ See also `with-region-or-to-eol'."
603 "/git-rebase-todo\\'")) 568 "/git-rebase-todo\\'"))
604 (global-undo-fu-session-mode)) 569 (global-undo-fu-session-mode))
605 570
571(use-package crux
572 :ensure t :demand t
573 :bind (("C-o" . crux-smart-open-line)
574 ("C-x 4 t" . crux-transpose-windows))
575 :config
576 (crux-with-region-or-buffer indent-region)
577 (crux-with-region-or-buffer tabify)
578 (crux-with-region-or-buffer untabify)
579 (crux-reopen-as-root-mode))
580
581(use-package pixel-scroll
582 :demand t
583 :bind (([right-margin wheel-down] . pixel-scroll-precision)
584 ([right-margin double-wheel-down] . pixel-scroll-precision)
585 ([right-margin triple-wheel-down] . pixel-scroll-precision)
586 ([right-margin wheel-up] . pixel-scroll-precision)
587 ([right-margin double-wheel-up] . pixel-scroll-precision)
588 ([right-margin triple-wheel-up] . pixel-scroll-precision))
589 :config
590 (pixel-scroll-precision-mode))
591
606;;; basics.el ends here 592;;; basics.el ends here
diff --git a/init.el b/init.el index f114adf..617de47 100644 --- a/init.el +++ b/init.el
@@ -13,9 +13,10 @@
13 (setopt tab-bar-show 1 13 (setopt tab-bar-show 1
14 recenter-positions '(top middle bottom) 14 recenter-positions '(top middle bottom)
15 initial-scratch-message 15 initial-scratch-message
16 (mapconcat (lambda (s) (format ";; %s" s)) 16 (format "%s\n\n"
17 (process-lines "fortune") 17 (mapconcat (lambda (s) (format ";; %s" s))
18 "\n")) 18 (process-lines "fortune" "-s")
19 "\n")))
19 (keymap-global-unset "C-\\") 20 (keymap-global-unset "C-\\")
20 (add-hook 'kill-buffer-query-functions 21 (add-hook 'kill-buffer-query-functions
21 (defun scratch@immortal () 22 (defun scratch@immortal ()
@@ -27,6 +28,8 @@
27 :config 28 :config
28 (add-hook 'server-after-make-frame-hook 29 (add-hook 'server-after-make-frame-hook
29 (defun first-frame@set-fonts () 30 (defun first-frame@set-fonts ()
31 (remove-hook 'server-after-make-frame-hook
32 #'first-frame@set-fonts)
30 (face-spec-set 'fixed-pitch 33 (face-spec-set 'fixed-pitch
31 `((t :family ,(find-font "Comic Code" 34 `((t :family ,(find-font "Comic Code"
32 "DejaVu Sans Mono") 35 "DejaVu Sans Mono")
@@ -73,7 +76,9 @@
73 (telugu . "Noto Sans Telugu") 76 (telugu . "Noto Sans Telugu")
74 (tibetan . "Noto Sans Tibetan")) 77 (tibetan . "Noto Sans Tibetan"))
75 if (member font ffl) 78 if (member font ffl)
76 do (set-fontset-font t charset font))))) 79 do (set-fontset-font t charset font))))
80 (unless (daemonp)
81 (run-with-idle-timer 1 nil #'first-frame@set-fonts)))
77 82
78(use-package text-mode 83(use-package text-mode
79 :config 84 :config
@@ -81,6 +86,8 @@
81 86
82(use-package prog-mode 87(use-package prog-mode
83 :config 88 :config
89 (setopt tab-width 8
90 sh-indentation tab-width)
84 (add-hook 'prog-mode-hook #'auto-fill-mode) 91 (add-hook 'prog-mode-hook #'auto-fill-mode)
85 (add-hook 'prog-mode-hook 92 (add-hook 'prog-mode-hook
86 (defun prog@indent-tabs-maybe () 93 (defun prog@indent-tabs-maybe ()
@@ -90,63 +97,6 @@
90 'haskell-mode) 97 'haskell-mode)
91 -1 1))))) 98 -1 1)))))
92 99
93(use-package eshell
94 :preface
95 ;; TODO: Break this out into its own package (eshell-pop?). This may not work
96 ;; the way I want it to sometimes .. but then, I don't know how I want it to
97 ;; work sometimes either. More testing, clearly, is needed.
98 (defvar eshell-buffer-format "*eshell:%s*"
99 "Format for eshell buffer names.")
100 (defun eshell-rename-pwd ()
101 (rename-buffer (format eshell-buffer-format default-directory) t))
102 (defun eshell-last-dir ()
103 (goto-char (point-max))
104 (insert "cd -")
105 (eshell-send-input))
106 (defun eshellp (buffer-or-name)
107 (with-current-buffer buffer-or-name
108 (derived-mode-p 'eshell-mode)))
109 (defun +eshell (&optional new)
110 (interactive "P")
111 (let ((dir default-directory)
112 (bname (format eshell-buffer-format default-directory))
113 (display-comint-buffer-action 'pop-to-buffer))
114 (if-let ((buf (and (not new)
115 (or (get-buffer bname)
116 (seq-find #'eshellp
117 (reverse (buffer-list)))))))
118 (pop-to-buffer buf)
119 (eshell new))
120 (eshell-rename-pwd)
121 (unless (equal default-directory dir)
122 (goto-char (point-max))
123 (insert (format "cd %s" dir))
124 (eshell-send-input))))
125 (defun +eshell-quit (&optional choose)
126 (interactive "P")
127 (if choose
128 (let* ((bufs (mapcar #'buffer-name
129 (seq-filter #'eshellp
130 (buffer-list))))
131 (buf (get-buffer
132 (completing-read "Eshell: "
133 bufs nil t nil nil (car bufs)))))
134 (quit-window)
135 (pop-to-buffer buf))
136 (quit-window)))
137 :init
138 (add-hook 'eshell-post-command-hook #'eshell-rename-pwd)
139 :commands eshell
140 :bind (("C-z" . +eshell)
141 :map eshell-mode-map
142 ("C-z" . +eshell-quit)
143 ("C-o" . eshell-last-dir))
144 :config
145 (add-hook 'eshell-mode-hook
146 (defun eshell-setup ()
147 (setq-local imenu-generic-expression
148 '(("Prompt" " $ \\(.*\\)" 1))))))
149
150(use-package auth-source 100(use-package auth-source
151 :config 101 :config
152 (setopt auth-sources '(default "secrets:passwords")) 102 (setopt auth-sources '(default "secrets:passwords"))
@@ -159,24 +109,6 @@
159(use-package flyspell 109(use-package flyspell
160 :hook org-mode-hook) 110 :hook org-mode-hook)
161 111
162(use-package browse-url
163 :preface
164 (defcustom +browse-url-other-safe-browser-functions nil
165 "Other safe browser functions."
166 :type '(repeat function))
167 (defun +browse-url-browser-function-safe-p (f)
168 "Return t if F is a safe browser function."
169 (memq f (append +browse-url-other-safe-browser-functions
170 (mapcar (lambda (i)
171 (plist-get (cdr i) :value))
172 (seq-filter (lambda (i)
173 (eq (car i) 'function-item))
174 (cdr (get 'browse-url-browser-function
175 'custom-type)))))))
176 :config
177 (put 'browse-url-browser-function 'safe-local-variable
178 '+browse-url-browser-function-safe-p))
179
180(use-package dired 112(use-package dired
181 :bind (("C-x C-j" . dired-jump) 113 :bind (("C-x C-j" . dired-jump)
182 ([remap list-directory] . dired) 114 ([remap list-directory] . dired)
@@ -206,6 +138,63 @@
206 (add-hook 'dired-mode-hook #'hl-line-mode) 138 (add-hook 'dired-mode-hook #'hl-line-mode)
207 (add-hook 'dired-mode-hook #'truncate-lines-local-mode)) 139 (add-hook 'dired-mode-hook #'truncate-lines-local-mode))
208 140
141(use-package dictionary
142 :custom
143 (dictionary-server (if (or (executable-find "dictd")
144 (file-exists-p "/usr/sbin/dictd")) ; debian
145 "localhost"
146 "dict.org"))
147 :bind
148 (("C-c d" . dictionary-search)))
149
150(use-package mouse
151 :config
152 (setopt context-menu-functions '(context-menu-undo
153 context-menu-region
154 context-menu-middle-separator
155 context-menu-local
156 context-menu-minor))
157 (context-menu-mode))
158
159(use-package password-cache
160 :config
161 (setopt password-cache t
162 password-cache-expiry 3600))
163
164(use-package time
165 :config
166 (setopt display-time-format " %H:%M"
167 display-time-mail-function
168 (defun +notmuch-new-mail-p ()
169 (plist-get (cl-find "inbox+unread"
170 (ignore-errors
171 (notmuch-hello-query-counts notmuch-saved-searches))
172 :key (lambda (l) (plist-get l :name))
173 :test #'equal)
174 :count))
175 display-time-default-load-average nil)
176 (display-time-mode))
177
178
179;;; Applications
180
181(use-package acdw-mail
182 :load-path "lisp/"
183 :demand t
184 :bind (("C-c n" . +notmuch-goto)))
185
186(use-package acdw-org
187 :load-path "lisp/")
188
189(use-package acdw-shell
190 :load-path "lisp/")
191
192(use-package acdw-web
193 :load-path "lisp/")
194
195(use-package _work
196 :load-path "~/Sync/emacs/private/")
197
209 198
210;;; Locally-developed packages 199;;; Locally-developed packages
211 200
@@ -284,7 +273,7 @@ With prefix ARG, toggle the value of
284 (global-frowny-mode)) 273 (global-frowny-mode))
285 274
286(use-package jabber 275(use-package jabber
287 :load-path "~/src/emacs/emacs-jabber/" 276 :load-path "~/src/emacs/jabber/"
288 :preface 277 :preface
289 (defvar jabber-prefix-width 10 278 (defvar jabber-prefix-width 10
290 "Width of jabber prompts and other prefixes.") 279 "Width of jabber prompts and other prefixes.")
@@ -300,7 +289,7 @@ With prefix ARG, toggle the value of
300 (jabber-activity-face ((t :inherit jabber-chat-prompt-foreign 289 (jabber-activity-face ((t :inherit jabber-chat-prompt-foreign
301 :foreground unspecified 290 :foreground unspecified
302 :weight normal))) 291 :weight normal)))
303 (jabber-activity-personal-face ((t :inherit font-lock-warning-face 292 (jabber-activity-personal-face ((t :inherit jabber-chat-prompt-local
304 :foreground unspecified 293 :foreground unspecified
305 :weight bold))) 294 :weight bold)))
306 (jabber-chat-prompt-local ((t :inherit font-lock-warning-face 295 (jabber-chat-prompt-local ((t :inherit font-lock-warning-face
@@ -323,21 +312,15 @@ With prefix ARG, toggle the value of
323 ("Mode #.*" . jabber-muc-presence-dim) 312 ("Mode #.*" . jabber-muc-presence-dim)
324 ("." . jabber-muc-presence-dim)) 313 ("." . jabber-muc-presence-dim))
325 jabber-activity-make-strings #'jabber-activity-make-strings-shorten 314 jabber-activity-make-strings #'jabber-activity-make-strings-shorten
326 jabber-last-read-marker (make-string fill-column ?-)
327 jabber-rare-time-format " - - - - - - %H:%M %F" 315 jabber-rare-time-format " - - - - - - %H:%M %F"
328 ;; buffer name formats 316 ;; buffer name formats
329 jabber-chat-buffer-format "%n <xmpp>" 317 ;; jabber-chat-buffer-format "%n <xmpp>"
330 jabber-browse-buffer-format "%n <xmpp-browse>" 318 ;; jabber-browse-buffer-format "%n <xmpp-browse>"
331 jabber-groupchat-buffer-format "%n <xmpp-muc>" 319 ;; jabber-groupchat-buffer-format "%n <xmpp-muc>"
332 jabber-muc-private-buffer-format "%n <xmpp-muc-private>" 320 ;; jabber-muc-private-buffer-format "%n <xmpp-muc-private>"
333 ;; "prompt" (speaker) formats 321 ;; "prompt" (speaker) formats
334 jabber-groupchat-prompt-format (format "%%>%dn | " jabber-prefix-width) 322 jabber-groupchat-prompt-format (format "%%>%dn | " jabber-prefix-width)
335 jabber-chat-local-prompt-format (format "%%>%dn | " jabber-prefix-width) 323 jabber-chat-local-prompt-format (format "%%>%dn | " jabber-prefix-width)
336 jabber-chat-system-prompt-format (let ((s ""))
337 (while (< (length s)
338 jabber-prefix-width)
339 (setq s (concat s " *")))
340 s)
341 jabber-chat-foreign-prompt-format (format "%%>%dn | " jabber-prefix-width) 324 jabber-chat-foreign-prompt-format (format "%%>%dn | " jabber-prefix-width)
342 jabber-muc-private-foreign-prompt-format "\n%g/%n | ") 325 jabber-muc-private-foreign-prompt-format "\n%g/%n | ")
343 (add-hook 'jabber-chat-mode-hook #'jabber-ui-setup) 326 (add-hook 'jabber-chat-mode-hook #'jabber-ui-setup)
@@ -355,7 +338,8 @@ With prefix ARG, toggle the value of
355 word-boundary))) 338 word-boundary)))
356 (hi-lock-unface-buffer regexp) 339 (hi-lock-unface-buffer regexp)
357 (highlight-regexp regexp 'font-lock-warning-face)))))) 340 (highlight-regexp regexp 'font-lock-warning-face))))))
358 (add-hook 'window-configuration-change-hook #'jabber-chat-update-focus)) 341 (when (fboundp 'jabber-chat-update-focus)
342 (add-hook 'window-configuration-change-hook #'jabber-chat-update-focus)))
359 343
360(use-package keepassxc-shim 344(use-package keepassxc-shim
361 :load-path "~/src/emacs/keepassxc-shim/" 345 :load-path "~/src/emacs/keepassxc-shim/"
@@ -365,10 +349,18 @@ With prefix ARG, toggle the value of
365 349
366;;; External packages 350;;; External packages
367 351
352(use-package trashed
353 :ensure t)
354
368(use-package form-feed 355(use-package form-feed
369 :ensure t 356 :ensure t
370 :hook (emacs-lisp-mode-hook 357 :hook (emacs-lisp-mode-hook))
371 jabber-chat-mode-hook)) 358
359(use-package clean-kill-ring
360 :vc (:url "https://github.com/NicholasBHubbard/clean-kill-ring.el")
361 :config
362 (setopt clean-kill-ring-prevent-duplicates t)
363 (clean-kill-ring-mode))
372 364
373(use-package minions 365(use-package minions
374 :ensure t 366 :ensure t
@@ -407,15 +399,6 @@ With prefix ARG, toggle the value of
407 (advice-add 'emacs-completion-at-point 399 (advice-add 'emacs-completion-at-point
408 :around #'cape-wrap-nonexclusive)) 400 :around #'cape-wrap-nonexclusive))
409 401
410(use-package ws-butler
411 :ensure t
412 :config
413 (setopt ws-butler-trim-predicate
414 (lambda (begin end)
415 (not (eq 'font-lock-string-face
416 (get-text-property end 'face)))))
417 (ws-butler-global-mode))
418
419(use-package wgrep 402(use-package wgrep
420 :ensure t 403 :ensure t
421 :config 404 :config
@@ -563,10 +546,6 @@ With prefix ARG, toggle the value of
563 (setopt sly-net-coding-system 'utf-8-unix) 546 (setopt sly-net-coding-system 'utf-8-unix)
564 (sly-symbol-completion-mode -1)) 547 (sly-symbol-completion-mode -1))
565 548
566(use-package eat
567 :ensure t
568 :hook (eshell-load-hook . eat-eshell-mode))
569
570(use-package pdf-tools 549(use-package pdf-tools
571 :ensure t 550 :ensure t
572 :mode ("\\.[pP][dD][fF]\\'" . pdf-view-mode) 551 :mode ("\\.[pP][dD][fF]\\'" . pdf-view-mode)
@@ -722,16 +701,36 @@ With PREFIX, prompt to change the current dictionary."
722 (emacs-lisp-mode-hook . embrace-emacs-lisp-mode-hook) 701 (emacs-lisp-mode-hook . embrace-emacs-lisp-mode-hook)
723 (latex-mode-hook . embrace-LaTeX-mode-hook))) 702 (latex-mode-hook . embrace-LaTeX-mode-hook)))
724 703
725 704(use-package apheleia
726;;; Applications 705 :ensure t
727 706 :config
728(use-package acdw-mail 707 (setopt apheleia-hide-log-buffers t)
729 :load-path "lisp/" 708 (setf (alist-get 'shfmt apheleia-formatters)
730 :demand t 709 '("shfmt" "--case-indent"))
731 :bind (("C-c n" . +notmuch-goto))) 710 (global-set-key (kbd "M-C-\\")
732 711 (defun +apheleia-format|indent-buffer ()
733(use-package acdw-org 712 (interactive)
734 :load-path "lisp/") 713 (if-let ((formatters (apheleia--get-formatters)))
714 (apheleia-format-buffer
715 formatters
716 (lambda ()
717 (with-demoted-errors "Apheleia: %s"
718 (when buffer-file-name
719 (let ((apheleia--format-after-save-in-progress t))
720 (apheleia--save-buffer-silently)))
721 (run-hooks 'apheleia-post-format-hook))))
722 (indent-region (point-min) (point-max))
723 (when buffer-file-name
724 (save-buffer))))))
725
726(use-package php-mode
727 :ensure t)
735 728
736(use-package _work 729(use-package tab-bar
737 :load-path "~/Sync/emacs/private/") 730 :config
731 (setopt tab-bar-show t
732 tab-bar-format
733 (append tab-bar-format
734 '(tab-bar-format-align-right
735 tab-bar-format-global)))
736 (tab-bar-mode))
diff --git a/lisp/acdw-shell b/lisp/acdw-shell new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lisp/acdw-shell
diff --git a/lisp/acdw-shell.el b/lisp/acdw-shell.el new file mode 100644 index 0000000..7c542aa --- /dev/null +++ b/lisp/acdw-shell.el
@@ -0,0 +1,141 @@
1;;; acdw-shell.el ---Shell config -*- lexical-binding: t; -*-
2
3;;; Code:
4
5(defvar eshell-buffer-format "*eshell:%s*"
6 "Format for eshell buffer names.")
7
8(defun eshell-rename-pwd ()
9 (rename-buffer (format eshell-buffer-format default-directory) t))
10
11(defun eshell-last-dir ()
12 (goto-char (point-max))
13 (insert "cd -")
14 (eshell-send-input))
15
16(defun eshellp (buffer-or-name)
17 (with-current-buffer buffer-or-name
18 (derived-mode-p 'eshell-mode)))
19
20(defun +eshell (&optional new)
21 (interactive "P")
22 (let ((dir default-directory)
23 (bname (format eshell-buffer-format default-directory))
24 (display-comint-buffer-action 'pop-to-buffer))
25 (if-let ((buf (and (not new)
26 (or (get-buffer bname)
27 (seq-find #'eshellp
28 (reverse (buffer-list)))))))
29 (pop-to-buffer buf)
30 (eshell new))
31 (eshell-rename-pwd)
32 (unless (equal default-directory dir)
33 (eshell/cd dir)
34 (eshell-send-input)
35 (goto-char (point-max)))))
36
37(defun +eshell-quit (&optional choose)
38 (interactive "P")
39 (if choose
40 (let* ((bufs (mapcar #'buffer-name
41 (seq-filter #'eshellp
42 (buffer-list))))
43 (buf (get-buffer
44 (completing-read "Eshell: "
45 bufs nil t nil nil (car bufs)))))
46 (quit-window)
47 (pop-to-buffer buf))
48 (quit-window)))
49
50(defun acdw/eshell-prompt ()
51 "My custom eshell prompt."
52 (concat (if (= 0 eshell-last-command-status)
53 "^_^ "
54 ";_; ")
55 (abbreviate-file-name (eshell/pwd))
56 (if (= (user-uid) 0) " # " " $ ")))
57
58
59;;; Packages
60
61(use-package eshell
62 :init
63 (add-hook 'eshell-post-command-hook #'eshell-rename-pwd)
64 (setopt eshell-modules-list
65 '(eshell-alias
66 eshell-basic
67 eshell-cmpl
68 eshell-dirs
69 eshell-elecslash
70 eshell-hist
71 eshell-ls
72 eshell-prompt
73 eshell-smart
74 eshell-extpipe
75 eshell-glob
76 eshell-hist
77 eshell-ls
78 eshell-pred
79 eshell-prompt
80 eshell-script
81 eshell-term
82 eshell-unix))
83 :commands eshell
84 :bind (("C-z" . +eshell)
85 :map eshell-mode-map
86 ("C-z" . +eshell-quit)
87 ("C-o" . eshell-last-dir))
88 :config
89 (require 'esh-module)
90 (require 'em-smart)
91 (require 'em-tramp)
92 (setopt eshell-destroy-buffer-when-process-dies t
93 eshell-error-if-no-glob t
94 eshell-hist-ignoredups t
95 eshell-kill-on-exit t
96 eshell-prefer-lisp-functions t
97 eshell-prefer-lisp-variables t
98 eshell-scroll-to-bottom-on-input 'this
99 eshell-banner-message ""
100 eshell-hist-ignoredups 'erase
101 eshell-history-size 512
102 eshell-input-filter (lambda (input)
103 (or (eshell-input-filter-default input)
104 (eshell-input-filter-initial-space input)))
105 eshell-prompt-function #'acdw/eshell-prompt)
106 (add-hook 'eshell-mode-hook
107 (defun eshell-setup ()
108 (hungry-delete-mode -1)
109 (setq-local outline-regexp eshell-prompt-regexp
110 page-delimiter eshell-prompt-regexp
111 imenu-generic-expression
112 '(("Prompt" " $ \\(.*\\)" 1))
113 truncate-lines t)
114 (setenv "PAGER" "cat"))))
115
116(use-package eat
117 :ensure t
118 :hook (eshell-load-hook . eat-eshell-mode))
119
120(use-package exec-path-from-shell
121 :when (eq system-type 'gnu/linux)
122 :ensure t
123 :config
124 (add-to-list 'exec-path-from-shell-variables "SSH_AUTH_SOCK")
125 (add-to-list 'exec-path-from-shell-variables "SSH_AGENT_PID")
126 (add-to-list 'exec-path-from-shell-variables "GPG_AGENT_INFO")
127 (add-to-list 'exec-path-from-shell-variables "LANG")
128 (add-to-list 'exec-path-from-shell-variables "LC_CTYPE")
129 (add-to-list 'exec-path-from-shell-variables "XDG_CONFIG_HOME")
130 (add-to-list 'exec-path-from-shell-variables "XDG_CONFIG_DIRS")
131 (add-to-list 'exec-path-from-shell-variables "XDG_DATA_HOME")
132 (add-to-list 'exec-path-from-shell-variables "XDG_DATA_DIRS")
133 (add-to-list 'exec-path-from-shell-variables "XDG_CACHE_HOME")
134 (exec-path-from-shell-initialize))
135
136(use-package eshell-bookmark
137 :ensure t
138 :hook (eshell-mode-hook . eshell-bookmark-setup))
139
140(provide 'acdw-shell)
141;;; acdw-shell.el ends here
diff --git a/lisp/acdw-web.el b/lisp/acdw-web.el new file mode 100644 index 0000000..080cd9a --- /dev/null +++ b/lisp/acdw-web.el
@@ -0,0 +1,28 @@
1;;; acdw.web.el --- Web browsing and such -*- lexical-binding: t; -*-
2
3;;; Code:
4
5(defcustom +browse-url-other-safe-browser-functions nil
6 "Other safe browser functions."
7 :type '(repeat function))
8
9(defun +browse-url-browser-function-safe-p (f)
10 "Return t if F is a safe browser function."
11 (memq f (append +browse-url-other-safe-browser-functions
12 (mapcar (lambda (i)
13 (plist-get (cdr i) :value))
14 (seq-filter (lambda (i)
15 (eq (car i) 'function-item))
16 (cdr (get 'browse-url-browser-function
17 'custom-type)))))))
18
19
20;;; Packages
21
22(use-package browse-url
23 :config
24 (put 'browse-url-browser-function 'safe-local-variable
25 '+browse-url-browser-function-safe-p))
26
27(provide 'acdw-web)
28;;; acdw-web.el ends here