[emacs] drop the various doom-like naming conventions, simply use a/
[~bandali/configs] / init.org
1 #+title: =aminb='s Literate Emacs Configuration
2 #+author: Amin Bandali
3 #+babel: :cache yes
4 #+property: header-args :tangle yes
5
6 * About
7 :PROPERTIES:
8 :CUSTOM_ID: about
9 :END:
10
11 This org file is my literate configuration for GNU Emacs, and is
12 tangled to [[./init.el][init.el]]. Packages are installed and managed using
13 [[https://github.com/emacscollective/borg][Borg]]. Over the years, I've taken inspiration from configurations of
14 many different people. Some of the configurations that I can remember
15 off the top of my head are:
16
17 - [[https://github.com/dieggsy/dotfiles][dieggsy/dotfiles]]: literate Emacs and dotfiles configuration, uses
18 straight.el for managing packages
19 - [[https://github.com/dakra/dmacs][dakra/dmacs]]: literate Emacs configuration, using Borg for managing
20 packages
21 - [[http://pages.sachachua.com/.emacs.d/Sacha.html][Sacha Chua's literate Emacs configuration]]
22 - [[https://github.com/dakrone/eos][dakrone/eos]]
23 - Ryan Rix's [[http://doc.rix.si/cce/cce.html][Complete Computing Environment]] ([[http://doc.rix.si/projects/fsem.html][about cce]])
24 - [[https://github.com/jwiegley/dot-emacs][jwiegley/dot-emacs]]: nix-based configuration
25 - [[https://github.com/wasamasa/dotemacs][wasamasa/dotemacs]]
26 - [[https://github.com/hlissner/doom-emacs][Doom Emacs]]
27
28 I'd like to have a fully reproducible Emacs setup (part of the reason
29 why I store my configuration in this repository) but unfortunately out
30 of the box, that's not achievable with =package.el=, not currently
31 anyway. So, I've opted to use Borg. For what it's worth, I briefly
32 experimented with [[https://github.com/raxod502/straight.el][straight.el]], but found that it added about 2 seconds
33 to my init time; which is unacceptable for me: I use Emacs as my
34 window manager (via EXWM) and coming from bspwm, I'm too used to
35 having fast startup times.
36
37 ** Installation
38
39 To use this config for your Emacs, first you need to clone this repo,
40 then bootstrap Borg, tell Borg to retrieve package submodules, and
41 byte-compiled the packages. Something along these lines should work:
42
43 #+begin_src sh :tangle no
44 git clone https://github.com/aminb/dotfiles ~/.emacs.d
45 cd ~/.emacs.d
46 make bootstrap-borg
47 make bootstrap
48 make build
49 #+end_src
50
51 * Contents :toc_1:noexport:
52
53 - [[#about][About]]
54 - [[#header][Header]]
55 - [[#initial-setup][Initial setup]]
56 - [[#core][Core]]
57 - [[#borg-essentials][Borg's =layer/essentials=]]
58 - [[#editing][Editing]]
59 - [[#syntax-spell-checking][Syntax and spell checking]]
60 - [[#programming-modes][Programming modes]]
61 - [[#emacs-enhancements][Emacs enhancements]]
62 - [[#email][Email]]
63 - [[#blogging][Blogging]]
64 - [[#post-initialization][Post initialization]]
65 - [[#footer][Footer]]
66
67 * Header
68 :PROPERTIES:
69 :CUSTOM_ID: header
70 :END:
71
72 ** First line
73
74 #+begin_src emacs-lisp :comments none
75 ;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t; eval: (view-mode 1) -*-
76 #+end_src
77
78 Enable =view-mode=, which both makes the file read-only (as a reminder
79 that =init.el= is an auto-generated file, not supposed to be edited),
80 and provides some convenient key bindings for browsing through the
81 file.
82
83 ** License
84
85 #+begin_src emacs-lisp :comments none
86 ;; Copyright (C) 2018 Amin Bandali <bandali@gnu.org>
87
88 ;; This program is free software: you can redistribute it and/or modify
89 ;; it under the terms of the GNU General Public License as published by
90 ;; the Free Software Foundation, either version 3 of the License, or
91 ;; (at your option) any later version.
92
93 ;; This program is distributed in the hope that it will be useful,
94 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
95 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96 ;; GNU General Public License for more details.
97
98 ;; You should have received a copy of the GNU General Public License
99 ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
100 #+end_src
101
102 ** Commentary
103
104 #+begin_src emacs-lisp :comments none
105 ;;; Commentary:
106
107 ;; Emacs configuration of Amin Bandali, computer scientist, functional
108 ;; programmer, and free software advocate.
109
110 ;; THIS FILE IS AUTO-GENERATED FROM `init.org'.
111 #+end_src
112
113 * Initial setup
114 :PROPERTIES:
115 :CUSTOM_ID: initial-setup
116 :END:
117
118 ** Emacs initialization
119
120 I'd like to do a couple of measurements of Emacs' startup time. First,
121 let's see how long Emacs takes to start up, before even loading
122 =init.el=, i.e. =user-init-file=:
123
124 #+begin_src emacs-lisp
125 (defvar a/before-user-init-time (current-time)
126 "Value of `current-time' when Emacs begins loading `user-init-file'.")
127 (message "Loading Emacs...done (%.3fs)"
128 (float-time (time-subtract a/before-user-init-time
129 before-init-time)))
130 #+end_src
131
132 Also, temporarily increase ~gc-cons-threshhold~ and
133 ~gc-cons-percentage~ during startup to reduce garbage collection
134 frequency. Clearing the ~file-name-handler-alist~ seems to help reduce
135 startup time as well.
136
137 #+begin_src emacs-lisp
138 (defvar a/gc-cons-threshold gc-cons-threshold)
139 (defvar a/gc-cons-percentage gc-cons-percentage)
140 (defvar a/file-name-handler-alist file-name-handler-alist)
141 (setq gc-cons-threshold (* 400 1024 1024) ; 400 MiB
142 gc-cons-percentage 0.6
143 file-name-handler-alist nil
144 ;; sidesteps a bug when profiling with esup
145 esup-child-profile-require-level 0)
146 #+end_src
147
148 Of course, we'd like to set them back to their defaults once we're
149 done initializing.
150
151 #+begin_src emacs-lisp
152 (add-hook
153 'after-init-hook
154 (lambda ()
155 (setq gc-cons-threshold a/gc-cons-threshold
156 gc-cons-percentage a/gc-cons-percentage
157 file-name-handler-alist a/file-name-handler-alist)))
158 #+end_src
159
160 Increase the number of lines kept in message logs (the =*Messages*=
161 buffer).
162
163 #+begin_src emacs-lisp
164 (setq message-log-max 20000)
165 #+end_src
166
167 Optionally, we could suppress some byte compiler warnings like below,
168 but for now I've decided to keep them enabled. See documentation for
169 ~byte-compile-warnings~ for more details.
170
171 #+begin_src emacs-lisp
172 ;; (setq byte-compile-warnings
173 ;; '(not free-vars unresolved noruntime lexical make-local))
174 #+end_src
175
176 ** whoami
177
178 #+begin_src emacs-lisp
179 (setq user-full-name "Amin Bandali"
180 user-mail-address "amin@aminb.org")
181 #+end_src
182
183 ** Package management
184
185 *** No =package.el=
186
187 I can do all my package management things with Borg, and don't need
188 Emacs' built-in =package.el=. Emacs 27 lets us disable =package.el= in
189 the =early-init-file= (see [[https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=24acb31c04b4048b85311d794e600ecd7ce60d3b][here]]).
190
191 #+begin_src emacs-lisp :tangle early-init.el
192 (setq package-enable-at-startup nil)
193 #+end_src
194
195 But since Emacs 27 isn't out yet (Emacs 26 is just around the corner
196 right now), and even when released it'll be long before most distros
197 ship in their repos, I'll still put the old workaround with the
198 commented call to ~package-initialize~ here anyway.
199
200 #+begin_src emacs-lisp
201 (setq package-enable-at-startup nil)
202 ;; (package-initialize)
203 #+end_src
204
205 *** Borg
206
207 #+begin_quote
208 Assimilate Emacs packages as Git submodules
209 #+end_quote
210
211 [[https://github.com/emacscollective/borg][Borg]] is at the heart of package management of my Emacs setup. In
212 short, it creates a git submodule in =lib/= for each package, which
213 can then be managed with the help of Magit or other tools.
214
215 #+begin_src emacs-lisp
216 (setq user-init-file (or load-file-name buffer-file-name)
217 user-emacs-directory (file-name-directory user-init-file))
218 (add-to-list 'load-path
219 (expand-file-name "lib/borg" user-emacs-directory))
220 (require 'borg)
221 (borg-initialize)
222
223 ;; (require 'borg-nix-shell)
224 ;; (setq borg-build-shell-command 'borg-nix-shell-build-command)
225
226 (with-eval-after-load 'bind-key
227 (bind-keys
228 :package borg
229 ("C-c b A" . borg-activate)
230 ("C-c b a" . borg-assimilate)
231 ("C-c b b" . borg-build)
232 ("C-c b c" . borg-clone)
233 ("C-c b r" . borg-remove)))
234 #+end_src
235
236 *** =use-package=
237
238 #+begin_quote
239 A use-package declaration for simplifying your .emacs
240 #+end_quote
241
242 [[https://github.com/jwiegley/use-package][use-package]] is an awesome utility for managing and configuring
243 packages (in our case especially the latter) in a neatly organized way
244 and without compromising on performance.
245
246 #+begin_src emacs-lisp
247 (require 'use-package)
248 (if nil ; set to t when need to debug init
249 (setq use-package-verbose t
250 use-package-expand-minimally nil
251 use-package-compute-statistics t
252 debug-on-error t)
253 (setq use-package-verbose nil
254 use-package-expand-minimally t))
255 #+end_src
256
257 *** Epkg
258
259 #+begin_quote
260 Browse the Emacsmirror package database
261 #+end_quote
262
263 Epkg provides access to a local copy of the [[https://emacsmirror.net][Emacsmirror]] package
264 database, low-level functions for querying the database, and a
265 =package.el=-like user interface for browsing the available packages.
266
267 #+begin_src emacs-lisp
268 (use-package epkg
269 :defer t
270 :bind
271 (("C-c b d" . epkg-describe-package)
272 ("C-c b p" . epkg-list-packages)
273 ("C-c b u" . epkg-update)))
274 #+end_src
275
276 ** No littering in =~/.emacs.d=
277
278 #+begin_quote
279 Help keeping ~/.emacs.d clean
280 #+end_quote
281
282 By default, even for Emacs' built-in packages, the configuration files
283 and persistent data are all over the place. Use =no-littering= to help
284 contain the mess.
285
286 #+begin_src emacs-lisp
287 (use-package no-littering
288 :demand t
289 :config
290 (savehist-mode 1)
291 (add-to-list 'savehist-additional-variables 'kill-ring)
292 (save-place-mode 1)
293 (setq auto-save-file-name-transforms
294 `((".*" ,(no-littering-expand-var-file-name "auto-save/") t))))
295 #+end_src
296
297 ** Custom file (=custom.el=)
298
299 I'm not planning on using the custom file much, but even so, I
300 definitely don't want it mixing with =init.el=. So, here; let's give
301 it it's own file. While at it, treat themes as safe.
302
303 #+begin_src emacs-lisp
304 (use-package custom
305 :no-require t
306 :config
307 (setq custom-file (no-littering-expand-etc-file-name "custom.el"))
308 (when (file-exists-p custom-file)
309 (load custom-file))
310 (setf custom-safe-themes t))
311 #+end_src
312
313 ** Secrets file
314
315 Load the secrets file if it exists, otherwise show a warning.
316
317 #+begin_src emacs-lisp
318 (with-demoted-errors
319 (load (no-littering-expand-etc-file-name "secrets")))
320 #+end_src
321
322 ** Better =$PATH= handling
323
324 Let's use [[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] to make Emacs use the =$PATH= as set up
325 in my shell.
326
327 #+begin_src emacs-lisp
328 (use-package exec-path-from-shell
329 :defer 1
330 :init
331 (setq exec-path-from-shell-check-startup-files nil)
332 :config
333 (exec-path-from-shell-initialize)
334 ;; while we're at it, let's fix access to our running ssh-agent
335 (exec-path-from-shell-copy-env "SSH_AGENT_PID")
336 (exec-path-from-shell-copy-env "SSH_AUTH_SOCK"))
337 #+end_src
338
339 ** COMMENT Only one custom theme at a time
340
341 #+begin_src emacs-lisp
342 (defadvice load-theme (before clear-previous-themes activate)
343 "Clear existing theme settings instead of layering them"
344 (mapc #'disable-theme custom-enabled-themes))
345 #+end_src
346
347 ** Server
348
349 Start server if not already running. Alternatively, can be done by
350 issuing =emacs --daemon= in the terminal, which can be automated with
351 a systemd service or using =brew services start emacs= on macOS. I use
352 Emacs as my window manager (via EXWM), so I always start Emacs on
353 login; so starting the server from inside Emacs is good enough for me.
354
355 See [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server][Using Emacs as a Server]].
356
357 #+begin_src emacs-lisp
358 (use-package server
359 :defer 1
360 :config (or (server-running-p) (server-mode)))
361 #+end_src
362
363 ** COMMENT Unicode support
364
365 Font stack with better unicode support, around =Ubuntu Mono= and
366 =Hack=.
367
368 #+begin_src emacs-lisp
369 (dolist (ft (fontset-list))
370 (set-fontset-font
371 ft
372 'unicode
373 (font-spec :name "Source Code Pro" :size 14))
374 (set-fontset-font
375 ft
376 'unicode
377 (font-spec :name "DejaVu Sans Mono")
378 nil
379 'append)
380 ;; (set-fontset-font
381 ;; ft
382 ;; 'unicode
383 ;; (font-spec
384 ;; :name "Symbola monospacified for DejaVu Sans Mono")
385 ;; nil
386 ;; 'append)
387 ;; (set-fontset-font
388 ;; ft
389 ;; #x2115 ; ℕ
390 ;; (font-spec :name "DejaVu Sans Mono")
391 ;; nil
392 ;; 'append)
393 (set-fontset-font
394 ft
395 (cons ?Α ?ω)
396 (font-spec :name "DejaVu Sans Mono" :size 14)
397 nil
398 'prepend))
399 #+end_src
400
401 ** Gentler font resizing
402
403 #+begin_src emacs-lisp
404 (setq text-scale-mode-step 1.05)
405 #+end_src
406
407 ** Focus follows mouse
408
409 I’d like focus to follow the mouse when I move the cursor from one
410 window to the next.
411
412 #+begin_src emacs-lisp
413 (setq mouse-autoselect-window t)
414 #+end_src
415
416 Let’s define a function to conveniently disable this for certain
417 buffers and/or modes.
418
419 #+begin_src emacs-lisp
420 (defun a/no-mouse-autoselect-window ()
421 (make-local-variable 'mouse-autoselect-window)
422 (setq mouse-autoselect-window nil))
423 #+end_src
424
425 ** Libraries
426
427 #+begin_src emacs-lisp
428 (require 'cl-lib)
429 (require 'subr-x)
430 #+end_src
431
432 ** Useful utilities
433
434 Convenience macro for =setq='ing multiple variables to the same value:
435
436 #+begin_src emacs-lisp
437 (defmacro a/setq-every (value &rest vars)
438 "Set all the variables from VARS to value VALUE."
439 (declare (indent defun) (debug t))
440 `(progn ,@(mapcar (lambda (x) (list 'setq x value)) vars)))
441 #+end_src
442
443 * Core
444 :PROPERTIES:
445 :CUSTOM_ID: core
446 :END:
447
448 ** Defaults
449
450 *** Time and battery in mode-line
451
452 Enable displaying time and battery in the mode-line, since I'm not
453 using the Xfce panel anymore. Also, I don't need to see the load
454 average on a regular basis, so disable that.
455
456 Note: using =i3status= on sway at the moment, so disabling this.
457
458 #+begin_src emacs-lisp :tangle no
459 (use-package time
460 :init
461 (setq display-time-default-load-average nil)
462 :config
463 (display-time-mode))
464
465 (use-package battery
466 :config
467 (display-battery-mode))
468 #+end_src
469
470 *** Smaller fringe
471
472 Might want to set the fringe to a smaller value, especially if using
473 EXWM. I'm fine with the default for now.
474
475 #+begin_src emacs-lisp
476 ;; (fringe-mode '(3 . 1))
477 (fringe-mode nil)
478 #+end_src
479
480 *** Disable disabled commands
481
482 Emacs disables some commands by default that could persumably be
483 confusing for novice users. Let's disable that.
484
485 #+begin_src emacs-lisp
486 (setq disabled-command-function nil)
487 #+end_src
488
489 *** Kill-ring
490
491 Save what I copy into clipboard from other applications into Emacs'
492 kill-ring, which would allow me to still be able to easily access it
493 in case I kill (cut or copy) something else inside Emacs before
494 yanking (pasting) what I'd originally intended to.
495
496 #+begin_src emacs-lisp
497 (setq save-interprogram-paste-before-kill t)
498 #+end_src
499
500 *** Minibuffer
501
502 #+begin_src emacs-lisp
503 (setq enable-recursive-minibuffers t
504 resize-mini-windows t)
505 #+end_src
506
507 *** Lazy-person-friendly yes/no prompts
508
509 Lazy people would prefer to type fewer keystrokes, especially for yes
510 or no questions. I'm lazy.
511
512 #+begin_src emacs-lisp
513 (defalias 'yes-or-no-p #'y-or-n-p)
514 #+end_src
515
516 *** Startup screen and =*scratch*=
517
518 Firstly, let Emacs know that I'd like to have =*scratch*= as my
519 startup buffer.
520
521 #+begin_src emacs-lisp
522 (setq initial-buffer-choice t)
523 #+end_src
524
525 Now let's customize the =*scratch*= buffer a bit. First off, I don't
526 need the default hint.
527
528 #+begin_src emacs-lisp
529 (setq initial-scratch-message nil)
530 #+end_src
531
532 Also, let's use Text mode as the major mode, in case I want to
533 customize it (=*scratch*='s default major mode, Fundamental mode,
534 can't really be customized).
535
536 #+begin_src emacs-lisp
537 (setq initial-major-mode 'text-mode)
538 #+end_src
539
540 Inhibit the buffer list when more than 2 files are loaded.
541
542 #+begin_src emacs-lisp
543 (setq inhibit-startup-buffer-menu t)
544 #+end_src
545
546 I don't really need to see the startup screen or echo area message
547 either.
548
549 #+begin_src emacs-lisp
550 (advice-add #'display-startup-echo-area-message :override #'ignore)
551 (setq inhibit-startup-screen t
552 inhibit-startup-echo-area-message user-login-name)
553 #+end_src
554
555 *** More useful frame titles
556
557 Show either the file name or the buffer name (in case the buffer isn't
558 visiting a file). Borrowed from Emacs Prelude.
559
560 #+begin_src emacs-lisp
561 (setq frame-title-format
562 '("" invocation-name " - "
563 (:eval (if (buffer-file-name)
564 (abbreviate-file-name (buffer-file-name))
565 "%b"))))
566 #+end_src
567
568 *** Backups
569
570 Emacs' default backup settings aren't that great. Let's use more
571 sensible options. See documentation for the ~make-backup-file~
572 variable.
573
574 #+begin_src emacs-lisp
575 (setq backup-by-copying t
576 version-control t
577 delete-old-versions t)
578 #+end_src
579
580 *** Auto revert
581
582 Enable automatic reloading of changed buffers and files.
583
584 #+begin_src emacs-lisp
585 (global-auto-revert-mode 1)
586 (setq auto-revert-verbose nil
587 global-auto-revert-non-file-buffers nil)
588 #+end_src
589
590 *** Always use space for indentation
591
592 #+begin_src emacs-lisp
593 (setq-default
594 indent-tabs-mode nil
595 require-final-newline t
596 tab-width 4)
597 #+end_src
598
599 *** Winner mode
600
601 Enable =winner-mode=.
602
603 #+begin_src emacs-lisp
604 (winner-mode 1)
605 #+end_src
606
607 *** Don’t display =*compilation*= on success
608
609 Based on https://stackoverflow.com/a/17788551, with changes to use
610 =cl-letf= instead of the now obsolete =flet=.
611
612 #+begin_src emacs-lisp
613 (with-eval-after-load 'compile
614 (defun a/compilation-finish-function (buffer outstr)
615 (unless (string-match "finished" outstr)
616 (switch-to-buffer-other-window buffer))
617 t)
618
619 (setq compilation-finish-functions #'a/compilation-finish-function)
620
621 (require 'cl-macs)
622
623 (defadvice compilation-start
624 (around inhibit-display
625 (command &optional mode name-function highlight-regexp))
626 (if (not (string-match "^\\(find\\|grep\\)" command))
627 (cl-letf (((symbol-function 'display-buffer) #'ignore))
628 (save-window-excursion ad-do-it))
629 ad-do-it))
630 (ad-activate 'compilation-start))
631 #+end_src
632
633 *** Search for non-ASCII characters
634
635 I’d like non-ASCII characters such as ‘’“”«»‹›áⓐ𝒶 to be selected when
636 I search for their ASCII counterpart. Shoutout to [[http://endlessparentheses.com/new-in-emacs-25-1-easily-search-non-ascii-characters.html][endlessparentheses]]
637 for this.
638
639 #+begin_src emacs-lisp
640 (setq search-default-mode #'char-fold-to-regexp)
641
642 ;; uncomment to extend this behaviour to query-replace
643 ;; (setq replace-char-fold t)
644 #+end_src
645
646 *** Cursor shape
647
648 #+begin_src emacs-lisp
649 (setq-default cursor-type 'bar)
650 #+end_src
651
652 ** Bindings
653
654 #+begin_src emacs-lisp
655 (bind-keys
656 ("C-c a i" . ielm)
657
658 ("C-c e b" . eval-buffer)
659 ("C-c e r" . eval-region)
660
661 ("C-c F m" . make-frame-command)
662 ("C-c F d" . delete-frame)
663 ("C-c F D" . delete-other-frames)
664
665 ("C-c o" . other-window)
666
667 ("C-c Q" . save-buffers-kill-terminal)
668
669 ("C-S-h C" . describe-char)
670 ("C-S-h F" . describe-face)
671
672 ("C-x K" . kill-this-buffer)
673
674 ("s-p" . beginning-of-buffer)
675 ("s-n" . end-of-buffer))
676 #+end_src
677
678 ** Packages
679
680 The packages in this section are absolutely essential to my everyday
681 workflow, and they play key roles in how I do my computing. They
682 immensely enhance the Emacs experience for me; both using Emacs, and
683 customizing it.
684
685 *** [[https://github.com/emacscollective/auto-compile][auto-compile]]
686
687 #+begin_src emacs-lisp
688 (use-package auto-compile
689 :demand t
690 :config
691 (auto-compile-on-load-mode)
692 (auto-compile-on-save-mode)
693 (setq auto-compile-display-buffer nil
694 auto-compile-mode-line-counter t
695 auto-compile-source-recreate-deletes-dest t
696 auto-compile-toggle-deletes-nonlib-dest t
697 auto-compile-update-autoloads t)
698 (add-hook 'auto-compile-inhibit-compile-hook
699 'auto-compile-inhibit-compile-detached-git-head))
700 #+end_src
701
702 *** [[https://orgmode.org/][Org mode]]
703
704 #+begin_quote
705 Org mode is for keeping notes, maintaining TODO lists, planning
706 projects, and authoring documents with a fast and effective plain-text
707 system.
708 #+end_quote
709
710 In short, my favourite way of life.
711
712 #+begin_src emacs-lisp
713 (use-package org
714 :defer 1
715 :config
716 (setq org-src-tab-acts-natively t
717 org-src-preserve-indentation nil
718 org-edit-src-content-indentation 0
719 org-email-link-description-format "Email %c: %s" ; %.30s
720 org-highlight-latex-and-related '(entities)
721 org-use-speed-commands t
722 org-startup-folded 'content
723 org-catch-invisible-edits 'show-and-error
724 org-log-done 'time)
725 (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t)
726 (font-lock-add-keywords
727 'org-mode
728 '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)"
729 (1 '(:foreground "#5a5b5a" :background "#292b2b") t) ; directive
730 (3 '(:foreground "#81a2be" :background "#292b2b") t) ; kind
731 (4 '(:foreground "#c5c8c6") t))) ; title
732 t)
733 :bind (:map org-mode-map ("M-L" . org-insert-last-stored-link))
734 :hook ((org-mode . org-indent-mode)
735 (org-mode . auto-fill-mode)
736 (org-mode . flyspell-mode))
737 :custom
738 (org-latex-packages-alist '(("" "listings") ("" "color")))
739 :custom-face
740 '(org-block-begin-line ((t (:foreground "#5a5b5a" :background "#1d1f21"))))
741 '(org-block ((t (:background "#1d1f21"))))
742 '(org-latex-and-related ((t (:foreground "#b294bb")))))
743
744 (use-package ox-latex
745 :after ox
746 :config
747 (setq org-latex-listings 'listings
748 ;; org-latex-prefer-user-labels t
749 )
750 (add-to-list 'org-latex-packages-alist '("" "listings"))
751 (add-to-list 'org-latex-packages-alist '("" "color"))
752 (add-to-list 'org-latex-classes
753 '("IEEEtran" "\\documentclass[11pt]{IEEEtran}"
754 ("\\section{%s}" . "\\section*{%s}")
755 ("\\subsection{%s}" . "\\subsection*{%s}")
756 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
757 ("\\paragraph{%s}" . "\\paragraph*{%s}")
758 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
759 t))
760
761 (use-package ox-beamer
762 :after ox)
763
764 (use-package orgalist
765 :after message
766 :hook (message-mode . orgalist-mode))
767 #+end_src
768
769 **** asynchronous tangle
770
771 =a/async-babel-tangle= is a function closely inspired by [[https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles][dieggsy's
772 d/async-babel-tangle]] which uses [[https://github.com/jwiegley/emacs-async][async]] to asynchronously tangle an org
773 file.
774
775 #+begin_src emacs-lisp
776 (with-eval-after-load 'org
777 (defvar a/show-async-tangle-results nil
778 "Keep *emacs* async buffers around for later inspection.")
779
780 (defvar a/show-async-tangle-time nil
781 "Show the time spent tangling the file.")
782
783 (defvar a/async-tangle-post-compile "make ti"
784 "If non-nil, pass to `compile' after successful tangle.")
785
786 (defun a/async-babel-tangle ()
787 "Tangle org file asynchronously."
788 (interactive)
789 (let* ((file-tangle-start-time (current-time))
790 (file (buffer-file-name))
791 (file-nodir (file-name-nondirectory file))
792 ;; (async-quiet-switch "-q")
793 )
794 (async-start
795 `(lambda ()
796 (require 'org)
797 (org-babel-tangle-file ,file))
798 (unless a/show-async-tangle-results
799 `(lambda (result)
800 (if result
801 (progn
802 (message "Tangled %s%s"
803 ,file-nodir
804 (if a/show-async-tangle-time
805 (format " (%.3fs)"
806 (float-time (time-subtract (current-time)
807 ',file-tangle-start-time)))
808 ""))
809 (when a/async-tangle-post-compile
810 (compile a/async-tangle-post-compile)))
811 (message "Tangling %s failed" ,file-nodir))))))))
812
813 (add-to-list
814 'safe-local-variable-values
815 '(eval add-hook 'after-save-hook #'a/async-babel-tangle 'append 'local))
816 #+end_src
817
818 *** [[https://magit.vc/][Magit]]
819
820 #+begin_quote
821 It's Magit! A Git porcelain inside Emacs.
822 #+end_quote
823
824 Not just how I do git, but /the/ way to do git.
825
826 #+begin_src emacs-lisp
827 (use-package magit
828 :defer 1
829 :bind (("C-x g" . magit-status)
830 ("s-g s" . magit-status)
831 ("s-g l" . magit-log-buffer-file))
832 :config
833 (magit-add-section-hook 'magit-status-sections-hook
834 'magit-insert-modules
835 'magit-insert-stashes
836 'append)
837 (setq
838 magit-repository-directories '(("~/.emacs.d/" . 0)
839 ("~/src/git/" . 1)))
840 (nconc magit-section-initial-visibility-alist
841 '(([unpulled status] . show)
842 ([unpushed status] . show)))
843 :custom-face (magit-diff-file-heading ((t (:weight normal)))))
844 #+end_src
845
846 *** [[https://github.com/abo-abo/swiper][Ivy]] (and friends)
847
848 #+begin_quote
849 Ivy - a generic completion frontend for Emacs, Swiper - isearch with
850 an overview, and more. Oh, man!
851 #+end_quote
852
853 There's no way I could top that, so I won't attempt to.
854
855 **** Ivy
856
857 #+begin_src emacs-lisp
858 (use-package ivy
859 :defer 1
860 :bind
861 (:map ivy-minibuffer-map
862 ([escape] . keyboard-escape-quit)
863 ([S-up] . ivy-previous-history-element)
864 ([S-down] . ivy-next-history-element)
865 ("DEL" . ivy-backward-delete-char))
866 :config
867 (setq ivy-wrap t)
868 (ivy-mode 1)
869 ;; :custom-face
870 ;; (ivy-minibuffer-match-face-2 ((t (:background "#e99ce8" :weight semi-bold))))
871 ;; (ivy-minibuffer-match-face-3 ((t (:background "#bbbbff" :weight semi-bold))))
872 ;; (ivy-minibuffer-match-face-4 ((t (:background "#ffbbff" :weight semi-bold))))
873 )
874 #+end_src
875
876 **** Swiper
877
878 #+begin_src emacs-lisp
879 (use-package swiper
880 :bind (("C-s" . swiper)
881 ("C-r" . swiper)
882 ("C-S-s" . isearch-forward)))
883 #+end_src
884
885 **** Counsel
886
887 #+begin_src emacs-lisp
888 (use-package counsel
889 :defer 1
890 :bind (([remap execute-extended-command] . counsel-M-x)
891 ([remap find-file] . counsel-find-file)
892 ("s-r" . counsel-recentf)
893 ("C-c x" . counsel-M-x)
894 ("C-c f ." . counsel-find-file)
895 :map minibuffer-local-map
896 ("C-r" . counsel-minibuffer-history))
897 :config
898 (counsel-mode 1)
899 (defalias 'locate #'counsel-locate))
900 #+end_src
901
902 *** eshell
903
904 #+begin_src emacs-lisp
905 (use-package eshell
906 :defer 1
907 :commands eshell
908 :bind ("C-c a s e" . eshell)
909 :config
910 (eval-when-compile (defvar eshell-prompt-regexp))
911 (defun a/eshell-quit-or-delete-char (arg)
912 (interactive "p")
913 (if (and (eolp) (looking-back eshell-prompt-regexp nil))
914 (eshell-life-is-too-much)
915 (delete-char arg)))
916
917 (defun a/eshell-clear ()
918 (interactive)
919 (let ((inhibit-read-only t))
920 (erase-buffer))
921 (eshell-send-input))
922
923 (defun a/eshell-setup ()
924 (make-local-variable 'company-idle-delay)
925 (defvar company-idle-delay nil)
926 (bind-keys :map eshell-mode-map
927 ("C-d" . a/eshell-quit-or-delete-char)
928 ("C-S-l" . a/eshell-clear)
929 ("M-r" . counsel-esh-history)
930 ([tab] . company-complete)))
931
932 :hook (eshell-mode . a/eshell-setup)
933 :custom
934 (eshell-hist-ignoredups t)
935 (eshell-input-filter 'eshell-input-filter-initial-space))
936 #+end_src
937
938 *** Ibuffer
939
940 #+begin_src emacs-lisp
941 (use-package ibuffer
942 :defer t
943 :bind
944 (("C-x C-b" . ibuffer-other-window)
945 :map ibuffer-mode-map
946 ("P" . ibuffer-backward-filter-group)
947 ("N" . ibuffer-forward-filter-group)
948 ("M-p" . ibuffer-do-print)
949 ("M-n" . ibuffer-do-shell-command-pipe-replace))
950 :config
951 ;; Use human readable Size column instead of original one
952 (define-ibuffer-column size-h
953 (:name "Size" :inline t)
954 (cond
955 ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
956 ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0)))
957 ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
958 (t (format "%8d" (buffer-size)))))
959 :custom
960 (ibuffer-saved-filter-groups
961 '(("default"
962 ("dired" (mode . dired-mode))
963 ("org" (mode . org-mode))
964 ("gnus"
965 (or
966 (mode . gnus-group-mode)
967 (mode . gnus-summary-mode)
968 (mode . gnus-article-mode)
969 ;; not really, but...
970 (mode . message-mode)))
971 ("web"
972 (or
973 (mode . web-mode)
974 (mode . css-mode)
975 (mode . scss-mode)
976 (mode . js2-mode)))
977 ("shell"
978 (or
979 (mode . eshell-mode)
980 (mode . shell-mode)
981 (mode . term-mode)))
982 ("programming"
983 (or
984 (mode . python-mode)
985 (mode . c-mode)
986 (mode . c++-mode)
987 (mode . emacs-lisp-mode)
988 (mode . scheme-mode)
989 (mode . haskell-mode)
990 (mode . lean-mode)))
991 ("emacs"
992 (or
993 (name . "^\\*scratch\\*$")
994 (name . "^\\*Messages\\*$"))))))
995 (ibuffer-formats
996 '((mark modified read-only locked " "
997 (name 18 18 :left :elide)
998 " "
999 (size-h 9 -1 :right)
1000 " "
1001 (mode 16 16 :left :elide)
1002 " " filename-and-process)
1003 (mark " "
1004 (name 16 -1)
1005 " " filename)))
1006 :hook (ibuffer . (lambda () (ibuffer-switch-to-saved-filter-groups "default"))))
1007 #+end_src
1008
1009 *** Outline
1010
1011 #+begin_src emacs-lisp
1012 (use-package outline
1013 :defer t
1014 :hook (prog-mode . outline-minor-mode)
1015 :bind
1016 (:map
1017 outline-minor-mode-map
1018 ("<s-tab>" . outline-toggle-children)
1019 ("M-p" . outline-previous-visible-heading)
1020 ("M-n" . outline-next-visible-heading)
1021 :prefix-map a/outline-prefix-map
1022 :prefix "s-o"
1023 ("TAB" . outline-toggle-children)
1024 ("a" . outline-hide-body)
1025 ("H" . outline-hide-body)
1026 ("S" . outline-show-all)
1027 ("h" . outline-hide-subtree)
1028 ("s" . outline-show-subtree)))
1029 #+end_src
1030
1031 * Borg's =layer/essentials=
1032 :PROPERTIES:
1033 :CUSTOM_ID: borg-essentials
1034 :END:
1035
1036 TODO: break this giant source block down into individual org sections.
1037
1038 #+begin_src emacs-lisp
1039 (use-package dash
1040 :config (dash-enable-font-lock))
1041
1042 (use-package diff-hl
1043 :config
1044 (setq diff-hl-draw-borders nil)
1045 (global-diff-hl-mode)
1046 (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh t))
1047
1048 (use-package dired
1049 :defer t
1050 :config (setq dired-listing-switches "-alh"))
1051
1052 (use-package eldoc
1053 :when (version< "25" emacs-version)
1054 :config (global-eldoc-mode))
1055
1056 (use-package help
1057 :defer t
1058 :config
1059 (temp-buffer-resize-mode)
1060 (setq help-window-select t))
1061
1062 (progn ; `isearch'
1063 (setq isearch-allow-scroll t))
1064
1065 (use-package lisp-mode
1066 :config
1067 (add-hook 'emacs-lisp-mode-hook 'outline-minor-mode)
1068 (add-hook 'emacs-lisp-mode-hook 'reveal-mode)
1069 (defun indent-spaces-mode ()
1070 (setq indent-tabs-mode nil))
1071 (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode))
1072
1073 (use-package man
1074 :defer t
1075 :config (setq Man-width 80))
1076
1077 (use-package paren
1078 :config (show-paren-mode))
1079
1080 (use-package prog-mode
1081 :config (global-prettify-symbols-mode)
1082 (defun indicate-buffer-boundaries-left ()
1083 (setq indicate-buffer-boundaries 'left))
1084 (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left))
1085
1086 (use-package recentf
1087 :defer 0.5
1088 :config
1089 (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:")
1090 (setq recentf-max-saved-items 40))
1091
1092 (use-package savehist
1093 :config (savehist-mode))
1094
1095 (use-package saveplace
1096 :when (version< "25" emacs-version)
1097 :config (save-place-mode))
1098
1099 (use-package simple
1100 :config (column-number-mode))
1101
1102 (progn ; `text-mode'
1103 (add-hook 'text-mode-hook #'indicate-buffer-boundaries-left)
1104 (add-hook 'text-mode-hook #'abbrev-mode))
1105
1106 (use-package tramp
1107 :defer t
1108 :config
1109 (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
1110 (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil))
1111 (add-to-list 'tramp-default-proxies-alist
1112 (list (regexp-quote (system-name)) nil nil)))
1113
1114 #+end_src
1115
1116 * Editing
1117 :PROPERTIES:
1118 :CUSTOM_ID: editing
1119 :END:
1120
1121 ** Company
1122
1123 #+begin_src emacs-lisp
1124 (use-package company
1125 :defer 1
1126 :bind
1127 (:map company-active-map
1128 ([tab] . company-complete-common-or-cycle)
1129 ([escape] . company-abort))
1130 :custom
1131 (company-minimum-prefix-length 1)
1132 (company-selection-wrap-around t)
1133 (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]")
1134 (company-dabbrev-downcase nil)
1135 (company-dabbrev-ignore-case nil)
1136 :config
1137 (global-company-mode t))
1138 #+end_src
1139
1140 * Syntax and spell checking
1141 :PROPERTIES:
1142 :CUSTOM_ID: syntax-spell-checking
1143 :END:
1144
1145 #+begin_src emacs-lisp
1146 (use-package flycheck
1147 :defer 3
1148 :hook (prog-mode . flycheck-mode)
1149 :bind
1150 (:map flycheck-mode-map
1151 ("M-P" . flycheck-previous-error)
1152 ("M-N" . flycheck-next-error))
1153 :config
1154 ;; Use the load-path from running Emacs when checking elisp files
1155 (setq flycheck-emacs-lisp-load-path 'inherit)
1156
1157 ;; Only flycheck when I actually save the buffer
1158 (setq flycheck-check-syntax-automatically '(mode-enabled save)))
1159
1160 ;; http://endlessparentheses.com/ispell-and-apostrophes.html
1161 (use-package ispell
1162 :defer 3
1163 :config
1164 ;; ’ can be part of a word
1165 (setq ispell-local-dictionary-alist
1166 `((nil "[[:alpha:]]" "[^[:alpha:]]"
1167 "['\x2019]" nil ("-B") nil utf-8)))
1168 ;; don't send ’ to the subprocess
1169 (defun endless/replace-apostrophe (args)
1170 (cons (replace-regexp-in-string
1171 "’" "'" (car args))
1172 (cdr args)))
1173 (advice-add #'ispell-send-string :filter-args
1174 #'endless/replace-apostrophe)
1175
1176 ;; convert ' back to ’ from the subprocess
1177 (defun endless/replace-quote (args)
1178 (if (not (derived-mode-p 'org-mode))
1179 args
1180 (cons (replace-regexp-in-string
1181 "'" "’" (car args))
1182 (cdr args))))
1183 (advice-add #'ispell-parse-output :filter-args
1184 #'endless/replace-quote))
1185 #+end_src
1186
1187 * Programming modes
1188 :PROPERTIES:
1189 :CUSTOM_ID: programming-modes
1190 :END:
1191
1192 ** [[http://alloytools.org][Alloy]] (with [[https://github.com/dwwmmn/alloy-mode][alloy-mode]])
1193
1194 #+begin_src emacs-lisp
1195 (use-package alloy-mode
1196 :defer t
1197 :config (setq alloy-basic-offset 2))
1198 #+end_src
1199
1200 ** [[https://coq.inria.fr][Coq]] (with [[https://github.com/ProofGeneral/PG][Proof General]])
1201
1202 #+begin_src emacs-lisp
1203 (use-package proof-site ; Proof General
1204 :defer t
1205 :load-path "lib/proof-site/generic/")
1206 #+end_src
1207
1208 ** [[https://leanprover.github.io][Lean]] (with [[https://github.com/leanprover/lean-mode][lean-mode]])
1209
1210 #+begin_src emacs-lisp
1211 (eval-when-compile (defvar lean-mode-map))
1212 (use-package lean-mode
1213 :defer 1
1214 :bind (:map lean-mode-map
1215 ("S-SPC" . company-complete))
1216 :config
1217 (require 'lean-input)
1218 (setq default-input-method "Lean"
1219 lean-input-tweak-all '(lean-input-compose
1220 (lean-input-prepend "/")
1221 (lean-input-nonempty))
1222 lean-input-user-translations '(("/" "/")))
1223 (lean-input-setup))
1224 #+end_src
1225
1226 ** Haskell
1227
1228 *** [[https://github.com/haskell/haskell-mode][haskell-mode]]
1229
1230 #+begin_src emacs-lisp
1231 (use-package haskell-mode
1232 :defer t
1233 :config
1234 (setq haskell-indentation-layout-offset 4
1235 haskell-indentation-left-offset 4
1236 flycheck-checker 'haskell-hlint
1237 flycheck-disabled-checkers '(haskell-stack-ghc haskell-ghc)))
1238 #+end_src
1239
1240 *** [[https://github.com/jyp/dante][dante]]
1241
1242 #+begin_src emacs-lisp
1243 (use-package dante
1244 :after haskell-mode
1245 :commands dante-mode
1246 :hook (haskell-mode . dante-mode))
1247 #+end_src
1248
1249 *** [[https://github.com/mpickering/hlint-refactor-mode][hlint-refactor]]
1250
1251 Emacs bindings for [[https://github.com/ndmitchell/hlint][hlint]]'s refactor option. This requires the refact
1252 executable from [[https://github.com/mpickering/apply-refact][apply-refact]].
1253
1254 #+begin_src emacs-lisp
1255 (use-package hlint-refactor
1256 :after haskell-mode
1257 :bind (:map hlint-refactor-mode-map
1258 ("C-c l b" . hlint-refactor-refactor-buffer)
1259 ("C-c l r" . hlint-refactor-refactor-at-point))
1260 :hook (haskell-mode . hlint-refactor-mode))
1261 #+end_src
1262
1263 *** [[https://github.com/flycheck/flycheck-haskell][flycheck-haskell]]
1264
1265 #+begin_src emacs-lisp
1266 (use-package flycheck-haskell
1267 :after haskell-mode)
1268 #+end_src
1269
1270 *** [[https://github.com/ndmitchell/hlint/blob/20e116a043f2073c57b17b24ae6364b5e433ba7e/data/hs-lint.el][hs-lint.el]]
1271 :PROPERTIES:
1272 :header-args+: :tangle lisp/hs-lint.el :mkdirp yes
1273 :END:
1274
1275 Currently using =flycheck-haskell= with the =haskell-hlint= checker
1276 instead.
1277
1278 #+begin_src emacs-lisp :tangle no
1279 ;;; hs-lint.el --- minor mode for HLint code checking
1280
1281 ;; Copyright 2009 (C) Alex Ott
1282 ;;
1283 ;; Author: Alex Ott <alexott@gmail.com>
1284 ;; Keywords: haskell, lint, HLint
1285 ;; Requirements:
1286 ;; Status: distributed under terms of GPL2 or above
1287
1288 ;; Typical message from HLint looks like:
1289 ;;
1290 ;; /Users/ott/projects/lang-exp/haskell/test.hs:52:1: Eta reduce
1291 ;; Found:
1292 ;; count1 p l = length (filter p l)
1293 ;; Why not:
1294 ;; count1 p = length . filter p
1295
1296
1297 (require 'compile)
1298
1299 (defgroup hs-lint nil
1300 "Run HLint as inferior of Emacs, parse error messages."
1301 :group 'tools
1302 :group 'haskell)
1303
1304 (defcustom hs-lint-command "hlint"
1305 "The default hs-lint command for \\[hlint]."
1306 :type 'string
1307 :group 'hs-lint)
1308
1309 (defcustom hs-lint-save-files t
1310 "Save modified files when run HLint or no (ask user)"
1311 :type 'boolean
1312 :group 'hs-lint)
1313
1314 (defcustom hs-lint-replace-with-suggestions nil
1315 "Replace user's code with suggested replacements"
1316 :type 'boolean
1317 :group 'hs-lint)
1318
1319 (defcustom hs-lint-replace-without-ask nil
1320 "Replace user's code with suggested replacements automatically"
1321 :type 'boolean
1322 :group 'hs-lint)
1323
1324 (defun hs-lint-process-setup ()
1325 "Setup compilation variables and buffer for `hlint'."
1326 (run-hooks 'hs-lint-setup-hook))
1327
1328 ;; regex for replace suggestions
1329 ;;
1330 ;; ^\(.*?\):\([0-9]+\):\([0-9]+\): .*
1331 ;; Found:
1332 ;; \s +\(.*\)
1333 ;; Why not:
1334 ;; \s +\(.*\)
1335
1336 (defvar hs-lint-regex
1337 "^\\(.*?\\):\\([0-9]+\\):\\([0-9]+\\): .*[\n\C-m]Found:[\n\C-m]\\s +\\(.*\\)[\n\C-m]Why not:[\n\C-m]\\s +\\(.*\\)[\n\C-m]"
1338 "Regex for HLint messages")
1339
1340 (defun make-short-string (str maxlen)
1341 (if (< (length str) maxlen)
1342 str
1343 (concat (substring str 0 (- maxlen 3)) "...")))
1344
1345 (defun hs-lint-replace-suggestions ()
1346 "Perform actual replacement of suggestions"
1347 (goto-char (point-min))
1348 (while (re-search-forward hs-lint-regex nil t)
1349 (let* ((fname (match-string 1))
1350 (fline (string-to-number (match-string 2)))
1351 (old-code (match-string 4))
1352 (new-code (match-string 5))
1353 (msg (concat "Replace '" (make-short-string old-code 30)
1354 "' with '" (make-short-string new-code 30) "'"))
1355 (bline 0)
1356 (eline 0)
1357 (spos 0)
1358 (new-old-code ""))
1359 (save-excursion
1360 (switch-to-buffer (get-file-buffer fname))
1361 (goto-char (point-min))
1362 (forward-line (1- fline))
1363 (beginning-of-line)
1364 (setf bline (point))
1365 (when (or hs-lint-replace-without-ask
1366 (yes-or-no-p msg))
1367 (end-of-line)
1368 (setf eline (point))
1369 (beginning-of-line)
1370 (setf old-code (regexp-quote old-code))
1371 (while (string-match "\\\\ " old-code spos)
1372 (setf new-old-code (concat new-old-code
1373 (substring old-code spos (match-beginning 0))
1374 "\\ *"))
1375 (setf spos (match-end 0)))
1376 (setf new-old-code (concat new-old-code (substring old-code spos)))
1377 (remove-text-properties bline eline '(composition nil))
1378 (when (re-search-forward new-old-code eline t)
1379 (replace-match new-code nil t)))))))
1380
1381 (defun hs-lint-finish-hook (buf msg)
1382 "Function, that is executed at the end of HLint execution"
1383 (if hs-lint-replace-with-suggestions
1384 (hs-lint-replace-suggestions)
1385 (next-error 1 t)))
1386
1387 (define-compilation-mode hs-lint-mode "HLint"
1388 "Mode for check Haskell source code."
1389 (set (make-local-variable 'compilation-process-setup-function)
1390 'hs-lint-process-setup)
1391 (set (make-local-variable 'compilation-disable-input) t)
1392 (set (make-local-variable 'compilation-scroll-output) nil)
1393 (set (make-local-variable 'compilation-finish-functions)
1394 (list 'hs-lint-finish-hook))
1395 )
1396
1397 (defun hs-lint ()
1398 "Run HLint for current buffer with haskell source"
1399 (interactive)
1400 (save-some-buffers hs-lint-save-files)
1401 (compilation-start (concat hs-lint-command " \"" buffer-file-name "\"")
1402 'hs-lint-mode))
1403
1404 (provide 'hs-lint)
1405 ;;; hs-lint.el ends here
1406 #+end_src
1407
1408 #+begin_src emacs-lisp :tangle no
1409 (use-package hs-lint
1410 :load-path "lisp/"
1411 :bind (:map haskell-mode-map
1412 ("C-c l l" . hs-lint)))
1413 #+end_src
1414
1415 ** Web dev
1416
1417 *** SGML and HTML
1418
1419 #+begin_src emacs-lisp
1420 (use-package sgml-mode
1421 :defer t
1422 :config
1423 (setq sgml-basic-offset 2))
1424 #+end_src
1425
1426 *** CSS and SCSS
1427
1428 #+begin_src emacs-lisp
1429 (use-package css-mode
1430 :defer t
1431 :config
1432 (setq css-indent-offset 2))
1433 #+end_src
1434
1435 *** Web mode
1436
1437 #+begin_src emacs-lisp
1438 (use-package web-mode
1439 :defer t
1440 :mode "\\.html\\'"
1441 :config
1442 (a/setq-every 2
1443 web-mode-code-indent-offset
1444 web-mode-css-indent-offset
1445 web-mode-markup-indent-offset))
1446 #+end_src
1447
1448 *** Emmet mode
1449
1450 #+begin_src emacs-lisp
1451 (use-package emmet-mode
1452 :after (:any web-mode css-mode sgml-mode)
1453 :bind* (("C-)" . emmet-next-edit-point)
1454 ("C-(" . emmet-prev-edit-point))
1455 :config
1456 (unbind-key "C-j" emmet-mode-keymap)
1457 (setq emmet-move-cursor-between-quotes t)
1458 :hook (web-mode css-mode html-mode sgml-mode))
1459 #+end_src
1460
1461 ** COMMENT Java
1462
1463 *** meghanada
1464
1465 #+begin_src emacs-lisp
1466 (use-package meghanada
1467 :bind
1468 (:map meghanada-mode-map
1469 (("C-M-o" . meghanada-optimize-import)
1470 ("C-M-t" . meghanada-import-all)))
1471 :hook (java-mode . meghanada-mode))
1472 #+end_src
1473
1474 *** lsp-java
1475
1476 #+begin_comment
1477 dependencies:
1478
1479 ace-window
1480 avy
1481 bui
1482 company-lsp
1483 dap-mode
1484 lsp-java
1485 lsp-mode
1486 lsp-ui
1487 pfuture
1488 tree-mode
1489 treemacs
1490 #+end_comment
1491
1492 #+begin_src emacs-lisp
1493 (use-package treemacs
1494 :config (setq treemacs-never-persist t))
1495
1496 (use-package yasnippet
1497 :config
1498 ;; (yas-global-mode)
1499 )
1500
1501 (use-package lsp-mode
1502 :init (setq lsp-eldoc-render-all nil
1503 lsp-highlight-symbol-at-point nil)
1504 )
1505
1506 (use-package hydra)
1507
1508 (use-package company-lsp
1509 :after company
1510 :config
1511 (setq company-lsp-cache-candidates t
1512 company-lsp-async t))
1513
1514 (use-package lsp-ui
1515 :config
1516 (setq lsp-ui-sideline-update-mode 'point))
1517
1518 (use-package lsp-java
1519 :config
1520 (add-hook 'java-mode-hook
1521 (lambda ()
1522 (setq-local company-backends (list 'company-lsp))))
1523
1524 (add-hook 'java-mode-hook 'lsp-java-enable)
1525 (add-hook 'java-mode-hook 'flycheck-mode)
1526 (add-hook 'java-mode-hook 'company-mode)
1527 (add-hook 'java-mode-hook 'lsp-ui-mode))
1528
1529 (use-package dap-mode
1530 :after lsp-mode
1531 :config
1532 (dap-mode t)
1533 (dap-ui-mode t))
1534
1535 (use-package dap-java
1536 :after (lsp-java))
1537
1538 (use-package lsp-java-treemacs
1539 :after (treemacs))
1540 #+end_src
1541
1542 ** geiser
1543
1544 #+begin_src emacs-lisp
1545 (use-package geiser)
1546
1547 (use-package geiser-guile
1548 :config
1549 (setq geiser-guile-load-path "~/src/git/guix"))
1550 #+end_src
1551
1552 ** guix
1553
1554 #+begin_src emacs-lisp
1555 (use-package guix
1556 :load-path "lib/guix/elisp")
1557 #+end_src
1558
1559 * Emacs enhancements
1560 :PROPERTIES:
1561 :CUSTOM_ID: emacs-enhancements
1562 :END:
1563
1564 ** [[https://github.com/justbur/emacs-which-key][which-key]]
1565
1566 #+begin_quote
1567 Emacs package that displays available keybindings in popup
1568 #+end_quote
1569
1570 #+begin_src emacs-lisp
1571 (use-package which-key
1572 :defer 1
1573 :config (which-key-mode))
1574 #+end_src
1575
1576 ** theme
1577
1578 #+begin_src emacs-lisp
1579 (add-to-list 'custom-theme-load-path "~/.emacs.d/lisp")
1580 (load-theme 'tangomod t)
1581 #+end_src
1582
1583 ** smart-mode-line
1584
1585 #+begin_src emacs-lisp
1586 (use-package smart-mode-line
1587 :config
1588 (sml/setup))
1589 #+end_src
1590
1591 ** doom-themes
1592
1593 #+begin_src emacs-lisp
1594 (use-package doom-themes)
1595 #+end_src
1596
1597 ** theme helper functions
1598
1599 #+begin_src emacs-lisp
1600 (defun a/lights-on ()
1601 "Enable my favourite light theme."
1602 (interactive)
1603 (mapc #'disable-theme custom-enabled-themes)
1604 (load-theme 'tangomod t)
1605 (sml/apply-theme 'automatic))
1606
1607 (defun a/lights-off ()
1608 "Go dark."
1609 (interactive)
1610 (mapc #'disable-theme custom-enabled-themes)
1611 (load-theme 'doom-tomorrow-night t)
1612 (sml/apply-theme 'automatic))
1613
1614 (bind-keys
1615 ("s-t d" . a/lights-off)
1616 ("s-t l" . a/lights-on))
1617 #+end_src
1618
1619 ** [[https://github.com/bbatsov/crux][crux]]
1620
1621 #+begin_src emacs-lisp
1622 (use-package crux
1623 :defer 1
1624 :bind (("C-c b k" . crux-kill-other-buffers)
1625 ("C-c d" . crux-duplicate-current-line-or-region)
1626 ("C-c D" . crux-duplicate-and-comment-current-line-or-region)
1627 ("C-c f c" . crux-copy-file-preserve-attributes)
1628 ("C-c f d" . crux-delete-file-and-buffer)
1629 ("C-c f r" . crux-rename-file-and-buffer)
1630 ("C-c j" . crux-top-join-line)
1631 ("C-S-j" . crux-top-join-line)))
1632 #+end_src
1633
1634 ** [[https://github.com/alezost/mwim.el][mwim]]
1635
1636 #+begin_src emacs-lisp
1637 (use-package mwim
1638 :bind (("C-a" . mwim-beginning-of-code-or-line)
1639 ("C-e" . mwim-end-of-code-or-line)
1640 ("<home>" . mwim-beginning-of-line-or-code)
1641 ("<end>" . mwim-end-of-line-or-code)))
1642 #+end_src
1643
1644 ** projectile
1645
1646 #+begin_src emacs-lisp
1647 (use-package projectile
1648 :defer t
1649 :bind-keymap ("C-c p" . projectile-command-map)
1650 :config
1651 (projectile-mode)
1652
1653 (defun my-projectile-invalidate-cache (&rest _args)
1654 ;; ignore the args to `magit-checkout'
1655 (projectile-invalidate-cache nil))
1656
1657 (eval-after-load 'magit-branch
1658 '(progn
1659 (advice-add 'magit-checkout
1660 :after #'my-projectile-invalidate-cache)
1661 (advice-add 'magit-branch-and-checkout
1662 :after #'my-projectile-invalidate-cache)))
1663 :custom (projectile-completion-system 'ivy))
1664 #+end_src
1665
1666 ** [[https://github.com/Wilfred/helpful][helpful]]
1667
1668 #+begin_src emacs-lisp
1669 (use-package helpful
1670 :defer 1
1671 :bind
1672 (("C-S-h c" . helpful-command)
1673 ("C-S-h f" . helpful-callable) ; helpful-function
1674 ("C-S-h v" . helpful-variable)
1675 ("C-S-h k" . helpful-key)
1676 ("C-S-h p" . helpful-at-point)))
1677 #+end_src
1678
1679 ** [[https://github.com/EricCrosson/unkillable-scratch][unkillable-scratch]]
1680
1681 Make =*scratch*= and =*Messages*= unkillable.
1682
1683 #+begin_src emacs-lisp
1684 (use-package unkillable-scratch
1685 :defer 3
1686 :config
1687 (unkillable-scratch 1)
1688 :custom
1689 (unkillable-scratch-behavior 'do-nothing)
1690 (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")))
1691 #+end_src
1692
1693 ** [[https://github.com/davep/boxquote.el][boxquote.el]]
1694
1695 #+begin_example
1696 ,----
1697 | make pretty boxed quotes like this
1698 `----
1699 #+end_example
1700
1701 #+begin_src emacs-lisp
1702 (use-package boxquote
1703 :defer 3
1704 :bind
1705 (:prefix-map a/boxquote-prefix-map
1706 :prefix "C-c q"
1707 ("b" . boxquote-buffer)
1708 ("B" . boxquote-insert-buffer)
1709 ("d" . boxquote-defun)
1710 ("F" . boxquote-insert-file)
1711 ("hf" . boxquote-describe-function)
1712 ("hk" . boxquote-describe-key)
1713 ("hv" . boxquote-describe-variable)
1714 ("hw" . boxquote-where-is)
1715 ("k" . boxquote-kill)
1716 ("p" . boxquote-paragraph)
1717 ("q" . boxquote-boxquote)
1718 ("r" . boxquote-region)
1719 ("s" . boxquote-shell-command)
1720 ("t" . boxquote-text)
1721 ("T" . boxquote-title)
1722 ("u" . boxquote-unbox)
1723 ("U" . boxquote-unbox-region)
1724 ("y" . boxquote-yank)
1725 ("M-q" . boxquote-fill-paragraph)
1726 ("M-w" . boxquote-kill-ring-save)))
1727 #+end_src
1728
1729 Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]].
1730
1731 ** typo.el
1732
1733 #+begin_src emacs-lisp
1734 (use-package typo
1735 :defer 2
1736 :config
1737 (typo-global-mode 1)
1738 :hook (text-mode . typo-mode))
1739 #+end_src
1740
1741 ** hl-todo
1742
1743 #+begin_src emacs-lisp
1744 (use-package hl-todo
1745 :defer 4
1746 :config
1747 (global-hl-todo-mode))
1748 #+end_src
1749
1750 ** shrink-path
1751
1752 #+begin_src emacs-lisp
1753 (use-package shrink-path
1754 :after eshell
1755 :config
1756 (setq eshell-prompt-regexp "\\(.*\n\\)*λ "
1757 eshell-prompt-function #'+eshell/prompt)
1758
1759 (defun +eshell/prompt ()
1760 (let ((base/dir (shrink-path-prompt default-directory)))
1761 (concat (propertize (car base/dir)
1762 'face 'font-lock-comment-face)
1763 (propertize (cdr base/dir)
1764 'face 'font-lock-constant-face)
1765 (propertize (+eshell--current-git-branch)
1766 'face 'font-lock-function-name-face)
1767 "\n"
1768 (propertize "λ" 'face 'eshell-prompt-face)
1769 ;; needed for the input text to not have prompt face
1770 (propertize " " 'face 'default))))
1771
1772 (defun +eshell--current-git-branch ()
1773 (let ((branch (car (loop for match in (split-string (shell-command-to-string "git branch") "\n")
1774 when (string-match "^\*" match)
1775 collect match))))
1776 (if (not (eq branch nil))
1777 (concat " " (substring branch 2))
1778 ""))))
1779 #+end_src
1780
1781 ** [[https://github.com/peterwvj/eshell-up][eshell-up]]
1782
1783 #+begin_src emacs-lisp
1784 (use-package eshell-up
1785 :after eshell)
1786 #+end_src
1787
1788 ** multi-term
1789
1790 #+begin_src emacs-lisp
1791 (use-package multi-term
1792 :defer 1
1793 :bind (("C-c a s m m" . multi-term)
1794 ("C-c a s m p" . multi-term-dedicated-toggle)
1795 :map term-mode-map
1796 ("C-c C-j" . term-char-mode)
1797 :map term-raw-map
1798 ("C-c C-j" . term-line-mode))
1799 :config
1800 (setq multi-term-program "/bin/screen"
1801 ;; TODO: add separate bindings for connecting to existing
1802 ;; session vs. always creating a new one
1803 multi-term-dedicated-select-after-open-p t
1804 multi-term-dedicated-window-height 20
1805 multi-term-dedicated-max-window-height 30
1806 term-bind-key-alist
1807 '(("C-c C-c" . term-interrupt-subjob)
1808 ("C-c C-e" . term-send-esc)
1809 ("C-k" . kill-line)
1810 ("C-y" . term-paste)
1811 ("M-f" . term-send-forward-word)
1812 ("M-b" . term-send-backward-word)
1813 ("M-p" . term-send-up)
1814 ("M-n" . term-send-down)
1815 ("<C-backspace>" . term-send-backward-kill-word)
1816 ("<M-DEL>" . term-send-backward-kill-word)
1817 ("M-d" . term-send-delete-word)
1818 ("M-," . term-send-raw)
1819 ("M-." . comint-dynamic-complete))
1820 term-unbind-key-alist
1821 '("C-z" "C-x" "C-c" "C-h" "C-y" "<ESC>")))
1822 #+end_src
1823
1824 ** page-break-lines
1825
1826 #+begin_src emacs-lisp
1827 (use-package page-break-lines
1828 :config
1829 (global-page-break-lines-mode))
1830 #+end_src
1831
1832 ** expand-region
1833
1834 #+begin_src emacs-lisp
1835 (use-package expand-region
1836 :bind ("C-=" . er/expand-region))
1837 #+end_src
1838
1839 * Email
1840 :PROPERTIES:
1841 :CUSTOM_ID: email
1842 :END:
1843
1844 #+begin_src emacs-lisp
1845 (defvar a/maildir (expand-file-name "~/mail/"))
1846 (with-eval-after-load 'recentf
1847 (add-to-list 'recentf-exclude a/maildir))
1848 #+end_src
1849
1850 ** Gnus
1851
1852 #+begin_src emacs-lisp
1853 (setq
1854 a/gnus-init-file (no-littering-expand-etc-file-name "gnus")
1855 mail-user-agent 'gnus-user-agent
1856 read-mail-command 'gnus)
1857
1858 (use-package gnus
1859 :bind (("C-c m" . gnus)
1860 ("C-c M" . gnus-unplugged)
1861 ("s-m" . gnus)
1862 ("s-M" . gnus-unplugged))
1863 :init
1864 (setq
1865 gnus-select-method '(nnnil "")
1866 gnus-secondary-select-methods
1867 '((nnimap "amin"
1868 (nnimap-stream plain)
1869 (nnimap-address "127.0.0.1")
1870 (nnimap-server-port 143)
1871 (nnimap-authenticator plain)
1872 (nnimap-user "amin@aminb.org"))
1873 (nnimap "uwaterloo"
1874 (nnimap-stream plain)
1875 (nnimap-address "127.0.0.1")
1876 (nnimap-server-port 143)
1877 (nnimap-authenticator plain)
1878 (nnimap-user "abandali@uwaterloo.ca")))
1879 gnus-message-archive-group "nnimap+amin:Sent"
1880 gnus-parameters
1881 '(("gnu.*"
1882 (gcc-self . t)))
1883 gnus-large-newsgroup 50
1884 gnus-home-directory (no-littering-expand-var-file-name "gnus/")
1885 gnus-directory (concat gnus-home-directory "news/")
1886 message-directory (concat gnus-home-directory "mail/")
1887 nndraft-directory (concat gnus-home-directory "drafts/")
1888 gnus-save-newsrc-file nil
1889 gnus-read-newsrc-file nil
1890 gnus-interactive-exit nil
1891 gnus-gcc-mark-as-read t))
1892
1893 (use-package gnus-art
1894 :config
1895 (setq
1896 gnus-visible-headers
1897 (concat gnus-visible-headers "\\|^List-Id:\\|^X-RT-Originator:\\|^User-Agent:")
1898 gnus-sorted-header-list
1899 '("^From:" "^Subject:" "^Summary:" "^Keywords:"
1900 "^Followup-To:" "^To:" "^Cc:" "X-RT-Originator"
1901 "^Newsgroups:" "List-Id:" "^Organization:"
1902 "^User-Agent:" "^Date:")
1903 ;; local-lapsed article dates
1904 ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
1905 gnus-article-date-headers '(user-defined)
1906 gnus-article-time-format
1907 (lambda (time)
1908 (let* ((date (format-time-string "%a, %d %b %Y %T %z" time))
1909 (local (article-make-date-line date 'local))
1910 (combined-lapsed (article-make-date-line date
1911 'combined-lapsed))
1912 (lapsed (progn
1913 (string-match " (.+" combined-lapsed)
1914 (match-string 0 combined-lapsed))))
1915 (concat local lapsed))))
1916 (bind-keys
1917 :map gnus-article-mode-map
1918 ("r" . gnus-article-reply-with-original)
1919 ("R" . gnus-article-wide-reply-with-original)
1920 ("M-L" . org-store-link)))
1921
1922 (use-package gnus-sum
1923 :bind (:map gnus-summary-mode-map
1924 :prefix-map a/gnus-summary-prefix-map
1925 :prefix "v"
1926 ("r" . gnus-summary-reply)
1927 ("w" . gnus-summary-wide-reply)
1928 ("v" . gnus-summary-show-raw-article))
1929 :config
1930 (bind-keys
1931 :map gnus-summary-mode-map
1932 ("r" . gnus-summary-reply-with-original)
1933 ("R" . gnus-summary-wide-reply-with-original)
1934 ("M-L" . org-store-link))
1935 :hook (gnus-summary-mode . a/no-mouse-autoselect-window))
1936
1937 (use-package gnus-msg
1938 :config
1939 (setq gnus-posting-styles
1940 '((".*"
1941 (address "amin@aminb.org")
1942 (body "\nBest,\namin\n")
1943 (eval (setq a/message-cite-say-hi t)))
1944 ("gnu.*"
1945 (address "bandali@gnu.org"))
1946 ((header "subject" "ThankCRM")
1947 (to "webmasters-comment@gnu.org")
1948 (body "\nAdded to 2018supporters.html.\n\nMoving to campaigns.\n\n-amin\n")
1949 (eval (setq a/message-cite-say-hi nil)))
1950 ("nnimap\\+uwaterloo:.*"
1951 (address "abandali@uwaterloo.ca")
1952 (gcc "\"nnimap+uwaterloo:Sent Items\"")))))
1953
1954 (use-package gnus-topic
1955 :hook (gnus-group-mode . gnus-topic-mode))
1956
1957 (use-package gnus-agent
1958 :config
1959 (setq gnus-agent-synchronize-flags 'ask)
1960 :hook (gnus-group-mode . gnus-agent-mode))
1961
1962 (use-package gnus-group
1963 :config
1964 (setq gnus-permanently-visible-groups "\\((INBOX\\|gnu$\\)"))
1965
1966 (use-package mm-decode
1967 :config
1968 (setq mm-discouraged-alternatives '("text/html" "text/richtext")))
1969 #+end_src
1970
1971 ** sendmail
1972
1973 #+begin_src emacs-lisp
1974 (use-package sendmail
1975 :config
1976 (setq sendmail-program "/usr/bin/msmtp"
1977 ;; message-sendmail-extra-arguments '("-v" "-d")
1978 mail-specify-envelope-from t
1979 mail-envelope-from 'header))
1980 #+end_src
1981
1982 ** message
1983
1984 #+begin_src emacs-lisp
1985 (use-package message
1986 :config
1987 (defconst a/message-cite-style-format "On %Y-%m-%d %l:%M %p, %N wrote:")
1988 (defconst message-cite-style-bandali
1989 '((message-cite-function 'message-cite-original)
1990 (message-citation-line-function 'message-insert-formatted-citation-line)
1991 (message-cite-reply-position 'traditional)
1992 (message-yank-prefix "> ")
1993 (message-yank-cited-prefix ">")
1994 (message-yank-empty-prefix ">")
1995 (message-citation-line-format
1996 (if a/message-cite-say-hi
1997 (concat "Hi %F,\n\n" a/message-cite-style-format)
1998 a/message-cite-style-format)))
1999 "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.")
2000 (setq message-cite-style 'message-cite-style-bandali
2001 message-kill-buffer-on-exit t
2002 message-send-mail-function 'message-send-mail-with-sendmail
2003 message-sendmail-envelope-from 'header
2004 message-dont-reply-to-names
2005 "\\(\\(.*@aminb\\.org\\)\\|\\(amin@bandali\\.me\\)\\|\\(\\(aminb?\\|mab\\|bandali\\)@gnu\\.org\\)\\|\\(\\(m\\|a\\(min\\.\\)?\\)bandali@uwaterloo\\.ca\\)\\)"
2006 message-user-fqdn "aminb.org")
2007 :hook (;; (message-setup . mml-secure-message-sign-pgpmime)
2008 (message-mode . flyspell-mode)
2009 (message-mode . (lambda ()
2010 ;; (setq fill-column 65
2011 ;; message-fill-column 65)
2012 (make-local-variable 'company-idle-delay)
2013 (setq company-idle-delay 0.2))))
2014 ;; :custom-face
2015 ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold))))
2016 ;; (message-header-to ((t (:foreground "#111" :weight normal))))
2017 ;; (message-header-cc ((t (:foreground "#333" :weight normal))))
2018 )
2019
2020 (with-eval-after-load 'mml-sec
2021 (setq mml-secure-openpgp-encrypt-to-self t
2022 mml-secure-openpgp-sign-with-sender t))
2023 #+end_src
2024
2025 ** footnote
2026
2027 Convenient footnotes in =message-mode=.
2028
2029 #+begin_src emacs-lisp
2030 (use-package footnote
2031 :after message
2032 :bind
2033 (:map message-mode-map
2034 :prefix-map a/footnote-prefix-map
2035 :prefix "C-c f"
2036 ("a" . footnote-add-footnote)
2037 ("b" . footnote-back-to-message)
2038 ("c" . footnote-cycle-style)
2039 ("d" . footnote-delete-footnote)
2040 ("g" . footnote-goto-footnote)
2041 ("r" . footnote-renumber-footnotes)
2042 ("s" . footnote-set-style))
2043 :config
2044 (setq footnote-start-tag ""
2045 footnote-end-tag ""
2046 footnote-style 'unicode))
2047 #+end_src
2048
2049 ** ebdb
2050
2051 #+begin_src emacs-lisp
2052 (use-package ebdb
2053 :defer 1
2054 :bind (:map gnus-group-mode-map ("e" . ebdb))
2055 :config
2056 (setq ebdb-sources (no-littering-expand-var-file-name "ebdb"))
2057 (with-eval-after-load 'swiper
2058 (add-to-list 'swiper-font-lock-exclude 'ebdb-mode t)))
2059
2060 (use-package ebdb-com
2061 :after ebdb)
2062
2063 ;; (use-package ebdb-complete
2064 ;; :after ebdb
2065 ;; :config
2066 ;; (ebdb-complete-enable))
2067
2068 (use-package company-ebdb
2069 :after (:all company message)
2070 :config
2071 (defun company-ebdb--post-complete (_) nil)
2072 :hook
2073 (message-mode . (lambda ()
2074 (add-to-list (make-local-variable 'company-backends)
2075 'company-ebdb))))
2076
2077 (use-package ebdb-gnus
2078 :after ebdb
2079 :custom
2080 (ebdb-gnus-window-configuration
2081 '(article
2082 (vertical 1.0
2083 (summary 0.25 point)
2084 (horizontal 1.0
2085 (article 1.0)
2086 (ebdb-gnus 0.3))))))
2087
2088 (use-package ebdb-mua
2089 :after ebdb
2090 ;; :custom (ebdb-mua-pop-up nil)
2091 )
2092
2093 ;; (use-package ebdb-message
2094 ;; :after ebdb)
2095
2096
2097 ;; (use-package ebdb-vcard
2098 ;; :after ebdb)
2099 #+end_src
2100
2101 ** COMMENT message-x
2102
2103 #+begin_src emacs-lisp
2104 (use-package message-x
2105 :custom
2106 (message-x-completion-alist
2107 (quote
2108 (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address)
2109 ((if
2110 (boundp
2111 (quote message-newgroups-header-regexp))
2112 message-newgroups-header-regexp message-newsgroups-header-regexp)
2113 . message-expand-group)))))
2114 #+end_src
2115
2116 ** COMMENT gnus-harvest
2117
2118 #+begin_src emacs-lisp
2119 (use-package gnus-harvest
2120 :commands gnus-harvest-install
2121 :demand t
2122 :config
2123 (if (featurep 'message-x)
2124 (gnus-harvest-install 'message-x)
2125 (gnus-harvest-install)))
2126 #+end_src
2127
2128 * Blogging
2129 :PROPERTIES:
2130 :CUSTOM_ID: blogging
2131 :END:
2132
2133 ** [[https://ox-hugo.scripter.co][ox-hugo]]
2134
2135 #+begin_src emacs-lisp
2136 (use-package ox-hugo
2137 :after ox)
2138
2139 (use-package ox-hugo-auto-export
2140 :load-path "lib/ox-hugo")
2141 #+end_src
2142
2143 * Post initialization
2144 :PROPERTIES:
2145 :CUSTOM_ID: post-initialization
2146 :END:
2147
2148 Display how long it took to load the init file.
2149
2150 #+begin_src emacs-lisp
2151 (message "Loading %s...done (%.3fs)" user-init-file
2152 (float-time (time-subtract (current-time)
2153 a/before-user-init-time)))
2154 #+end_src
2155
2156 * Footer
2157 :PROPERTIES:
2158 :CUSTOM_ID: footer
2159 :END:
2160
2161 #+begin_src emacs-lisp :comments none
2162 ;;; init.el ends here
2163 #+end_src
2164
2165 * COMMENT Local Variables :ARCHIVE:
2166 # Local Variables:
2167 # eval: (add-hook 'after-save-hook #'a/async-babel-tangle 'append 'local)
2168 # eval: (typo-mode -1)
2169 # End: