summary refs log tree commit diff stats
path: root/init.el
diff options
context:
space:
mode:
Diffstat (limited to 'init.el')
-rw-r--r--init.el237
1 files changed, 118 insertions, 119 deletions
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))