[emacs] remove evil; back to using vanilla emacs
[~bandali/configs] / init.org
CommitLineData
180cab37
AB
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
11This org file is my literate configuration for GNU Emacs, and is
3b98e899
AB
12tangled 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
14many different people. Some of the configurations that I can remember
15off 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]]
180cab37
AB
27
28I'd like to have a fully reproducible Emacs setup (part of the reason
29why I store my configuration in this repository) but unfortunately out
30of the box, that's not achievable with =package.el=, not currently
31anyway. So, I've opted to use Borg. For what it's worth, I briefly
32experimented with [[https://github.com/raxod502/straight.el][straight.el]], but found that it added about 2 seconds
33to my init time; which is unacceptable for me: I use Emacs as my
34window manager (via EXWM) and coming from bspwm, I'm too used to
35having fast startup times.
36
3b98e899
AB
37** Installation
38
4ae2cd62
AB
39To use this config for your Emacs, first you need to clone this repo,
40then bootstrap Borg, tell Borg to retrieve package submodules, and
41byte-compiled the packages. Something along these lines should work:
42
4b4e432d 43#+begin_src sh :tangle no
4ae2cd62
AB
44git clone https://github.com/aminb/dotfiles ~/.emacs.d
45cd ~/.emacs.d
46make bootstrap-borg
4ae2cd62
AB
47make bootstrap
48make build
49#+end_src
50
180cab37
AB
51* Contents :toc_1:noexport:
52
53- [[#about][About]]
54- [[#header][Header]]
55- [[#initial-setup][Initial setup]]
56- [[#core][Core]]
967b0a82 57- [[#post-initialization][Post initialization]]
180cab37
AB
58- [[#footer][Footer]]
59
60* Header
61:PROPERTIES:
62:CUSTOM_ID: header
63:END:
64
65** First line
66
67#+begin_src emacs-lisp :comments none
68;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t ; eval: (view-mode 1)-*-
69#+end_src
70
71Enable =view-mode=, which both makes the file read-only (as a reminder
72that =init.el= is an auto-generated file, not supposed to be edited),
73and provides some convenient key bindings for browsing through the
74file.
75
76** License
77
78#+begin_src emacs-lisp :comments none
79;; Copyright (C) 2018 Amin Bandali <amin@aminb.org>
80
81;; This program is free software: you can redistribute it and/or modify
82;; it under the terms of the GNU General Public License as published by
83;; the Free Software Foundation, either version 3 of the License, or
84;; (at your option) any later version.
85
86;; This program is distributed in the hope that it will be useful,
87;; but WITHOUT ANY WARRANTY; without even the implied warranty of
88;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
89;; GNU General Public License for more details.
90
91;; You should have received a copy of the GNU General Public License
92;; along with this program. If not, see <https://www.gnu.org/licenses/>.
93#+end_src
94
95** Commentary
96
97#+begin_src emacs-lisp :comments none
98;;; Commentary:
99
100;; Emacs configuration of Amin Bandali, computer scientist and functional
101;; programmer.
102
103;; THIS FILE IS AUTO-GENERATED FROM `init.org'.
104#+end_src
105
106** Naming conventions
107
850dd012 108The conventions below were inspired by [[https://github.com/hlissner/doom-emacs][Doom]]'s, found [[https://github.com/hlissner/doom-emacs/blob/5dacbb7cb1c6ac246a9ccd15e6c4290def67757c/core/core.el#L3-L17][here]].
180cab37
AB
109
110#+begin_src emacs-lisp :comments none
111;; Naming conventions:
112;;
850dd012
AB
113;; amin-... public variables or non-interactive functions
114;; amin--... private anything (non-interactive), not safe for direct use
115;; amin/... an interactive function; safe for M-x or keybinding
116;; amin:... an evil operator, motion, or command
117;; amin|... a hook function
118;; amin*... an advising function
119;; amin@... a hydra command
120;; ...! a macro
180cab37
AB
121#+end_src
122
123* Initial setup
124:PROPERTIES:
125:CUSTOM_ID: initial-setup
126:END:
127
128#+begin_src emacs-lisp :comments none
129;;; Code:
130#+end_src
131
132** Emacs initialization
133
134I'd like to do a couple of measurements of Emacs' startup time. First,
135let's see how long Emacs takes to start up, before even loading
136=init.el=, i.e. =user-init-file=:
137
138#+begin_src emacs-lisp
850dd012 139(defvar amin--before-user-init-time (current-time)
180cab37
AB
140 "Value of `current-time' when Emacs begins loading `user-init-file'.")
141(message "Loading Emacs...done (%.3fs)"
850dd012 142 (float-time (time-subtract amin--before-user-init-time
180cab37
AB
143 before-init-time)))
144#+end_src
145
146Also, temporarily increase ~gc-cons-threshhold~ and
147~gc-cons-percentage~ during startup to reduce garbage collection
148frequency. Clearing the ~file-name-handler-alist~ seems to help reduce
149startup time as well.
150
151#+begin_src emacs-lisp
850dd012
AB
152(defvar amin--gc-cons-threshold gc-cons-threshold)
153(defvar amin--gc-cons-percentage gc-cons-percentage)
154(defvar amin--file-name-handler-alist file-name-handler-alist)
180cab37
AB
155(setq gc-cons-threshold (* 400 1024 1024) ; 400 MiB
156 gc-cons-percentage 0.6
157 file-name-handler-alist nil
158 ;; sidesteps a bug when profiling with esup
159 esup-child-profile-require-level 0)
160#+end_src
161
162Of course, we'd like to set them back to their defaults once we're
163done initializing.
164
165#+begin_src emacs-lisp
166(add-hook
167 'after-init-hook
168 (lambda ()
850dd012
AB
169 (setq gc-cons-threshold amin--gc-cons-threshold
170 gc-cons-percentage amin--gc-cons-percentage
171 file-name-handler-alist amin--file-name-handler-alist)))
180cab37
AB
172#+end_src
173
174Increase the number of lines kept in message logs (the =*Messages*=
175buffer).
176
177#+begin_src emacs-lisp
178(setq message-log-max 20000)
179#+end_src
180
181Optionally, we could suppress some byte compiler warnings like below,
182but for now I've decided to keep them enabled. See documentation for
183~byte-compile-warnings~ for more details.
184
185#+begin_src emacs-lisp
186;; (setq byte-compile-warnings
187;; '(not free-vars unresolved noruntime lexical make-local))
188#+end_src
189
41a4f26a
AB
190** whoami
191
192#+begin_src emacs-lisp
193(setq user-full-name "Amin Bandali"
194 user-mail-address "amin@aminb.org")
195#+end_src
196
180cab37
AB
197** Package management
198
199*** No =package.el=
200
201I can do all my package management things with Borg, and don't need
202Emacs' built-in =package.el=. Emacs 27 lets us disable =package.el= in
203the =early-init-file= (see [[https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=24acb31c04b4048b85311d794e600ecd7ce60d3b][here]]).
204
205#+begin_src emacs-lisp :tangle early-init.el
206(setq package-enable-at-startup nil)
207#+end_src
208
209But since Emacs 27 isn't out yet (Emacs 26 is just around the corner
210right now), and even when released it'll be long before most distros
211ship in their repos, I'll still put the old workaround with the
212commented call to ~package-initialize~ here anyway.
213
214#+begin_src emacs-lisp
215(setq package-enable-at-startup nil)
216;; (package-initialize)
217#+end_src
218
219*** Borg
220
221#+begin_quote
222Assimilate Emacs packages as Git submodules
223#+end_quote
224
225[[https://github.com/emacscollective/borg][Borg]] is at the heart of package management of my Emacs setup. In
226short, it creates a git submodule in =lib/= for each package, which
227can then be managed with the help of Magit or other tools.
228
229#+begin_src emacs-lisp
230(setq user-init-file (or load-file-name buffer-file-name)
231 user-emacs-directory (file-name-directory user-init-file))
232(add-to-list 'load-path
233 (expand-file-name "lib/borg" user-emacs-directory))
234(require 'borg)
235(borg-initialize)
d14698a3
AB
236
237(with-eval-after-load 'bind-key
238 ; unbind M-m for use as a personal prefix
239 (unbind-key "M-m" global-map)
240 (bind-key "M-m M-m" 'back-to-indentation)
241 ; add some bindings for Borg
242 (bind-keys
243 :package borg
244 ("M-m B A" . borg-activate)
245 ("M-m B a" . borg-assimilate)
246 ("M-m B b" . borg-build)
247 ("M-m B c" . borg-clone)))
180cab37
AB
248#+end_src
249
250*** =use-package=
251
252#+begin_quote
253A use-package declaration for simplifying your .emacs
254#+end_quote
255
256[[https://github.com/jwiegley/use-package][use-package]] is an awesome utility for managing and configuring
257packages (in our case especially the latter) in a neatly organized way
258and without compromising on performance.
259
260#+begin_src emacs-lisp
261(require 'use-package)
eb186a5a 262(if nil ; set to t when need to debug init
180cab37
AB
263 (setq use-package-verbose t
264 use-package-expand-minimally nil
265 use-package-compute-statistics t
266 debug-on-error t)
267 (setq use-package-verbose nil
268 use-package-expand-minimally t))
269#+end_src
270
271*** Epkg
272
273#+begin_quote
274Browse the Emacsmirror package database
275#+end_quote
276
277Epkg provides access to a local copy of the [[https://emacsmirror.net][Emacsmirror]] package
278database, low-level functions for querying the database, and a
279=package.el=-like user interface for browsing the available packages.
280
281#+begin_src emacs-lisp
282(use-package epkg
d14698a3
AB
283 :defer t
284 :bind
285 (("M-m B d" . epkg-describe-package)
286 ("M-m B p" . epkg-list-packages)
287 ("M-m B r" . borg-remove)
288 ("M-m B u" . epkg-update)))
180cab37
AB
289#+end_src
290
291** No littering in =~/.emacs.d=
292
293#+begin_quote
294Help keeping ~/.emacs.d clean
295#+end_quote
296
297By default, even for Emacs' built-in packages, the configuration files
298and persistent data are all over the place. Use =no-littering= to help
299contain the mess.
300
301#+begin_src emacs-lisp
302(use-package no-littering
303 :demand t
304 :config
305 (savehist-mode 1)
306 (add-to-list 'savehist-additional-variables 'kill-ring)
307 (save-place-mode 1)
308 (setq auto-save-file-name-transforms
309 `((".*" ,(no-littering-expand-var-file-name "auto-save/") t))))
310#+end_src
311
180cab37
AB
312** Custom file (=custom.el=)
313
314I'm not planning on using the custom file much, but even so, I
315definitely don't want it mixing with =init.el=. So, here; let's give
316it it's own file. While at it, treat themes as safe.
317
318#+begin_src emacs-lisp
319(use-package custom
320 :no-require t
321 :config
322 (setq custom-file (no-littering-expand-etc-file-name "custom.el"))
323 (when (file-exists-p custom-file)
324 (load custom-file))
325 (setf custom-safe-themes t))
326#+end_src
327
328** Better =$PATH= handling
329
330Let's use [[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] to make Emacs use the =$PATH= as set up
331in my shell.
332
333#+begin_src emacs-lisp
7538956f
AB
334(use-package exec-path-from-shell
335 :defer 1
336 :init
337 (setq exec-path-from-shell-check-startup-files nil)
338 :config
339 (exec-path-from-shell-initialize)
340 ;; while we're at it, let's fix access to our running ssh-agent
341 (exec-path-from-shell-copy-env "SSH_AGENT_PID")
342 (exec-path-from-shell-copy-env "SSH_AUTH_SOCK"))
180cab37
AB
343#+end_src
344
ebec2c18
AB
345** Only one custom theme at a time
346
347#+begin_src emacs-lisp
348(defadvice load-theme (before clear-previous-themes activate)
349 "Clear existing theme settings instead of layering them"
350 (mapc #'disable-theme custom-enabled-themes))
351#+end_src
352
180cab37
AB
353** Server
354
355Start server if not already running. Alternatively, can be done by
356issuing =emacs --daemon= in the terminal, which can be automated with
357a systemd service or using =brew services start emacs= on macOS. I use
358Emacs as my window manager (via EXWM), so I always start Emacs on
359login; so starting the server from inside Emacs is good enough for me.
360
361See [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server][Using Emacs as a Server]].
362
363#+begin_src emacs-lisp
364(use-package server
365 :config (or (server-running-p) (server-mode)))
366#+end_src
367
e9bcfa30
AB
368** Unicode support
369
370Font stack with better unicode support, around =Ubuntu Mono= and
371=Hack=.
372
373#+begin_src emacs-lisp
374(dolist (ft (fontset-list))
375 (set-fontset-font
376 ft
377 'unicode
378 (font-spec :name "Ubuntu Mono"))
379 (set-fontset-font
380 ft
381 'unicode
16d70d6f 382 (font-spec :name "DejaVu Sans Mono")
e9bcfa30
AB
383 nil
384 'append)
16d70d6f
AB
385 ;; (set-fontset-font
386 ;; ft
387 ;; 'unicode
388 ;; (font-spec
389 ;; :name "Symbola monospacified for DejaVu Sans Mono")
390 ;; nil
391 ;; 'append)
392 ;; (set-fontset-font
393 ;; ft
394 ;; #x2115 ; â„•
395 ;; (font-spec :name "DejaVu Sans Mono")
396 ;; nil
397 ;; 'append)
e9bcfa30
AB
398 (set-fontset-font
399 ft
16d70d6f
AB
400 (cons ?Α ?ω)
401 (font-spec :name "DejaVu Sans Mono" :size 14)
e9bcfa30 402 nil
16d70d6f 403 'prepend))
e9bcfa30
AB
404#+end_src
405
51db62d8
AB
406** Libraries
407
408#+begin_src emacs-lisp
409(require 'cl-lib)
410(require 'subr-x)
411#+end_src
412
413** Useful utilities
414
415#+begin_src emacs-lisp
850dd012 416(defun amin-enlist (exp)
51db62d8
AB
417 "Return EXP wrapped in a list, or as-is if already a list."
418(if (listp exp) exp (list exp)))
419
420; from https://github.com/hlissner/doom-emacs/commit/589108fdb270f24a98ba6209f6955fe41530b3ef
421(defmacro after! (features &rest body)
422 "A smart wrapper around `with-eval-after-load'. Supresses warnings during
423compilation."
424 (declare (indent defun) (debug t))
425 (list (if (or (not (bound-and-true-p byte-compile-current-file))
850dd012 426 (dolist (next (amin-enlist features))
51db62d8
AB
427 (if (symbolp next)
428 (require next nil :no-error)
429 (load next :no-message :no-error))))
430 #'progn
431 #'with-no-warnings)
432 (cond ((symbolp features)
433 `(eval-after-load ',features '(progn ,@body)))
434 ((and (consp features)
435 (memq (car features) '(:or :any)))
436 `(progn
437 ,@(cl-loop for next in (cdr features)
438 collect `(after! ,next ,@body))))
439 ((and (consp features)
440 (memq (car features) '(:and :all)))
441 (dolist (next (cdr features))
442 (setq body `(after! ,next ,@body)))
443 body)
444 ((listp features)
eb186a5a 445 `(after! (:all ,@features) ,@body)))))
51db62d8
AB
446#+end_src
447
180cab37
AB
448* Core
449:PROPERTIES:
450:CUSTOM_ID: core
451:END:
452
453** Defaults
454
e602de37
AB
455*** Time and battery in mode-line
456
457Enable displaying time and battery in the mode-line, since I'm not
458using the Xfce panel anymore. Also, I don't need to see the load
459average on a regular basis, so disable that.
460
63073abd
AB
461Note: using =i3status= on sway at the moment, so disabling this.
462
463#+begin_src emacs-lisp :tangle no
e602de37 464(use-package time
e602de37
AB
465 :init
466 (setq display-time-default-load-average nil)
467 :config
468 (display-time-mode))
469
470(use-package battery
e602de37
AB
471 :config
472 (display-battery-mode))
473#+end_src
474
180cab37
AB
475*** Smaller fringe
476
2f8102f0
AB
477Might want to set the fringe to a smaller value, especially if using
478EXWM. I'm fine with the default for now.
180cab37
AB
479
480#+begin_src emacs-lisp
2f8102f0 481;; (fringe-mode '(3 . 1))
4b4e432d 482(fringe-mode nil)
180cab37
AB
483#+end_src
484
485*** Disable disabled commands
486
487Emacs disables some commands by default that could persumably be
488confusing for novice users. Let's disable that.
489
490#+begin_src emacs-lisp
491(setq disabled-command-function nil)
492#+end_src
493
494*** Kill-ring
495
496Save what I copy into clipboard from other applications into Emacs'
497kill-ring, which would allow me to still be able to easily access it
498in case I kill (cut or copy) something else inside Emacs before
499yanking (pasting) what I'd originally intended to.
500
501#+begin_src emacs-lisp
502(setq save-interprogram-paste-before-kill t)
503#+end_src
504
505*** Minibuffer
506
507#+begin_src emacs-lisp
508(setq enable-recursive-minibuffers t
509 resize-mini-windows t)
510#+end_src
511
512*** Lazy-person-friendly yes/no prompts
513
514Lazy people would prefer to type fewer keystrokes, especially for yes
515or no questions. I'm lazy.
516
517#+begin_src emacs-lisp
518(defalias 'yes-or-no-p #'y-or-n-p)
519#+end_src
520
521*** Startup screen and =*scratch*=
522
523Firstly, let Emacs know that I'd like to have =*scratch*= as my
524startup buffer.
525
526#+begin_src emacs-lisp
527(setq initial-buffer-choice t)
528#+end_src
529
530Now let's customize the =*scratch*= buffer a bit. First off, I don't
531need the default hint.
532
533#+begin_src emacs-lisp
534(setq initial-scratch-message nil)
535#+end_src
536
537Also, let's use Text mode as the major mode, in case I want to
538customize it (=*scratch*='s default major mode, Fundamental mode,
539can't really be customized).
540
541#+begin_src emacs-lisp
542(setq initial-major-mode 'text-mode)
543#+end_src
544
545Inhibit the buffer list when more than 2 files are loaded.
546
547#+begin_src emacs-lisp
548(setq inhibit-startup-buffer-menu t)
549#+end_src
550
551I don't really need to see the startup screen or echo area message
552either.
553
554#+begin_src emacs-lisp
555(advice-add #'display-startup-echo-area-message :override #'ignore)
556(setq inhibit-startup-screen t
557 inhibit-startup-echo-area-message user-login-name)
558#+end_src
559
560*** More useful frame titles
561
562Show either the file name or the buffer name (in case the buffer isn't
563visiting a file). Borrowed from Emacs Prelude.
564
565#+begin_src emacs-lisp
566(setq frame-title-format
567 '("" invocation-name " - "
568 (:eval (if (buffer-file-name)
569 (abbreviate-file-name (buffer-file-name))
570 "%b"))))
571#+end_src
572
573*** Backups
574
575Emacs' default backup settings aren't that great. Let's use more
576sensible options. See documentation for the ~make-backup-file~
577variable.
578
579#+begin_src emacs-lisp
580(setq backup-by-copying t
581 version-control t)
582#+end_src
583
89394449
AB
584*** Auto revert
585
586Enable automatic reloading of changed buffers and files.
587
588#+begin_src emacs-lisp
589(global-auto-revert-mode 1)
590(setq auto-revert-verbose nil
591 global-auto-revert-non-file-buffers t)
592#+end_src
593
594*** Always use space for indentation
595
596#+begin_src emacs-lisp
597(setq-default
598 indent-tabs-mode nil
599 require-final-newline t
600 tab-width 4)
601#+end_src
602
d14698a3
AB
603*** Winner mode
604
605Enable =winner-mode=.
606
607#+begin_src emacs-lisp
608(winner-mode 1)
609#+end_src
610
611** Bindings
612
613#+begin_src emacs-lisp :tangle no
614(bind-keys
615 ; buffers
616 ("M-m b b" . ibuffer-list-buffers)
617 ("M-m b k" . kill-this-buffer)
618 ("M-m b s" . save-buffer)
619
620 ; help
621 ("M-m h c" . describe-char)
622 ("M-m h f" . describe-function)
623 ("M-m h F" . describe-face)
624 ("M-m h i" . info)
625 ("M-m h k" . describe-key)
626 ("M-m h l" . view-lossage)
627 ("M-m h m" . describe-mode)
628 ("M-m h v" . describe-variable)
629
630 ("M-m o" . other-window)
631 ("M-m w o" . other-window)
632
633 ("M-m q q" . save-buffers-kill-terminal))
634#+end_src
635
180cab37
AB
636** Packages
637
638The packages in this section are absolutely essential to my everyday
639workflow, and they play key roles in how I do my computing. They
640immensely enhance the Emacs experience for me; both using Emacs, and
641customizing it.
642
643*** [[https://github.com/emacscollective/auto-compile][auto-compile]]
644
645#+begin_src emacs-lisp
646(use-package auto-compile
647 :demand t
648 :config
649 (auto-compile-on-load-mode)
650 (auto-compile-on-save-mode)
651 (setq auto-compile-display-buffer nil
eb186a5a
AB
652 auto-compile-mode-line-counter t
653 auto-compile-source-recreate-deletes-dest t
654 auto-compile-toggle-deletes-nonlib-dest t
655 auto-compile-update-autoloads t)
180cab37
AB
656 (add-hook 'auto-compile-inhibit-compile-hook
657 'auto-compile-inhibit-compile-detached-git-head))
658#+end_src
659
180cab37
AB
660*** [[https://orgmode.org/][Org mode]]
661
662#+begin_quote
663Org mode is for keeping notes, maintaining TODO lists, planning
664projects, and authoring documents with a fast and effective plain-text
665system.
666#+end_quote
667
668In short, my favourite way of life.
669
670#+begin_src emacs-lisp
51f3b22b 671(use-package org
51f3b22b
AB
672 :config
673 (setq org-src-tab-acts-natively t
674 org-src-preserve-indentation nil
c0f95448 675 org-edit-src-content-indentation 0)
51f3b22b 676 :hook (org-mode . org-indent-mode))
6578a877 677
f1dd8248
AB
678(use-package org-notmuch
679 :after (:any org notmuch))
180cab37
AB
680#+end_src
681
682*** [[https://magit.vc/][Magit]]
683
684#+begin_quote
685It's Magit! A Git porcelain inside Emacs.
686#+end_quote
687
688Not just how I do git, but /the/ way to do git.
689
690#+begin_src emacs-lisp
691(use-package magit
692 :defer t
d14698a3
AB
693 :bind
694 (("s-g" . magit-dispatch-popup)
695 ("C-x g" . magit-status)
696 :prefix-map amin--magit-prefix-map
697 :prefix "M-m g"
698 ("SPC" . magit-status)
699 ("s" . magit-status)
700 ("S" . magit-status-prefix)
701 ("B" . magit-blame)
702 ("C" . magit-clone)
703 ("f" . magit-fetch)
704 ("F" . magit-pull)
705 ("P" . magit-push)
706 ("c c" . magit-commit)
707 ("c a" . magit-commit-amend)
708 ("b b" . magit-checkout)
709 ("b c" . magit-branch))
180cab37
AB
710 :config
711 (magit-add-section-hook 'magit-status-sections-hook
712 'magit-insert-modules
713 'magit-insert-stashes
714 'append))
715#+end_src
716
717*** [[https://github.com/abo-abo/swiper][Ivy]] (and friends)
718
719#+begin_quote
720Ivy - a generic completion frontend for Emacs, Swiper - isearch with
721an overview, and more. Oh, man!
722#+end_quote
723
724There's no way I could top that, so I won't attempt to.
725
726**** Ivy
727
728#+begin_src emacs-lisp
f7752223 729(use-package ivy
3ea5e792 730 :defer 1
f7752223 731 :bind
d14698a3
AB
732 (("M-m ," . ivy-switch-buffer)
733 :map ivy-minibuffer-map
734 ([escape] . keyboard-escape-quit)
735 ([S-up] . ivy-previous-history-element)
736 ([S-down] . ivy-next-history-element)
737 ("DEL" . ivy-backward-delete-char))
f7752223 738 :config
f6d8e3e4 739 (setq ivy-wrap t)
f7752223 740 (ivy-mode 1))
180cab37
AB
741#+end_src
742
743**** Swiper
744
745#+begin_src emacs-lisp
f7752223
AB
746(use-package swiper
747 :bind (([remap isearch-forward] . swiper)
eb186a5a 748 ([remap isearch-backward] . swiper)))
180cab37
AB
749#+end_src
750
751**** Counsel
752
753#+begin_src emacs-lisp
f7752223 754(use-package counsel
3d35bdff 755 :defer 1
f7752223 756 :bind (([remap execute-extended-command] . counsel-M-x)
d14698a3
AB
757 ([remap find-file] . counsel-find-file)
758 ("s-r" . counsel-recentf)
759 ("M-m SPC" . counsel-M-x)
760 ("M-m ." . counsel-find-file)
761 ("M-m f r" . counsel-recentf)
f7752223 762 :map minibuffer-local-map
eb186a5a 763 ("C-r" . counsel-minibuffer-history))
f7752223
AB
764 :config
765 (counsel-mode 1)
766 (defalias 'locate #'counsel-locate))
180cab37
AB
767#+end_src
768
769* Borg's =layer/essentials=
770
771TODO: break this giant source block down into individual org sections.
772
773#+begin_src emacs-lisp
774(use-package dash
775 :config (dash-enable-font-lock))
776
777(use-package diff-hl
778 :config
779 (setq diff-hl-draw-borders nil)
780 (global-diff-hl-mode)
781 (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh t))
782
783(use-package dired
784 :defer t
785 :config (setq dired-listing-switches "-alh"))
786
787(use-package eldoc
788 :when (version< "25" emacs-version)
789 :config (global-eldoc-mode))
790
791(use-package help
792 :defer t
793 :config (temp-buffer-resize-mode))
794
795(progn ; `isearch'
796 (setq isearch-allow-scroll t))
797
798(use-package lisp-mode
799 :config
800 (add-hook 'emacs-lisp-mode-hook 'outline-minor-mode)
801 (add-hook 'emacs-lisp-mode-hook 'reveal-mode)
802 (defun indent-spaces-mode ()
803 (setq indent-tabs-mode nil))
804 (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode))
805
806(use-package man
807 :defer t
808 :config (setq Man-width 80))
809
810(use-package paren
811 :config (show-paren-mode))
812
813(use-package prog-mode
814 :config (global-prettify-symbols-mode)
815 (defun indicate-buffer-boundaries-left ()
816 (setq indicate-buffer-boundaries 'left))
817 (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left))
818
819(use-package recentf
820 :demand t
821 :config (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:"))
822
823(use-package savehist
824 :config (savehist-mode))
825
826(use-package saveplace
827 :when (version< "25" emacs-version)
828 :config (save-place-mode))
829
830(use-package simple
831 :config (column-number-mode))
832
833(progn ; `text-mode'
834 (add-hook 'text-mode-hook #'indicate-buffer-boundaries-left))
835
836(use-package tramp
837 :defer t
838 :config
839 (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
840 (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil))
841 (add-to-list 'tramp-default-proxies-alist
842 (list (regexp-quote (system-name)) nil nil)))
843
844(use-package undo-tree
bffae347 845 :bind (("C-?" . undo-tree-undo)
82ff3214 846 ("M-_" . undo-tree-redo))
180cab37
AB
847 :config
848 (global-undo-tree-mode)
bffae347
AB
849 (setq undo-tree-mode-lighter ""
850 undo-tree-auto-save-history t))
180cab37
AB
851#+end_src
852
54512e45
AB
853* Editing
854
855** Company
856
857#+begin_src emacs-lisp
858(use-package company
859 :defer 5
860 :bind
861 (:map company-active-map
eb186a5a 862 ([tab] . company-complete-common-or-cycle))
54512e45
AB
863 :custom
864 (company-idle-delay 0.3)
865 (company-minimum-prefix-length 1)
866 (company-selection-wrap-around t)
867 (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]")
868 :config
869 (global-company-mode t))
870#+end_src
871
284bbe78
AB
872* Syntax and spell checking
873#+begin_src emacs-lisp
874(use-package flycheck
875 :hook (prog-mode . flycheck-mode)
876 :config
877 ;; Use the load-path from running Emacs when checking elisp files
878 (setq flycheck-emacs-lisp-load-path 'inherit)
879
880 ;; Only flycheck when I actually save the buffer
881 (setq flycheck-check-syntax-automatically '(mode-enabled save)))
882#+end_src
3f0f8d01
AB
883* Programming modes
884
d43a8eda 885** [[http://alloytools.org][Alloy]] (with [[https://github.com/dwwmmn/alloy-mode][alloy-mode]])
221cdaa3
AB
886
887#+begin_src emacs-lisp
fad62af5
AB
888(use-package alloy-mode
889 :config (setq alloy-basic-offset 2))
221cdaa3
AB
890#+end_src
891
d43a8eda 892** [[https://coq.inria.fr][Coq]] (with [[https://github.com/ProofGeneral/PG][Proof General]])
695170a4
AB
893
894#+begin_src emacs-lisp
895(use-package proof-site ; Proof General
896 :load-path "lib/proof-site/generic/")
897#+end_src
898
d43a8eda 899** [[https://leanprover.github.io][Lean]] (with [[https://github.com/leanprover/lean-mode][lean-mode]])
3f0f8d01
AB
900
901#+begin_src emacs-lisp
e9bcfa30
AB
902(use-package lean-mode
903 :bind (:map lean-mode-map
eb186a5a 904 ("S-SPC" . company-complete)))
3f0f8d01
AB
905#+end_src
906
36fca309
AB
907** Haskell
908
909*** [[https://github.com/haskell/haskell-mode][haskell-mode]]
a81db923
AB
910
911#+begin_src emacs-lisp
912(use-package haskell-mode
913 :config
914 (setq haskell-indentation-layout-offset 4
915 haskell-indentation-left-offset 4
eb186a5a
AB
916 flycheck-checker 'haskell-hlint
917 flycheck-disabled-checkers '(haskell-stack-ghc haskell-ghc)))
a81db923 918#+end_src
36fca309 919
eba52b9c
AB
920*** [[https://github.com/jyp/dante][dante]]
921
922#+begin_src emacs-lisp
923(use-package dante
924 :after haskell-mode
925 :commands dante-mode
926 :hook (haskell-mode . dante-mode))
927#+end_src
928
36fca309
AB
929*** [[https://github.com/mpickering/hlint-refactor-mode][hlint-refactor]]
930
931Emacs bindings for [[https://github.com/ndmitchell/hlint][hlint]]'s refactor option. This requires the refact
932executable from [[https://github.com/mpickering/apply-refact][apply-refact]].
933
934#+begin_src emacs-lisp
935(use-package hlint-refactor
936 :bind (:map hlint-refactor-mode-map
eb186a5a
AB
937 ("C-c l b" . hlint-refactor-refactor-buffer)
938 ("C-c l r" . hlint-refactor-refactor-at-point))
36fca309
AB
939 :hook (haskell-mode . hlint-refactor-mode))
940#+end_src
941
f76bdaa8
AB
942*** [[https://github.com/flycheck/flycheck-haskell][flycheck-haskell]]
943
944#+begin_src emacs-lisp
945(use-package flycheck-haskell)
946#+end_src
947
948*** [[https://github.com/ndmitchell/hlint/blob/20e116a043f2073c57b17b24ae6364b5e433ba7e/data/hs-lint.el][hs-lint.el]]
949:PROPERTIES:
950:header-args+: :tangle lisp/hs-lint.el :mkdirp yes
951:END:
952
953Currently using =flycheck-haskell= with the =haskell-hlint= checker
954instead.
955
956#+begin_src emacs-lisp :tangle no
957;;; hs-lint.el --- minor mode for HLint code checking
958
959;; Copyright 2009 (C) Alex Ott
960;;
961;; Author: Alex Ott <alexott@gmail.com>
962;; Keywords: haskell, lint, HLint
963;; Requirements:
964;; Status: distributed under terms of GPL2 or above
965
966;; Typical message from HLint looks like:
967;;
968;; /Users/ott/projects/lang-exp/haskell/test.hs:52:1: Eta reduce
969;; Found:
970;; count1 p l = length (filter p l)
971;; Why not:
972;; count1 p = length . filter p
973
974
975(require 'compile)
976
977(defgroup hs-lint nil
978 "Run HLint as inferior of Emacs, parse error messages."
979 :group 'tools
980 :group 'haskell)
981
982(defcustom hs-lint-command "hlint"
983 "The default hs-lint command for \\[hlint]."
984 :type 'string
985 :group 'hs-lint)
986
987(defcustom hs-lint-save-files t
988 "Save modified files when run HLint or no (ask user)"
989 :type 'boolean
990 :group 'hs-lint)
991
992(defcustom hs-lint-replace-with-suggestions nil
993 "Replace user's code with suggested replacements"
994 :type 'boolean
995 :group 'hs-lint)
996
997(defcustom hs-lint-replace-without-ask nil
998 "Replace user's code with suggested replacements automatically"
999 :type 'boolean
1000 :group 'hs-lint)
1001
1002(defun hs-lint-process-setup ()
1003 "Setup compilation variables and buffer for `hlint'."
1004 (run-hooks 'hs-lint-setup-hook))
1005
1006;; regex for replace suggestions
1007;;
1008;; ^\(.*?\):\([0-9]+\):\([0-9]+\): .*
1009;; Found:
1010;; \s +\(.*\)
1011;; Why not:
1012;; \s +\(.*\)
1013
1014(defvar hs-lint-regex
1015 "^\\(.*?\\):\\([0-9]+\\):\\([0-9]+\\): .*[\n\C-m]Found:[\n\C-m]\\s +\\(.*\\)[\n\C-m]Why not:[\n\C-m]\\s +\\(.*\\)[\n\C-m]"
1016 "Regex for HLint messages")
1017
1018(defun make-short-string (str maxlen)
1019 (if (< (length str) maxlen)
1020 str
1021 (concat (substring str 0 (- maxlen 3)) "...")))
1022
1023(defun hs-lint-replace-suggestions ()
1024 "Perform actual replacement of suggestions"
1025 (goto-char (point-min))
1026 (while (re-search-forward hs-lint-regex nil t)
1027 (let* ((fname (match-string 1))
1028 (fline (string-to-number (match-string 2)))
1029 (old-code (match-string 4))
1030 (new-code (match-string 5))
1031 (msg (concat "Replace '" (make-short-string old-code 30)
1032 "' with '" (make-short-string new-code 30) "'"))
1033 (bline 0)
1034 (eline 0)
1035 (spos 0)
1036 (new-old-code ""))
1037 (save-excursion
1038 (switch-to-buffer (get-file-buffer fname))
eb186a5a
AB
1039 (goto-char (point-min))
1040 (forward-line (1- fline))
f76bdaa8
AB
1041 (beginning-of-line)
1042 (setf bline (point))
1043 (when (or hs-lint-replace-without-ask
1044 (yes-or-no-p msg))
1045 (end-of-line)
1046 (setf eline (point))
1047 (beginning-of-line)
1048 (setf old-code (regexp-quote old-code))
1049 (while (string-match "\\\\ " old-code spos)
1050 (setf new-old-code (concat new-old-code
1051 (substring old-code spos (match-beginning 0))
1052 "\\ *"))
1053 (setf spos (match-end 0)))
1054 (setf new-old-code (concat new-old-code (substring old-code spos)))
1055 (remove-text-properties bline eline '(composition nil))
1056 (when (re-search-forward new-old-code eline t)
1057 (replace-match new-code nil t)))))))
1058
1059(defun hs-lint-finish-hook (buf msg)
1060 "Function, that is executed at the end of HLint execution"
1061 (if hs-lint-replace-with-suggestions
1062 (hs-lint-replace-suggestions)
1063 (next-error 1 t)))
1064
1065(define-compilation-mode hs-lint-mode "HLint"
1066 "Mode for check Haskell source code."
1067 (set (make-local-variable 'compilation-process-setup-function)
1068 'hs-lint-process-setup)
1069 (set (make-local-variable 'compilation-disable-input) t)
1070 (set (make-local-variable 'compilation-scroll-output) nil)
1071 (set (make-local-variable 'compilation-finish-functions)
1072 (list 'hs-lint-finish-hook))
1073 )
1074
1075(defun hs-lint ()
1076 "Run HLint for current buffer with haskell source"
1077 (interactive)
1078 (save-some-buffers hs-lint-save-files)
1079 (compilation-start (concat hs-lint-command " \"" buffer-file-name "\"")
1080 'hs-lint-mode))
1081
1082(provide 'hs-lint)
1083;;; hs-lint.el ends here
1084#+end_src
1085
1086#+begin_src emacs-lisp :tangle no
1087(use-package hs-lint
1088 :load-path "lisp/"
1089 :bind (:map haskell-mode-map
1090 ("C-c l l" . hs-lint)))
1091#+end_src
0deee788
AB
1092* Emacs Enhancements
1093
1094** [[https://github.com/justbur/emacs-which-key][which-key]]
1095
1096#+begin_quote
1097Emacs package that displays available keybindings in popup
1098#+end_quote
1099
1100#+begin_src emacs-lisp
1101(use-package which-key
1102 :defer 1
1103 :config (which-key-mode))
1104#+end_src
75095920 1105
d43a8eda 1106** [[https://github.com/seagle0128/doom-modeline][doom-modeline]]
75095920
AB
1107
1108#+begin_src emacs-lisp
1109(use-package doom-modeline
1110 :demand t
1111 :config (setq doom-modeline-height 32)
1112 :hook (after-init . doom-modeline-init))
1113#+end_src
1114
d43a8eda 1115** [[https://github.com/11111000000/tao-theme-emacs][tao-theme]]
75095920 1116
fdcac86a 1117#+begin_src emacs-lisp :tangle no
75095920
AB
1118(use-package tao-theme
1119 :demand t
1120 :config (load-theme 'tao-yang t))
1121#+end_src
1122
fdcac86a
AB
1123** [[https://github.com/maio/eink-emacs][eink-theme]]
1124
1125#+begin_src emacs-lisp
1126(load-theme 'eink t)
1127#+end_src
1128
bb93c9e1
AB
1129** [[https://github.com/bbatsov/crux][crux]]
1130
1131#+begin_src emacs-lisp
1132(use-package crux
d14698a3
AB
1133 :bind (("C-c d" . crux-duplicate-current-line-or-region)
1134 ("C-c M-d" . crux-duplicate-and-comment-current-line-or-region)
1135 ("M-m b K" . crux-kill-other-buffers)
1136 ("M-m f c" . crux-copy-file-preserve-attributes)
1137 ("M-m f D" . crux-delete-file-and-buffer)
1138 ("M-m f R" . crux-rename-file-and-buffer)))
bb93c9e1
AB
1139#+end_src
1140
1141** [[https://github.com/alezost/mwim.el][mwim]]
1142
1143#+begin_src emacs-lisp
1144(use-package mwim
1145 :bind (("C-a" . mwim-beginning-of-code-or-line)
1146 ("C-e" . mwim-end-of-code-or-line)
1147 ("<home>" . mwim-beginning-of-line-or-code)
d14698a3 1148 ("<end>" . mwim-end-of-line-or-code)))
f8869b0b
AB
1149#+end_src
1150
51db62d8 1151* Email
d43a8eda 1152** [[https://notmuchmail.org][notmuch]]
51db62d8 1153
9d5d55c5
AB
1154See [[notmuch:id:87muuqsvci.fsf@fencepost.gnu.org][bug follow-up]].
1155
51db62d8 1156#+begin_src emacs-lisp
850dd012 1157(defvar amin-maildir "~/mail")
51db62d8
AB
1158
1159(use-package sendmail
1160 ;; :ensure nil
1161 :config
1162 (setq sendmail-program "/usr/bin/msmtp"
9e568495 1163 ; message-sendmail-extra-arguments '("-v" "-d")
51db62d8
AB
1164 mail-specify-envelope-from t
1165 mail-envelope-from 'header))
1166
1167(use-package message
1168 ;; :ensure nil
1169 :config
1170 (setq message-kill-buffer-on-exit t
1171 message-send-mail-function 'message-send-mail-with-sendmail
1172 message-sendmail-envelope-from 'header
1173 message-directory "drafts"
41a4f26a 1174 message-user-fqdn "aminb.org")
51db62d8
AB
1175 (add-hook 'message-mode-hook
1176 (lambda () (setq fill-column 65
1177 message-fill-column 65)))
1178 (add-hook 'message-mode-hook
1179 #'flyspell-mode)
1180 ;; (add-hook 'notmuch-message-mode-hook #'+doom-modeline|set-special-modeline)
1181 ;; TODO: is there a way to only run this when replying and not composing?
5842415b
AB
1182 ;; (add-hook 'notmuch-message-mode-hook
1183 ;; (lambda () (progn
1184 ;; (newline)
1185 ;; (newline)
1186 ;; (forward-line -1)
1187 ;; (forward-line -1))))
51db62d8
AB
1188 ;; (add-hook 'message-setup-hook
1189 ;; #'mml-secure-message-sign-pgpmime)
1190 )
1191
1192(after! mml-sec
1193 (setq mml-secure-openpgp-encrypt-to-self t
1194 mml-secure-openpgp-sign-with-sender t))
1195
6f4c133d
AB
1196(defun amin/notmuch ()
1197 "Delete other windows, then launch `notmuch'."
1198 (interactive)
1199 (delete-other-windows)
1200 (notmuch))
1201
51db62d8 1202(use-package notmuch
6f4c133d 1203 :commands notmuch
d14698a3
AB
1204 :bind (("C-c m" . amin/notmuch)
1205 ("M-m m" . amin/notmuch))
51db62d8
AB
1206 :config
1207 (setq notmuch-hello-sections
1208 '(notmuch-hello-insert-header
1209 notmuch-hello-insert-saved-searches
1210 ;; notmuch-hello-insert-search
1211 notmuch-hello-insert-alltags)
1212 notmuch-search-oldest-first nil
1213 notmuch-show-all-tags-list t
9d5d55c5
AB
1214 notmuch-message-headers ; see bug follow-up above
1215 '("Subject" "To" "Cc" "Date" "List-Id" "X-RT-Originator")
51db62d8
AB
1216 notmuch-hello-thousands-separator ","
1217 notmuch-fcc-dirs
1e340324
AB
1218 '(("amin@aminb.org" . "amin/Sent")
1219 ("amin@gnu.org" . "gnu/Sent")
1220 ("abandali@uwaterloo.ca" . "\"uwaterloo/Sent Items\"")
1221 ("mab@gnu.org" . "gnu/Sent")
1222 ("aminb@gnu.org" . "gnu/Sent")
1223 (".*" . "sent"))
f4636d6b 1224 notmuch-search-result-format
1e340324
AB
1225 '(("date" . "%12s ")
1226 ("count" . "%-7s ")
f4636d6b
AB
1227 ("authors" . "%-40s ")
1228 ("subject" . "%s ")
1e340324
AB
1229 ("tags" . "(%s)"))
1230 notmuch-saved-searches
1231 '((:name "inbox" :query "tag:inbox" :key "i")
1232 (:name "unread" :query "tag:unread" :key "u")
1233 (:name "latest" :query "tag:latest" :key "l")
1234 (:name "encrypted" :query "tag:encrypted" :key "e")
1235 (:name "flagged" :query "tag:flagged" :key "f")
1236 (:name "sent" :query "tag:sent" :key "s")
1237 (:name "drafts" :query "tag:draft" :key "d")
1238 (:name "all mail" :query "*" :key "a")))
51db62d8
AB
1239 ;; (add-hook 'visual-fill-column-mode-hook
1240 ;; (lambda ()
1241 ;; (when (string= major-mode 'notmuch-message-mode)
1242 ;; (setq visual-fill-column-width 70))))
1243 ;; (set! :evil-state 'notmuch-message-mode 'insert)
1244 ;; (advice-add #'notmuch-bury-or-kill-this-buffer
1245 ;; :override #'kill-this-buffer)
d14698a3
AB
1246 ;; (evil-collection-define-key 'normal 'notmuch-common-keymap
1247 ;; "c" (lambda ()
1248 ;; "Compose new mail and prompt for sender"
1249 ;; (interactive)
1250 ;; (let ((current-prefix-arg t))
1251 ;; (call-interactively #'notmuch-mua-new-mail))))
51db62d8 1252 :bind
51db62d8 1253 (:map notmuch-search-mode-map
eb186a5a
AB
1254 ("k" . (lambda ()
1255 "Mark message read"
1256 (interactive)
1257 (notmuch-search-tag '("-unread"))
1258 ;; (notmuch-search-archive-thread)
1259 (notmuch-search-next-thread)))
1260 ("u" . (lambda ()
1261 "Mark message unread"
1262 (interactive)
1263 (notmuch-search-tag '("+unread"))
1264 (notmuch-search-next-thread)))
1265 ("K" . (lambda ()
1266 "Mark message deleted"
1267 (interactive)
1268 (notmuch-search-tag '("-unread" "-inbox" "+deleted"))
1269 (notmuch-search-archive-thread)))
1270 ("S" . (lambda ()
1271 "Mark message as spam"
1272 (interactive)
1273 (notmuch-search-tag '("-unread" "-inbox" "-webmasters" "+spam"))
1274 (notmuch-search-archive-thread))))
51db62d8 1275 (:map notmuch-tree-mode-map ; TODO: additional bindings
eb186a5a
AB
1276 ("S" . (lambda ()
1277 "Mark message as spam"
1278 (interactive)
1279 (notmuch-tree-tag '("-unread" "-inbox" "-webmasters" "+spam"))
1280 (notmuch-tree-archive-thread))))
51db62d8
AB
1281)
1282
6f4c133d 1283(use-package counsel-notmuch
d14698a3 1284 :bind ("M-m / m" . counsel-notmuch))
51db62d8
AB
1285
1286(after! notmuch-crypto
1287 (setq notmuch-crypto-process-mime t))
1288
51db62d8 1289(after! recentf
850dd012 1290 (add-to-list 'recentf-exclude (expand-file-name amin-maildir)))
51db62d8 1291#+end_src
f76bdaa8 1292
26172d91
AB
1293** supercite
1294
1295#+begin_src emacs-lisp :tangle no
1296(use-package supercite
1297 :commands sc-cite-original
1298 :init
1299 (add-hook 'mail-citation-hook 'sc-cite-original)
1300
1301 (defun sc-remove-existing-signature ()
1302 (save-excursion
1303 (goto-char (region-beginning))
1304 (when (re-search-forward message-signature-separator (region-end) t)
1305 (delete-region (match-beginning 0) (region-end)))))
1306
1307 (add-hook 'mail-citation-hook 'sc-remove-existing-signature)
1308
1309 (defun sc-remove-if-not-mailing-list ()
1310 (unless (assoc "list-id" sc-mail-info)
1311 (setq attribution sc-default-attribution
1312 citation (concat sc-citation-delimiter
1313 sc-citation-separator))))
1314
1315 (add-hook 'sc-attribs-postselect-hook 'sc-remove-if-not-mailing-list)
1316
1317 :config
1318 (defun sc-fill-if-different (&optional prefix)
1319 "Fill the region bounded by `sc-fill-begin' and point.
1320Only fill if optional PREFIX is different than
1321`sc-fill-line-prefix'. If `sc-auto-fill-region-p' is nil, do not
1322fill region. If PREFIX is not supplied, initialize fill
1323variables. This is useful for a regi `begin' frame-entry."
1324 (if (not prefix)
1325 (setq sc-fill-line-prefix ""
1326 sc-fill-begin (line-beginning-position))
1327 (if (and sc-auto-fill-region-p
1328 (not (string= prefix sc-fill-line-prefix)))
1329 (let ((fill-prefix sc-fill-line-prefix))
1330 (unless (or (string= fill-prefix "")
1331 (save-excursion
1332 (goto-char sc-fill-begin)
1333 (or (looking-at ">+ +")
1334 (< (length
1335 (buffer-substring (point)
1336 (line-end-position)))
1337 65))))
1338 (fill-region sc-fill-begin (line-beginning-position)))
1339 (setq sc-fill-line-prefix prefix
1340 sc-fill-begin (line-beginning-position)))))
1341nil))
1342#+end_src
1343
97934ec4
AB
1344* Blogging
1345** [[https://ox-hugo.scripter.co][ox-hugo]]
1346
1347#+begin_src emacs-lisp
1348(use-package ox-hugo
1349 :after ox)
1350#+end_src
1351
180cab37
AB
1352* Post initialization
1353:PROPERTIES:
967b0a82 1354:CUSTOM_ID: post-initialization
180cab37
AB
1355:END:
1356
1357Display how long it took to load the init file.
1358
1359#+begin_src emacs-lisp
1360(message "Loading %s...done (%.3fs)" user-init-file
1361 (float-time (time-subtract (current-time)
850dd012 1362 amin--before-user-init-time)))
180cab37
AB
1363#+end_src
1364
1365* Footer
1366:PROPERTIES:
1367:CUSTOM_ID: footer
1368:END:
1369
1370#+begin_src emacs-lisp :comments none
1371;;; init.el ends here
1372#+end_src