about summary refs log tree commit diff stats
path: root/init.el
blob: bafdda283aa9bebeb5c46e4611f96db6452d1638 (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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
;;; init.el -*- lexical-binding: t; coding: utf-8; fill-column: 70 -*-

;;; Commentary:
;; I /was/ going to convert this to org-mode, but then I found this
;; page: https://yiufung.net/post/pure-emacs-lisp-init-skeleton/,
;; which pointed out that I could use `outline-mode' (or in my case,
;; `outshine') to fold and navigate a pure-elisp `init.el'.  So that's
;; what I'm doing.
;;; Basic emacs config & built-in packages
;;;; /Really/ basic emacs config
;; I /did/ use `better-defaults', but it turns out that that package
;; is (a) short and (b) mostly overriden by other settings.
(use-package emacs
  :demand ; make sure this stuff loads
  :init
  ;; where I am
  (setq calendar-location-name "Baton Rouge, LA")
  (setq calendar-latitude 30.39)
  (setq calendar-longitude -91.83)

  ;; firefox is love, firefox is life
  (setq browse-url-browser-function 'browse-url-firefox
        browse-url-new-window-flag t
        browse-url-firefox-new-window-is-tab t)

  ;; honestly not sure if this is necessary
  (autoload 'zap-up-to-char "misc"
    "Kill up to, but not including, ARGth occurence of CHAR." t)

  ;; show parentheses
  (setq show-paren-style 'mixed)
  (show-paren-mode)

  ;; always work on visual lines
  (global-visual-line-mode)

  ;; make the mouse avoid where I'm typing
  (mouse-avoidance-mode 'jump)

  ;; delete the selection when I start typing, like a normal editor
  (delete-selection-mode)

  ;; ignore case
  (setq-default completion-ignore-case t
                read-buffer-completion-ignore-case t
                read-file-name-completion-ignore-case t)

  ;; etc defaults
  (fset 'yes-or-no-p 'y-or-n-p)
  (setq-default indent-tabs-mode nil
                save-interprogram-paste-before-kill t
                apropos-do-all t
                mouse-yank-at-point t
                require-final-newline t
                visible-bell (not *acdw/at-larry*)
                ediff-window-setup-function 'ediff-setup-windows-plain
                use-dialog-box nil
                mark-even-if-inactive nil
                sentence-end-double-space t)

  ;; utf-8 is now, old man
  (set-charset-priority 'unicode)
  (set-language-environment "UTF-8")
  (set-default-coding-systems 'utf-8)
  (set-terminal-coding-system 'utf-8)
  (set-keyboard-coding-system 'utf-8)
  (set-selection-coding-system 'utf-8)
  (prefer-coding-system 'utf-8)
  (setq default-buffer-file-coding-system 'utf-8
        default-process-coding-system '(utf-8-unix . utf-8-unix)
        locale-coding-system 'utf-8)

  ;; don't confirm killing
  (setq confirm-kill-processes nil
        confirm-kill-emacs nil)

  ;; simplify the GUI
  (setq default-frame-alist '((tool-bar-lines . 0)
                              (menu-bar-lines . 0)
                              (vertical-scroll-bars . nil)
                              (horizontal-scroll-bars . nil)
                              (right-divider-width . 2)
                              (bottom-divider-width . 2)
                              (left-fringe-width . 2)
                              (right-fringe-width . 2))
        inhibit-startup-buffer-menu t
        inhibit-startup-screen t
        initial-buffer-choice t
        initial-scratch-message nil)

  ;; When at larry, fullscreen emacs.
  (when *acdw/at-larry*
    (add-to-list 'default-frame-alist '(fullscreen . maximized)))

  ;; set up the cursor
  (blink-cursor-mode 0)
  (setq-default cursor-type 'bar
                cursor-in-non-selected-windows 'hollow)

  ;; display line numbers in `prog-mode'
  (add-hook 'prog-mode-hook
            (if (and (fboundp 'display-line-numbers-mode)
                     (display-graphic-p))
                #'display-line-numbers-mode
              #'linum-mode))

  ;; custom functions
  (defun split-and-follow-below ()
    "Split the window below and switch to the split."
    (interactive)
    (split-window-below)
    (balance-windows)
    (other-window 1))

  (defun split-and-follow-right ()
    "Split the window right and switch to the split."
    (interactive)
    (split-window-right)
    (balance-windows)
    (other-window 1))

  (defun full-auto-save ()
    "Save all buffers that (a) have files associated and (b) are modified."
    (interactive)
    (save-excursion
      (dolist (buf (buffer-list))
        (set-buffer buf)
        (if (and (buffer-file-name) (buffer-modified-p))
            (basic-save-buffer)))))

  (defun kill-this-buffer ()
    "Kill the current buffer."
    (interactive)
    (kill-buffer nil))

  :bind
  ("C-x C-b" . ibuffer)
  ("M-z" . zap-up-to-char)
  ([remap split-window-below] . split-and-follow-below)
  ([remap split-window-right] . split-and-follow-right)
  ("C-x f" . find-file)
  ("C-z" . nil)
  ("C-x k" . kill-this-buffer)
  ("C-x K" . kill-buffer)

  :hook
  (prog-mode-hook . prettify-symbols-mode)
  ((auto-save-hook focus-out-hook) . full-auto-save)
  (before-save-hook . delete-trailing-whitespace))

;;;; Keep .emacs.d clean
;; load this early for other packages to use
(use-package no-littering
  :demand
  :config
  (setq custom-file (no-littering-expand-etc-file-name "custom.el"))

  (setq create-lockfiles nil)

  (setq delete-old-versions t
        kept-new-versions 6
        kept-old-versions 2
        version-control t)

  (setq backup-directory-alist
        `((".*" . ,(no-littering-expand-var-file-name "backup/"))))

  (setq auto-save-file-name-transforms
        `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
  (auto-save-mode))

;;;; Uniquily name buffers
(use-package uniquify
  :straight nil
  :init
  (setq uniquify-buffer-name-style 'forward))

;;;; Use async when possible
(use-package async
  :config
  (dired-async-mode))

;;;; Autocompile elisp files (like this one)
(use-package auto-compile
  :init
  (setq load-prefer-newer t)
  :config
  (auto-compile-on-load-mode))

;;;; Recent files
(use-package recentf
  :init
  (setq recentf-max-menu-items 100
        recentf-max-saved-items 100)
  :config
  (add-to-list 'recentf-exclude no-littering-var-directory)
  (add-to-list 'recentf-exclude no-littering-etc-directory)
  (recentf-mode))
;;;; Save places in files
(use-package saveplace
  :init
  (setq save-place-file (no-littering-expand-var-file-name "places"))
  (when *acdw/at-work*
    (setq save-place-forget-unreadable-files nil))
  :config
  (save-place-mode))

;;;; Save history of commands, etc.
(use-package savehist
  :init
  (setq savehist-additional-variables
        '(kill-ring
          search-ring
          regexp-search-ring))
  :config
  (savehist-mode))

;;;; Authority sources for logins
;; TODO: use gpg
(use-package auth-source
  :init
  (setq auth-sources '("~/.authinfo"))
  (setq user-full-name "Case Duckworth")
  (setq user-mail-address "acdw@acdw.net"))

;;; General-ish Packages
;;;; General improvements
;;;;; Diminish TODO: is this necessary?
(use-package diminish)

;;;;; Restart emacs /from within/ emacs
(use-package restart-emacs)

;;;; User interface
;;;;; Pop-up help for keys
(use-package which-key
  :diminish which-key-mode
  :init
  (setq which-key-enable-extended-define-key t)
  :config
  (which-key-setup-side-window-right-bottom)
  (which-key-mode))

;;;;; A better help buffer
(use-package helpful
  :bind
  ("C-h f" . helpful-callable)
  ("C-h v" . helpful-variable)
  ("C-h k" . helpful-key)
  ("C-c C-d" . helpful-at-point)
  ("C-h F" . helpful-function)
  ("C-h C" . helpful-command))

;;;;; A better `outline-mode'
(use-package outshine
  :init
  (setq outshine-cycle-emulate-tab t)
  :bind (:map outshine-mode-map
              ("<S-iso-lefttab>" . outshine-cycle-buffer)
              ("<backtab>" . outshine-cycle-buffer))
  :hook
  (emacs-lisp-mode-hook: . outshine-mode))

;;;;; Item selection & narrowing
(use-package selectrum
  :init
  (setq enable-recursive-minibuffers t)
  (minibuffer-depth-indicate-mode)
  :config
  (selectrum-mode))

(use-package prescient)

(use-package selectrum-prescient
  :config
  (selectrum-prescient-mode)
  (prescient-persist-mode))

;;;;; Searching
(use-package ctrlf
  :config
  (ctrlf-mode))

;;;;; Visually switch windows
(use-package switch-window
  :init
  (setq switch-window-shortcut-style 'qwerty)
  :bind
  ([remap other-window] . switch-window)
  ("s-o" . switch-window))

;;;; Theming, looks, fonts
;;;;; Modeline
(use-package doom-modeline
  :init
  (setq doom-modeline-icon nil
        doom-modeline-enable-word-count t)

  (when *acdw/at-larry*
    (setq display-time-format "%R")
    (display-time-mode))

  :hook
  (window-setup-hook . doom-modeline-mode))
;;;;; Ligatures
(use-package ligature
  :straight (ligature
	     :host github
	     :repo "mickeynp/ligature.el")
  :config
  (ligature-set-ligatures 'prog-mode
			  '("++" "--" "/=" "&&" "||" "||="
			    "->" "=>" "::" "__"
			    "==" "===" "!=" "=/=" "!=="
			    "<=" ">=" "<=>"
			    "/*" "*/" "//" "///"
			    "\\n" "\\\\"
			    "<<" "<<<" "<<=" ">>" ">>>" ">>="
			    "|=" "^="
			    "**" "--" "---" "----" "-----"
			    "==" "===" "====" "====="
			    "</" "<!--" "</>" "-->" "/>"
			    ":=" "..." ":>" ":<" ">:" "<:"
			    "::=" ;; add others here
			    ))
  (global-ligature-mode))
;;;;; Unicode
(use-package unicode-fonts
  :config
  (unicode-fonts-setup))
;;;;; Modus themes
(use-package modus-operandi-theme
  :if window-system
  :config
  (load-theme 'modus-operandi t t)

  (defun acdw/sunrise ()
    (enable-theme 'modus-operandi)
    (start-process-shell-command "light" nil "light -S 60"))

  (if *acdw/at-work*
      (enable-theme 'modus-operandi)
    (run-at-time (nth 1 (split-string (sunrise-sunset)))
                 (* 60 60 24) #'acdw/sunrise)))

(when *acdw/at-home*
  (use-package modus-vivendi-theme
    :if window-system
    :config
    (load-theme 'modus-vivendi t t)

    (defun acdw/sunset ()
      (enable-theme 'modus-vivendi)
      (start-process-shell-command "light" nil "light -S 35"))

    (run-at-time (nth 4 (split-string (sunrise-sunset)))
                 (* 60 60 24) #'acdw/sunset)
    (run-at-time "12am" (* 60 60 24) #'acdw/sunset)))
;;;; General text editing
;;;;; Jump to characters fast
(use-package avy
  :bind
  ("M-s" . avy-goto-char-timer))
;;;;; Show text commands acted on
(use-package volatile-highlights
  :config
  (volatile-highlights-mode))
;;;;; Visual replacement for `zap-to-char'
(use-package zop-to-char
  :bind
  ([remap zap-to-char] . zop-to-char)
  ([remap zap-up-to-char] . zop-up-to-char))
;;;;; Kill & mark things more visually
(use-package easy-kill
  :bind
  ([remap kill-ring-save] . easy-kill)
  ([remap mark-sexp] . easy-mark))
;;;;; Operate on the current line if no region is active
(use-package whole-line-or-region
  :config
  (whole-line-or-region-global-mode))

;;;;; Expand region
(use-package expand-region
  :bind
  ("C-=" . er/expand-region))
;;;; Programming
;;;;; Code completion
(use-package company
  :init
  (setq company-idle-delay 0.1
        company-show-numbers t)
  :config
  (let ((map company-active-map))
    (mapc (lambda (x)
            (define-key map (format "%d" x)
              `(lambda ()
                 (interactive)
                 (company-complete-number ,x))))
          (number-sequence 0 9)))
  :hook
  (prog-mode-hook . company-mode)
  :bind (:map company-active-map
              ("C-n" . company-select-next)
              ("C-p" . company-select-previous)))

(use-package company-quickhelp
  :hook
  (company-mode-hook . company-quickhelp-local-mode))

(use-package company-prescient
  :hook
  (company-mode-hook . company-prescient-mode))

;;;;; Git integration
(use-package magit
  :if *acdw/at-home*
  :bind
  ("C-x g" . magit-status)
  :config
  (add-to-list 'magit-no-confirm 'stage-all-changes))

;; use libgit to speed up magit, only at home
(when (and *acdw/at-home* (executable-find "cmake"))
  (use-package libgit)

  (use-package magit-libgit
    :after (magit libgit))
  )

(use-package forge
  :if *acdw/at-home*
  :after magit
  :config
  (setq forge-owned-accounts '(("duckwork"))))
;;;;; Code formatting & display
;;;;;; Keep code properly indented
(use-package aggressive-indent
  :diminish aggressive-indent-mode
  :hook
  (prog-mode-hook . aggressive-indent-mode))
;;;;;; Smartly deal with pairs
(use-package smartparens
  :config
  (require 'smartparens-config)
  (smartparens-global-mode))
;;;;;; Show delimiters as different colors
(use-package rainbow-delimiters
  :hook
  (prog-mode-hook . rainbow-delimiters-mode))
;;;;;; Show colors as they appear in the buffer
(use-package rainbow-mode
  :hook
  (prog-mode-hook . rainbow-mode))
;;;; Writing
;;;;; `fill-column', but in `visual-line-mode'
(use-package visual-fill-column
  :init
  (setq split-window-preferred-function 'visual-fill-column-split-window-sensibly)
  (setq visual-fill-column-center-text t)
  :config
  (advice-add 'text-scale-adjust
              :after #'visual-fill-column-adjust))

;;;; Machine-specific
;;;;; Linux at home
(when *acdw/at-home*
;;;;;; Edit files with `sudo' (I think?)
  (use-package su
    :config
    (su-mode))
;;;;;; Implement XDG Trash specification
  (use-package trashed
    :init
    (setq delete-by-moving-to-trash t))
;;;;;; Build exec-path from $PATH
  (use-package exec-path-from-shell
    :demand
    :config
    (exec-path-from-shell-initialize))
  )
;;; Specialized packages
;;;; Gemini & Gopher
(use-package elpher
  :straight (elpher
	     :repo "git://thelambdalab.xyz/elpher.git")
  :bind (:map elpher-mode-map
	      ("n" . elpher-next-link)
	      ("p" . elpher-prev-link)
              ("o" . elpher-follow-current-link)
              ("G" . elpher-go-current))
  :hook (elpher-mode-hook . (lambda ()
                              (variable-pitch-mode)
                              (set-fill-column 100)
                              (visual-fill-column-mode))))

(use-package gemini-mode
  :straight (gemini-mode
	     :repo "https://git.carcosa.net/jmcbray/gemini.el.git"))

(use-package gemini-write
  :straight (gemini-write
	     :repo "https://alexschroeder.ch/cgit/gemini-write"))

(defun post-to-gemlog-blue (post-title user pass)
  "Post current buffer to gemlog.blue."
  (interactive
   (let* ((title-maybe (progn ;; TODO this is ... clunky
                         (goto-char (point-min))
                         (if (re-search-forward "^# \\(.*\\)" nil t)
                             (buffer-substring-no-properties
                              (match-beginning 1)
                              (match-end 1))
                           "")))
          (title (read-string
                  (format "Title%s: "
                          (if (string= "" title-maybe)
                              ""
                            (concat " (" title-maybe ")")))
                  nil nil title-maybe))
          (user (read-string "User: " nil))
          (pass (read-passwd "Pass: " nil)))
     (list title user pass)))

  (require 'mm-url)
  (let ((url-request-method "POST")
        (url-request-extra-headers
         '(("Content-Type" . "application/x-www-form-urlencoded")))
        (url-request-data
         (mm-url-encode-www-form-urlencoded
          `(("title" . ,post-title)
            ("gemloguser" . ,user)
            ("pw" . ,pass)
            ("post" . ,(buffer-string))))))
    (with-current-buffer
        (url-retrieve-synchronously "https://gemlog.blue/post.php")
      (goto-char (point-min))
      (re-search-forward "\\(gemini://.*\\.gmi\\)")
      (elpher-go (match-string 1)))))

;;;; exwm ~ Emacs X Window Manager
(when *acdw/at-larry*
  (use-package exwm
    :if window-system
    :demand
    :custom
    (exwm-layout-show-all-buffers t)
    (exwm-workspace-warp-cursor t)
    ;;(mouse-autoselect-window t)
    (exwm-workspace-number 4)
    (exwm-input-global-keys
     `(
       ([remap split-window-below] . split-and-follow-below)
       ([remap split-window-right] . split-and-follow-right)
       ([?\s-r] . exwm-reset)
       ([?\s-w] . exwm-workspace-switch)
       ([?\s-&] . (lambda (command)
		    (interactive (list (read-shell-command "$ ")))
		    (start-process-shell-command command nil command)))
       ,@(mapcar (lambda (i)
		   `(,(kbd (format "s-%d" i)) .
		     (lambda ()
		       (interactive)
		       (exwm-workspace-switch-create ,i))))
	         (number-sequence 0 9))))
    (exwm-input-simulation-keys
     '(([?\C-b] . [left])
       ([?\M-b] . [C-left])
       ([?\C-f] . [right])
       ([?\M-f] . [C-right])
       ([?\C-p] . [up])
       ([?\C-n] . [down])
       ([?\C-a] . [home])
       ([?\C-e] . [end])
       ([?\M-v] . [prior])
       ([?\C-v] . [next])
       ([?\C-d] . [delete])
       ([?\C-k] . [S-end delete])
       ([?\C-s] . [?\C-f])
       ([?\C-w] . [?\C-x])
       ([?\M-w] . [?\C-c])
       ([?\C-y] . [?\C-v])))
    :hook
    ((exwm-update-class-hook .
			     (lambda () "Rename buffer to window's class name"
			       (exwm-workspace-rename-buffer exwm-class-name)))
     (exwm-update-title-hook .
			     (lambda () "Update workspace name to window title"
			       (when (not exwm-instance-name)
			         (exwm-workspace-rename-buffer exwm-title))))
     (exwm-init-hook . window-divider-mode)
     (exwm-init-hook .
		     (lambda () "Autostart"
		       (start-process-shell-command "cmst" nil "cmst -m -w 5")
		       (start-process-shell-command "keepassxc" nil "keepassxc")
		       (start-process-shell-command
		        "pa-applet" nil
		        "pa-applet --disable-key-grabbing --disable-notifications")
		       (start-process-shell-command
                        "cbatticon" nil "cbatticon"))))
    :config
    (require 'exwm)
    (exwm-enable)
    (require 'exwm-systemtray)
    (exwm-systemtray-enable))

  (use-package exwm-firefox-core
    :after exwm
    :straight (exwm-firefox-core
 	       :type git
 	       :host github
 	       :repo "walseb/exwm-firefox-core"))

  (use-package exwm-firefox
    :after exwm-firefox-core
    :straight (exwm-firefox
 	       :type git
 	       :host github
 	       :repo "ieure/exwm-firefox")
    :config
    (exwm-firefox-mode))

  (use-package exwm-mff
    :straight (exwm-mff
               :host github
               :repo "ieure/exwm-mff"
               :fork (
                      :host github
                      :repo "duckwork/exwm-mff"))
    :after exwm
    :hook
    (exwm-init-hook . exwm-mff-mode))

  (use-package exwm-edit)

  ) ;; end of *acdw/at-larry* block for exwm

;;;; IRC
(use-package circe
  :if *acdw/at-larry*
  :init
  (defun my/fetch-password (&rest params)
    "Fetch a password from auth-sources"
    (require 'auth-source)
    (let ((match (car (apply 'auth-source-search params))))
      (if match
	  (let ((secret (plist-get match :secret)))
	    (if (functionp secret)
	        (funcall secret)
	      secret))
        (error "Password not found for %S" params))))

  (defun my/sasl-password (nick server)
    "Fetch a password for $server and $nick"
    (my/fetch-password :user nick :host server))
  (require 'lui-autopaste)
  (defun my/circe-prompt ()
    (lui-set-prompt
     (concat (propertize (concat (buffer-name) ">")
			 'face 'circe-prompt-face)
	     " ")))
  (defun my/lui-setup ()
    (setq right-margin-width 5
	  fringes-outside-margins t
	  word-wrap t
	  wrap-prefix "             ")
    (setf (cdr (assoc 'continuation fringe-indicator-alist)) nil))
  :hook
  (circe-channel-mode-hook . enable-lui-autopaste)
  (circe-chat-mode-hook . my/circe-prompt)
  (lui-mode-hook . my/lui-setup)
  :config
  (setq circe-default-part-message "Peace out, cub scouts")
  (setq circe-default-quit-message "See  You Space Cowpokes ......")
  (setq circe-default-realname "Case D")
  (setq circe-highlight-nick-type 'all)
  (setq circe-reduce-lurker-spam t)
  (setq circe-format-say "{nick:-12s} {body}")
  (setq circe-format-self-say "{nick:-11s}> {body}")
  (setq lui-time-stamp-position 'right-margin)
  (setq lui-fill-type nil)
  (setq lui-time-stamp-format "%H:%M")
  (setq lui-track-bar-behavior 'before-switch-to-buffer)
  (setq circe-network-options
        `(("Freenode"
           :tls t
           :port 6697
           :nick "acdw"
           :sasl-username "acdw"
           :sasl-password ,(my/sasl-password "acdw" "irc.freenode.net")
           :channels ("#emacs" "#daydreams"))
          ("Tilde.chat"
           :tls t
           :port 6697
           :nick "acdw"
           :sasl-username "acdw"
           :sasl-password ,(my/sasl-password "acdw" "irc.tilde.chat")
           :channels ("#gemini" "#meta"))))
  (enable-lui-track-bar)
  :custom-face
  (circe-my-message-face ((t (:inherit 'circe-highlight-nick-face :weight normal))))
  (circe-originator-face ((t (:weight bold))))
  (circe-prompt-face ((t (:inherit 'circe-my-message-face)))))

;;;; eshell
(use-package eshell
  :init
  (defun eshell/emacs (&rest args)
    "Open a file in emacs."
    (if (null args)
        (bury-buffer)
      (mapc #'find-file
            (mapcar #'expand-file-name
                    (eshell-flatten-list (reverse args))))))
  (defun eshell/info (&optional subject)
    "Invoke `info', optionally opening Info to SUBJECT."
    (require 'cl)
    (let ((buf (current-buffer)))
      (Info-directory)
      (if (not (null subject))
          (let ((node-exists (ignore-errors (Info-menu subject))))
            (if (not node-exists)
                (format "No menu item `%s' in node `(dir)Top'."
                        subject)))))))

(use-package eshell-syntax-highlighting
  :after esh-mode
  :config
  (eshell-syntax-highlighting-global-mode))

;;;; org-mode
(use-package org
  :init
  (setq org-startup-indented t)
  (setq org-src-tab-acts-natively t)
  (setq org-hide-emphasis-markers t)
  (setq org-fontify-done-headline t)
  (setq org-hide-leading-stars t)
  (setq org-pretty-entities t)

  (font-lock-add-keywords 'org-mode
                          '(("^ *\\([-+*]\\) "
                             (0 (prog1 () (compose-region (match-beginning 1)
                                                          (match-end 1)
                                                          "•"))))))
  :hook
  (org-mode-hook . variable-pitch-mode))

(use-package org-bullets
  :hook
  (org-mode-hook . (lambda () (org-bullets-mode))))

(provide 'init)
;;; init.el ends here