From b9887d7945e77becfc6696288e88bc8550c19310 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Mon, 29 Apr 2019 11:15:48 -0400 Subject: [PATCH 01/16] emacs: update packages --- .emacs.d/straight/versions/default.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.emacs.d/straight/versions/default.el b/.emacs.d/straight/versions/default.el index 442b177..9ffe569 100644 --- a/.emacs.d/straight/versions/default.el +++ b/.emacs.d/straight/versions/default.el @@ -12,7 +12,7 @@ ("crux" . "308f17d914e2cd79cbc809de66d02b03ceb82859") ("dante" . "d6be8fa2d49ac73b34578736ca6340573bbcb68a") ("dash.el" . "258c324d9840901db83b2cabef3fa75bba57c1ba") - ("debbugs" . "657a1e8068bdb38c833bd6150ab442ead2000476") + ("debbugs" . "15bffadf0c96e3b2ecaa383a79af7e8d17d5b332") ("diff-hl" . "84a5fe1900af2e5cc522f02749804f0d9f094bbf") ("ebdb" . "b7da024746d650b4dc6eba48155c87f85448b12c") ("edit-indirect" . "de645d8144e8a08f039a9c88185121ec81d957ef") @@ -32,7 +32,7 @@ ("f.el" . "8191672377816a1975414cc1f116fd3b94b30bd0") ("flycheck" . "8997a4ebbd37d0ed624c1c63aa5bb11013989050") ("flycheck-haskell" . "32ddff87165a7d3a35e7318bee997b5b4bd41278") - ("forge" . "598fd5b979b6d65c20d932e7e69400f7a34cead2") + ("forge" . "9a4ce77201863430184f9ef5aff4b45c9bd8baa3") ("geiser" . "156970ff1402512b4bbf53a5e1c22156cb0e2f9c") ("ghub" . "c7ca6780bcd4d00d22e668e74b25f865ba892a45") ("gnu-elpa-mirror" . "de32165c6c3cdb23bfa5adb7e84d328f0acc4aa0") @@ -50,19 +50,19 @@ ("lean-mode" . "9d6b8471e2044310b4cd7cd3213b1fc8f78ec499") ("let-alist" . "33e71829e8814cf5f28b6e4291192aafef61b69e") ("loop.el" . "e22807f83a0890dc8a904c51ee0742c34efccc6c") - ("magit" . "88222678bba51b27bd27d967f6c253baa35cf5ef") + ("magit" . "839aaedaddf316032fce738203fe14dbf751bd64") ("magit-popup" . "4250c3a606011e3ff2477e3b5bbde2b493f3c85c") ("markdown-mode" . "115f77df9755c6a453f3e5d9623ff885d207ea82") - ("melpa" . "0d5fbd76a40d84dd2d91a1022f59c15e6db6b90a") + ("melpa" . "07fd791e2674ce3c773e2c213e045d6c7d12d848") ("message-x" . "5524de7bbfdd8749c110f48de5afb024d9f83133") ("multi-term" . "f954e4e18b0a035151d34852387e724d87a3316f") ("multiple-cursors.el" . "5ffb19af48bf8a76ddc9f81745be052f050bddef") ("mwim.el" . "b4f3edb4c0fb8f8b71cecbf8095c2c25a8ffbf85") ("no-littering" . "99ae007ead688689b5b25a9482f98ec67663bb61") - ("org" . "4939b41750055ec59efc3eb9a360e760641a9b82") + ("org" . "7cfc9ce95fd42b68b829decdb3eefd7d0ba74a93") ("org-ref" . "d12a8bed162f160cb33fa66d572ce2587f4eb928") ("packed" . "c41c3dfda86ae33832ffc146923e2a4675cbacfa") - ("page-break-lines" . "87e801efb816b24e83ebf84c052001e178e180bc") + ("page-break-lines" . "9b509e2cb2afaad79c5eeca4197103f9db1e9b8b") ("parsebib" . "9a5f1730b8ef1fb6c29262a8ba79f8136e5548d4") ("pdf-tools" . "d780b82a5ea5eb64140a3a68fa278f877771a1fc") ("pkg-info.el" . "76ba7415480687d05a4353b27fea2ae02b8d9d61") @@ -79,12 +79,12 @@ ("straight.el" . "eff23789d48abc49a6210169f301c42e9be2cef3") ("swiper" . "0e62f0d1f61b825ca5eb4b55e47ecb37b3e2834e") ("tablist" . "8079801527da1f596bc942162026328d7bdf6ad9") - ("transient" . "a87cb2c35ace612d1e1f7fc51264baac49a5708b") + ("transient" . "afdf1f0050d38457dad6efc513bc7118445e8028") ("treepy.el" . "b40e6b09eb9be45da67b8c9e4990a5a0d7a2a09d") ("typoel" . "9dad93b6f367f02f52c8d9bf15d446d922cec294") ("unkillable-scratch" . "b24c2a760529833f230c14cb02ff6e7ec92288ab") ("use-package" . "0ee88b5cac41acf974c4bedb8859931ead8bfc79") - ("web-mode" . "b286d682205f86b7fe878a92a5afb510a07cd132") + ("web-mode" . "0cfdb0fb365761e01772d1103e3ea7126003b0c1") ("with-editor" . "38df9bfc2227bcb7ac4899c83a03756d5f171450") ("yasnippet" . "fc33b2fbaee6c514c91e80f5b1c0210c776b03ed") ("znc" . "ee50cc596adab44cf5460ef62be2c6e3d745aa5b")) -- 2.20.1 From 17c9334f92bc11b265fc55406e2039122fbe26b8 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Mon, 29 Apr 2019 11:15:57 -0400 Subject: [PATCH 02/16] emacs: add tex filter-group for ibuffer --- .emacs.d/init.org | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.emacs.d/init.org b/.emacs.d/init.org index 87ea69e..4f1193d 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -1203,6 +1203,10 @@ There's no way I could top that, so I won't attempt to. (mode . haskell-mode) (mode . lean-mode) (mode . alloy-mode))) + ("tex" + (or + (mode . bibtex-mode) + (mode . latex-mode))) ("emacs" (or (name . "^\\*scratch\\*$") -- 2.20.1 From f791e3e46c70d4b20ddab30475251fb57091434c Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Mon, 29 Apr 2019 11:16:28 -0400 Subject: [PATCH 03/16] sway: fix light minimum brightness setting --- .local/bin/s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/s b/.local/bin/s index a4b7bb3..dc34441 100755 --- a/.local/bin/s +++ b/.local/bin/s @@ -3,5 +3,5 @@ export _JAVA_AWT_WM_NONREPARENTING=1 export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true' export MOZ_USE_XINPUT2=1 # precise scrolling in firefox -light -Nr 2 +light -N 1 sway -- 2.20.1 From f120f77c5d7e6c98b57543b0bc3cdd8167bd052c Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Mon, 29 Apr 2019 11:16:47 -0400 Subject: [PATCH 04/16] tridactyl: a few more bindings and tweaks --- .config/tridactyl/tridactylrc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.config/tridactyl/tridactylrc b/.config/tridactyl/tridactylrc index 8081446..1fc49fc 100644 --- a/.config/tridactyl/tridactylrc +++ b/.config/tridactyl/tridactylrc @@ -3,6 +3,9 @@ bind k scrollline -2 bind n scrollline 2 bind p scrollline -2 +bind 0 scrollto 0 x +bind - scrollto 100 x + bind J tabprev bind K tabnext bind P tabprev @@ -15,6 +18,7 @@ unbind bind x tabclose bind X undo +bind stop bind gd tabduplicate bind gw tabdetach @@ -23,9 +27,13 @@ bind O fillcmdline bmarks bind ; fillcmdline_notrail +unbind + set hintfiltermode vimperator-reflow set hintnames numeric set browser iceweasel -autocmd DocStart www.reddit.com js tri.excmds.urlmodify("-t", "www", "old") +seturl warrior.uwaterloo.ca noiframe true + +" autocmd DocStart www.reddit.com js tri.excmds.urlmodify("-t", "www", "old") -- 2.20.1 From d679528924ece80d045ea736636194a71182e8c4 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Sat, 4 May 2019 23:12:03 -0400 Subject: [PATCH 05/16] emacs: update packages --- .emacs.d/straight/versions/default.el | 38 +++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.emacs.d/straight/versions/default.el b/.emacs.d/straight/versions/default.el index 9ffe569..f213135 100644 --- a/.emacs.d/straight/versions/default.el +++ b/.emacs.d/straight/versions/default.el @@ -8,16 +8,16 @@ ("cl-lib" . "deb92588d9d83d46c4698936ea31c5f58d244f04") ("closql" . "012b94f8695e194455111fd54eff0b94dd0dd0db") ("company-ebdb" . "3b463fe1236ac6445657f3a1df20357a7a2fa8f6") - ("company-mode" . "3eda0ba23921d43b733f7975e56d490a34b9f30b") + ("company-mode" . "ad6ff0eecca99dc5ac8b6a8a6174df7d2ad88ae7") ("crux" . "308f17d914e2cd79cbc809de66d02b03ceb82859") - ("dante" . "d6be8fa2d49ac73b34578736ca6340573bbcb68a") + ("dante" . "4170ff57f3fd9414915d7a72b805de8727bd81ee") ("dash.el" . "258c324d9840901db83b2cabef3fa75bba57c1ba") - ("debbugs" . "15bffadf0c96e3b2ecaa383a79af7e8d17d5b332") + ("debbugs" . "e0c8c2d9c3caafbe5b6ad78089ac6f331b32eb17") ("diff-hl" . "84a5fe1900af2e5cc522f02749804f0d9f094bbf") ("ebdb" . "b7da024746d650b4dc6eba48155c87f85448b12c") ("edit-indirect" . "de645d8144e8a08f039a9c88185121ec81d957ef") ("elisp-refs" . "540daaf50a88ca0e7d7c8d5f09ca383362e67baf") - ("emacs-async" . "81dc034572e963550c5403a2b3c28047e46b4029") + ("emacs-async" . "bd68cc1ab1ac6af890e250bdaa12ffb1cb9649be") ("emacs-doom-themes" . "e771d566b138918c7c553a9a9e96ce1bd38bc903") ("emacs-htmlize" . "8db0aa6aab77475a732b7363f0d57bd3933c18fd") ("emacs-memoize" . "9a561268ffb550b257a08710489a95cd087998b6") @@ -30,17 +30,17 @@ ("exec-path-from-shell" . "3cfedb8791397ed50ee66bc0a7cbee5b9d78245c") ("expand-region.el" . "1c31447730443d98f90f65dfcb752f347d46ad1b") ("f.el" . "8191672377816a1975414cc1f116fd3b94b30bd0") - ("flycheck" . "8997a4ebbd37d0ed624c1c63aa5bb11013989050") + ("flycheck" . "47174a12fd84a685f36019632838c73b4813b66d") ("flycheck-haskell" . "32ddff87165a7d3a35e7318bee997b5b4bd41278") - ("forge" . "9a4ce77201863430184f9ef5aff4b45c9bd8baa3") + ("forge" . "0375541d9ea3a18172d9829fb3083e8adf207874") ("geiser" . "156970ff1402512b4bbf53a5e1c22156cb0e2f9c") ("ghub" . "c7ca6780bcd4d00d22e668e74b25f865ba892a45") ("gnu-elpa-mirror" . "de32165c6c3cdb23bfa5adb7e84d328f0acc4aa0") ("graphql.el" . "e2b309689f4faf9225f290080f836e988c5a576d") - ("guix.el" . "f764641396fb2e8ca1fb319f782b0e07c0a3fd0c") + ("guix.el" . "11e0dbf6491300d250efb3dc09d634b01e86b35b") ("haskell-mode" . "23978d384ffe6ef7d82b7c2559ac8581c8b5d59d") - ("helm" . "dd08aebd88712850373e305581cd2ad5f5f3709b") - ("helm-bibtex" . "b1c79f5ba1e026b301baf74b91967e7c3a13bbb2") + ("helm" . "97c86bc1653b76759b1e8493eac2ddb9ce783943") + ("helm-bibtex" . "e1391a4be629b506f06d678bcdfd17d290904482") ("helpful" . "53ae44bd2384de5e2513496ccf6ca2fce6767299") ("hl-todo" . "487d349b7b8d6738223d5dd10957dd10b45eb9f3") ("hlint-refactor-mode" . "c4307f86aad6d02e32e9b30cb6edc115584c791c") @@ -50,16 +50,16 @@ ("lean-mode" . "9d6b8471e2044310b4cd7cd3213b1fc8f78ec499") ("let-alist" . "33e71829e8814cf5f28b6e4291192aafef61b69e") ("loop.el" . "e22807f83a0890dc8a904c51ee0742c34efccc6c") - ("magit" . "839aaedaddf316032fce738203fe14dbf751bd64") + ("magit" . "2d21705393262e3fcfdaa0bea018be5a7dc5f8d2") ("magit-popup" . "4250c3a606011e3ff2477e3b5bbde2b493f3c85c") ("markdown-mode" . "115f77df9755c6a453f3e5d9623ff885d207ea82") - ("melpa" . "07fd791e2674ce3c773e2c213e045d6c7d12d848") + ("melpa" . "43808f57146a395b92ed498803fa948a33e5f3c2") ("message-x" . "5524de7bbfdd8749c110f48de5afb024d9f83133") ("multi-term" . "f954e4e18b0a035151d34852387e724d87a3316f") ("multiple-cursors.el" . "5ffb19af48bf8a76ddc9f81745be052f050bddef") ("mwim.el" . "b4f3edb4c0fb8f8b71cecbf8095c2c25a8ffbf85") ("no-littering" . "99ae007ead688689b5b25a9482f98ec67663bb61") - ("org" . "7cfc9ce95fd42b68b829decdb3eefd7d0ba74a93") + ("org" . "c47c686d5f84ad447e853fd45bb40b104565683a") ("org-ref" . "d12a8bed162f160cb33fa66d572ce2587f4eb928") ("packed" . "c41c3dfda86ae33832ffc146923e2a4675cbacfa") ("page-break-lines" . "9b509e2cb2afaad79c5eeca4197103f9db1e9b8b") @@ -67,7 +67,7 @@ ("pdf-tools" . "d780b82a5ea5eb64140a3a68fa278f877771a1fc") ("pkg-info.el" . "76ba7415480687d05a4353b27fea2ae02b8d9d61") ("popup-el" . "80829dd46381754639fb764da11c67235fe63282") - ("projectile" . "cfae848258a7cb9c7a430d152ad0bf6e82a6a32c") + ("projectile" . "564ef2f7e6066674783afd7dc04bdcec31a660da") ("rich-minority" . "a03e693f6f9232cf75363aaaf1cb041f21675c19") ("s.el" . "03410e6a7a2b11e47e1fea3b7d9899c7df26435e") ("seq" . "095fb15a3baa082079799dd36b6caccdb062cb90") @@ -76,16 +76,16 @@ ("smart-mode-line" . "268319aafee710ce8916c8612a5a8dcdce55fc1b") ("smex" . "55aaebe3d793c2c990b39a302eb26c184281c42c") ("soap-client" . "7afb2f3e987edc8a7e77ac1a8c3871a9cfa8837e") - ("straight.el" . "eff23789d48abc49a6210169f301c42e9be2cef3") - ("swiper" . "0e62f0d1f61b825ca5eb4b55e47ecb37b3e2834e") + ("straight.el" . "c42edf91249a3610a872402082e977c61cf65dc9") + ("swiper" . "c1ff0d6ff4176f5ebcf324561c7b5e416700cc79") ("tablist" . "8079801527da1f596bc942162026328d7bdf6ad9") - ("transient" . "afdf1f0050d38457dad6efc513bc7118445e8028") + ("transient" . "c7ad1f01f4ff9e5125bcec99dfb9c3dedadfc369") ("treepy.el" . "b40e6b09eb9be45da67b8c9e4990a5a0d7a2a09d") ("typoel" . "9dad93b6f367f02f52c8d9bf15d446d922cec294") ("unkillable-scratch" . "b24c2a760529833f230c14cb02ff6e7ec92288ab") ("use-package" . "0ee88b5cac41acf974c4bedb8859931ead8bfc79") - ("web-mode" . "0cfdb0fb365761e01772d1103e3ea7126003b0c1") - ("with-editor" . "38df9bfc2227bcb7ac4899c83a03756d5f171450") - ("yasnippet" . "fc33b2fbaee6c514c91e80f5b1c0210c776b03ed") + ("web-mode" . "e5317bf90e7ca7d0b5c157cf42606ecb9054bc8e") + ("with-editor" . "7b8520b98f882f635db7eec115d8e61d8cc8cf32") + ("yasnippet" . "e45e3de357fbd4289fcfa3dd26aaa7be357fb0b8") ("znc" . "ee50cc596adab44cf5460ef62be2c6e3d745aa5b")) :neptune -- 2.20.1 From 88606ff7dc0f900042c51f37a4d76ec657e72294 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Thu, 9 May 2019 08:44:38 -0400 Subject: [PATCH 06/16] =?utf8?q?emacs:=20don=E2=80=99t=20use=20my=20custom?= =?utf8?q?=20message-cite-ctyle?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit to help me avoid top-posting when replying --- .emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.emacs.d/init.org b/.emacs.d/init.org index 4f1193d..1ea9fe1 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -2527,7 +2527,7 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]]. (concat "Hi %F,\n\n" a/message-cite-style-format) a/message-cite-style-format))) "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.") - (setq message-cite-style 'message-cite-style-bandali + (setq ;; message-cite-style 'message-cite-style-bandali message-kill-buffer-on-exit t message-send-mail-function 'message-send-mail-with-sendmail message-sendmail-envelope-from 'header -- 2.20.1 From d9241fc2f8fad196658f5167c56b062485dcc217 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Thu, 9 May 2019 08:46:01 -0400 Subject: [PATCH 07/16] sway: move monitor to the right, and some other minor tweaks --- .config/sway/config | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.config/sway/config b/.config/sway/config index e1a421b..73a291b 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -21,9 +21,9 @@ output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill # # You can get the names of your outputs by running: swaymsg -t get_outputs -output DP-1 res 2560x1440 pos 0,0 +output DP-1 res 2560x1440 pos 1366,0 # 672 = 1440 - 768 -output LVDS-1 pos 2560,760 +output LVDS-1 pos 0,760 ### Idle configuration @@ -40,7 +40,7 @@ exec swayidle \ set $floating_term $term -name floating for_window [class="URxvt" instance="floating"] floating enable -set $mode_launch (⏎)urxvt, (e)macs, iceweasel (a)minb (c)hr (p)riv, ice(C)at +set $mode_launch (⏎)urxvt | (e)macs | iceweasel (a)minb (c)hr (p)riv | ice(C)at mode "$mode_launch" { bindsym Return exec $floating_term, mode "default" bindsym e exec emacs, mode "default" @@ -224,7 +224,7 @@ bindsym $mod+Shift+r mode "resize" # Power button # -set $mode_system System (l)ock, (e)xit sway, (s)uspend, (h)ibernate, (r)eboot, (S)hutdown +set $mode_system System (l)ock | (e)xit sway | (s)uspend | (h)ibernate | (r)eboot | (S)hutdown mode "$mode_system" { bindsym l exec swaylock, mode "default" bindsym e exec swaymsg exit, mode "default" @@ -240,6 +240,7 @@ mode "$mode_system" { } # bindsym XF86PowerOff mode "$mode_system" bindsym $mod+Shift+e mode "$mode_system" +bindsym XF86ScreenSaver exec swaylock # # Presentation mode @@ -265,14 +266,15 @@ mode notifications { # Screenshotting # -bindsym $mod+Shift+s mode screenshot -mode screenshot { +set $mode_screenshot (a)ll | (r)egion +mode "$mode_screenshot" { bindsym a exec grim $(xdg-user-dir PICTURES)/shots/$(date +'%Y-%m-%d-%H%M%S.png'); mode default bindsym r exec slurp | grim -g - $(xdg-user-dir PICTURES)/shots/$(date +'%Y-%m-%d-%H%M%S.png'); mode default bindsym Escape mode default bindsym q mode default } +bindsym Print mode "$mode_screenshot" # # Window configurations -- 2.20.1 From 3bfd8640be53c1632c92ac814bb74727ecc21428 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Thu, 9 May 2019 11:35:52 -0400 Subject: [PATCH 08/16] =?utf8?q?emacs:=20don=E2=80=99t=20byte-compile=20in?= =?utf8?q?it?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit going to try a non-byte-compiled init for a while; esp. now that on emacs master i get a segfault: -*- mode: compilation; default-directory: "~/.emacs.d/" -*- Compilation started at Thu May 9 11:38:40 make build-init Loading Emacs...done (0.004s) Loading /home/amin/.emacs.d/etc/custom.el (source)... Loading /home/amin/.emacs.d/etc/secrets... Fatal error 11: Segmentation fault Backtrace: emacs(+0x132cdf)[0x55c6bd232cdf] emacs(+0x3acdf)[0x55c6bd13acdf] emacs(+0x3b133)[0x55c6bd13b133] emacs(+0x131339)[0x55c6bd231339] emacs(+0x1313ba)[0x55c6bd2313ba] /usr/lib/libpthread.so.0(+0x124d0)[0x7f6e6c4f34d0] /bin/sh: line 1: 28103 Segmentation fault (core dumped) emacs -Q --batch -l init.el --eval '(a/build-init)' 2>&1 make: *** [Makefile:11: build-init] Error 139 Compilation exited abnormally with code 2 at Thu May 9 11:38:42 --- .emacs.d/init.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.emacs.d/init.org b/.emacs.d/init.org index 1ea9fe1..cb8a540 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -146,7 +146,7 @@ If you would like a byte-compiled init file, set the following variable to ~t~, otherwise set it to ~nil~. #+begin_src emacs-lisp -(defvar a/byte-compiled-init t +(defvar a/byte-compiled-init nil "If non-nil, byte-(re)compile init.el on successful tangles.") #+end_src -- 2.20.1 From 141014e58a3092220d99e210e533d24fc2b549c4 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Thu, 9 May 2019 11:40:20 -0400 Subject: [PATCH 09/16] emacs: add emacs-slack (temporary) and update swiper --- .emacs.d/etc/secrets.el | 7 +--- .emacs.d/init.org | 57 +++++++++++++++++++++++++++ .emacs.d/straight/versions/default.el | 12 +++++- 3 files changed, 69 insertions(+), 7 deletions(-) diff --git a/.emacs.d/etc/secrets.el b/.emacs.d/etc/secrets.el index e881fb0..edfa1a6 100644 --- a/.emacs.d/etc/secrets.el +++ b/.emacs.d/etc/secrets.el @@ -1,10 +1,5 @@ (eval-when-compile (require 'auth-source)) -(defvar uw-apv-client-id (eval-when-compile (plist-get (car (auth-source-search :host "uw-apv.slack.com" :max 1)) :client-id))) -(defvar uw-apv-client-secret (eval-when-compile (plist-get (car (auth-source-search :host "uw-apv.slack.com" :max 1)) :client-secret))) -(defvar uw-apv-token (eval-when-compile (plist-get (car (auth-source-search :host "uw-apv.slack.com" :max 1)) :token))) -(defvar watform-client-id (eval-when-compile (plist-get (car (auth-source-search :host "watform.slack.com" :max 1)) :client-id))) -(defvar watform-client-secret (eval-when-compile (plist-get (car (auth-source-search :host "watform.slack.com" :max 1)) :client-secret))) -(defvar watform-token (eval-when-compile (plist-get (car (auth-source-search :host "watform.slack.com" :max 1)) :token))) +(defvar nday-students-token (eval-when-compile (plist-get (car (auth-source-search :host "nday-students.slack.com" :max 1)) :token))) (defvar canlock-password (eval-when-compile (funcall (plist-get (car (auth-source-search :host "gnus-canlock-password" :max 1)) :secret)))) diff --git a/.emacs.d/init.org b/.emacs.d/init.org index cb8a540..899901c 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -2276,6 +2276,63 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]]. org-ref-pdf-directory "~/usr/org/bibtex-pdfs/")) #+end_src +** slack + +Not an "Emacs enhancement", but just so that I don't have to use the +proprietary web interface. Needed for interacting with the URA(s) +this summer. + +#+begin_src emacs-lisp +(use-package slack + :commands (slack-start) + :init + (eval-when-compile ; silence the byte-compiler + (defvar url-http-data nil) + (defvar url-http-extra-headers nil) + (defvar url-http-method nil) + (defvar url-callback-function nil) + (defvar url-callback-arguments nil) + (defvar oauth--token-data nil)) + (setq slack-buffer-emojify t + slack-prefer-current-team t) + :config + (slack-register-team + :name "nday-students" + :default t + :token nday-students-token + :subscribed-channels '(general) + :full-and-display-names t) + (add-to-list 'swiper-font-lock-exclude 'slack-message-buffer-mode t) + (setq lui-time-stamp-format "[%Y-%m-%d %H:%M:%S]" + lui-time-stamp-only-when-changed-p t + lui-time-stamp-position 'right) + :bind + (("C-c s s" . slack-start) + ("C-c s u" . slack-select-unread-rooms) + ("C-c s b" . slack-select-rooms) + ("C-c s t" . slack-change-current-team) + ("C-c s c" . slack-ws-close) + :map slack-mode-map + ("M-p" . slack-buffer-goto-prev-message) + ("M-n" . slack-buffer-goto-next-message) + ("C-c e" . slack-message-edit) + ("C-c k" . slack-message-delete) + ("C-c C-k" . slack-channel-leave) + ("C-c r a" . slack-message-add-reaction) + ("C-c r r" . slack-message-remove-reaction) + ("C-c r s" . slack-message-show-reaction-users) + ("C-c p l" . slack-room-pins-list) + ("C-c p a" . slack-message-pins-add) + ("C-c p r" . slack-message-pins-remove) + ("@" . slack-message-embed-mention) + ("#" . slack-message-embed-channel))) + +(use-package alert + :commands (alert) + :init + (setq alert-default-style 'notifier)) +#+end_src + * Email :PROPERTIES: :CUSTOM_ID: email diff --git a/.emacs.d/straight/versions/default.el b/.emacs.d/straight/versions/default.el index f213135..96568ba 100644 --- a/.emacs.d/straight/versions/default.el +++ b/.emacs.d/straight/versions/default.el @@ -1,10 +1,12 @@ (("PG" . "946be87a944c9d8b850fdddb83d36e2ef9dad5c9") + ("alert" . "a53e39e2fcd14fd0c04db9b27776831f04593b7f") ("all-the-icons.el" . "f996fafa5b2ea072d0ad1df9cd98acc75820f530") ("alloy-mode" . "0d05bdd10c77ec04c3d61eccf67e68c08284951f") ("auto-compile" . "e6bbb1371324c8884af3b201e9adbc9296eb2ff4") ("biblio.el" . "d1b2286f4ffc9f77919d916763eb2469f532027a") ("boxquote.el" . "7e47e0e2853bc1215739b2e28f260e9eed93b2c5") ("bui.el" . "508577a7225b3d07eaefa9444064410af2518675") + ("circe" . "6ccd4b494cbae9d28091217654f052eaea321007") ("cl-lib" . "deb92588d9d83d46c4698936ea31c5f58d244f04") ("closql" . "012b94f8695e194455111fd54eff0b94dd0dd0db") ("company-ebdb" . "3b463fe1236ac6445657f3a1df20357a7a2fa8f6") @@ -19,8 +21,12 @@ ("elisp-refs" . "540daaf50a88ca0e7d7c8d5f09ca383362e67baf") ("emacs-async" . "bd68cc1ab1ac6af890e250bdaa12ffb1cb9649be") ("emacs-doom-themes" . "e771d566b138918c7c553a9a9e96ce1bd38bc903") + ("emacs-emojify" . "4954a4f2cffe5c459727bee30cd221c59eacd839") ("emacs-htmlize" . "8db0aa6aab77475a732b7363f0d57bd3933c18fd") ("emacs-memoize" . "9a561268ffb550b257a08710489a95cd087998b6") + ("emacs-request" . "db88fd21d25399ff9940c208173665b12493992b") + ("emacs-slack" . "10fbb81f567b44647ad125a48ecd72df106fb624") + ("emacs-websocket" . "d8ef1b764a7047b1163e8b9664bac5bd819058ed") ("emacs-which-key" . "187ac0eb8990b62d4bfd83aac10a0ae68cdd2ff5") ("emacsql" . "d5c37d905d133a3887bc582e4a0126671816beaa") ("emmet-mode" . "1acb821e0142136344ccf40c1e5fb664d7db2e70") @@ -35,6 +41,7 @@ ("forge" . "0375541d9ea3a18172d9829fb3083e8adf207874") ("geiser" . "156970ff1402512b4bbf53a5e1c22156cb0e2f9c") ("ghub" . "c7ca6780bcd4d00d22e668e74b25f865ba892a45") + ("gntp.el" . "767571135e2c0985944017dc59b0be79af222ef5") ("gnu-elpa-mirror" . "de32165c6c3cdb23bfa5adb7e84d328f0acc4aa0") ("graphql.el" . "e2b309689f4faf9225f290080f836e988c5a576d") ("guix.el" . "11e0dbf6491300d250efb3dc09d634b01e86b35b") @@ -44,11 +51,13 @@ ("helpful" . "53ae44bd2384de5e2513496ccf6ca2fce6767299") ("hl-todo" . "487d349b7b8d6738223d5dd10957dd10b45eb9f3") ("hlint-refactor-mode" . "c4307f86aad6d02e32e9b30cb6edc115584c791c") + ("ht.el" . "095fde55294bd20dc7f46d614e1b0504e3830cfa") ("hydra" . "acb69859f3dde8d6924587f39997320256bdd85d") ("key-chord" . "72443e9ff3c4f1c3ccaced3130236801efde3d83") ("lcr" . "c14f40692292d59156c7632dbdd2867c086aa75f") ("lean-mode" . "9d6b8471e2044310b4cd7cd3213b1fc8f78ec499") ("let-alist" . "33e71829e8814cf5f28b6e4291192aafef61b69e") + ("log4e" . "c69424e407be0d9d0e54b427d8b18b1ac5a607e2") ("loop.el" . "e22807f83a0890dc8a904c51ee0742c34efccc6c") ("magit" . "2d21705393262e3fcfdaa0bea018be5a7dc5f8d2") ("magit-popup" . "4250c3a606011e3ff2477e3b5bbde2b493f3c85c") @@ -59,6 +68,7 @@ ("multiple-cursors.el" . "5ffb19af48bf8a76ddc9f81745be052f050bddef") ("mwim.el" . "b4f3edb4c0fb8f8b71cecbf8095c2c25a8ffbf85") ("no-littering" . "99ae007ead688689b5b25a9482f98ec67663bb61") + ("oauth2" . "bf4903b5a4a2af0327832bdcb20f3149176e1c1d") ("org" . "c47c686d5f84ad447e853fd45bb40b104565683a") ("org-ref" . "d12a8bed162f160cb33fa66d572ce2587f4eb928") ("packed" . "c41c3dfda86ae33832ffc146923e2a4675cbacfa") @@ -77,7 +87,7 @@ ("smex" . "55aaebe3d793c2c990b39a302eb26c184281c42c") ("soap-client" . "7afb2f3e987edc8a7e77ac1a8c3871a9cfa8837e") ("straight.el" . "c42edf91249a3610a872402082e977c61cf65dc9") - ("swiper" . "c1ff0d6ff4176f5ebcf324561c7b5e416700cc79") + ("swiper" . "6f56049dc3b53e25d151f301b42c3b2e7f71d269") ("tablist" . "8079801527da1f596bc942162026328d7bdf6ad9") ("transient" . "c7ad1f01f4ff9e5125bcec99dfb9c3dedadfc369") ("treepy.el" . "b40e6b09eb9be45da67b8c9e4990a5a0d7a2a09d") -- 2.20.1 From 1f910cc05731951c98556d09a441ca29afed2955 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Thu, 9 May 2019 23:56:16 -0400 Subject: [PATCH 10/16] emacs: briefly try out helm and auctex leave the configs in init for now (commented out) --- .emacs.d/init.org | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.emacs.d/init.org b/.emacs.d/init.org index 899901c..4b2d425 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -1112,6 +1112,26 @@ There's no way I could top that, so I won't attempt to. (defalias 'locate #'counsel-locate)) #+end_src +*** COMMENT Helm + +#+begin_src emacs-lisp +(use-package helm + :commands (helm-M-x helm-mini helm-resume) + :bind (("M-x" . helm-M-x) + ("M-y" . helm-show-kill-ring) + ("C-x b" . helm-mini) + ("C-x C-b" . helm-buffers-list) + ("C-x C-f" . helm-find-files) + ("C-h r" . helm-info-emacs) + ("s-r" . helm-recentf) + ("C-s-r" . helm-resume) + :map helm-map + ("" . helm-execute-persistent-action) + ("C-i" . helm-execute-persistent-action) ; Make TAB work in terminals + ("C-z" . helm-select-action)) ; List actions + :config (helm-mode 1)) +#+end_src + *** eshell #+begin_src emacs-lisp @@ -1868,6 +1888,14 @@ treemacs (use-package guix) #+end_src +** COMMENT TeX + +#+begin_src emacs-lisp +(use-package auctex + :custom + (font-latex-fontify-sectioning 'color)) +#+end_src + * Emacs enhancements :PROPERTIES: :CUSTOM_ID: emacs-enhancements -- 2.20.1 From 29d69d01797af9967d315a81605b6b0da3793bc3 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Thu, 9 May 2019 23:57:03 -0400 Subject: [PATCH 11/16] =?utf8?q?emacs:=20exclude=20straight.el=E2=80=99s?= =?utf8?q?=20build=20dir=20from=20recentf?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .emacs.d/init.org | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.emacs.d/init.org b/.emacs.d/init.org index 4b2d425..51954b6 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -297,6 +297,14 @@ integration, we will define a =use-feature= for plain ole ,@args)) #+end_src +While at it, let's exclude =straight.el='s build from recentf: + +#+begin_src emacs-lisp +(with-eval-after-load 'recentf + (add-to-list 'recentf-exclude + (expand-file-name "~/.emacs.d/straight/build/"))) +#+end_src + Also, here's a useful function for reloading the init file (useful after running =straight-check-all=: -- 2.20.1 From adaf94002bf2fd34574e1ca53f2c41393f356f59 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Thu, 9 May 2019 23:57:23 -0400 Subject: [PATCH 12/16] =?utf8?q?emacs:=20exclude=20gnus=E2=80=99s=20home?= =?utf8?q?=20dir=20from=20recentf?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .emacs.d/init.org | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.emacs.d/init.org b/.emacs.d/init.org index 51954b6..5d877f8 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -2500,7 +2500,10 @@ this summer. :config (require 'ebdb) (require 'ebdb-mua) - (require 'ebdb-gnus)) + (require 'ebdb-gnus) + + (with-eval-after-load 'recentf + (add-to-list 'recentf-exclude gnus-home-directory))) (use-feature gnus-art :config -- 2.20.1 From 970aa92ead84ce3bc7039a098c0a8f84fb0deb58 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Thu, 9 May 2019 23:59:40 -0400 Subject: [PATCH 13/16] =?utf8?q?emacs:=20use=20ivy=E2=80=99s=20virtual=20b?= =?utf8?q?uffers?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .emacs.d/etc/custom.el | 5 +++-- .emacs.d/init.org | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.emacs.d/etc/custom.el b/.emacs.d/etc/custom.el index 7bf75f0..34cc306 100644 --- a/.emacs.d/etc/custom.el +++ b/.emacs.d/etc/custom.el @@ -21,7 +21,7 @@ " " filename-and-process) (mark " " (name 16 -1) - " " filename))) + " " filename)) t) '(ibuffer-saved-filter-groups '(("default" ("dired" @@ -65,7 +65,7 @@ (name . "^\\*scratch\\*$") (name . "^\\*Messages\\*$"))) ("erc" - (mode . erc-mode))))) + (mode . erc-mode)))) t) '(ls-lisp-dirs-first t t) '(org-agenda-files '("~/usr/org/todos/personal.org" "~/usr/org/todos/masters.org")) @@ -88,6 +88,7 @@ ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(dired-directory ((t (:weight semi-bold)))) + '(ivy-virtual ((t (:inherit font-lock-builtin-face :foreground "dim gray")))) '(magit-diff-file-heading ((t (:weight normal)))) '(quote (org-block-begin-line ((t (:foreground "#5a5b5a" :background "#1d1f21"))))) '(widget-button ((t (:weight semi-bold))))) diff --git a/.emacs.d/init.org b/.emacs.d/init.org index 5d877f8..06b0ce0 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -1084,7 +1084,11 @@ There's no way I could top that, so I won't attempt to. ([S-down] . ivy-next-history-element) ("DEL" . ivy-backward-delete-char)) :config - (setq ivy-wrap t) + (setq ivy-wrap t + ivy-height 14 + ivy-use-virtual-buffers t + ivy-virtual-abbreviate 'abbreviate + ivy-count-format "%d/%d ") (ivy-mode 1) ;; :custom-face ;; (ivy-minibuffer-match-face-2 ((t (:background "#e99ce8" :weight semi-bold)))) @@ -1110,9 +1114,9 @@ There's no way I could top that, so I won't attempt to. :after ivy :bind (([remap execute-extended-command] . counsel-M-x) ([remap find-file] . counsel-find-file) - ("s-r" . counsel-recentf) ("C-c x" . counsel-M-x) ("C-c f ." . counsel-find-file) + ("C-c f l" . counsel-find-library) :map minibuffer-local-map ("C-r" . counsel-minibuffer-history)) :config -- 2.20.1 From c919de06d375088b8f9abc64c56971bae4087203 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Fri, 10 May 2019 00:00:19 -0400 Subject: [PATCH 14/16] emacs: use ox-extra --- .emacs.d/init.org | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.emacs.d/init.org b/.emacs.d/init.org index 06b0ce0..42e4def 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -951,6 +951,10 @@ And here's where my actual Org configurations begin: ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) t) (require 'ox-beamer)) + +(use-feature ox-extra + :config + (ox-extras-activate '(latex-header-blocks ignore-headlines))) #+end_src **** asynchronous tangle -- 2.20.1 From ea5966bc77e3a0fd2b182867d4be529d93f64dd2 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Fri, 10 May 2019 00:06:59 -0400 Subject: [PATCH 15/16] emacs: update org and swiper --- .emacs.d/straight/versions/default.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.emacs.d/straight/versions/default.el b/.emacs.d/straight/versions/default.el index 96568ba..d4df089 100644 --- a/.emacs.d/straight/versions/default.el +++ b/.emacs.d/straight/versions/default.el @@ -69,7 +69,7 @@ ("mwim.el" . "b4f3edb4c0fb8f8b71cecbf8095c2c25a8ffbf85") ("no-littering" . "99ae007ead688689b5b25a9482f98ec67663bb61") ("oauth2" . "bf4903b5a4a2af0327832bdcb20f3149176e1c1d") - ("org" . "c47c686d5f84ad447e853fd45bb40b104565683a") + ("org" . "d79e80fc4a7c0fbcfe8fceeddfb9943ab5839d92") ("org-ref" . "d12a8bed162f160cb33fa66d572ce2587f4eb928") ("packed" . "c41c3dfda86ae33832ffc146923e2a4675cbacfa") ("page-break-lines" . "9b509e2cb2afaad79c5eeca4197103f9db1e9b8b") @@ -87,7 +87,7 @@ ("smex" . "55aaebe3d793c2c990b39a302eb26c184281c42c") ("soap-client" . "7afb2f3e987edc8a7e77ac1a8c3871a9cfa8837e") ("straight.el" . "c42edf91249a3610a872402082e977c61cf65dc9") - ("swiper" . "6f56049dc3b53e25d151f301b42c3b2e7f71d269") + ("swiper" . "1d08b2965e9c239713d2ad397cd12864bad0d305") ("tablist" . "8079801527da1f596bc942162026328d7bdf6ad9") ("transient" . "c7ad1f01f4ff9e5125bcec99dfb9c3dedadfc369") ("treepy.el" . "b40e6b09eb9be45da67b8c9e4990a5a0d7a2a09d") -- 2.20.1 From 41d290a233ff4f54a839184e74b9c86065a30cf5 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Fri, 10 May 2019 00:07:31 -0400 Subject: [PATCH 16/16] emacs: add {early-,}init.el, as exported from init.org in preparation for moving to a regular non-literate config --- .emacs.d/early-init.el | 1 + .emacs.d/init.el | 1557 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1558 insertions(+) create mode 100644 .emacs.d/early-init.el create mode 100644 .emacs.d/init.el diff --git a/.emacs.d/early-init.el b/.emacs.d/early-init.el new file mode 100644 index 0000000..512068a --- /dev/null +++ b/.emacs.d/early-init.el @@ -0,0 +1 @@ +(setq package-enable-at-startup nil) diff --git a/.emacs.d/init.el b/.emacs.d/init.el new file mode 100644 index 0000000..19c4d7a --- /dev/null +++ b/.emacs.d/init.el @@ -0,0 +1,1557 @@ +;;; init.el --- Amin Bandali's Emacs config -*- lexical-binding: t; eval: (view-mode 1) -*- + +;; Copyright (C) 2018-2019 Amin Bandali + +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Emacs configuration of Amin Bandali, computer scientist, functional +;; programmer, and free software advocate. + +;; THIS FILE IS AUTO-GENERATED FROM `init.org'. + +(defvar a/byte-compiled-init nil + "If non-nil, byte-(re)compile init.el on successful tangles.") + +(defvar a/before-user-init-time (current-time) + "Value of `current-time' when Emacs begins loading `user-init-file'.") +(message "Loading Emacs...done (%.3fs)" + (float-time (time-subtract a/before-user-init-time + before-init-time))) + +(defvar a/gc-cons-threshold gc-cons-threshold) +(defvar a/gc-cons-percentage gc-cons-percentage) +(defvar a/file-name-handler-alist file-name-handler-alist) +(setq gc-cons-threshold (* 400 1024 1024) ; 400 MiB + gc-cons-percentage 0.6 + file-name-handler-alist nil + ;; sidesteps a bug when profiling with esup + esup-child-profile-require-level 0) + +(add-hook + 'after-init-hook + (lambda () + (setq gc-cons-threshold a/gc-cons-threshold + gc-cons-percentage a/gc-cons-percentage + file-name-handler-alist a/file-name-handler-alist))) + +(setq message-log-max 20000) + +;; (setq byte-compile-warnings +;; '(not free-vars unresolved noruntime lexical make-local)) + +(setq user-full-name "Amin Bandali" + user-mail-address "amin@bndl.org") + +;; Main engine start... + +(setq straight-repository-branch "develop" + straight-check-for-modifications '(check-on-save find-when-checking)) + +(defun a/bootstrap-straight () + (defvar bootstrap-version) + (let ((bootstrap-file + (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) + (bootstrap-version 5)) + (unless (file-exists-p bootstrap-file) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage))) + +;; Solid rocket booster ignition... + +(defun a/build-init () + (a/bootstrap-straight) + (byte-compile-file "init.el")) + +(a/bootstrap-straight) + +;; We have lift off! + +(setq straight-use-package-by-default t) + +(defmacro use-feature (name &rest args) + "Like `use-package', but with `straight-use-package-by-default' disabled." + (declare (indent defun)) + `(use-package ,name + :straight nil + ,@args)) + +(with-eval-after-load 'recentf + (add-to-list 'recentf-exclude + (expand-file-name "~/.emacs.d/straight/build/"))) + +(defun a/reload-init () + "Reload init.el." + (interactive) + (straight-transaction + (straight-mark-transaction-as-init) + (load (if a/byte-compiled-init + (concat (file-name-sans-extension user-init-file) ".elc") + user-init-file)))) + +(straight-use-package 'use-package) +(if nil ; set to t when need to debug init + (progn + (setq use-package-verbose t + use-package-expand-minimally nil + use-package-compute-statistics t + debug-on-error t) + (require 'use-package)) + (setq use-package-verbose nil + use-package-expand-minimally t)) + +(setq use-package-always-defer t) +(require 'bind-key) + +(use-package no-littering + :demand t + :config + (savehist-mode 1) + (add-to-list 'savehist-additional-variables 'kill-ring) + (save-place-mode 1) + (setq auto-save-file-name-transforms + `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))) + +(use-feature custom + :no-require t + :config + (setq custom-file (no-littering-expand-etc-file-name "custom.el")) + (when (file-exists-p custom-file) + (load custom-file)) + (setf custom-safe-themes t)) + +(with-demoted-errors + (load (no-littering-expand-etc-file-name "secrets"))) + +(use-package exec-path-from-shell + :defer 0.4 + :init + (setq exec-path-from-shell-arguments nil + exec-path-from-shell-check-startup-files nil) + :config + (exec-path-from-shell-initialize) + ;; while we're at it, let's fix access to our running ssh-agent + (exec-path-from-shell-copy-env "SSH_AGENT_PID") + (exec-path-from-shell-copy-env "SSH_AUTH_SOCK")) + +(use-feature server + :defer 0.4 + :config (or (server-running-p) (server-mode))) + +(setq text-scale-mode-step 1.05) + +(setq mouse-autoselect-window t) + +(defun a/no-mouse-autoselect-window () + (make-local-variable 'mouse-autoselect-window) + (setq mouse-autoselect-window nil)) + +(setq ;; scroll-margin 1 + ;; scroll-conservatively 10000 + scroll-step 1 + scroll-conservatively 10 + scroll-preserve-screen-position 1) + +(use-feature mwheel + :defer 0.4 + :config + (setq mouse-wheel-scroll-amount '(1 ((shift) . 1)) ; one line at a time + mouse-wheel-progressive-speed nil ; don't accelerate scrolling + mouse-wheel-follow-mouse t)) ; scroll window under mouse + +(use-feature pixel-scroll + :defer 0.4 + :config (pixel-scroll-mode 1)) + +(setq epg-pinentry-mode 'loopback) + +(require 'cl-lib) +(require 'subr-x) + +(defmacro a/setq-every (value &rest vars) + "Set all the variables from VARS to value VALUE." + (declare (indent defun) (debug t)) + `(progn ,@(mapcar (lambda (x) (list 'setq x value)) vars))) + +(defun a/start-process (program &rest args) + "Same as `start-process', but doesn't bother about name and buffer." + (let ((process-name (concat program "_process")) + (buffer-name (generate-new-buffer-name + (concat program "_output")))) + (apply #'start-process + process-name buffer-name program args))) + +(defun a/dired-start-process (program &optional args) + "Open current file with a PROGRAM." + ;; Shell command looks like this: "program [ARGS]... FILE" (ARGS can + ;; be nil, so remove it). + (apply #'a/start-process + program + (remove nil (list args (dired-get-file-for-visit))))) + +;; (fringe-mode '(3 . 1)) +(fringe-mode nil) + +(setq disabled-command-function nil) + +(setq save-interprogram-paste-before-kill t) + +(setq enable-recursive-minibuffers t + resize-mini-windows t) + +(defalias 'yes-or-no-p #'y-or-n-p) + +(setq initial-buffer-choice t) + +(setq initial-scratch-message nil) + +(setq initial-major-mode 'text-mode) + +(setq inhibit-startup-buffer-menu t) + +(advice-add #'display-startup-echo-area-message :override #'ignore) +(setq inhibit-startup-screen t + inhibit-startup-echo-area-message user-login-name) + +(setq frame-title-format + '("" invocation-name " - " + (:eval (if (buffer-file-name) + (abbreviate-file-name (buffer-file-name)) + "%b")))) + +(setq backup-by-copying t + version-control t + delete-old-versions t) + +(global-auto-revert-mode 1) +(setq auto-revert-verbose nil + global-auto-revert-non-file-buffers nil) + +(setq-default + indent-tabs-mode nil + require-final-newline t + tab-width 4) + +(winner-mode 1) + +(with-eval-after-load 'compile + (defun a/compilation-finish-function (buffer outstr) + (unless (string-match "finished" outstr) + (switch-to-buffer-other-window buffer)) + t) + + (setq compilation-finish-functions #'a/compilation-finish-function) + + (require 'cl-macs) + + (defadvice compilation-start + (around inhibit-display + (command &optional mode name-function highlight-regexp)) + (if (not (string-match "^\\(find\\|grep\\)" command)) + (cl-letf (((symbol-function 'display-buffer) #'ignore)) + (save-window-excursion ad-do-it)) + ad-do-it)) + (ad-activate 'compilation-start)) + +(setq search-default-mode #'char-fold-to-regexp) + +;; uncomment to extend this behaviour to query-replace +;; (setq replace-char-fold t) + +(setq-default cursor-type 'bar) + +(setq isearch-allow-scroll t) + +(bind-keys + ("C-c a i" . ielm) + + ("C-c e b" . eval-buffer) + ("C-c e r" . eval-region) + + ("C-c e i" . emacs-init-time) + ("C-c e u" . emacs-uptime) + + ("C-c F m" . make-frame-command) + ("C-c F d" . delete-frame) + ("C-c F D" . delete-other-frames) + + ("C-c o" . other-window) + + ("C-S-h C" . describe-char) + ("C-S-h F" . describe-face) + + ("C-x k" . kill-this-buffer) + ("C-x K" . kill-buffer) + + ("s-p" . beginning-of-buffer) + ("s-n" . end-of-buffer)) + +(when (display-graphic-p) + (unbind-key "C-z" global-map)) + +(bind-keys + :prefix-map a/straight-prefix-map + :prefix "C-c p s" + ("u" . straight-use-package) + ("f" . straight-freeze-versions) + ("t" . straight-thaw-versions) + ("P" . straight-prune-build) + ("g" . straight-get-recipe) + ("r" . a/reload-init) + ;; M-x ^straight-.*-all$ + ("a c" . straight-check-all) + ("a f" . straight-fetch-all) + ("a m" . straight-merge-all) + ("a n" . straight-normalize-all) + ("a F" . straight-pull-all) + ("a P" . straight-push-all) + ("a r" . straight-rebuild-all) + ;; M-x ^straight-.*-package$ + ("p c" . straight-check-package) + ("p f" . straight-fetch-package) + ("p m" . straight-merge-package) + ("p n" . straight-normalize-package) + ("p F" . straight-pull-package) + ("p P" . straight-push-package) + ("p r" . straight-rebuild-package)) + +(use-package auto-compile + :demand t + :config + (auto-compile-on-load-mode) + (auto-compile-on-save-mode) + (setq auto-compile-display-buffer nil + auto-compile-mode-line-counter t + auto-compile-source-recreate-deletes-dest t + auto-compile-toggle-deletes-nonlib-dest t + auto-compile-update-autoloads t) + (add-hook 'auto-compile-inhibit-compile-hook + 'auto-compile-inhibit-compile-detached-git-head)) + +(straight-use-package 'org-plus-contrib) + +(use-feature org + :defer 0.5 + :config + (setq org-src-tab-acts-natively t + org-src-preserve-indentation nil + org-edit-src-content-indentation 0 + org-link-email-description-format "Email %c: %s" ; %.30s + org-highlight-latex-and-related '(entities) + org-use-speed-commands t + org-startup-folded 'content + org-catch-invisible-edits 'show-and-error + org-log-done 'time) + (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t) + :bind + (("C-c a o a" . org-agenda) + :map org-mode-map + ("M-L" . org-insert-last-stored-link) + ("s-T" . org-todo)) + :hook ((org-mode . org-indent-mode) + (org-mode . auto-fill-mode) + (org-mode . flyspell-mode)) + :custom + (org-agenda-files '("~/usr/org/todos/personal.org" + "~/usr/org/todos/masters.org")) + (org-agenda-start-on-weekday 0) + (org-latex-packages-alist '(("" "listings") ("" "color"))) + :custom-face + '(org-block-begin-line ((t (:foreground "#5a5b5a" :background "#1d1f21")))) + '(org-block ((t (:background "#1d1f21")))) + '(org-latex-and-related ((t (:foreground "#b294bb"))))) + +(use-feature ox-latex + :after ox + :config + (setq org-latex-listings 'listings + ;; org-latex-prefer-user-labels t + ) + (add-to-list 'org-latex-classes + '("IEEEtran" "\\documentclass[11pt]{IEEEtran}" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) + t) + (require 'ox-beamer)) + +(use-feature ox-extra + :config + (ox-extras-activate '(latex-header-blocks ignore-headlines))) + +(with-eval-after-load 'org + (defvar a/show-async-tangle-results nil + "Keep *emacs* async buffers around for later inspection.") + + (defvar a/show-async-tangle-time nil + "Show the time spent tangling the file.") + + (defvar a/async-tangle-post-compile + (when a/byte-compiled-init "make build-init") + "If non-nil, pass to `compile' after successful tangle.") + + ;; TODO: look into why directly byte-compiling init.el causes a + ;; number of problems, including magit-status not loading (busy + ;; waiting). + (defvar a/async-tangle-byte-recompile nil + "If non-nil, byte-recompile the file on successful tangle.") + + (defun a/async-babel-tangle () + "Tangle org file asynchronously." + (interactive) + (let* ((file-tangle-start-time (current-time)) + (file (buffer-file-name)) + (file-nodir (file-name-nondirectory file)) + ;; (async-quiet-switch "-q") + (file-noext (file-name-sans-extension file))) + (async-start + `(lambda () + (require 'org) + (org-babel-tangle-file ,file)) + (unless a/show-async-tangle-results + `(lambda (result) + (if result + (progn + ;; (setq byte-compile-warnings '(not noruntime unresolved)) + (message "Tangled %s%s" + ,file-nodir + (if a/show-async-tangle-time + (format " (%.3fs)" + (float-time (time-subtract (current-time) + ',file-tangle-start-time))) + "")) + (when a/async-tangle-post-compile + (compile a/async-tangle-post-compile)) + (when a/async-tangle-byte-recompile + (byte-recompile-file (concat ,file-noext ".el")))) + (message "Tangling %s failed" ,file-nodir)))))))) + +(add-to-list + 'safe-local-variable-values + '(eval add-hook 'after-save-hook #'a/async-babel-tangle 'append 'local)) + +(use-package magit + :defer 0.5 + :bind (("C-x g" . magit-status) + ("s-g s" . magit-status) + ("s-g l" . magit-log-buffer-file)) + :config + (magit-add-section-hook 'magit-status-sections-hook + 'magit-insert-modules + 'magit-insert-stashes + 'append) + (setq magit-repository-directories '(("~/" . 0) + ("~/src/git/" . 1))) + (nconc magit-section-initial-visibility-alist + '(([unpulled status] . show) + ([unpushed status] . show))) + :custom-face (magit-diff-file-heading ((t (:weight normal))))) + +(use-feature recentf + :defer 0.2 + :config + (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:") + (setq recentf-max-saved-items 40)) + +(use-package smex) + +(use-package ivy + :defer 0.3 + :bind + (:map ivy-minibuffer-map + ([escape] . keyboard-escape-quit) + ([S-up] . ivy-previous-history-element) + ([S-down] . ivy-next-history-element) + ("DEL" . ivy-backward-delete-char)) + :config + (setq ivy-wrap t + ivy-height 14 + ivy-use-virtual-buffers t + ivy-virtual-abbreviate 'abbreviate + ivy-count-format "%d/%d ") + (ivy-mode 1) + ;; :custom-face + ;; (ivy-minibuffer-match-face-2 ((t (:background "#e99ce8" :weight semi-bold)))) + ;; (ivy-minibuffer-match-face-3 ((t (:background "#bbbbff" :weight semi-bold)))) + ;; (ivy-minibuffer-match-face-4 ((t (:background "#ffbbff" :weight semi-bold)))) +) + +(use-package swiper + :after ivy + :bind (("C-s" . swiper-isearch) + ("C-r" . swiper) + ("C-S-s" . isearch-forward))) + +(use-package counsel + :after ivy + :bind (([remap execute-extended-command] . counsel-M-x) + ([remap find-file] . counsel-find-file) + ("C-c x" . counsel-M-x) + ("C-c f ." . counsel-find-file) + ("C-c f l" . counsel-find-library) + :map minibuffer-local-map + ("C-r" . counsel-minibuffer-history)) + :config + (counsel-mode 1) + (defalias 'locate #'counsel-locate)) + +(use-feature eshell + :defer 0.5 + :commands eshell + :bind ("C-c a s e" . eshell) + :config + (eval-when-compile (defvar eshell-prompt-regexp)) + (defun a/eshell-quit-or-delete-char (arg) + (interactive "p") + (if (and (eolp) (looking-back eshell-prompt-regexp nil)) + (eshell-life-is-too-much) + (delete-char arg))) + + (defun a/eshell-clear () + (interactive) + (let ((inhibit-read-only t)) + (erase-buffer)) + (eshell-send-input)) + + (defun a/eshell-setup () + (make-local-variable 'company-idle-delay) + (defvar company-idle-delay) + (setq company-idle-delay nil) + (bind-keys :map eshell-mode-map + ("C-d" . a/eshell-quit-or-delete-char) + ("C-S-l" . a/eshell-clear) + ("M-r" . counsel-esh-history) + ([tab] . company-complete))) + + :hook (eshell-mode . a/eshell-setup) + :custom + (eshell-hist-ignoredups t) + (eshell-input-filter 'eshell-input-filter-initial-space)) + +(use-feature ibuffer + :bind + (("C-x C-b" . ibuffer-other-window) + :map ibuffer-mode-map + ("P" . ibuffer-backward-filter-group) + ("N" . ibuffer-forward-filter-group) + ("M-p" . ibuffer-do-print) + ("M-n" . ibuffer-do-shell-command-pipe-replace)) + :config + ;; Use human readable Size column instead of original one + (define-ibuffer-column size-h + (:name "Size" :inline t) + (cond + ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0))) + ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0))) + ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0))) + (t (format "%8d" (buffer-size))))) + :custom + (ibuffer-saved-filter-groups + '(("default" + ("dired" (mode . dired-mode)) + ("org" (mode . org-mode)) + ("gnus" + (or + (mode . gnus-group-mode) + (mode . gnus-summary-mode) + (mode . gnus-article-mode) + ;; not really, but... + (mode . message-mode))) + ("web" + (or + (mode . web-mode) + (mode . css-mode) + (mode . scss-mode) + (mode . js2-mode))) + ("shell" + (or + (mode . eshell-mode) + (mode . shell-mode) + (mode . term-mode))) + ("programming" + (or + (mode . python-mode) + (mode . c-mode) + (mode . c++-mode) + (mode . java-mode) + (mode . emacs-lisp-mode) + (mode . scheme-mode) + (mode . haskell-mode) + (mode . lean-mode) + (mode . alloy-mode))) + ("tex" + (or + (mode . bibtex-mode) + (mode . latex-mode))) + ("emacs" + (or + (name . "^\\*scratch\\*$") + (name . "^\\*Messages\\*$"))) + ("erc" (mode . erc-mode))))) + (ibuffer-formats + '((mark modified read-only locked " " + (name 18 18 :left :elide) + " " + (size-h 9 -1 :right) + " " + (mode 16 16 :left :elide) + " " filename-and-process) + (mark " " + (name 16 -1) + " " filename))) + :hook (ibuffer . (lambda () (ibuffer-switch-to-saved-filter-groups "default")))) + +(use-feature outline + :hook (prog-mode . outline-minor-mode) + :bind + (:map + outline-minor-mode-map + ("" . outline-toggle-children) + ("M-p" . outline-previous-visible-heading) + ("M-n" . outline-next-visible-heading) + :prefix-map a/outline-prefix-map + :prefix "s-o" + ("TAB" . outline-toggle-children) + ("a" . outline-hide-body) + ("H" . outline-hide-body) + ("S" . outline-show-all) + ("h" . outline-hide-subtree) + ("s" . outline-show-subtree))) + +(use-feature ls-lisp + :custom (ls-lisp-dirs-first t)) + +(use-feature dired + :config + (setq dired-listing-switches "-alh" + ls-lisp-use-insert-directory-program nil) + + ;; easily diff 2 marked files + ;; https://oremacs.com/2017/03/18/dired-ediff/ + (defun dired-ediff-files () + (interactive) + (require 'dired-aux) + (defvar ediff-after-quit-hook-internal) + (let ((files (dired-get-marked-files)) + (wnd (current-window-configuration))) + (if (<= (length files) 2) + (let ((file1 (car files)) + (file2 (if (cdr files) + (cadr files) + (read-file-name + "file: " + (dired-dwim-target-directory))))) + (if (file-newer-than-file-p file1 file2) + (ediff-files file2 file1) + (ediff-files file1 file2)) + (add-hook 'ediff-after-quit-hook-internal + (lambda () + (setq ediff-after-quit-hook-internal nil) + (set-window-configuration wnd)))) + (error "no more than 2 files should be marked")))) + :bind (:map dired-mode-map + ("b" . dired-up-directory) + ("e" . dired-ediff-files) + ("E" . dired-toggle-read-only) + ("\\" . dired-hide-details-mode) + ("z" . (lambda () + (interactive) + (a/dired-start-process "zathura")))) + :hook (dired-mode . dired-hide-details-mode)) + +(use-feature help + :config + (temp-buffer-resize-mode) + (setq help-window-select t)) + +(use-feature tramp + :config + (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:")) + (add-to-list 'tramp-default-proxies-alist '("localhost" nil nil)) + (add-to-list 'tramp-default-proxies-alist + (list (regexp-quote (system-name)) nil nil))) + +(use-package dash + :config (dash-enable-font-lock)) + +(use-package doc-view + :bind (:map doc-view-mode-map + ("M-RET" . image-previous-line))) + +(use-package diff-hl + :config + (setq diff-hl-draw-borders nil) + (global-diff-hl-mode) + :hook (magit-post-refresh . diff-hl-magit-post-refresh)) + +(use-feature eldoc + :when (version< "25" emacs-version) + :config (global-eldoc-mode)) + +(use-feature paren + :demand + :config (show-paren-mode)) + +(use-feature simple + :config (column-number-mode)) + +(use-feature savehist + :config (savehist-mode)) + +(use-feature saveplace + :when (version< "25" emacs-version) + :config (save-place-mode)) + +(use-feature prog-mode + :config (global-prettify-symbols-mode) + (defun indicate-buffer-boundaries-left () + (setq indicate-buffer-boundaries 'left)) + (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left)) + +(use-feature text-mode + :hook ((text-mode . indicate-buffer-boundaries-left) + (text-mode . abbrev-mode))) + +(use-package company + :defer 0.6 + :bind + (:map company-active-map + ([tab] . company-complete-common-or-cycle) + ([escape] . company-abort)) + :custom + (company-minimum-prefix-length 1) + (company-selection-wrap-around t) + (company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]") + (company-dabbrev-downcase nil) + (company-dabbrev-ignore-case nil) + :config + (global-company-mode t)) + +(use-package flycheck + :defer 0.6 + :hook (prog-mode . flycheck-mode) + :bind + (:map flycheck-mode-map + ("M-P" . flycheck-previous-error) + ("M-N" . flycheck-next-error)) + :config + ;; Use the load-path from running Emacs when checking elisp files + (setq flycheck-emacs-lisp-load-path 'inherit) + + ;; Only flycheck when I actually save the buffer + (setq flycheck-check-syntax-automatically '(mode-enabled save))) + +;; http://endlessparentheses.com/ispell-and-apostrophes.html +(use-package ispell + :defer 0.6 + :config + ;; ’ can be part of a word + (setq ispell-local-dictionary-alist + `((nil "[[:alpha:]]" "[^[:alpha:]]" + "['\x2019]" nil ("-B") nil utf-8))) + ;; don't send ’ to the subprocess + (defun endless/replace-apostrophe (args) + (cons (replace-regexp-in-string + "’" "'" (car args)) + (cdr args))) + (advice-add #'ispell-send-string :filter-args + #'endless/replace-apostrophe) + + ;; convert ' back to ’ from the subprocess + (defun endless/replace-quote (args) + (if (not (derived-mode-p 'org-mode)) + args + (cons (replace-regexp-in-string + "'" "’" (car args)) + (cdr args)))) + (advice-add #'ispell-parse-output :filter-args + #'endless/replace-quote)) + +(use-feature lisp-mode + :config + (add-hook 'emacs-lisp-mode-hook 'outline-minor-mode) + (add-hook 'emacs-lisp-mode-hook 'reveal-mode) + (defun indent-spaces-mode () + (setq indent-tabs-mode nil)) + (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode)) + +(use-package alloy-mode + :straight (:host github :repo "dwwmmn/alloy-mode") + :mode "\\.als\\'" + :config (setq alloy-basic-offset 2)) + +(use-package proof-site ; Proof General + :straight proof-general) + +(eval-when-compile (defvar lean-mode-map)) +(use-package lean-mode + :defer 0.4 + :bind (:map lean-mode-map + ("S-SPC" . company-complete)) + :config + (require 'lean-input) + (setq default-input-method "Lean" + lean-input-tweak-all '(lean-input-compose + (lean-input-prepend "/") + (lean-input-nonempty)) + lean-input-user-translations '(("/" "/"))) + (lean-input-setup)) + +(use-package haskell-mode + :config + (setq haskell-indentation-layout-offset 4 + haskell-indentation-left-offset 4 + flycheck-checker 'haskell-hlint + flycheck-disabled-checkers '(haskell-stack-ghc haskell-ghc))) + +(use-package dante + :after haskell-mode + :commands dante-mode + :hook (haskell-mode . dante-mode)) + +(use-package hlint-refactor + :after haskell-mode + :bind (:map hlint-refactor-mode-map + ("C-c l b" . hlint-refactor-refactor-buffer) + ("C-c l r" . hlint-refactor-refactor-at-point)) + :hook (haskell-mode . hlint-refactor-mode)) + +(use-package flycheck-haskell + :after haskell-mode) + +(use-package sgml-mode + :config + (setq sgml-basic-offset 2)) + +(use-package css-mode + :config + (setq css-indent-offset 2)) + +(use-package web-mode + :mode "\\.html\\'" + :config + (a/setq-every 2 + web-mode-code-indent-offset + web-mode-css-indent-offset + web-mode-markup-indent-offset)) + +(use-package emmet-mode + :after (:any web-mode css-mode sgml-mode) + :bind* (("C-)" . emmet-next-edit-point) + ("C-(" . emmet-prev-edit-point)) + :config + (unbind-key "C-j" emmet-mode-keymap) + (setq emmet-move-cursor-between-quotes t) + :hook (web-mode css-mode html-mode sgml-mode)) + +(use-package geiser) + +(use-feature geiser-guile + :config + (setq geiser-guile-load-path "~/src/git/guix")) + +(use-package guix) + +(use-feature man + :config (setq Man-width 80)) + +(use-package which-key + :defer 0.4 + :config + (which-key-add-key-based-replacements + ;; prefixes for global prefixes and minor modes + "C-c @" "outline" + "C-c !" "flycheck" + "C-c 8" "typo" + "C-c 8 -" "typo/dashes" + "C-c 8 <" "typo/left-brackets" + "C-c 8 >" "typo/right-brackets" + "C-x 8" "unicode" + "C-x a" "abbrev/expand" + "C-x r" "rectangle/register/bookmark" + "C-x v" "version control" + ;; prefixes for my personal bindings + "C-c a" "applications" + "C-c a e" "erc" + "C-c a o" "org" + "C-c a s" "shells" + "C-c p" "package-management" + ;; "C-c p e" "package-management/epkg" + "C-c p s" "straight.el" + "C-c psa" "all" + "C-c psp" "package" + "C-c c" "compile-and-comments" + "C-c e" "eval" + "C-c f" "files" + "C-c F" "frames" + "C-S-h" "help(ful)" + "C-c m" "multiple-cursors" + "C-c P" "projectile" + "C-c P s" "projectile/search" + "C-c P x" "projectile/execute" + "C-c P 4" "projectile/other-window" + "C-c q" "boxquote" + "s-g" "magit" + "s-o" "outline" + "s-t" "themes") + + ;; prefixes for major modes + (which-key-add-major-mode-key-based-replacements 'message-mode + "C-c f" "footnote") + (which-key-add-major-mode-key-based-replacements 'org-mode + "C-c C-v" "org-babel") + (which-key-add-major-mode-key-based-replacements 'web-mode + "C-c C-a" "web/attributes" + "C-c C-b" "web/blocks" + "C-c C-d" "web/dom" + "C-c C-e" "web/element" + "C-c C-t" "web/tags") + + (which-key-mode) + :custom + (which-key-add-column-padding 5) + (which-key-max-description-length 32)) + +(add-to-list 'custom-theme-load-path "~/.emacs.d/lisp") +(load-theme 'tangomod t) + +(use-package smart-mode-line + :commands (sml/apply-theme) + :demand + :config + (sml/setup)) + +(use-package doom-themes) + +(defvar a/org-mode-font-lock-keywords + '(("[ \t]*\\(#\\+\\(BEGIN\\|END\\|begin\\|end\\)_\\(\\S-+\\)\\)[ \t]*\\([^\n:]*\\)" + (1 '(:foreground "#5a5b5a" :background "#292b2b") t) ; directive + (3 '(:foreground "#81a2be" :background "#292b2b") t) ; kind + (4 '(:foreground "#c5c8c6") t)))) ; title + +(defun a/lights-on () + "Enable my favourite light theme." + (interactive) + (mapc #'disable-theme custom-enabled-themes) + (load-theme 'tangomod t) + (sml/apply-theme 'automatic) + (font-lock-remove-keywords + 'org-mode a/org-mode-font-lock-keywords)) + +(defun a/lights-off () + "Go dark." + (interactive) + (mapc #'disable-theme custom-enabled-themes) + (load-theme 'doom-tomorrow-night t) + (sml/apply-theme 'automatic) + (font-lock-add-keywords + 'org-mode a/org-mode-font-lock-keywords t)) + +(bind-keys + ("s-t d" . a/lights-off) + ("s-t l" . a/lights-on)) + +(use-package crux ; results in Waiting for git... [2 times] + :defer 0.4 + :bind (("C-c b k" . crux-kill-other-buffers) + ("C-c d" . crux-duplicate-current-line-or-region) + ("C-c D" . crux-duplicate-and-comment-current-line-or-region) + ("C-c f c" . crux-copy-file-preserve-attributes) + ("C-c f d" . crux-delete-file-and-buffer) + ("C-c f r" . crux-rename-file-and-buffer) + ("C-c j" . crux-top-join-line) + ("C-S-j" . crux-top-join-line))) + +(use-package mwim + :bind (("C-a" . mwim-beginning-of-code-or-line) + ("C-e" . mwim-end-of-code-or-line) + ("" . mwim-beginning-of-line-or-code) + ("" . mwim-end-of-line-or-code))) + +(use-package projectile + :bind-keymap ("C-c P" . projectile-command-map) + :config + (projectile-mode) + + (defun my-projectile-invalidate-cache (&rest _args) + ;; ignore the args to `magit-checkout' + (projectile-invalidate-cache nil)) + + (eval-after-load 'magit-branch + '(progn + (advice-add 'magit-checkout + :after #'my-projectile-invalidate-cache) + (advice-add 'magit-branch-and-checkout + :after #'my-projectile-invalidate-cache))) + :custom (projectile-completion-system 'ivy)) + +(use-package helpful + :defer 0.6 + :bind + (("C-S-h c" . helpful-command) + ("C-S-h f" . helpful-callable) ; helpful-function + ("C-S-h v" . helpful-variable) + ("C-S-h k" . helpful-key) + ("C-S-h p" . helpful-at-point))) + +(use-package unkillable-scratch + :defer 0.6 + :config + (unkillable-scratch 1) + :custom + (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$"))) + +(use-package boxquote + :defer 0.6 + :bind + (:prefix-map a/boxquote-prefix-map + :prefix "C-c q" + ("b" . boxquote-buffer) + ("B" . boxquote-insert-buffer) + ("d" . boxquote-defun) + ("F" . boxquote-insert-file) + ("hf" . boxquote-describe-function) + ("hk" . boxquote-describe-key) + ("hv" . boxquote-describe-variable) + ("hw" . boxquote-where-is) + ("k" . boxquote-kill) + ("p" . boxquote-paragraph) + ("q" . boxquote-boxquote) + ("r" . boxquote-region) + ("s" . boxquote-shell-command) + ("t" . boxquote-text) + ("T" . boxquote-title) + ("u" . boxquote-unbox) + ("U" . boxquote-unbox-region) + ("y" . boxquote-yank) + ("M-q" . boxquote-fill-paragraph) + ("M-w" . boxquote-kill-ring-save))) + +(use-package orgalist + :disabled t + :after message + :hook (message-mode . orgalist-mode)) + +(use-package typo + :defer 0.5 + :config + (typo-global-mode 1) + :hook (text-mode . typo-mode)) + +(use-package hl-todo + :defer 0.5 + :config + (global-hl-todo-mode)) + +(use-package shrink-path + :defer 0.5 + :after eshell + :config + (defvar user-@-host (concat (user-login-name) "@" (system-name) " ")) + (defun +eshell/prompt () + (let ((base/dir (shrink-path-prompt default-directory))) + (concat (propertize user-@-host 'face 'default) + (propertize (car base/dir) + 'face 'font-lock-comment-face) + (propertize (cdr base/dir) + 'face 'font-lock-constant-face) + (propertize "> " 'face 'default)))) + (setq eshell-prompt-regexp (concat user-@-host ".*> ") + eshell-prompt-function #'+eshell/prompt)) + +(use-package eshell-up + :after eshell + :commands eshell-up) + +(use-package multi-term + :defer 0.6 + :bind (("C-c a s m" . multi-term-dedicated-toggle) + :map term-mode-map + ("C-c C-j" . term-char-mode) + :map term-raw-map + ("C-c C-j" . term-line-mode)) + :config + (setq multi-term-program "/bin/screen" + ;; TODO: add separate bindings for connecting to existing + ;; session vs. always creating a new one + multi-term-dedicated-select-after-open-p t + multi-term-dedicated-window-height 20 + multi-term-dedicated-max-window-height 30 + term-bind-key-alist + '(("C-c C-c" . term-interrupt-subjob) + ("C-c C-e" . term-send-esc) + ("C-k" . kill-line) + ("C-y" . term-paste) + ("M-f" . term-send-forward-word) + ("M-b" . term-send-backward-word) + ("M-p" . term-send-up) + ("M-n" . term-send-down) + ("" . term-send-backward-kill-word) + ("" . term-send-backward-kill-word) + ("M-d" . term-send-delete-word) + ("M-," . term-send-raw) + ("M-." . comint-dynamic-complete)) + term-unbind-key-alist + '("C-z" "C-x" "C-c" "C-h" "C-y" ""))) + +(use-package page-break-lines + :config + (global-page-break-lines-mode)) + +(use-package expand-region + :bind ("C-=" . er/expand-region)) + +(use-package multiple-cursors + :bind + (("C-S-" . mc/add-cursor-on-click) + (:prefix-map a/mc-prefix-map + :prefix "C-c m" + ("c" . mc/edit-lines) + ("n" . mc/mark-next-like-this) + ("p" . mc/mark-previous-like-this) + ("a" . mc/mark-all-like-this)))) + +(use-package forge + :after magit + :demand) + +(use-package yasnippet + :defer 0.6 + :config + (defconst yas-verbosity-cur yas-verbosity) + (setq yas-verbosity 2) + (add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets") + (yas-reload-all) + (setq yas-verbosity yas-verbosity-cur) + :hook + (text-mode . yas-minor-mode)) + +(use-package debbugs + :straight (debbugs + :host github + :repo "emacs-straight/debbugs" + :files (:defaults "Debbugs.wsdl"))) + +(use-package org-ref + :init + (a/setq-every '("~/usr/org/references.bib") + reftex-default-bibliography + org-ref-default-bibliography) + (setq + org-ref-bibliography-notes "~/usr/org/notes.org" + org-ref-pdf-directory "~/usr/org/bibtex-pdfs/")) + +(use-package slack + :commands (slack-start) + :init + (eval-when-compile ; silence the byte-compiler + (defvar url-http-data nil) + (defvar url-http-extra-headers nil) + (defvar url-http-method nil) + (defvar url-callback-function nil) + (defvar url-callback-arguments nil) + (defvar oauth--token-data nil)) + (setq slack-buffer-emojify t + slack-prefer-current-team t) + :config + (slack-register-team + :name "nday-students" + :default t + :token nday-students-token + :subscribed-channels '(general) + :full-and-display-names t) + (add-to-list 'swiper-font-lock-exclude 'slack-message-buffer-mode t) + (setq lui-time-stamp-format "[%Y-%m-%d %H:%M:%S]" + lui-time-stamp-only-when-changed-p t + lui-time-stamp-position 'right) + :bind + (("C-c s s" . slack-start) + ("C-c s u" . slack-select-unread-rooms) + ("C-c s b" . slack-select-rooms) + ("C-c s t" . slack-change-current-team) + ("C-c s c" . slack-ws-close) + :map slack-mode-map + ("M-p" . slack-buffer-goto-prev-message) + ("M-n" . slack-buffer-goto-next-message) + ("C-c e" . slack-message-edit) + ("C-c k" . slack-message-delete) + ("C-c C-k" . slack-channel-leave) + ("C-c r a" . slack-message-add-reaction) + ("C-c r r" . slack-message-remove-reaction) + ("C-c r s" . slack-message-show-reaction-users) + ("C-c p l" . slack-room-pins-list) + ("C-c p a" . slack-message-pins-add) + ("C-c p r" . slack-message-pins-remove) + ("@" . slack-message-embed-mention) + ("#" . slack-message-embed-channel))) + +(use-package alert + :commands (alert) + :init + (setq alert-default-style 'notifier)) + +(defvar a/maildir (expand-file-name "~/mail/")) +(with-eval-after-load 'recentf + (add-to-list 'recentf-exclude a/maildir)) + +(setq + a/gnus-init-file (no-littering-expand-etc-file-name "gnus") + mail-user-agent 'gnus-user-agent + read-mail-command 'gnus) + +(use-feature gnus + :bind (("s-m" . gnus) + ("s-M" . gnus-unplugged)) + :init + (setq + gnus-select-method '(nnnil "") + gnus-secondary-select-methods + '((nnimap "amin" + (nnimap-stream plain) + (nnimap-address "127.0.0.1") + (nnimap-server-port 143) + (nnimap-authenticator plain) + (nnimap-user "amin@bndl.org")) + (nnimap "uwaterloo" + (nnimap-stream plain) + (nnimap-address "127.0.0.1") + (nnimap-server-port 143) + (nnimap-authenticator plain) + (nnimap-user "abandali@uwaterloo.ca")) + (nnimap "csclub" + (nnimap-stream plain) + (nnimap-address "127.0.0.1") + (nnimap-server-port 143) + (nnimap-authenticator plain) + (nnimap-user "abandali@csclub.uw"))) + gnus-message-archive-group "nnimap+amin:Sent" + gnus-parameters + '(("gnu\\.deepspec" + (to-address . "deepspec@lists.cs.princeton.edu") + (to-list . "deepspec@lists.cs.princeton.edu")) + ("gnu\\.emacs-devel" + (to-address . "emacs-devel@gnu.org") + (to-list . "emacs-devel@gnu.org")) + ("gnu\\.emacs-orgmode" + (to-address . "emacs-orgmode@gnu.org") + (to-list . "emacs-orgmode@gnu.org")) + ("gnu\\.emacsconf-discuss" + (to-address . "emacsconf-discuss@gnu.org") + (to-list . "emacsconf-discuss@gnu.org")) + ("gnu\\.fencepost-users" + (to-address . "fencepost-users@gnu.org") + (to-list . "fencepost-users@gnu.org")) + ("gnu\\.gnunet-developers" + (to-address . "gnunet-developers@gnu.org") + (to-list . "gnunet-developers@gnu.org")) + ("gnu\\.guile-devel" + (to-address . "guile-devel@gnu.org") + (to-list . "guile-devel@gnu.org")) + ("gnu\\.guix-devel" + (to-address . "guix-devel@gnu.org") + (to-list . "guix-devel@gnu.org")) + ("gnu\\.haskell-art" + (to-address . "haskell-art@we.lurk.org") + (to-list . "haskell-art@we.lurk.org")) + ("gnu\\.haskell-cafe" + (to-address . "haskell-cafe@haskell.org") + (to-list . "haskell-cafe@haskell.org")) + ("gnu\\.help-gnu-emacs" + (to-address . "help-gnu-emacs@gnu.org") + (to-list . "help-gnu-emacs@gnu.org")) + ("gnu\\.info-gnu-emacs" + (to-address . "info-gnu-emacs@gnu.org") + (to-list . "info-gnu-emacs@gnu.org")) + ("gnu\\.info-guix" + (to-address . "info-guix@gnu.org") + (to-list . "info-guix@gnu.org")) + ("gnu\\.notmuch" + (to-address . "notmuch@notmuchmail.org") + (to-list . "notmuch@notmuchmail.org")) + ("gnu\\.parabola-dev" + (to-address . "dev@lists.parabola.nu") + (to-list . "dev@lists.parabola.nu")) + ("gnu\\.webmasters" + (to-address . "webmasters@gnu.org") + (to-list . "webmasters@gnu.org")) + ("gnu\\.www-commits" + (to-address . "www-commits@gnu.org") + (to-list . "www-commits@gnu.org")) + ("gnu\\.www-discuss" + (to-address . "www-discuss@gnu.org") + (to-list . "www-discuss@gnu.org")) + ("gnu\\.~bandali\\.public-inbox" + (to-address . "~bandali/public-inbox@lists.sr.ht") + (to-list . "~bandali/public-inbox@lists.sr.ht")) + ("gnu\\.~sircmpwn\\.srht-admins" + (to-address . "~sircmpwn/sr.ht-admins@lists.sr.ht") + (to-list . "~sircmpwn/sr.ht-admins@lists.sr.ht")) + ("gnu\\.~sircmpwn\\.srht-announce" + (to-address . "~sircmpwn/sr.ht-announce@lists.sr.ht") + (to-list . "~sircmpwn/sr.ht-announce@lists.sr.ht")) + ("gnu\\.~sircmpwn\\.srht-dev" + (to-address . "~sircmpwn/sr.ht-dev@lists.sr.ht") + (to-list . "~sircmpwn/sr.ht-dev@lists.sr.ht")) + ("gnu\\.~sircmpwn\\.srht-discuss" + (to-address . "~sircmpwn/sr.ht-discuss@lists.sr.ht") + (to-list . "~sircmpwn/sr.ht-discuss@lists.sr.ht")) + ("gnu.*" + (gcc-self . t)) + ("gnu\\." + (subscribed . t))) + gnus-large-newsgroup 50 + gnus-home-directory (no-littering-expand-var-file-name "gnus/") + gnus-directory (concat gnus-home-directory "news/") + message-directory (concat gnus-home-directory "mail/") + nndraft-directory (concat gnus-home-directory "drafts/") + gnus-save-newsrc-file nil + gnus-read-newsrc-file nil + gnus-interactive-exit nil + gnus-gcc-mark-as-read t) + :config + (require 'ebdb) + (require 'ebdb-mua) + (require 'ebdb-gnus) + + (with-eval-after-load 'recentf + (add-to-list 'recentf-exclude gnus-home-directory))) + +(use-feature gnus-art + :config + (setq + gnus-visible-headers + (concat gnus-visible-headers "\\|^List-Id:\\|^X-RT-Originator:\\|^User-Agent:") + gnus-sorted-header-list + '("^From:" "^Subject:" "^Summary:" "^Keywords:" + "^Followup-To:" "^To:" "^Cc:" "X-RT-Originator" + "^Newsgroups:" "List-Id:" "^Organization:" + "^User-Agent:" "^Date:") + ;; local-lapsed article dates + ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11 + gnus-article-date-headers '(user-defined) + gnus-article-time-format + (lambda (time) + (let* ((date (format-time-string "%a, %d %b %Y %T %z" time)) + (local (article-make-date-line date 'local)) + (combined-lapsed (article-make-date-line date + 'combined-lapsed)) + (lapsed (progn + (string-match " (.+" combined-lapsed) + (match-string 0 combined-lapsed)))) + (concat local lapsed)))) + (bind-keys + :map gnus-article-mode-map + ("M-L" . org-store-link))) + +(use-feature gnus-sum + :bind (:map gnus-summary-mode-map + :prefix-map a/gnus-summary-prefix-map + :prefix "v" + ("r" . gnus-summary-reply) + ("w" . gnus-summary-wide-reply) + ("v" . gnus-summary-show-raw-article)) + :config + (bind-keys + :map gnus-summary-mode-map + ("M-L" . org-store-link)) + :hook (gnus-summary-mode . a/no-mouse-autoselect-window)) + +(use-feature gnus-msg + :config + (setq gnus-posting-styles + '((".*" + (address "amin@bndl.org") + (body "\nBest,\n") + (eval (setq a/message-cite-say-hi t))) + ("gnu.*" + (address "bandali@gnu.org") + (eval (set (make-local-variable 'message-user-fqdn) "fencepost.gnu.org"))) + ((header "subject" "ThankCRM") + (to "webmasters-comment@gnu.org") + (body "Added to 2019supporters.html.\n\nMoving to campaigns.\n\n-amin\n") + (eval (setq a/message-cite-say-hi nil))) + ("nnimap\\+uwaterloo:.*" + (address "abandali@uwaterloo.ca") + (gcc "\"nnimap+uwaterloo:Sent Items\"")) + ("nnimap\\+csclub:.*" + (address "abandali@csclub.uwaterloo.ca") + (gcc "nnimap+csclub:Sent"))))) + +(use-feature gnus-topic + :hook (gnus-group-mode . gnus-topic-mode) + :config (setq gnus-topic-line-format "%i[ %A: %(%{%n%}%) ]%v\n")) + +(use-feature gnus-agent + :config + (setq gnus-agent-synchronize-flags 'ask) + :hook (gnus-group-mode . gnus-agent-mode)) + +(use-feature gnus-group + :config + (setq gnus-permanently-visible-groups "\\(:INBOX$\\|:gnu$\\)")) + +(use-feature mm-decode + :config + (setq mm-discouraged-alternatives '("text/html" "text/richtext"))) + +(use-feature sendmail + :config + (setq sendmail-program "/usr/bin/msmtp" + ;; message-sendmail-extra-arguments '("-v" "-d") + mail-specify-envelope-from t + mail-envelope-from 'header)) + +(use-feature message + :config + ;; redefine for a simplified In-Reply-To header + ;; (see https://todo.sr.ht/~sircmpwn/lists.sr.ht/67) + (defun message-make-in-reply-to () + "Return the In-Reply-To header for this message." + (when message-reply-headers + (let ((from (mail-header-from message-reply-headers)) + (msg-id (mail-header-id message-reply-headers))) + (when from + msg-id)))) + + (defconst a/message-cite-style-format "On %Y-%m-%d %l:%M %p, %N wrote:") + (defconst message-cite-style-bandali + '((message-cite-function 'message-cite-original) + (message-citation-line-function 'message-insert-formatted-citation-line) + (message-cite-reply-position 'traditional) + (message-yank-prefix "> ") + (message-yank-cited-prefix ">") + (message-yank-empty-prefix ">") + (message-citation-line-format + (if a/message-cite-say-hi + (concat "Hi %F,\n\n" a/message-cite-style-format) + a/message-cite-style-format))) + "Citation style based on Mozilla Thunderbird's. Use with message-cite-style.") + (setq ;; message-cite-style 'message-cite-style-bandali + message-kill-buffer-on-exit t + message-send-mail-function 'message-send-mail-with-sendmail + message-sendmail-envelope-from 'header + message-subscribed-address-functions + '(gnus-find-subscribed-addresses) + message-dont-reply-to-names + "\\(\\(amin@bndl\\.org\\)\\|\\(.*@\\(aminb\\|amin\\.bndl\\)\\.org\\)\\|\\(\\(bandali\\|aminb?\\|mab\\)@gnu\\.org\\)\\|\\(a\\(min\\.\\)?bandali@uwaterloo\\.ca\\)\\|\\(abandali@csclub\\.uwaterloo\\.ca\\)\\)") + (require 'company-ebdb) + :hook (;; (message-setup . mml-secure-message-sign-pgpmime) + (message-mode . flyspell-mode) + (message-mode . (lambda () + ;; (setq fill-column 65 + ;; message-fill-column 65) + (make-local-variable 'company-idle-delay) + (setq company-idle-delay 0.2)))) + ;; :custom-face + ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold)))) + ;; (message-header-to ((t (:foreground "#111" :weight normal)))) + ;; (message-header-cc ((t (:foreground "#333" :weight normal)))) + ) + +(with-eval-after-load 'mml-sec + (setq mml-secure-openpgp-encrypt-to-self t + mml-secure-openpgp-sign-with-sender t)) + +(use-feature footnote + :after message + ;; :config + ;; (setq footnote-start-tag "" + ;; footnote-end-tag "" + ;; footnote-style 'unicode) + :bind + (:map message-mode-map + :prefix-map a/footnote-prefix-map + :prefix "C-c f" + ("a" . footnote-add-footnote) + ("b" . footnote-back-to-message) + ("c" . footnote-cycle-style) + ("d" . footnote-delete-footnote) + ("g" . footnote-goto-footnote) + ("r" . footnote-renumber-footnotes) + ("s" . footnote-set-style))) + +(use-package ebdb + :straight (:host github :repo "girzel/ebdb") + :after gnus + :bind (:map gnus-group-mode-map ("e" . ebdb)) + :config + (setq ebdb-sources (no-littering-expand-var-file-name "ebdb")) + (with-eval-after-load 'swiper + (add-to-list 'swiper-font-lock-exclude 'ebdb-mode t))) + +(use-feature ebdb-com + :after ebdb) + +;; (use-package ebdb-complete +;; :after ebdb +;; :config +;; (ebdb-complete-enable)) + +(use-package company-ebdb + :config + (defun company-ebdb--post-complete (_) nil)) + +(use-feature ebdb-gnus + :after ebdb + :custom + (ebdb-gnus-window-configuration + '(article + (vertical 1.0 + (summary 0.25 point) + (horizontal 1.0 + (article 1.0) + (ebdb-gnus 0.3)))))) + +(use-feature ebdb-mua + :after ebdb + ;; :custom (ebdb-mua-pop-up nil) + ) + +;; (use-package ebdb-message +;; :after ebdb) + + +;; (use-package ebdb-vcard +;; :after ebdb) + +(use-package message-x) + +(use-package znc + :straight (:host nil :repo "https://git.bndl.org/amin/znc.el") + :bind (("C-c a e e" . znc-erc) + ("C-c a e a" . znc-all)) + :config + (let ((pwd (let ((auth (auth-source-search :host "znca"))) + (cond + ((null auth) (error "Couldn't find znca's authinfo")) + (t (funcall (plist-get (car auth) :secret))))))) + (setq znc-servers + `(("znc.bndl.org" 1337 t + ((freenode "amin/freenode" ,pwd))) + ("znc.bndl.org" 1337 t + ((moznet "amin/moznet" ,pwd))))))) + +(message "Loading %s...done (%.3fs)" user-init-file + (float-time (time-subtract (current-time) + a/before-user-init-time))) + +;;; init.el ends here -- 2.20.1