From 2ec18855d6d4e144776551dfb4921e1b133dfd29 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Sat, 11 Apr 2020 23:54:33 -0400 Subject: move emacs files from .emacs.d to . this repository's root will be ~/.emacs.d (again) from now on --- .emacs.d/early-init.el | 1 - .emacs.d/etc/.dir-locals.el | 4 - .emacs.d/etc/custom.el | 228 -- .emacs.d/etc/secrets.el | 5 - .emacs.d/etc/yasnippet/snippets/java-mode/format | 5 - .emacs.d/etc/yasnippet/snippets/java-mode/new | 5 - .emacs.d/etc/yasnippet/snippets/java-mode/printf | 5 - .emacs.d/etc/yasnippet/snippets/java-mode/println | 5 - .emacs.d/etc/yasnippet/snippets/java-mode/return | 5 - .emacs.d/etc/yasnippet/snippets/latex-mode/cite | 5 - .emacs.d/etc/yasnippet/snippets/latex-mode/eg | 5 - .emacs.d/etc/yasnippet/snippets/latex-mode/emph | 5 - .../etc/yasnippet/snippets/latex-mode/enumerate | 7 - .emacs.d/etc/yasnippet/snippets/latex-mode/etc | 5 - .emacs.d/etc/yasnippet/snippets/latex-mode/ie | 5 - .emacs.d/etc/yasnippet/snippets/latex-mode/itemize | 7 - .emacs.d/etc/yasnippet/snippets/latex-mode/label | 5 - .../etc/yasnippet/snippets/latex-mode/newcommand | 5 - .emacs.d/etc/yasnippet/snippets/latex-mode/ref | 5 - .emacs.d/etc/yasnippet/snippets/latex-mode/section | 8 - .../etc/yasnippet/snippets/latex-mode/subsection | 8 - .emacs.d/etc/yasnippet/snippets/latex-mode/textbf | 5 - .emacs.d/etc/yasnippet/snippets/latex-mode/texttt | 5 - .../etc/yasnippet/snippets/latex-mode/usepackage | 5 - .../etc/yasnippet/snippets/log-edit-mode/thankgnu | 5 - .../etc/yasnippet/snippets/message-mode/thankgnu | 7 - .emacs.d/init.el | 2557 -------------------- .emacs.d/lisp/gnus-article-treat-patch.el | 465 ---- .emacs.d/lisp/smart-mode-line-tangomod-theme.el | 51 - .emacs.d/lisp/tangomod-theme.el | 154 -- .emacs.d/straight/versions/default.el | 97 - .emacs.d/var/abbrev.el | 5 - .emacs.d/var/eshell/alias | 19 - .gitignore | 2 +- early-init.el | 1 + etc/.dir-locals.el | 4 + etc/custom.el | 228 ++ etc/secrets.el | 5 + etc/yasnippet/snippets/java-mode/format | 5 + etc/yasnippet/snippets/java-mode/new | 5 + etc/yasnippet/snippets/java-mode/printf | 5 + etc/yasnippet/snippets/java-mode/println | 5 + etc/yasnippet/snippets/java-mode/return | 5 + etc/yasnippet/snippets/latex-mode/cite | 5 + etc/yasnippet/snippets/latex-mode/eg | 5 + etc/yasnippet/snippets/latex-mode/emph | 5 + etc/yasnippet/snippets/latex-mode/enumerate | 7 + etc/yasnippet/snippets/latex-mode/etal | 5 + etc/yasnippet/snippets/latex-mode/etc | 5 + etc/yasnippet/snippets/latex-mode/ie | 5 + etc/yasnippet/snippets/latex-mode/itemize | 7 + etc/yasnippet/snippets/latex-mode/label | 5 + etc/yasnippet/snippets/latex-mode/newcommand | 5 + etc/yasnippet/snippets/latex-mode/ref | 5 + etc/yasnippet/snippets/latex-mode/section | 8 + etc/yasnippet/snippets/latex-mode/subsection | 8 + etc/yasnippet/snippets/latex-mode/textbf | 5 + etc/yasnippet/snippets/latex-mode/texttt | 5 + etc/yasnippet/snippets/latex-mode/usepackage | 5 + etc/yasnippet/snippets/log-edit-mode/thankgnu | 5 + etc/yasnippet/snippets/message-mode/thankgnu | 7 + init.el | 2557 ++++++++++++++++++++ lisp/gnus-article-treat-patch.el | 465 ++++ lisp/smart-mode-line-tangomod-theme.el | 51 + lisp/tangomod-theme.el | 154 ++ var/abbrev.el | 5 + var/eshell/alias | 19 + 67 files changed, 3617 insertions(+), 3709 deletions(-) delete mode 100644 .emacs.d/early-init.el delete mode 100644 .emacs.d/etc/.dir-locals.el delete mode 100644 .emacs.d/etc/custom.el delete mode 100644 .emacs.d/etc/secrets.el delete mode 100644 .emacs.d/etc/yasnippet/snippets/java-mode/format delete mode 100644 .emacs.d/etc/yasnippet/snippets/java-mode/new delete mode 100644 .emacs.d/etc/yasnippet/snippets/java-mode/printf delete mode 100644 .emacs.d/etc/yasnippet/snippets/java-mode/println delete mode 100644 .emacs.d/etc/yasnippet/snippets/java-mode/return delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/cite delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/eg delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/emph delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/enumerate delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/etc delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/ie delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/itemize delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/label delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/newcommand delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/ref delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/section delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/subsection delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/textbf delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/texttt delete mode 100644 .emacs.d/etc/yasnippet/snippets/latex-mode/usepackage delete mode 100644 .emacs.d/etc/yasnippet/snippets/log-edit-mode/thankgnu delete mode 100644 .emacs.d/etc/yasnippet/snippets/message-mode/thankgnu delete mode 100644 .emacs.d/init.el delete mode 100644 .emacs.d/lisp/gnus-article-treat-patch.el delete mode 100644 .emacs.d/lisp/smart-mode-line-tangomod-theme.el delete mode 100644 .emacs.d/lisp/tangomod-theme.el delete mode 100644 .emacs.d/straight/versions/default.el delete mode 100644 .emacs.d/var/abbrev.el delete mode 100644 .emacs.d/var/eshell/alias create mode 100644 early-init.el create mode 100644 etc/.dir-locals.el create mode 100644 etc/custom.el create mode 100644 etc/secrets.el create mode 100644 etc/yasnippet/snippets/java-mode/format create mode 100644 etc/yasnippet/snippets/java-mode/new create mode 100644 etc/yasnippet/snippets/java-mode/printf create mode 100644 etc/yasnippet/snippets/java-mode/println create mode 100644 etc/yasnippet/snippets/java-mode/return create mode 100644 etc/yasnippet/snippets/latex-mode/cite create mode 100644 etc/yasnippet/snippets/latex-mode/eg create mode 100644 etc/yasnippet/snippets/latex-mode/emph create mode 100644 etc/yasnippet/snippets/latex-mode/enumerate create mode 100644 etc/yasnippet/snippets/latex-mode/etal create mode 100644 etc/yasnippet/snippets/latex-mode/etc create mode 100644 etc/yasnippet/snippets/latex-mode/ie create mode 100644 etc/yasnippet/snippets/latex-mode/itemize create mode 100644 etc/yasnippet/snippets/latex-mode/label create mode 100644 etc/yasnippet/snippets/latex-mode/newcommand create mode 100644 etc/yasnippet/snippets/latex-mode/ref create mode 100644 etc/yasnippet/snippets/latex-mode/section create mode 100644 etc/yasnippet/snippets/latex-mode/subsection create mode 100644 etc/yasnippet/snippets/latex-mode/textbf create mode 100644 etc/yasnippet/snippets/latex-mode/texttt create mode 100644 etc/yasnippet/snippets/latex-mode/usepackage create mode 100644 etc/yasnippet/snippets/log-edit-mode/thankgnu create mode 100644 etc/yasnippet/snippets/message-mode/thankgnu create mode 100644 init.el create mode 100644 lisp/gnus-article-treat-patch.el create mode 100644 lisp/smart-mode-line-tangomod-theme.el create mode 100644 lisp/tangomod-theme.el create mode 100644 var/abbrev.el create mode 100644 var/eshell/alias diff --git a/.emacs.d/early-init.el b/.emacs.d/early-init.el deleted file mode 100644 index 512068a..0000000 --- a/.emacs.d/early-init.el +++ /dev/null @@ -1 +0,0 @@ -(setq package-enable-at-startup nil) diff --git a/.emacs.d/etc/.dir-locals.el b/.emacs.d/etc/.dir-locals.el deleted file mode 100644 index e007adb..0000000 --- a/.emacs.d/etc/.dir-locals.el +++ /dev/null @@ -1,4 +0,0 @@ -;;; Directory Local Variables -;;; For more information see (info "(emacs) Directory Variables") - -((emacs-lisp-mode . ((flycheck-disabled-checkers . (emacs-lisp-checkdoc))))) diff --git a/.emacs.d/etc/custom.el b/.emacs.d/etc/custom.el deleted file mode 100644 index a831542..0000000 --- a/.emacs.d/etc/custom.el +++ /dev/null @@ -1,228 +0,0 @@ -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(abbrev-file-name "/home/bandali/.emacs.d/var/abbrev.el") - '(auth-sources '("~/.authinfo.gpg")) - '(authinfo-hidden "\\(?:client-secret\\|password\\|token\\)") - '(auto-revert-verbose nil) - '(auto-save-file-name-transforms '((".*" "/home/bandali/.emacs.d/var/auto-save/" t))) - '(backup-by-copying t) - '(company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]" t) - '(company-dabbrev-downcase nil t) - '(company-dabbrev-ignore-case nil t) - '(company-minimum-prefix-length 1) - '(company-selection-wrap-around t) - '(debpaste-paste-is-hidden t t) - '(delete-old-versions t) - '(display-battery-mode t) - '(display-time-mode t) - '(dmenu-prompt-string "run: " t) - '(dmenu-save-file "/home/bandali/.emacs.d/var/dmenu-items" t) - '(ebdb-gnus-window-configuration - '(article - (vertical 1.0 - (summary 0.25 point) - (horizontal 1.0 - (article 1.0) - (ebdb-gnus 0.3))))) - '(ebdb-gnus-window-size 0.3 t) - '(ebdb-mua-pop-up t) - '(ediff-split-window-function 'split-window-horizontally t) - '(ediff-window-setup-function 'ediff-setup-windows-plain t) - '(epa-pinentry-mode 'loopback) - '(epg-gpg-program "/home/bandali/.guix-profile/bin/gpg") - '(epg-pinentry-mode 'loopback) - '(erc-fill-column 77) - '(erc-fill-function 'erc-fill-static) - '(erc-fill-static-center 18) - '(erc-join-buffer 'bury) - '(erc-lurker-hide-list '("JOIN" "PART" "QUIT")) - '(erc-nick "bandali") - '(erc-pcomplete-nick-postfix ", ") - '(erc-prompt "erc>") - '(erc-rename-buffers t) - '(erc-server-reconnect-attempts 5) - '(erc-server-reconnect-timeout 3) - '(erc-track-enable-keybindings nil) - '(erc-track-exclude-types - '("JOIN" "MODE" "NICK" "PART" "QUIT" "324" "329" "332" "333" "353" "477")) - '(erc-track-position-in-mode-line t) - '(erc-track-priority-faces-only 'all) - '(erc-track-shorten-function nil) - '(eshell-directory-name "/home/bandali/.emacs.d/var/eshell/") - '(eshell-hist-ignoredups t) - '(eshell-input-filter 'eshell-input-filter-initial-space) - '(fci-rule-color "#5B6268") - '(flycheck-mode-line-prefix "flyc") - '(global-auto-revert-non-file-buffers nil) - '(gnus-thread-sort-functions - '(gnus-thread-sort-by-number gnus-thread-sort-by-subject gnus-thread-sort-by-date)) - '(ibuffer-formats - '((mark modified read-only locked " " - (name 72 72 :left :elide) - " " - (size-h 9 -1 :right) - " " - (mode 16 16 :left :elide) - " " filename-and-process) - (mark " " - (name 16 -1) - " " filename))) - '(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) - (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 . go-mode) - (mode . alloy-mode))) - ("tex" - (or - (mode . bibtex-mode) - (mode . latex-mode))) - ("emacs" - (or - (name . "^\\*scratch\\*$") - (name . "^\\*Messages\\*$"))) - ("exwm" - (mode . exwm-mode)) - ("erc" - (mode . erc-mode))))) - '(inhibit-startup-buffer-menu t) - '(inhibit-startup-echo-area-message "bandali") - '(inhibit-startup-screen t) - '(initial-buffer-choice t) - '(initial-scratch-message nil) - '(isearch-allow-scroll t) - '(jdee-db-active-breakpoint-face-colors (cons "#1B2229" "#51afef")) - '(jdee-db-requested-breakpoint-face-colors (cons "#1B2229" "#98be65")) - '(jdee-db-spec-breakpoint-face-colors (cons "#1B2229" "#3f444a")) - '(ls-lisp-dirs-first t) - '(magit-diff-refine-hunk t) - '(magit-display-buffer-function 'magit-display-buffer-fullframe-status-v1) - '(message-elide-ellipsis "[...] -") - '(minions-mode t) - '(mm-uu-diff-groups-regexp - "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)") - '(mml-secure-key-preferences - '((OpenPGP - (sign) - (encrypt - ("ineiev@gnu.org" "BD9D4DEE7B2FF1CBEF2EE0C4E0ACD3E0CBE7874A"))) - (CMS - (sign) - (encrypt)))) - '(mml-secure-openpgp-encrypt-to-self t) - '(mml-secure-openpgp-sign-with-sender t) - '(objed-cursor-color "#ff6c6b") - '(oddmuse-username "bandali" t) - '(org-agenda-files - '("~/usr/org/todos/personal.org" "~/usr/org/todos/habits.org" "~/src/git/masters-thesis/todo.org")) - '(org-agenda-start-on-weekday 0) - '(org-agenda-time-leading-zero t) - '(org-habit-graph-column 44) - '(org-latex-packages-alist '(("" "listings") ("" "color"))) - '(org-pretty-entities t) - '(page-break-lines-max-width 70) - '(pdf-view-midnight-colors (cons "#bbc2cf" "#282c34")) - '(pdf-view-resize-factor 1.05) - '(projectile-completion-system 'ivy) - '(projectile-mode-line-prefix " proj") - '(recentf-max-saved-items 2000) - '(recentf-save-file "/home/bandali/.emacs.d/var/recentf-save.el") - '(require-final-newline t) - '(safe-local-variable-values - '((tex-main-file . "../thesis.tex") - (org-export-allow-bind-keywords . t) - (eval load-file "thesis.el") - (eval modify-syntax-entry 43 "'") - (eval modify-syntax-entry 36 "'") - (eval modify-syntax-entry 126 "'") - (eval require 'org-ref) - (eval when - (featurep 'typo - (typo-mode -1))) - (eval add-hook 'after-save-hook #'a/async-babel-tangle 'append 'local) - (eval add-hook 'after-save-hook 'org-beamer-export-to-latex t t) - (eval setq org-latex-prefer-user-labels t) - (eval add-hook 'after-save-hook 'org-latex-export-to-latex t t))) - '(save-interprogram-paste-before-kill t) - '(save-place-file "/home/bandali/.emacs.d/var/save-place.el" t) - '(savehist-file "/home/bandali/.emacs.d/var/savehist.el") - '(search-default-mode 'char-fold-to-regexp) - '(split-width-threshold 150) - '(text-scale-mode-step 1.05) - '(unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")) - '(vc-annotate-background "#282c34") - '(vc-annotate-color-map - (list - (cons 20 "#98be65") - (cons 40 "#b4be6c") - (cons 60 "#d0be73") - (cons 80 "#ECBE7B") - (cons 100 "#e6ab6a") - (cons 120 "#e09859") - (cons 140 "#da8548") - (cons 160 "#d38079") - (cons 180 "#cc7cab") - (cons 200 "#c678dd") - (cons 220 "#d974b7") - (cons 240 "#ec7091") - (cons 260 "#ff6c6b") - (cons 280 "#cf6162") - (cons 300 "#9f585a") - (cons 320 "#6f4e52") - (cons 340 "#5B6268") - (cons 360 "#5B6268"))) - '(vc-annotate-very-old-color nil) - '(vc-git-print-log-follow t) - '(version-control t) - '(view-read-only t) - '(web-mode-enable-auto-indentation nil t) - '(which-key-add-column-padding 5) - '(which-key-max-description-length 32)) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; 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-current-match ((((class color) (background light)) :background "#d7d7d7" :foreground "black") (((class color) (background dark)) :background "#65a7e2" :foreground "black"))) - '(ivy-minibuffer-match-face-1 ((t (:background "#eeeeee")))) - '(ivy-minibuffer-match-face-2 ((t (:background "#e7e7e7" :weight bold)))) - '(ivy-minibuffer-match-face-3 ((t (:background "light goldenrod" :weight semi-bold)))) - '(ivy-minibuffer-match-face-4 ((t (:background "misty rose" :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/etc/secrets.el b/.emacs.d/etc/secrets.el deleted file mode 100644 index edfa1a6..0000000 --- a/.emacs.d/etc/secrets.el +++ /dev/null @@ -1,5 +0,0 @@ -(eval-when-compile (require 'auth-source)) -(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/etc/yasnippet/snippets/java-mode/format b/.emacs.d/etc/yasnippet/snippets/java-mode/format deleted file mode 100644 index 7620366..0000000 --- a/.emacs.d/etc/yasnippet/snippets/java-mode/format +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: String.format -# key: f -# -- -String.format("$1${2:%n}");$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/java-mode/new b/.emacs.d/etc/yasnippet/snippets/java-mode/new deleted file mode 100644 index 1ffd2e5..0000000 --- a/.emacs.d/etc/yasnippet/snippets/java-mode/new +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: new -# key: new -# -- -${1:Type} ${2:obj} = new ${3:Constr}(${4:args});$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/java-mode/printf b/.emacs.d/etc/yasnippet/snippets/java-mode/printf deleted file mode 100644 index 1b8c277..0000000 --- a/.emacs.d/etc/yasnippet/snippets/java-mode/printf +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: printf -# key: pf -# -- -System.out.printf("$1${2:%n}"$3);$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/java-mode/println b/.emacs.d/etc/yasnippet/snippets/java-mode/println deleted file mode 100644 index 7bb944c..0000000 --- a/.emacs.d/etc/yasnippet/snippets/java-mode/println +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: println -# key: p -# -- -System.out.println($1);$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/java-mode/return b/.emacs.d/etc/yasnippet/snippets/java-mode/return deleted file mode 100644 index 977859e..0000000 --- a/.emacs.d/etc/yasnippet/snippets/java-mode/return +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: return -# key: r -# -- -return $1;$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/cite b/.emacs.d/etc/yasnippet/snippets/latex-mode/cite deleted file mode 100644 index 3b4d161..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/cite +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: cite -# key: c -# -- -$1${2:~}\cite{${3:$$(unless yas-modified-p (mapconcat 'identity (reftex-citation 'dont-insert) ","))}}$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/eg b/.emacs.d/etc/yasnippet/snippets/latex-mode/eg deleted file mode 100644 index 7c025e3..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/eg +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: eg -# key: eg -# -- -\emph{e.g.}$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/emph b/.emacs.d/etc/yasnippet/snippets/latex-mode/emph deleted file mode 100644 index 36b19d7..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/emph +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: emph -# key: e -# -- -\emph{$1}$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/enumerate b/.emacs.d/etc/yasnippet/snippets/latex-mode/enumerate deleted file mode 100644 index bcb1df1..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/enumerate +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: enumerate -# key: o -# -- -\begin{enumerate} -\item $0 -\end{enumerate} \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/etc b/.emacs.d/etc/yasnippet/snippets/latex-mode/etc deleted file mode 100644 index 86b698e..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/etc +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: etc -# key: etc -# -- -\emph{etc.}$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/ie b/.emacs.d/etc/yasnippet/snippets/latex-mode/ie deleted file mode 100644 index cb91c2a..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/ie +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: ie -# key: ie -# -- -\emph{i.e.}$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/itemize b/.emacs.d/etc/yasnippet/snippets/latex-mode/itemize deleted file mode 100644 index b7a6949..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/itemize +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: itemize -# key: u -# -- -\begin{itemize} -\item $0 -\end{itemize} \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/label b/.emacs.d/etc/yasnippet/snippets/latex-mode/label deleted file mode 100644 index 8a98d7e..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/label +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: label -# key: lbl -# -- -\label{$0} \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/newcommand b/.emacs.d/etc/yasnippet/snippets/latex-mode/newcommand deleted file mode 100644 index e9e03ca..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/newcommand +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: newcommand -# key: cmd -# -- -\newcommand{\\${1:name}}${2:[${3:0}]}{$0} \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/ref b/.emacs.d/etc/yasnippet/snippets/latex-mode/ref deleted file mode 100644 index 7eef596..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/ref +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: ref -# key: r -# -- -$1${2:~}\ref{${3:$$(unless yas-modified-p (reftex-reference nil nil))}}$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/section b/.emacs.d/etc/yasnippet/snippets/latex-mode/section deleted file mode 100644 index e1a2710..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/section +++ /dev/null @@ -1,8 +0,0 @@ -# -*- mode: snippet -*- -# name: section -# key: s -# -- -\section{${1:name}} -\label{sec:${2:label}} - -$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/subsection b/.emacs.d/etc/yasnippet/snippets/latex-mode/subsection deleted file mode 100644 index ddfa13d..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/subsection +++ /dev/null @@ -1,8 +0,0 @@ -# -*- mode: snippet -*- -# name: subsection -# key: ss -# -- -\subsection{${1:name}} -\label{sec:${2:label}} - -$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/textbf b/.emacs.d/etc/yasnippet/snippets/latex-mode/textbf deleted file mode 100644 index 84171d7..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/textbf +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: textbf -# key: b -# -- -\textbf{$1}$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/texttt b/.emacs.d/etc/yasnippet/snippets/latex-mode/texttt deleted file mode 100644 index 43cd769..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/texttt +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: texttt -# key: tt -# -- -\texttt{$1}$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/latex-mode/usepackage b/.emacs.d/etc/yasnippet/snippets/latex-mode/usepackage deleted file mode 100644 index 3405077..0000000 --- a/.emacs.d/etc/yasnippet/snippets/latex-mode/usepackage +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: usepackage -# key: p -# -- -\usepackage{$0} \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/log-edit-mode/thankgnu b/.emacs.d/etc/yasnippet/snippets/log-edit-mode/thankgnu deleted file mode 100644 index bf29b63..0000000 --- a/.emacs.d/etc/yasnippet/snippets/log-edit-mode/thankgnu +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: thankgnu -# key: th -# -- -[RT#$1] Add ${2:$$(yas-choose-value '("Contributor" "Sustaining Contributor" "Patron"))} $3 to the 20${4:20} ThankGNUs list$0 \ No newline at end of file diff --git a/.emacs.d/etc/yasnippet/snippets/message-mode/thankgnu b/.emacs.d/etc/yasnippet/snippets/message-mode/thankgnu deleted file mode 100644 index 0d10448..0000000 --- a/.emacs.d/etc/yasnippet/snippets/message-mode/thankgnu +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: thankgnu -# key: th -# -- -Added ${2:$$(yas-choose-value '("Contributor" "Sustaining Contributor" "Patron"))} $3 to 20${4:20}supporters.html. - -Moving to campaigns.$0 diff --git a/.emacs.d/init.el b/.emacs.d/init.el deleted file mode 100644 index 04133fe..0000000 --- a/.emacs.d/init.el +++ /dev/null @@ -1,2557 +0,0 @@ -;;; init.el --- bandali's emacs configuration -*- lexical-binding: t -*- - -;; 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: - -;; GNU Emacs configuration of Amin Bandali, computer scientist, -;; Free Software activist, and GNU maintainer & webmaster. Packages -;; are installed through GNU Guix for a fully reproducible setup. -;; Before switching to Guix, I used straight.el, and before that Borg. - -;; Over the years, I've taken inspiration from configurations of many -;; great people. Some that I can remember off the top of my head are: -;; -;; - https://github.com/dieggsy/dotfiles -;; - https://github.com/dakra/dmacs -;; - http://pages.sachachua.com/.emacs.d/Sacha.html -;; - https://github.com/dakrone/eos -;; - http://doc.rix.si/cce/cce.html -;; - https://github.com/jwiegley/dot-emacs -;; - https://github.com/wasamasa/dotemacs -;; - https://github.com/hlissner/doom-emacs - -;;; Code: - -;;; Emacs initialization - -(defvar b/before-user-init-time (current-time) - "Value of `current-time' when Emacs begins loading `user-init-file'.") -(defvar b/emacs-initialized nil - "Whether Emacs has been initialized.") - -(when (not (bound-and-true-p b/emacs-initialized)) - (message "Loading Emacs...done (%.3fs)" - (float-time (time-subtract b/before-user-init-time - before-init-time)))) - -;; temporarily increase `gc-cons-threshhold' and `gc-cons-percentage' -;; during startup to reduce garbage collection frequency. clearing -;; `file-name-handler-alist' seems to help reduce startup time too. -(defvar b/gc-cons-threshold gc-cons-threshold) -(defvar b/gc-cons-percentage gc-cons-percentage) -(defvar b/file-name-handler-alist file-name-handler-alist) -(setq gc-cons-threshold (* 30 1024 1024) ; 30 MiB - gc-cons-percentage 0.6 - file-name-handler-alist nil - ;; sidesteps a bug when profiling with esup - esup-child-profile-require-level 0) - -;; set them back to their defaults once we're done initializing -(defun b/post-init () - "My post-initialize function, run after loading `user-init-file'." - (setq b/emacs-initialized t - gc-cons-threshold b/gc-cons-threshold - gc-cons-percentage b/gc-cons-percentage - file-name-handler-alist b/file-name-handler-alist) - (with-eval-after-load 'exwm-workspace - (setq-default - mode-line-format - (append - mode-line-format - '((:eval - (format - "[%s]" (number-to-string - exwm-workspace-current-index)))))))) -(add-hook 'after-init-hook #'b/post-init) - -;; increase number of lines kept in *Messages* log -(setq message-log-max 20000) - -;; optionally, uncomment to supress some byte-compiler warnings -;; (see C-h v byte-compile-warnings RET for more info) -;; (setq byte-compile-warnings -;; '(not free-vars unresolved noruntime lexical make-local)) - - -;;; whoami - -(setq user-full-name "Amin Bandali" - user-mail-address "bandali@gnu.org") - - -;;; comment macro - -;; useful for commenting out multiple sexps at a time -(defmacro comment (&rest _) - "Comment out one or more s-expressions." - (declare (indent defun)) - nil) - - -;;; Package management - -;; No package.el (for emacs 26 and before) -(when (version< emacs-version "27") - (setq package-enable-at-startup nil) - ;; (package-initialize) - ) -;; for emacs 27 and later, we use early-init.el. see -;; https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=24acb31c04b4048b85311d794e600ecd7ce60d3b - - -;; 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) - - -;;; Initial setup - -(defvar b/exwm-p (string= (system-name) "chaman") - "Whether or not we will be using `exwm'.") - -;; keep ~/.emacs.d clean -(use-package no-littering - :demand - :config - (defalias 'b/etc 'no-littering-expand-etc-file-name) - (defalias 'b/var 'no-littering-expand-var-file-name)) - -;; separate custom file (don't want it mixing with init.el) -(use-package custom - :no-require - :config - (setq custom-file (b/etc "custom.el")) - (when (file-exists-p custom-file) - (load custom-file)) - ;; while at it, treat themes as safe - (setf custom-safe-themes t) - ;; only one custom theme at a time - (comment - (defadvice load-theme (before clear-previous-themes activate) - "Clear existing theme settings instead of layering them" - (mapc #'disable-theme custom-enabled-themes)))) - -;; load the secrets file if it exists, otherwise show a warning -(comment - (with-demoted-errors - (load (b/etc "secrets")))) - -;; start up emacs server. see -;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server -(use-package server - :defer 0.4 - :config (or (server-running-p) (server-mode))) - - -;;; Useful utilities - -;; useful libraries -(require 'cl-lib) -(require 'subr-x) - -(defmacro b/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 b/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 b/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 #'b/start-process - program - (remove nil (list args (dired-get-file-for-visit))))) - -(defun b/add-elisp-section () - (interactive) - (insert "\n") - (previous-line) - (insert "\n \n;;; ")) - -;; (defvar b/fill-column 47 -;; "My custom `fill-column'.") - -(defconst b/asterism "* * *") - -(defun b/insert-asterism () - "Insert a centred asterism." - (interactive) - (insert - (concat - "\n\n" - (make-string (floor (/ (- fill-column (length b/asterism)) 2)) - ?\s) - b/asterism - "\n\n"))) - -(defun b/no-mouse-autoselect-window () - "Conveniently disable `focus-follows-mouse'. -For disabling the behaviour for certain buffers and/or modes." - (make-local-variable 'mouse-autoselect-window) - (setq mouse-autoselect-window nil)) - -(defun b/kill-current-buffer () - "Kill the current buffer." - ;; also see https://redd.it/64xb3q - (interactive) - (kill-buffer (current-buffer))) - - -;;; Defaults - -;;;; C-level customizations - -(setq - ;; minibuffer - enable-recursive-minibuffers t - resize-mini-windows t - ;; more useful frame titles - frame-title-format '("" invocation-name " - " - (:eval - (if (buffer-file-name) - (abbreviate-file-name (buffer-file-name)) - "%b"))) - ;; i don't feel like jumping out of my chair every now and again; so - ;; don't BEEP! at me, emacs - ring-bell-function 'ignore - ;; better scrolling - ;; scroll-margin 1 - ;; scroll-conservatively 10000 - scroll-step 1 - scroll-conservatively 10 - scroll-preserve-screen-position 1 - ;; focus follows mouse - mouse-autoselect-window t) - -(setq-default - ;; always use space for indentation - indent-tabs-mode nil - tab-width 4 - ;; cursor shape - cursor-type 'bar) - -;; unicode support -(comment - (dolist (ft (fontset-list)) - (set-fontset-font - ft - 'unicode - (font-spec :name "Source Code Pro" :size 14)) - (set-fontset-font - ft - 'unicode - (font-spec :name "DejaVu Sans Mono") - nil - 'append) - ;; (set-fontset-font - ;; ft - ;; 'unicode - ;; (font-spec - ;; :name "Symbola monospacified for DejaVu Sans Mono") - ;; nil - ;; 'append) - ;; (set-fontset-font - ;; ft - ;; #x2115 ; ℕ - ;; (font-spec :name "DejaVu Sans Mono") - ;; nil - ;; 'append) - (set-fontset-font - ft - (cons ?Α ?ω) - (font-spec :name "DejaVu Sans Mono" :size 14) - nil - 'prepend))) - -;;;; Elisp-level customizations - -(use-package startup - :no-require - :demand - :config - ;; don't need to see the startup echo area message - (advice-add #'display-startup-echo-area-message :override #'ignore) - :custom - ;; i want *scratch* as my startup buffer - (initial-buffer-choice t) - ;; i don't need the default hint - (initial-scratch-message nil) - ;; use customizable text-mode as major mode for *scratch* - ;; (initial-major-mode 'text-mode) - ;; inhibit buffer list when more than 2 files are loaded - (inhibit-startup-buffer-menu t) - ;; don't need to see the startup screen or echo area message - (inhibit-startup-screen t) - (inhibit-startup-echo-area-message user-login-name)) - -(use-package files - :no-require - :demand - :custom - ;; backups (C-h v make-backup-files RET) - (backup-by-copying t) - (version-control t) - (delete-old-versions t) - - ;; auto-save - (auto-save-file-name-transforms - `((".*" ,(b/var "auto-save/") t))) - - ;; insert newline at the end of files - (require-final-newline t) - - ;; open read-only file buffers in view-mode - ;; (enables niceties like `q' for quit) - (view-read-only t)) - -;; disable disabled commands -(setq disabled-command-function nil) - -;; lazy-person-friendly yes/no prompts -(defalias 'yes-or-no-p #'y-or-n-p) - -;; enable automatic reloading of changed buffers and files -(use-package autorevert - :demand - :config - (global-auto-revert-mode 1) - :custom - (auto-revert-verbose nil) - (global-auto-revert-non-file-buffers nil)) - -;; time and battery in mode-line -(use-package time - :demand - :config - (display-time-mode) - :custom - (display-time-default-load-average nil) - (display-time-format "%a %b %-e %-l:%M%P") - (display-time-mail-icon '(image :type xpm :file "gnus/gnus-pointer.xpm" :ascent center)) - (display-time-use-mail-icon t)) - -(use-package battery - :demand - :config - (display-battery-mode) - :custom - (battery-mode-line-format " %p%% %t")) - -(use-package fringe - :demand - :config - ;; smaller fringe - ;; (fringe-mode '(3 . 1)) - (fringe-mode nil)) - -(use-package winner - :demand - :config - ;; enable winner-mode (C-h f winner-mode RET) - (winner-mode 1)) - -(use-package compile - :config - ;; don't display *compilation* buffer on success. based on - ;; https://stackoverflow.com/a/17788551, with changes to use `cl-letf' - ;; instead of the now obsolete `flet'. - (defun b/compilation-finish-function (buffer outstr) - (unless (string-match "finished" outstr) - (switch-to-buffer-other-window buffer)) - t) - - (setq compilation-finish-functions #'b/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)) - -(use-package isearch - :custom - ;; allow scrolling in Isearch - (isearch-allow-scroll t) - ;; search for non-ASCII characters: i’d like non-ASCII characters such - ;; as ‘’“”«»‹›áⓐ𝒶 to be selected when i search for their ASCII - ;; counterpart. shoutout to - ;; http://endlessparentheses.com/new-in-emacs-25-1-easily-search-non-ascii-characters.html - (search-default-mode #'char-fold-to-regexp)) - -;; uncomment to extend the above behaviour to query-replace -(comment - (use-package replace - :custom - (replace-char-fold t))) - -(use-package vc - :bind ("C-x v C-=" . vc-ediff)) - -(use-package vc-git - :after vc - :custom - (vc-git-print-log-follow t)) - -(use-package ediff - :config (add-hook 'ediff-after-quit-hook-internal 'winner-undo) - :custom ((ediff-window-setup-function 'ediff-setup-windows-plain) - (ediff-split-window-function 'split-window-horizontally))) - -(use-package face-remap - :custom - ;; gentler font resizing - (text-scale-mode-step 1.05)) - -(use-package 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-package pixel-scroll - :defer 0.4 - :config (pixel-scroll-mode 1)) - -(use-package epg-config - :config - ;; ask for GPG passphrase in minibuffer - ;; this will fail if gpg>=2.1 is not available - (if (version< "27" emacs-version) - (setq epg-pinentry-mode 'loopback) - (setq epa-pinentry-mode 'loopback)) - :custom - (epg-gpg-program (executable-find "gpg"))) - -(use-package epg - :after epg-config) - -(use-package pinentry - :demand - :after (epa epg server) - :config - ;; workaround for systemd-based distros: - ;; (setq pinentry--socket-dir server-socket-dir) - (pinentry-start)) - -(use-package auth-source - :custom - (auth-sources '("~/.authinfo.gpg")) - (authinfo-hidden (regexp-opt '("password" "client-secret" "token")))) - - -;;; General bindings - -(bind-keys - ("C-c a i" . ielm) - - ("C-c e b" . eval-buffer) - ("C-c e e" . eval-last-sexp) - ("C-c e r" . eval-region) - - ("C-c e i" . emacs-init-time) - ("C-c e u" . emacs-uptime) - ("C-c e v" . emacs-version) - - ("C-c F m" . make-frame-command) - ("C-c F d" . delete-frame) - ("C-c F D" . server-edit) - - ("C-S-h C" . describe-char) - ("C-S-h F" . describe-face) - - ("C-x k" . b/kill-current-buffer) - ("C-x K" . kill-buffer) - ("C-x s" . save-buffer) - ("C-x S" . save-some-buffers) - - :map emacs-lisp-mode-map - ("" . b/add-elisp-section)) - -(when (display-graphic-p) - (unbind-key "C-z" global-map)) - -(bind-keys - ;; for back and forward mouse keys - ("" . previous-buffer) - ("" . previous-buffer) - ;; ("" . previous-buffer) - ("" . next-buffer) - ("" . next-buffer) - ;; ("" . next-buffer) - ;; ("" . kill-this-buffer) - ;; ("" . switch-to-buffer) - ) - - -;;; Essential packages - -(use-package exwm - :if b/exwm-p - :demand - :config - ;; make class name the buffer name, truncating beyond 60 characters - (defun b/exwm-rename-buffer () - (interactive) - (exwm-workspace-rename-buffer - (concat exwm-class-name ":" - (if (<= (length exwm-title) 60) exwm-title - (concat (substring exwm-title 0 59) "..."))))) - ;; Enable EXWM - (exwm-enable) - :hook ((exwm-update-class . b/exwm-rename-buffer) - (exwm-update-title . b/exwm-rename-buffer))) - -(use-package exwm-config - :demand - :after exwm - :hook (exwm-init . exwm-config--fix/ido-buffer-window-other-frame)) - -(use-package exwm-input - :demand - :after exwm - :config - (defun b/exwm-ws-prev-index () - "Return the index for the previous EXWM workspace, wrapping -around if needed." - (if (= exwm-workspace-current-index 0) - (1- exwm-workspace-number) - (1- exwm-workspace-current-index))) - - (defun b/exwm-ws-next-index () - "Return the index for the next EXWM workspace, wrapping -around if needed." - (if (= exwm-workspace-current-index - (1- exwm-workspace-number)) - 0 - (1+ exwm-workspace-current-index))) - - ;; shorten 'C-c C-q' to 'C-q' - (define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key) - - (setq exwm-workspace-number 4 - exwm-input-global-keys - `(([?\s-R] . exwm-reset) - ([?\s-\\] . exwm-workspace-switch) - ([?\s-\s] . dmenu) - ([?\S-\s-\s] . (lambda (command) - (interactive - (list (read-shell-command "➜ "))) - (start-process-shell-command - command nil command))) - ([s-return] . (lambda () - (interactive) - (start-process "" nil "urxvt"))) - ([?\C-\s-\s] . counsel-linux-app) - ([?\M-\s-\s] . (lambda () - (interactive) - (start-process-shell-command - "rofi-pass" nil "rofi-pass"))) - ([?\s-h] . windmove-left) - ([?\s-j] . windmove-down) - ([?\s-k] . windmove-up) - ([?\s-l] . windmove-right) - ([?\s-H] . windmove-swap-states-left) - ([?\s-J] . windmove-swap-states-down) - ([?\s-K] . windmove-swap-states-up) - ([?\s-L] . windmove-swap-states-right) - ([?\M-\s-h] . shrink-window-horizontally) - ([?\M-\s-l] . enlarge-window-horizontally) - ([?\M-\s-k] . shrink-window) - ([?\M-\s-j] . enlarge-window) - ([?\s-\[] . (lambda () - (interactive) - (exwm-workspace-switch-create - (b/exwm-ws-prev-index)))) - ([?\s-\]] . (lambda () - (interactive) - (exwm-workspace-switch-create - (b/exwm-ws-next-index)))) - ([?\s-{] . (lambda () - (interactive) - (exwm-workspace-move-window - (b/exwm-ws-prev-index)))) - ([?\s-}] . (lambda () - (interactive) - (exwm-workspace-move-window - (b/exwm-ws-next-index)))) - ,@(mapcar (lambda (i) - `(,(kbd (format "s-%d" i)) . - (lambda () - (interactive) - (exwm-workspace-switch-create ,i)))) - (number-sequence 0 (1- exwm-workspace-number))) - ([?\s-t] . exwm-floating-toggle-floating) - ([?\s-f] . exwm-layout-toggle-fullscreen) - ([?\s-W] . (lambda () - (interactive) - (kill-buffer (current-buffer)))) - ([?\s-Q] . (lambda () - (interactive) - (exwm-manage--kill-client))) - ([?\s-\'] . (lambda () - (interactive) - (start-process-shell-command - "rofi-light" nil "rofi-light"))) - ([XF86AudioMute] . - (lambda () - (interactive) - (start-process "" nil "amixer" "set" "'Master',0" "toggle"))) - ([XF86AudioLowerVolume] . - (lambda () - (interactive) - (start-process - "" nil "amixer" "set" "'Master',0" "5%-"))) - ([XF86AudioRaiseVolume] . - (lambda () - (interactive) - (start-process - "" nil "amixer" "set" "'Master',0" "5%+"))) - ([XF86AudioPlay] . - (lambda () - (interactive) - (start-process "" nil "mpc" "toggle"))) - ([XF86AudioPrev] . - (lambda () - (interactive) - (start-process "" nil "mpc" "prev"))) - ([XF86AudioNext] . - (lambda () - (interactive) - (start-process "" nil "mpc" "next"))) - ([XF86ScreenSaver] . - (lambda () - (interactive) - (start-process "" nil "dm-tool" "lock"))) - ([\s-XF86Back] . previous-buffer) - ([\s-XF86Forward] . next-buffer))) - - ;; Line-editing shortcuts - (setq exwm-input-simulation-keys - '(;; movement - ([?\C-b] . [left]) - ([?\M-b] . [C-left]) - ([?\C-f] . [right]) - ([?\M-f] . [C-right]) - ([?\C-p] . [up]) - ([?\C-n] . [down]) - ([?\C-a] . [home]) - ([?\C-e] . [end]) - ([?\M-v] . [prior]) - ([?\C-v] . [next]) - ([?\C-d] . [delete]) - ([?\C-k] . [S-end ?\C-x]) - ([?\M-<] . C-home) - ([?\M->] . C-end) - ;; cut/copy/paste - ([?\C-w] . [?\C-x]) - ([?\M-w] . [?\C-c]) - ([?\C-y] . [?\C-v]) - ([?\M-d] . [C-S-right ?\C-x]) - ([?\M-\d] . [C-S-left ?\C-x]) - ;; window - ([?\s-w] . [?\C-w]) - ([?\s-q] . [?\C-q]) - ;; misc - ([?\C-s] . [?\C-f]) - ([?\s-s] . [?\C-s]) - ([?\C-g] . [escape])))) - -(use-package exwm-manage - :demand - :after exwm - :hook - (exwm-manage-finish . (lambda () - (when exwm-class-name - (cond - ((string= exwm-class-name "IceCat") - (exwm-input-set-local-simulation-keys - `(,@exwm-input-simulation-keys - ([?\C-\S-d] . [?\C-d])))) - ((string= exwm-class-name "URxvt") - (exwm-input-set-local-simulation-keys - '(([?\C-c ?\C-c] . [?\C-c]) - ([?\C-c ?\C-u] . [?\C-u])))) - ((string= exwm-class-name "Zathura") - (exwm-input-set-local-simulation-keys - '(([?\C-p] . [C-up]) - ([?\C-n] . [C-down]))))))))) - -(use-package exwm-randr - :demand - :after exwm - :config - (exwm-randr-enable) - :custom - (exwm-randr-workspace-monitor-plist '(1 "VGA-1"))) - -(use-package exwm-systemtray - :demand - :after exwm - :config - (exwm-systemtray-enable)) - -(use-package exwm-workspace) - -(use-package exwm-edit - :demand - :after exwm) - -;; use the org-plus-contrib package to get the whole deal -(use-package org-plus-contrib) - -(use-package 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) - (when (version< org-version "9.3") - (setq org-email-link-description-format - org-link-email-description-format)) - (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t) - (add-to-list 'org-modules 'org-habit) - :bind - (("C-c a o a" . org-agenda) - :map org-mode-map - ("M-L" . org-insert-last-stored-link) - ("M-O" . org-toggle-link-display)) - :hook ((org-mode . org-indent-mode) - (org-mode . auto-fill-mode) - (org-mode . flyspell-mode)) - :custom - (org-pretty-entities t) - (org-agenda-files '("~/usr/org/todos/personal.org" - "~/usr/org/todos/habits.org" - "~/src/git/masters-thesis/todo.org")) - (org-agenda-start-on-weekday 0) - (org-agenda-time-leading-zero t) - (org-habit-graph-column 44) - (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-package 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-package ox-extra - :config - (ox-extras-activate '(latex-header-blocks ignore-headlines))) - -;; asynchronous tangle, using emacs-async to asynchronously tangle an -;; org file. closely inspired by -;; https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles -(with-eval-after-load 'org - (defvar b/show-async-tangle-results nil - "Keep *emacs* async buffers around for later inspection.") - - (defvar b/show-async-tangle-time nil - "Show the time spent tangling the file.") - - (defun b/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 b/show-async-tangle-results - `(lambda (result) - (if result - (message "Tangled %s%s" - ,file-nodir - (if b/show-async-tangle-time - (format " (%.3fs)" - (float-time (time-subtract (current-time) - ',file-tangle-start-time))) - "")) - (message "Tangling %s failed" ,file-nodir)))))))) - -(add-to-list - 'safe-local-variable-values - '(eval add-hook 'after-save-hook #'b/async-babel-tangle 'append 'local)) - -;; *the* right way to do git -(use-package magit - :defer 0.5 - :bind (("C-x g" . magit-status) - ("C-c g g" . magit-status) - ("C-c g b" . magit-blame-addition) - ("C-c g l" . magit-log-buffer-file)) - :config - (magit-add-section-hook 'magit-status-sections-hook - 'magit-insert-modules - 'magit-insert-stashes - 'append) - ;; (magit-add-section-hook 'magit-status-sections-hook - ;; 'magit-insert-ignored-files - ;; 'magit-insert-untracked-files - ;; 'append) - (setq magit-repository-directories '(("~/" . 0) - ("~/src/git/" . 2))) - (nconc magit-section-initial-visibility-alist - '(([unpulled status] . show) - ([unpushed status] . show))) - :custom - (magit-diff-refine-hunk t) - (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1) - ;; (magit-completing-read-function 'magit-ido-completing-read) - :custom-face (magit-diff-file-heading ((t (:weight normal))))) - -;; recently opened files -(use-package recentf - :defer 0.2 - ;; :config - ;; (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:") - :config - (recentf-mode) - :custom - (recentf-max-saved-items 2000)) - -;; smart M-x enhancement (needed by counsel for history) -;; (use-package smex) - -(bind-keys - ("C-c f ." . find-file) - ("C-c f d" . find-name-dired) - ("C-c f l" . find-library) - ;; ("C-c f r" . recentf-open-files) - ("C-c x" . execute-extended-command)) - -(comment - (use-package ido - :demand - :bind - (:map ido-common-completion-map - ([escape] . minibuffer-keyboard-quit) - ("DEL" . b/ido-backspace)) - :config - (require 'delsel) - (defun b/ido-backspace () - "Forward to `backward-delete-char'. On error (read-only), quit." - (interactive) - (condition-case nil - (backward-delete-char 1) - (error - (minibuffer-keyboard-quit)))) - (ido-mode 1) - (ido-everywhere 1) - :custom - (ido-enable-flex-matching t) - ;; (ido-enable-regexp t) - ;; (ido-enable-prefix t) - (ido-max-window-height 10) - (ido-use-virtual-buffers t)) - - (use-package ido-vertical-mode - :defer 0.3 - :config - (ido-vertical-mode 1) - :custom - (ido-vertical-define-keys 'C-n-C-p-up-and-down) - (ido-vertical-show-count t)) - - (use-package ido-completing-read+ - :defer 0.3 - :after ido - :config - (ido-ubiquitous-mode 1)) - - (use-package crm-custom - :defer 0.3 - :config - (crm-custom-mode 1)) - - (use-package icomplete - :defer 0.3 - :config - (icomplete-mode 1))) - -(use-package amx - :defer 0.3 - :config - (amx-mode)) - -(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 ") - - (defvar b/ivy-ignore-buffer-modes '(magit-mode erc-mode dired-mode)) - (defun b/ivy-ignore-buffer-p (str) - "Return non-nil if str names a buffer with a major mode -derived from one of `b/ivy-ignore-buffer-modes'. - -This function is intended for use with `ivy-ignore-buffers'." - (let* ((buf (get-buffer str)) - (mode (and buf (buffer-local-value 'major-mode buf)))) - (and mode - (apply #'provided-mode-derived-p mode b/ivy-ignore-buffer-modes)))) - (add-to-list 'ivy-ignore-buffers 'b/ivy-ignore-buffer-p) - - (ivy-mode 1) - :custom-face - (ivy-minibuffer-match-face-1 ((t (:background "#eeeeee")))) - (ivy-minibuffer-match-face-2 ((t (:background "#e7e7e7" :weight bold)))) - (ivy-minibuffer-match-face-3 ((t (:background "light goldenrod" :weight semi-bold)))) - (ivy-minibuffer-match-face-4 ((t (:background "misty rose" :weight semi-bold)))) - (ivy-current-match ((((class color) (background light)) - :background "#d7d7d7" :foreground "black") - (((class color) (background dark)) - :background "#65a7e2" :foreground "black")))) - -(use-package swiper - :demand - :after ivy - :bind (("C-S-s" . swiper-isearch))) - -(use-package counsel - :demand - :after ivy - :bind (("C-c f r" . counsel-recentf) - :map minibuffer-local-map - ("C-r" . counsel-minibuffer-history)) - :config - (counsel-mode 1) - (defalias 'locate #'counsel-locate)) - -(use-package eshell - :defer 0.5 - :commands eshell - :bind ("C-c a s e" . eshell) - :config - (eval-when-compile (defvar eshell-prompt-regexp)) - (defun b/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 b/eshell-clear () - (interactive) - (let ((inhibit-read-only t)) - (erase-buffer)) - (eshell-send-input)) - - (defun b/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" . b/eshell-quit-or-delete-char) - ("C-S-l" . b/eshell-clear) - ("M-r" . counsel-esh-history) - ;; ([tab] . company-complete) - ) - (if (version< "27" emacs-version) - (bind-keys :map eshell-hist-mode-map - ("M-r" . counsel-esh-history)) - (bind-keys :map eshell-mode-map - ("M-r" . counsel-esh-history)))) - - (setq - eshell-prompt-regexp "\\(.*\n\\)*[$#] " - eshell-prompt-function - (lambda () - (concat - (propertize (format "%s@%s:" (user-login-name) (system-name)) - 'face 'default) - (propertize (abbreviate-file-name default-directory) - 'face 'font-lock-comment-face) - (propertize "\n" 'face 'default) - (if (= (user-uid) 0) - (propertize "#" 'face 'red) - (propertize "$" 'face 'default)) - (propertize " " 'face 'default)))) - - :hook (eshell-mode . b/eshell-setup) - :custom - (eshell-hist-ignoredups t) - (eshell-input-filter 'eshell-input-filter-initial-space)) - -(use-package ibuffer - :bind - (("C-x C-b" . ibuffer) - :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 . mhtml-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 . go-mode) - (mode . alloy-mode))) - ("tex" - (or - (mode . bibtex-mode) - (mode . latex-mode))) - ("emacs" - (or - (name . "^\\*scratch\\*$") - (name . "^\\*Messages\\*$"))) - ("exwm" (mode . exwm-mode)) - ("erc" (mode . erc-mode))))) - (ibuffer-formats - '((mark modified read-only locked " " - (name 72 72 :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-package outline - :disabled - :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 b/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-package ls-lisp - :custom (ls-lisp-dirs-first t)) - -(use-package dired - :config - (setq dired-dwim-target t - 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")))) - - (require 'dired-x) - (setq dired-guess-shell-alist-user - '(("\\.pdf\\'" "evince" "zathura" "okular") - ("\\.doc\\'" "libreoffice") - ("\\.docx\\'" "libreoffice") - ("\\.ppt\\'" "libreoffice") - ("\\.pptx\\'" "libreoffice") - ("\\.xls\\'" "libreoffice") - ("\\.xlsx\\'" "libreoffice") - ("\\.flac\\'" "mpv"))) - :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) - (b/dired-start-process "zathura")))) - :hook (dired-mode . dired-hide-details-mode)) - -(use-package help - :config - (temp-buffer-resize-mode) - (setq help-window-select t)) - -(use-package 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 doc-view - :bind (:map doc-view-mode-map - ("M-RET" . image-previous-line))) - - -;;; Editing - -;; highlight uncommitted changes in the left fringe -(use-package diff-hl - :defer 0.6 - :config - (setq diff-hl-draw-borders nil) - (global-diff-hl-mode) - :hook (magit-post-refresh . diff-hl-magit-post-refresh)) - -;; display Lisp objects at point in the echo area -(use-package eldoc - :when (version< "25" emacs-version) - :config (global-eldoc-mode)) - -;; highlight matching parens -(use-package paren - :demand - :config (show-paren-mode)) - -(use-package elec-pair - :demand - :config (electric-pair-mode)) - -(use-package simple - :config (column-number-mode) - :custom - ;; Save what I copy into clipboard from other applications into Emacs' - ;; kill-ring, which would allow me to still be able to easily access - ;; it in case I kill (cut or copy) something else inside Emacs before - ;; yanking (pasting) what I'd originally intended to. - (save-interprogram-paste-before-kill t)) - -;; save minibuffer history -(use-package savehist - :demand - :config - (savehist-mode) - (add-to-list 'savehist-additional-variables 'kill-ring)) - -;; automatically save place in files -(use-package saveplace - :when (version< "25" emacs-version) - :config (save-place-mode)) - -(use-package 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-package text-mode - :bind (:map text-mode-map ("C-*" . b/insert-asterism)) - :hook ((text-mode . indicate-buffer-boundaries-left) - (text-mode . flyspell-mode))) - -(use-package conf-mode - :mode "\\.*rc$") - -(use-package sh-mode - :mode "\\.bashrc$") - -(use-package company - :disabled - :bind - (:map company-active-map - ([tab] . company-complete-common-or-cycle) - ([escape] . company-abort) - ("C-p" . company-select-previous-or-abort) - ("C-n" . company-select-next-or-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)) - :custom (flycheck-mode-line-prefix "flyc")) - -(use-package flyspell) - -;; 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)) - ispell-program-name (executable-find "hunspell")) - ;; 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-package abbrev - :hook (text-mode . abbrev-mode)) - - -;;; Programming modes - -(use-package lisp-mode - :config - (defun indent-spaces-mode () - (setq indent-tabs-mode nil)) - (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode)) - -(use-package reveal - :hook (emacs-lisp-mode . reveal-mode)) - -(use-package elisp-mode) - -;; (use-package alloy-mode -;; :straight (:host github :repo "dwwmmn/alloy-mode") -;; :mode "\\.\\(als\\|dsh\\)\\'" -;; :config -;; (setq alloy-basic-offset 2) -;; ;; (defun b/alloy-simple-indent (start end) -;; ;; (interactive "r") -;; ;; ;; (if (region-active-p) -;; ;; ;; (indent-rigidly start end alloy-basic-offset) -;; ;; ;; (if (bolp) -;; ;; ;; (indent-rigidly (line-beginning-position) -;; ;; ;; (line-end-position) -;; ;; ;; alloy-basic-offset))) -;; ;; (indent-to (+ (current-column) alloy-basic-offset))) -;; :bind (:map alloy-mode-map -;; ("RET" . electric-newline-and-maybe-indent) -;; ;; ("TAB" . b/alloy-simple-indent) -;; ("TAB" . indent-for-tab-command)) -;; :hook (alloy-mode . (lambda () (setq-local indent-tabs-mode nil)))) - -(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 mhtml-mode) - -(use-package sgml-mode - :config - (setq sgml-basic-offset 0)) - -(use-package css-mode - :config - (setq css-indent-offset 2)) - -(use-package emmet-mode - :after (:any mhtml-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 (css-mode html-mode sgml-mode)) - -(use-package geiser) - -(use-package geiser-guile - :config - (setq geiser-guile-load-path "~/src/git/guix")) - -(use-package guix) - -(comment - (use-package auctex - :custom - (font-latex-fontify-sectioning 'color))) - -(use-package go-mode - :disabled) - -(use-package po-mode - :hook - (po-mode . (lambda () (run-with-timer 0.1 nil 'View-exit)))) - -(use-package tex-mode - :config - (cl-delete-if - (lambda (p) (string-match "^---?" (car p))) - tex--prettify-symbols-alist) - :hook ((tex-mode . auto-fill-mode) - (tex-mode . flyspell-mode))) - -;; (use-package george-mode -;; :straight (:host nil :repo "https://git.shemshak.org/amin/george-mode") -;; :mode "\\.grg\\'") - - -;;; Theme - -(add-to-list 'custom-theme-load-path - (expand-file-name - (convert-standard-filename "lisp") user-emacs-directory)) -(load-theme 'tangomod t) - -(use-package smart-mode-line - :commands (sml/apply-theme) - :demand - :config - ;; thanks, but no thnaks; don't make fixed-width fills. - (defun sml/fill-for-buffer-identification () "") - (setq sml/theme 'tangomod) - (sml/setup) - (smart-mode-line-enable)) - -(use-package doom-modeline - :disabled - :demand - :hook (after-init . doom-modeline-init) - :custom - (doom-modeline-buffer-file-name-style 'relative-to-project)) - -(use-package doom-themes) - -(use-package moody - :disabled - :demand - :config - (setq x-underline-at-descent-line t) - (let ((line (face-attribute 'mode-line :underline))) - (set-face-attribute 'mode-line nil :overline line) - (set-face-attribute 'mode-line-inactive nil :overline line) - (set-face-attribute 'mode-line-inactive nil :underline line) - (set-face-attribute 'mode-line nil :box nil) - (set-face-attribute 'mode-line-inactive nil :box nil) - (set-face-attribute 'mode-line-inactive nil :background "#e1e1e1")) ; d3d7cf - (moody-replace-mode-line-buffer-identification) - (moody-replace-vc-mode)) - -(use-package mini-modeline - :disabled - :demand - :config (mini-modeline-mode)) - -(defvar b/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 - "For use with the `doom-tomorrow-night' theme.") - -(defun b/lights-on () - "Enable my favourite light theme." - (interactive) - (mapc #'disable-theme custom-enabled-themes) - (load-theme 'tangomod t) - (when (featurep 'smart-mode-line) - (sml/apply-theme 'tangomod)) - (font-lock-remove-keywords - 'org-mode b/org-mode-font-lock-keywords) - (when (featurep 'erc-hl-nicks) - (erc-hl-nicks-reset-face-table)) - (when (featurep 'exwm-systemtray) - (exwm-systemtray--refresh))) - -(defun b/lights-off () - "Go dark." - (interactive) - (mapc #'disable-theme custom-enabled-themes) - (load-theme 'doom-one t) - (when (featurep 'smart-mode-line) - (sml/apply-theme 'automatic)) - (font-lock-add-keywords - 'org-mode b/org-mode-font-lock-keywords t) - (when (featurep 'erc-hl-nicks) - (erc-hl-nicks-reset-face-table)) - (when (featurep 'exwm-systemtray) - (exwm-systemtray--refresh))) - -(bind-keys - ("C-c t d" . b/lights-off) - ("C-c t l" . b/lights-on)) - - -;;; Emacs enhancements & auxiliary packages - -(use-package 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-x RET" "coding system" - "C-x 8" "unicode" - "C-x @" "event modifiers" - "C-x a" "abbrev/expand" - "C-x r" "rectangle/register/bookmark" - "C-x t" "tabs" - "C-x v" "version control" - "C-x X" "edebug" - "C-x C-a" "edebug" - "C-x C-k" "kmacro" - ;; prefixes for my personal bindings - "C-c &" "yasnippet" - "C-c a" "applications" - "C-c a e" "erc" - "C-c a o" "org" - "C-c a s" "shells" - "C-c b" "buffers" - "C-c c" "compile-and-comments" - "C-c e" "eval" - "C-c f" "files" - "C-c F" "frames" - "C-c g" "magit" - "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" - "C-c t" "themes" - ;; "s-O" "outline" - ) - - ;; prefixes for major modes - (which-key-add-major-mode-key-based-replacements 'message-mode - "C-c f n" "footnote") - (which-key-add-major-mode-key-based-replacements 'org-mode - "C-c C-v" "org-babel") - - (which-key-mode) - :custom - (which-key-add-column-padding 5) - (which-key-max-description-length 32)) - -(use-package crux ; results in Waiting for git... [2 times] - :defer 0.4 - :bind (("C-c d" . crux-duplicate-current-line-or-region) - ("C-c M-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 - :disabled - :defer 0.5 - :bind-keymap ("C-c p" . projectile-command-map) - :config - (projectile-mode) - - (defun b/projectile-mode-line-fun () - "Report project name and type in the modeline." - (let ((project-name (projectile-project-name)) - (project-type (projectile-project-type))) - (format "%s%s" - projectile-mode-line-prefix - (if project-type - (format ":%s" project-type) - "")))) - (setq projectile-mode-line-function 'b/projectile-mode-line-fun) - - (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) - (projectile-mode-line-prefix " proj")) - -(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\\*$"))) - -;; ,---- -;; | make pretty boxed quotes like this -;; `---- -(use-package boxquote - :defer 0.6 - :bind - (:prefix-map b/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 - ;; breaks auto-fill-mode, showing this error: - ;; orgalist--boundaries: Lisp nesting exceeds ‘max-lisp-eval-depth’ - :disabled - :after message - :hook (message-mode . orgalist-mode)) - -;; highlight TODOs in buffers -(use-package hl-todo - :defer 0.5 - :config - (global-hl-todo-mode)) - -(use-package multi-term - :disabled - :defer 0.6 - :bind (("C-c a s m m" . multi-term) - ("C-c a s m d" . multi-term-dedicated-toggle) - ("C-c a s m p" . multi-term-prev) - ("C-c a s m n" . multi-term-next) - :map term-mode-map - ("C-c C-j" . term-char-mode)) - :config - (setq multi-term-program "screen" - multi-term-program-switches (concat "-c" - (getenv "XDG_CONFIG_HOME") - "/screen/screenrc") - ;; 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-c C-j" . term-line-mode) - ("C-k" . kill-line) - ;; ("C-y" . term-paste) - ("C-y" . term-send-raw) - ("M-f" . term-send-forward-word) - ("M-b" . term-send-backward-word) - ("M-p" . term-send-up) - ("M-n" . term-send-down) - ("M-j" . term-send-raw-meta) - ("M-y" . term-send-raw-meta) - ("M-/" . term-send-raw-meta) - ("M-0" . term-send-raw-meta) - ("M-1" . term-send-raw-meta) - ("M-2" . term-send-raw-meta) - ("M-3" . term-send-raw-meta) - ("M-4" . term-send-raw-meta) - ("M-5" . term-send-raw-meta) - ("M-6" . term-send-raw-meta) - ("M-7" . term-send-raw-meta) - ("M-8" . term-send-raw-meta) - ("M-9" . term-send-raw-meta) - ("" . 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 - :defer 0.5 - :custom - (page-break-lines-max-width fill-column) - :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 b/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 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" t) - (yas-reload-all) - (setq yas-verbosity yas-verbosity-cur) - - (defun b/yas--maybe-expand-key-filter (cmd) - (when (and (yas--maybe-expand-key-filter cmd) - (not (bound-and-true-p git-commit-mode))) - cmd)) - (defconst b/yas-maybe-expand - '(menu-item "" yas-expand :filter b/yas--maybe-expand-key-filter)) - (define-key yas-minor-mode-map - (kbd "SPC") b/yas-maybe-expand) - - (yas-global-mode)) - -(use-package debbugs - :bind - (("C-c D d" . debbugs-gnu) - ("C-c D b" . debbugs-gnu-bugs) - ("C-c D e" . - (lambda () - (interactive) ; bug-gnu-emacs - (setq debbugs-gnu-current-suppress t) - (debbugs-gnu debbugs-gnu-default-severities '("emacs")))) - ("C-c D g" . ; bug-gnuzilla - (lambda () - (interactive) - (setq debbugs-gnu-current-suppress t) - (debbugs-gnu debbugs-gnu-default-severities '("gnuzilla")))) - ("C-c D G b" . ; bug-guix - (lambda () - (interactive) - (setq debbugs-gnu-current-suppress t) - (debbugs-gnu debbugs-gnu-default-severities '("guix")))) - ("C-c D G p" . ; guix-patches - (lambda () - (interactive) - (setq debbugs-gnu-current-suppress t) - (debbugs-gnu debbugs-gnu-default-severities '("guix-patches")))))) - -(use-package org-ref - :init - (b/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 fill-column-indicator) - -(use-package window - :bind - (("C-c w e" . (lambda () - (interactive) - (split-window-right) - (other-window 1) - (erc-switch-to-buffer))) - ("C-c w s l" . (lambda () - (interactive) - (split-window-right) - (other-window 1))) - ("C-c w s j" . (lambda () - (interactive) - (split-window-below) - (other-window 1))) - ("C-c w q" . quit-window)) - :custom - (split-width-threshold 150)) - -(use-package windmove - :defer 0.6 - :bind - (("C-c w h" . windmove-left) - ("C-c w j" . windmove-down) - ("C-c w k" . windmove-up) - ("C-c w l" . windmove-right) - ("C-c w H" . windmove-swap-states-left) - ("C-c w J" . windmove-swap-states-down) - ("C-c w K" . windmove-swap-states-up) - ("C-c w L" . windmove-swap-states-right))) - -(use-package pass - :commands pass - :bind ("C-c a p" . pass) - :hook (pass-mode . View-exit)) - -(use-package pdf-tools - :defer 0.5 - :bind (:map pdf-view-mode-map - ("" . pdf-history-backward) - ("" . pdf-history-backward) - ("" . pdf-history-backward) - ("" . pdf-history-forward) - ("" . pdf-history-forward) - ("" . pdf-history-forward) - ("M-RET" . image-previous-line) - ("C-s" . isearch-forward) - ("s s" . isearch-forward)) - :config (pdf-tools-install nil t) - :custom (pdf-view-resize-factor 1.05)) - -(use-package org-pdftools - :disabled - :straight (:host github :repo "fuxialexander/org-pdftools") - :demand - :after org - :config - (with-eval-after-load 'org - (require 'org-pdftools))) - -(use-package biblio) - -(use-package reftex - :hook (latex-mode . reftex-mode)) - -(use-package reftex-cite - :after reftex - :disabled ; enable to disable - ; reftex-cite's default choice - ; of previous word - :config - (defun reftex-get-bibkey-default () - "If the cursor is in a citation macro, return the word before the macro." - (let* ((macro (reftex-what-macro 1))) - (save-excursion - (when (and macro (string-match "cite" (car macro))) - (goto-char (cdr macro))) - (reftex-this-word))))) - -(use-package minions - :demand - :config (minions-mode)) - -(use-package dmenu - :custom - (dmenu-prompt-string "run: ") - (dmenu-save-file (b/var "dmenu-items"))) - -(use-package eosd - ;; TODO: fix build by properly building the eosd-pixbuf.c module - ;; e.g. see https://github.com/raxod502/straight.el/issues/386 - :disabled - :straight (:host github :repo "clarete/eosd") - :demand - :after exwm - :config - (eosd-start)) - -(use-package scpaste - :disabled - :config - (setq scpaste-http-destination "https://p.bndl.org" - scpaste-scp-destination "nix:/var/www/p.bndl.org")) - -(use-package eww - :bind ("C-c a e w" . eww) - :custom - (eww-download-directory (file-name-as-directory - (getenv "XDG_DOWNLOAD_DIR")))) - - -;;; Email (with Gnus) - -(defvar b/maildir (expand-file-name "~/mail/")) -(with-eval-after-load 'recentf - (add-to-list 'recentf-exclude b/maildir)) - -(setq - b/gnus-init-file (b/etc "gnus") - mail-user-agent 'gnus-user-agent - read-mail-command 'gnus) - -(use-package gnus - :bind (("s-m" . gnus-plugged) - ("s-M" . gnus-unplugged) - ("C-c a m" . gnus-plugged) - ("C-c a M" . gnus-unplugged)) - :init - (setq - gnus-select-method '(nnnil "") - gnus-secondary-select-methods - '((nnimap "shemshak" - (nnimap-stream plain) - (nnimap-address "127.0.0.1") - (nnimap-server-port 143) - (nnimap-authenticator plain) - (nnimap-user "amin@shemshak.local")) - (nnimap "gnu" - (nnimap-stream plain) - (nnimap-address "127.0.0.1") - (nnimap-server-port 143) - (nnimap-authenticator plain) - (nnimap-user "bandali@gnu.local") - (nnimap-inbox "INBOX") - (nnimap-split-methods 'nnimap-split-fancy) - (nnimap-split-fancy (| - ;; (: gnus-registry-split-fancy-with-parent) - ;; (: gnus-group-split-fancy "INBOX" t "INBOX") - ;; gnu - (list ".*<\\(.*\\)\\.\\(non\\)?gnu\\.org>.*" "l.\\1") - ;; gnus - (list ".*<\\(.*\\)\\.gnus\\.org>.*" "l.\\1") - ;; libreplanet - (list ".*<\\(.*\\)\\.libreplanet\\.org>.*" "l.\\1") - ;; *.lists.sr.ht, omitting one dot if present - ;; add more \\.?\\([^.]*\\) if needed - (list ".*<~\\(.*\\)/\\([^.]*\\)\\.?\\([^.]*\\)\\.lists.sr.ht>.*" "l.~\\1.\\2\\3") - ;; webmasters - (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters") - ;; other - (list ".*atreus.freelists.org" "l.atreus") - (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec") - ;; (list ".*haskell-art.we.lurk.org" "l.haskell.art") ;d - (list ".*haskell-cafe.haskell.org" "l.haskell-cafe") - ;; (list ".*notmuch.notmuchmail.org" "l.notmuch") ;u - ;; (list ".*dev.lists.parabola.nu" "l.parabola-dev") ;u - ;; ---------------------------------- - ;; legend: (u)nsubscribed | (d)ead - ;; ---------------------------------- - ;; otherwise, leave mail in INBOX - "INBOX"))) - (nnimap "uw" - (nnimap-stream plain) - (nnimap-address "127.0.0.1") - (nnimap-server-port 143) - (nnimap-authenticator plain) - (nnimap-user "abandali@uw.local") - (nnimap-inbox "INBOX") - (nnimap-split-methods 'nnimap-split-fancy) - (nnimap-split-fancy (| - ;; (: gnus-registry-split-fancy-with-parent) - ;; se212-f19 - ("subject" "SE\\s-?212" "course.se212-f19") - (from "SE\\s-?212" "course.se212-f19") - ;; catch-all - "INBOX"))) - (nnimap "csc" - (nnimap-stream plain) - (nnimap-address "127.0.0.1") - (nnimap-server-port 143) - (nnimap-authenticator plain) - (nnimap-user "abandali@csc.uw.local"))) - gnus-message-archive-group "nnimap+gnu:INBOX" - gnus-parameters - '(("l\\.atreus" - (to-address . "atreus@freelists.org") - (to-list . "atreus@freelists.org")) - ("l\\.deepspec" - (to-address . "deepspec@lists.cs.princeton.edu") - (to-list . "deepspec@lists.cs.princeton.edu") - (list-identifier . "\\[deepspec\\]")) - ("l\\.emacs-devel" - (to-address . "emacs-devel@gnu.org") - (to-list . "emacs-devel@gnu.org")) - ("l\\.help-gnu-emacs" - (to-address . "help-gnu-emacs@gnu.org") - (to-list . "help-gnu-emacs@gnu.org")) - ("l\\.info-gnu-emacs" - (to-address . "info-gnu-emacs@gnu.org") - (to-list . "info-gnu-emacs@gnu.org")) - ("l\\.emacs-orgmode" - (to-address . "emacs-orgmode@gnu.org") - (to-list . "emacs-orgmode@gnu.org") - (list-identifier . "\\[O\\]")) - ("l\\.emacs-tangents" - (to-address . "emacs-tangents@gnu.org") - (to-list . "emacs-tangents@gnu.org")) - ("l\\.emacsconf-committee" - (to-address . "emacsconf-committee@gnu.org") - (to-list . "emacsconf-committee@gnu.org")) - ("l\\.emacsconf-discuss" - (to-address . "emacsconf-discuss@gnu.org") - (to-list . "emacsconf-discuss@gnu.org")) - ("l\\.emacsconf-register" - (to-address . "emacsconf-register@gnu.org") - (to-list . "emacsconf-register@gnu.org")) - ("l\\.emacsconf-submit" - (to-address . "emacsconf-submit@gnu.org") - (to-list . "emacsconf-submit@gnu.org")) - ("l\\.fencepost-users" - (to-address . "fencepost-users@gnu.org") - (to-list . "fencepost-users@gnu.org") - (list-identifier . "\\[Fencepost-users\\]")) - ("l\\.gnewsense-art" - (to-address . "gnewsense-art@nongnu.org") - (to-list . "gnewsense-art@nongnu.org") - (list-identifier . "\\[gNewSense-art\\]")) - ("l\\.gnewsense-dev" - (to-address . "gnewsense-dev@nongnu.org") - (to-list . "gnewsense-dev@nongnu.org") - (list-identifier . "\\[Gnewsense-dev\\]")) - ("l\\.gnewsense-users" - (to-address . "gnewsense-users@nongnu.org") - (to-list . "gnewsense-users@nongnu.org") - (list-identifier . "\\[gNewSense-users\\]")) - ("l\\.gnunet-developers" - (to-address . "gnunet-developers@gnu.org") - (to-list . "gnunet-developers@gnu.org") - (list-identifier . "\\[GNUnet-developers\\]")) - ("l\\.help-gnunet" - (to-address . "help-gnunet@gnu.org") - (to-list . "help-gnunet@gnu.org") - (list-identifier . "\\[Help-gnunet\\]")) - ("l\\.bug-gnuzilla" - (to-address . "bug-gnuzilla@gnu.org") - (to-list . "bug-gnuzilla@gnu.org") - (list-identifier . "\\[Bug-gnuzilla\\]")) - ("l\\.gnuzilla-dev" - (to-address . "gnuzilla-dev@gnu.org") - (to-list . "gnuzilla-dev@gnu.org") - (list-identifier . "\\[Gnuzilla-dev\\]")) - ("l\\.guile-devel" - (to-address . "guile-devel@gnu.org") - (to-list . "guile-devel@gnu.org")) - ("l\\.guile-user" - (to-address . "guile-user@gnu.org") - (to-list . "guile-user@gnu.org")) - ("l\\.guix-devel" - (to-address . "guix-devel@gnu.org") - (to-list . "guix-devel@gnu.org")) - ("l\\.help-guix" - (to-address . "help-guix@gnu.org") - (to-list . "help-guix@gnu.org")) - ("l\\.info-guix" - (to-address . "info-guix@gnu.org") - (to-list . "info-guix@gnu.org")) - ("l\\.savannah-hackers-public" - (to-address . "savannah-hackers-public@gnu.org") - (to-list . "savannah-hackers-public@gnu.org")) - ("l\\.savannah-users" - (to-address . "savannah-users@gnu.org") - (to-list . "savannah-users@gnu.org")) - ("l\\.www-commits" - (to-address . "www-commits@gnu.org") - (to-list . "www-commits@gnu.org")) - ("l\\.www-discuss" - (to-address . "www-discuss@gnu.org") - (to-list . "www-discuss@gnu.org")) - ("l\\.haskell-art" - (to-address . "haskell-art@we.lurk.org") - (to-list . "haskell-art@we.lurk.org") - (list-identifier . "\\[haskell-art\\]")) - ("l\\.haskell-cafe" - (to-address . "haskell-cafe@haskell.org") - (to-list . "haskell-cafe@haskell.org") - (list-identifier . "\\[Haskell-cafe\\]")) - ("l\\.notmuch" - (to-address . "notmuch@notmuchmail.org") - (to-list . "notmuch@notmuchmail.org")) - ("l\\.parabola-dev" - (to-address . "dev@lists.parabola.nu") - (to-list . "dev@lists.parabola.nu") - (list-identifier . "\\[Dev\\]")) - ("l\\.~bandali\\.public-inbox" - (to-address . "~bandali/public-inbox@lists.sr.ht") - (to-list . "~bandali/public-inbox@lists.sr.ht")) - ("l\\.~sircmpwn\\.free-writers-club" - (to-address . "~sircmpwn/free-writers-club@lists.sr.ht") - (to-list . "~sircmpwn/free-writers-club@lists.sr.ht")) - ("l\\.~sircmpwn\\.srht-admins" - (to-address . "~sircmpwn/sr.ht-admins@lists.sr.ht") - (to-list . "~sircmpwn/sr.ht-admins@lists.sr.ht")) - ("l\\.~sircmpwn\\.srht-announce" - (to-address . "~sircmpwn/sr.ht-announce@lists.sr.ht") - (to-list . "~sircmpwn/sr.ht-announce@lists.sr.ht")) - ("l\\.~sircmpwn\\.srht-dev" - (to-address . "~sircmpwn/sr.ht-dev@lists.sr.ht") - (to-list . "~sircmpwn/sr.ht-dev@lists.sr.ht")) - ("l\\.~sircmpwn\\.srht-discuss" - (to-address . "~sircmpwn/sr.ht-discuss@lists.sr.ht") - (to-list . "~sircmpwn/sr.ht-discuss@lists.sr.ht")) - ("webmasters" - (to-address . "webmasters@gnu.org") - (to-list . "webmasters@gnu.org")) - ("gnu.*" - (gcc-self . t)) - ("l\\." - (subscribed . t)) - ("nnimap\\+uw:.*" - (gcc-self . t))) - gnus-large-newsgroup 50 - gnus-home-directory (b/var "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 - (when (version< emacs-version "27") - (with-eval-after-load 'nnmail - (add-to-list - 'nnmail-split-abbrev-alist - '(list . "list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop") - t))) - - ;; (gnus-registry-initialize) - - (with-eval-after-load 'recentf - (add-to-list 'recentf-exclude gnus-home-directory))) - -(use-package gnus-art - :config - (setq - gnus-buttonized-mime-types '("multipart/\\(signed\\|encrypted\\)") - gnus-sorted-header-list '("^From:" - "^X-RT-Originator" - "^Newsgroups:" - "^Subject:" - "^Date:" - "^Envelope-To:" - "^Followup-To:" - "^Reply-To:" - "^Organization:" - "^Summary:" - "^Abstract:" - "^Keywords:" - "^To:" - "^[BGF]?Cc:" - "^Posted-To:" - "^Mail-Copies-To:" - "^Mail-Followup-To:" - "^Apparently-To:" - "^Resent-From:" - "^User-Agent:" - "^X-detected-operating-system:" - "^Message-ID:" - ;; "^References:" - "^List-Id:" - "^Gnus-Warning:") - gnus-visible-headers (mapconcat 'identity - gnus-sorted-header-list - "\\|") - ;; 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-package gnus-sum - :bind (:map gnus-summary-mode-map - :prefix-map b/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 . b/no-mouse-autoselect-window) - :custom - (gnus-thread-sort-functions '(gnus-thread-sort-by-number - gnus-thread-sort-by-subject - gnus-thread-sort-by-date))) - -(use-package gnus-msg - :config - (defvar b/shemshak-signature "Amin Bandali -https://shemshak.org/~amin") - (defvar b/uw-signature "Amin Bandali, MMath Student -Cheriton School of Computer Science -University of Waterloo -https://bandali.eu.org") - (defvar b/csc-signature "Amin Bandali -System Administrator, Systems Committee -Computer Science Club, University of Waterloo -https://csclub.uwaterloo.ca/~abandali") - (setq gnus-message-replysign t - gnus-posting-styles - '((".*" - (address "bandali@gnu.org")) - ("nnimap\\+gnu:l\\..*" - (signature nil)) - ("nnimap\\+gnu:.*" - (organization "GNU")) - ((header "subject" "ThankCRM") - (to "webmasters-comment@gnu.org") - (body "") - (eval (setq b/message-cite-say-hi nil))) - ("nnimap\\+shemshak:.*" - (address "amin@shemshak.org") - (body "\nBest,\n") - (signature b/shemshak-signature) - (gcc "nnimap+shemshak:Sent") - (eval (setq b/message-cite-say-hi t))) - ("nnimap\\+uw:.*" - (address "bandali@uwaterloo.ca") - (body "\nBest,\n") - (signature b/uw-signature)) - ("nnimap\\+uw:INBOX" - (gcc "\"nnimap+uw:Sent Items\"")) - ("nnimap\\+csc:.*" - (address "bandali@csclub.uwaterloo.ca") - (signature b/csc-signature) - (gcc "nnimap+csc:Sent")))) - :hook (gnus-message-setup . (lambda () - (unless (mml-secure-is-encrypted-p) - (mml-secure-message-sign))))) - -(use-package gnus-topic - :hook (gnus-group-mode . gnus-topic-mode) - :config (setq gnus-topic-line-format "%i[ %A: %(%{%n%}%) ]%v\n")) - -(use-package gnus-agent - :config - (setq gnus-agent-synchronize-flags 'ask) - :hook (gnus-group-mode . gnus-agent-mode)) - -(use-package gnus-group - :config - (setq gnus-permanently-visible-groups "\\(:INBOX$\\|:gnu$\\)")) - -(comment - ;; problematic with ebdb's popup, *EBDB-Gnus* - (use-package gnus-win - :config - (setq gnus-use-full-window nil))) - -(use-package gnus-dired - :commands gnus-dired-mode - :init - (add-hook 'dired-mode-hook 'gnus-dired-mode)) - -(comment - (use-package gnus-utils - :custom - (gnus-completing-read-function 'gnus-ido-completing-read))) - -(use-package mm-decode - :config - (setq mm-discouraged-alternatives '("text/html" "text/richtext") - mm-decrypt-option 'known - mm-verify-option 'known)) - -(use-package mm-uu - :config - (when (version< "27" emacs-version) - (set-face-attribute 'mm-uu-extract nil :extend t)) - :custom - (mm-uu-diff-groups-regexp - "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)")) - -(use-package sendmail - :config - (setq sendmail-program (executable-find "msmtp") - ;; message-sendmail-extra-arguments '("-v" "-d") - mail-specify-envelope-from t - mail-envelope-from 'header)) - -(use-package message - :bind (:map message-mode-map ("" . b/insert-asterism)) - :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 b/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 b/message-cite-say-hi - (concat "Hi %F,\n\n" b/message-cite-style-format) - b/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@shemshak\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|\\(a?bandali@\\(csclub\\.\\)?uwaterloo\\.ca\\)\\)") - ;; (require 'company-ebdb) - :hook (;; (message-setup . mml-secure-message-sign-pgpmime) - (message-mode . flyspell-mode) - (message-mode . (lambda () - ;; (setq-local fill-column b/fill-column - ;; message-fill-column b/fill-column) - (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)))) - :custom - (message-elide-ellipsis "[...]\n")) - -(use-package mml) - -(use-package mml-sec - :custom - (mml-secure-openpgp-encrypt-to-self t) - (mml-secure-openpgp-sign-with-sender t)) - -(use-package footnote - :after message - ;; :config - ;; (setq footnote-start-tag "" - ;; footnote-end-tag "" - ;; footnote-style 'unicode) - :bind - (:map message-mode-map - :prefix-map b/footnote-prefix-map - :prefix "C-c f n" - ("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 - :demand - :after gnus - :bind (:map gnus-group-mode-map ("e" . ebdb)) - :config - (setq ebdb-sources (b/var "ebdb")) - (with-eval-after-load 'swiper - (add-to-list 'swiper-font-lock-exclude 'ebdb-mode t))) - -(use-package ebdb-com - :after ebdb) - -(use-package ebdb-complete - :after ebdb - :config - ;; (setq ebdb-complete-mail 'capf) - (ebdb-complete-enable)) - -(use-package ebdb-message - :demand - :after ebdb) - -;; (use-package company-ebdb -;; :config -;; (defun company-ebdb--post-complete (_) nil)) - -(use-package ebdb-gnus - :after ebdb - :custom - (ebdb-gnus-window-size 0.3)) - -(use-package ebdb-mua - :demand - :after ebdb - :custom (ebdb-mua-pop-up t)) - -;; (use-package ebdb-message -;; :after ebdb) - -;; (use-package ebdb-vcard -;; :after ebdb) - -(use-package message-x) - -(comment - (use-package message-x - :custom - (message-x-completion-alist - (quote - (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address) - ((if - (boundp - (quote message-newgroups-header-regexp)) - message-newgroups-header-regexp message-newsgroups-header-regexp) - . message-expand-group)))))) - -(comment - (use-package gnus-harvest - :commands gnus-harvest-install - :demand t - :config - (if (featurep 'message-x) - (gnus-harvest-install 'message-x) - (gnus-harvest-install)))) - -(use-package gnus-article-treat-patch - :disabled - :demand - :load-path "lisp/" - :config - ;; note: be sure to customize faces with `:foreground "white"' when - ;; using a theme with a white/light background :) - (setq ft/gnus-article-patch-conditions - '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@"))) - - -;;; IRC (with ERC and ZNC) - -(use-package erc - :bind (("C-c b b" . erc-switch-to-buffer) - :map erc-mode-map - ("M-a" . erc-track-switch-buffer)) - :custom - (erc-join-buffer 'bury) - (erc-lurker-hide-list '("JOIN" "PART" "QUIT")) - (erc-nick "bandali") - (erc-prompt "erc>") - (erc-rename-buffers t) - (erc-server-reconnect-attempts 5) - (erc-server-reconnect-timeout 3) - :config - (defun erc-cmd-OPME () - "Request chanserv to op me." - (erc-message "PRIVMSG" - (format "chanserv op %s %s" - (erc-default-target) - (erc-current-nick)) nil)) - (defun erc-cmd-DEOPME () - "Deop myself from current channel." - (erc-cmd-DEOP (format "%s" (erc-current-nick)))) - (add-to-list 'erc-modules 'keep-place) - (add-to-list 'erc-modules 'notifications) - (add-to-list 'erc-modules 'smiley) - (add-to-list 'erc-modules 'spelling) - (add-to-list 'erc-modules 'scrolltoplace) - (erc-update-modules)) - -(use-package erc-fill - :after erc - :custom - (erc-fill-column 77) - (erc-fill-function 'erc-fill-static) - (erc-fill-static-center 18)) - -(use-package erc-pcomplete - :after erc - :custom - (erc-pcomplete-nick-postfix ", ")) - -(use-package erc-track - :after erc - :bind (("C-c a e t d" . erc-track-disable) - ("C-c a e t e" . erc-track-enable)) - :custom - (erc-track-enable-keybindings nil) - (erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT" - "324" "329" "332" "333" "353" "477")) - (erc-track-position-in-mode-line t) - (erc-track-priority-faces-only 'all) - (erc-track-shorten-function nil)) - -(use-package erc-hl-nicks - :after erc) - -(use-package erc-scrolltoplace - :after erc) - -(use-package znc - :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.shemshak.org" 1337 t - ((freenode "amin/freenode" ,pwd))) - ("znc.shemshak.org" 1337 t - ((oftc "amin/oftc" ,pwd))))))) - - -;;; Post initialization - -(message "Loading %s...done (%.3fs)" user-init-file - (float-time (time-subtract (current-time) - b/before-user-init-time))) - -;;; init.el ends here diff --git a/.emacs.d/lisp/gnus-article-treat-patch.el b/.emacs.d/lisp/gnus-article-treat-patch.el deleted file mode 100644 index f2f5c21..0000000 --- a/.emacs.d/lisp/gnus-article-treat-patch.el +++ /dev/null @@ -1,465 +0,0 @@ -;;; gnus-article-treat-patch.el --- Highlight inline patches in articles -;; -;; Copyright © 2011-2019 Frank Terbeck -;; -;; This file is not part of GNU Emacs. -;; -;; This file 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 Soft- -;; ware Foundation; either version 3, or (at your option) any later version. -;; -;; This file 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 file. If not, see . -;; -;; -;;; Commentary: -;; -;; Gnus addon to beautify patch-like emails. This uses a "ft/" prefix for -;; everything to avoid clashing with anything upstream. That prefix can be -;; savely s,ft/,,'d - if this is to be submitted to the gnus developers. - -(require 'diff-mode) - -(add-hook 'gnus-part-display-hook 'ft/gnus-article-treat-patch) - -;; Colour handling and faces -(defun ft/gnus-colour-line (use-face) - "Set text overlay to `use-face' for the current line." - (overlay-put (make-overlay (point-at-bol) (point-at-eol)) 'face use-face)) - -(make-face 'ft/gnus-three-dashes) -(set-face-attribute 'ft/gnus-three-dashes nil :foreground "brightblue") -(make-face 'ft/gnus-scissors) -(set-face-attribute 'ft/gnus-scissors nil :foreground "brown") -(make-face 'ft/gnus-diff-index) -(set-face-attribute 'ft/gnus-diff-index nil :foreground "brightmagenta") -(make-face 'ft/gnus-diff-hunk) -(set-face-attribute 'ft/gnus-diff-hunk nil :foreground "brightblue") -(make-face 'ft/gnus-diff-equals) -(set-face-attribute 'ft/gnus-diff-equals nil :foreground "brightmagenta") -(make-face 'ft/gnus-commit-message) -(set-face-attribute 'ft/gnus-commit-message nil :foreground "white") -(make-face 'ft/gnus-diff-stat-file) -(set-face-attribute 'ft/gnus-diff-stat-file nil :foreground "yellow") -(make-face 'ft/gnus-diff-stat-bar) -(set-face-attribute 'ft/gnus-diff-stat-bar nil :foreground "magenta") -(make-face 'ft/gnus-diff-stat-num) -(set-face-attribute 'ft/gnus-diff-stat-num nil :foreground "white") -(make-face 'ft/gnus-diff-misc) -(set-face-attribute 'ft/gnus-diff-misc nil :foreground "magenta") -(make-face 'ft/gnus-commit-comment) -(set-face-attribute 'ft/gnus-commit-comment nil :inherit 'default) -(make-face 'ft/gnus-diff-header) -(set-face-attribute 'ft/gnus-diff-header nil :inherit 'diff-header) -(make-face 'ft/gnus-diff-add) -(set-face-attribute 'ft/gnus-diff-add nil :inherit 'diff-added) -(make-face 'ft/gnus-diff-remove) -(set-face-attribute 'ft/gnus-diff-remove nil :inherit 'diff-removed) - -;; Pseudo-headers -(defvar ft/gnus-article-patch-pseudo-headers - '(("^Acked-by: " 'gnus-header-name 'gnus-header-from) - ("^C\\(c\\|C\\): " 'gnus-header-name 'gnus-header-from) - ("^From: " 'gnus-header-name 'gnus-header-from) - ("^Link: " 'gnus-header-name 'gnus-header-from) - ("^Reported-by: " 'gnus-header-name 'gnus-header-from) - ("^Reviewed-by: " 'gnus-header-name 'gnus-header-from) - ("^Signed-off-by: " 'gnus-header-name 'gnus-header-from) - ("^Subject: " 'gnus-header-name 'gnus-header-from) - ("^Suggested-by: " 'gnus-header-name 'gnus-header-from)) - "List of lists of regular expressions (with two face names) -which are used to determine the highlighting of pseudo headers in -the commit message (such as \"Signed-off-by:\"). - -The first face if used to highlight the header's name; the second -highlights the header's value.") - -(defun ft/gnus-pseudo-header-get (line) - "Check if `line' is a pseudo header, and if so return its enty in -`ft/gnus-article-patch-pseudo-headers'." - (catch 'done - (dolist (entry ft/gnus-article-patch-pseudo-headers) - (let ((regex (car entry))) - (if (string-match regex line) - (throw 'done entry)))) - (throw 'done '()))) - -(defun ft/gnus-pseudo-header-p (line) - "Returns `t' if `line' looks like a pseudo-header; `nil' otherwise. - -`ft/gnus-article-patch-pseudo-headers' is used to determine what a pseudo-header -is." - (if (eq (ft/gnus-pseudo-header-get line) '()) nil t)) - -(defun ft/gnus-pseudo-header-colour (line) - "Colourise a pseudo-header line." - (let ((data (ft/gnus-pseudo-header-get line))) - (if (eq data '()) - nil - (let* ((s (point-at-bol)) - (e (point-at-eol)) - (colon (re-search-forward ":")) - (value (+ colon 1))) - (overlay-put (make-overlay s colon) 'face (nth 1 data)) - (overlay-put (make-overlay value e) 'face (nth 2 data)))))) - -;; diff-stat -(defun ft/gnus-diff-stat-colour (line) - "Colourise a diff-stat line." - (let ((s (point-at-bol)) - (e (point-at-eol)) - (bar (- (re-search-forward "|") 1)) - (num (- (re-search-forward "[0-9]") 1)) - (pm (- (re-search-forward "\\([+-]\\|$\\)") 1))) - - (overlay-put (make-overlay s (- bar 1)) 'face 'ft/gnus-diff-stat-file) - (overlay-put (make-overlay bar (+ bar 1)) 'face 'ft/gnus-diff-stat-bar) - (overlay-put (make-overlay num pm) 'face 'ft/gnus-diff-stat-num) - - (goto-char pm) - (let* ((plus (looking-at "\\+")) - (regex (if plus "-+" "\\++")) - (brk (if plus - (re-search-forward "-" e t) - (re-search-forward "\\+" e t))) - (first-face (if plus 'ft/gnus-diff-add 'ft/gnus-diff-remove)) - (second-face (if plus 'ft/gnus-diff-remove 'ft/gnus-diff-add))) - - (if (eq brk nil) - (overlay-put (make-overlay pm e) 'face first-face) - (progn - (setq brk (- brk 1)) - (overlay-put (make-overlay pm brk) 'face first-face) - (overlay-put (make-overlay brk e) 'face second-face)))))) - -(defun ft/gnus-diff-stat-summary-colour (line) - "Colourise a diff-stat summary-line." - (let* ((e (point-at-eol)) - (plus (- (re-search-forward "(\\+)" e t) 2)) - (minus (- (re-search-forward "(-)" e t) 2))) - (overlay-put (make-overlay plus (+ plus 1)) 'face 'ft/gnus-diff-add) - (overlay-put (make-overlay minus (+ minus 1)) 'face 'ft/gnus-diff-remove))) - -(defun ft/gnus-diff-stat-line-p (line) - "Return `t' if `line' is a diff-stat line; `nil' otherwise." - (string-match "^ *[^ ]+[^|]+| +[0-9]+\\( *\\| +[+-]+\\)$" line)) - -(defun ft/gnus-diff-stat-summary-p (line) - "Return `t' if `line' is a diff-stat summary-line; `nil' otherwise." - (string-match "^ *[0-9]+ file\\(s\\|\\) changed,.*insertion.*deletion" line)) - -;; unified-diffs -(defun ft/gnus-diff-header-p (line) - "Returns `t' if `line' looks like a diff-header; `nil' otherwise." - (cond - ((string-match "^\\(\\+\\+\\+\\|---\\) " line) t) - ((string-match "^diff -" line) t) - (t nil))) - -(defun ft/gnus-index-line-p (line) - "Returns `t' if `line' looks like an index-line; `nil' otherwise." - (cond - ((string-match "^Index: " line) t) - ((string-match "^index [0-9a-f]+\\.\\.[0-9a-f]+" line) t) - (t nil))) - -(defun ft/gnus-hunk-line-p (line) - "Returns `t' if `line' looks like a hunk-line; `nil' otherwise." - (string-match "^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@" line)) - -(defun ft/gnus-atp-misc-diff-p (line) - "Return `t' if `line' is a \"misc line\" with respect to patch -treatment; `nil' otherwise." - (let ((patterns '("^new file" - "^RCS file:" - "^retrieving revision "))) - (catch 'done - (dolist (regex patterns) - (if (string-match regex line) - (throw 'done t))) - (throw 'done nil)))) - -(defun ft/gnus-atp-looks-like-diff (line) - "Return `t' if `line' looks remotely like a line from a unified -diff; `nil' otherwise." - (or (ft/gnus-index-line-p line) - (ft/gnus-diff-header-p line) - (ft/gnus-hunk-line-p line))) - -;; miscellaneous line handlers -(defun ft/gnus-scissors-line-p (line) - "Returns `t' if `line' looks like a scissors-line; `nil' otherwise." - (cond - ((string-match "^\\( *--* *\\(8<\\|>8\\)\\)+ *-* *$" line) t) - (t nil))) - -;; Patch mail detection -(defvar ft/gnus-article-patch-conditions nil - "List of conditions that will enable patch treatment. String -values will be matched as regular expressions within the currently -processed part. Non-string value are supposed to be code fragments, -which determine whether or not to do treatment: The code needs to -return `t' if treatment is wanted.") - -(defun ft/gnus-part-want-patch-treatment () - "Run through `ft/gnus-article-patch-conditions' to determine whether -patch treatment is wanted or not. Return `t' or `nil' accordingly." - (catch 'done - (dolist (entry ft/gnus-article-patch-conditions) - (cond - ((stringp entry) - (if (re-search-forward entry nil t) - (throw 'done t))) - (t - (if (eval entry) - (throw 'done t))))) - (throw 'done nil))) - - -;; The actual article treatment code -(defun ft/gnus-article-treat-patch-state-machine () - "Implement the state machine which colourises a part of an article -if it looks patch-like. - -The state machine works like this: - - 0a. The machinery starts at the first line of the article's body. Not - the header lines. We don't care about header lines at all. - - 0b. The whole thing works line by line. It doesn't do any forward or - backward looks. - - 1. Initially, we assume, that what we'll see first is part of the - patch's commit-message. Hence this first initial state is - \"commit-message\". There are several ways out of this state: - - a) a scissors line is found (see 2.) - b) a pseudo-header line is found (see 3.) - c) a three-dashes line is found (see 4.) - d) something that looks like the start of a unified diff is - found (see 7.) - - 2. A scissors line is something that looks like a pair of scissors running - through a piece of paper. Like this: - - ------ 8< ----- 8< ------ - - or this: - - ------------>8----------- - - The function `ft/gnus-scissors-line-p' decides whether a line is a - scissors line or not. After a scissors line was treated, the machine - will switch back to the \"commit-mesage\" state. - - 3. This is very similar to a scissors line. It'll just return to the old - state after its being done. The `ft/gnus-pseudo-header-p' function - decides if a line is a pseudo header. The line will be appropriately - coloured. - - 4. A three-dashes line is a line that looks like this: \"---\". It's the - definite end of the \"commit-message\" state. The three dashes line is - coloured and the state switches to \"commit-comment\". (See 5.) - - 5. Nothing in \"commit-comment\" will appear in the generated commit (this - is git-am specific semantics, but it's useful, so...). It may contain - things like random comments or - promimently - a diff stat. (See 6.) - - 6. A diff stat provides statistics about how much changed in a given commit - by files and by whole commit (in a summary line). Two functions - `ft/gnus-diff-stat-line-p' and `ft/gnus-diff-stat-summary-p' decide if a - line belongs to a diff stat. It's coloured appropriately and the state - switches back to \"commit-comment\". - - 7. There is a function `ft/gnus-unified-diff-line-p' which will cause the - state to switch to \"unified-diff\" state from either \"commit-message\" - or \"commit-comment\". In this mode there can be a set of lines types: - - a) diff-header lines (`ft/gnus-diff-header-p') - b) index lines (`ft/gnus-index-line-p') - c) hunk lines (`ft/gnus-hunk-line-p') - d) equals line (\"^==*$\") - e) context lines (\"^ \") - f) add lines (\"^\\+\") - g) remove lines (\"^-\") - h) empty lines (\"^$\") - - This state runs until the end of the part." - (catch 'ft/gnus-atp-done - (let ((state 'commit-message) - line do-not-move) - - (while t - ;; Put the current line into an easy-to-handle string variable. - (setq line - (buffer-substring-no-properties (point-at-bol) (point-at-eol))) - (setq do-not-move nil) - - ;; Switched state machine. The "real" states are `commit-message', - ;; `commit-comment' and `unified-diff'. The other "states" are only - ;; single-line colourisations that return to their respective parent- - ;; state. Each state may (throw 'ft/gnus-atp-done) to leave the state- - ;; machine immediately. - (setq state - (cond - - ((eq state 'commit-message) - (cond - ((ft/gnus-scissors-line-p line) - (ft/gnus-colour-line 'ft/gnus-scissors) - 'commit-message) - ((ft/gnus-pseudo-header-p line) - (ft/gnus-pseudo-header-colour line) - 'commit-message) - ((string= line "---") - (ft/gnus-colour-line 'ft/gnus-three-dashes) - 'commit-comment) - ((ft/gnus-atp-looks-like-diff line) - (setq do-not-move t) - 'unified-diff) - (t - (ft/gnus-colour-line 'ft/gnus-commit-message) - 'commit-message))) - - ((eq state 'commit-comment) - (cond - ((ft/gnus-diff-stat-line-p line) - (ft/gnus-diff-stat-colour line) - 'commit-comment) - ((ft/gnus-diff-stat-summary-p line) - (ft/gnus-diff-stat-summary-colour line) - 'commit-comment) - ((ft/gnus-atp-looks-like-diff line) - (setq do-not-move t) - 'unified-diff) - (t - (ft/gnus-colour-line 'ft/gnus-commit-comment) - 'commit-comment))) - - ((eq state 'unified-diff) - (cond - ((ft/gnus-diff-header-p line) - (ft/gnus-colour-line 'ft/gnus-diff-header) - 'unified-diff) - ((ft/gnus-index-line-p line) - (ft/gnus-colour-line 'ft/gnus-diff-index) - 'unified-diff) - ((ft/gnus-hunk-line-p line) - (ft/gnus-colour-line 'ft/gnus-diff-hunk) - 'unified-diff) - ((string-match "^==*$" line) - (ft/gnus-colour-line 'ft/gnus-diff-equals) - 'unified-diff) - ((string-match "^$" line) - 'unified-diff) - ((string-match "^ " line) - (ft/gnus-colour-line 'ft/gnus-diff-context) - 'unified-diff) - ((ft/gnus-atp-misc-diff-p line) - (ft/gnus-colour-line 'ft/gnus-diff-misc) - 'unified-diff) - ((string-match "^\\+" line) - (ft/gnus-colour-line 'ft/gnus-diff-add) - 'unified-diff) - ((string-match "^-" line) - (ft/gnus-colour-line 'ft/gnus-diff-remove) - 'unified-diff) - (t 'unified-diff))))) - - (if (not do-not-move) - (if (> (forward-line) 0) - (throw 'ft/gnus-atp-done t))))))) - -(defun ft/gnus-article-treat-patch () - "Highlight mail parts, that look like patches (well, usually -they *are* patches - or possibly, when you take git's format-patch output, -entire commit exports - including comments). This treatment assumes the -use of unified diffs. Here is how it works: - -The most fancy type of patch mails look like this: - - From: ... - Subject: ... - Other-Headers: ... - - Body text, which can be reflecting the commit message but may - optionally be followed by a so called scissors line, which - looks like this (in case of a scissors line, the text above is - not part of the commit message): - - -------8<---------- - - If there really was a scissors line, then it's usually - followed by repeated mail-headers. Which do not *have* to - be the same as the one from the sender. - - From: ... - Subject: ... - - More text. Usually part of the commit message. Likely - multiline. What follows may be an optional diffstat. If - there is one, it's usually preceded by a line that contains - only three dashes and nothing more. Before the diffstat, - however, there may be a set of pseudo headers again, like - these: - - Acked-by: Mike Dev - Signed-off-by: Joe D. User - - --- - ChangeLog | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletions(-) - - Now, there is again room for optional text, which is not - part of the actual commit message. May be multiline. Actually, - anything between the three-dashes line and the diff content - is ignored as far as the commit message goes. - - Now for the actual diff part. I want this to work for as - many unified diff formats as possible. What comes to mind - is the format used by git and the format used by cvs and - quilt. - - CVS style looks like this: - - Index: foo/bar.c - ============================================================ - --- boo.orig/foo/bar.c 2010-02-24 .... - +++ boo/foo/bar.c 2010-02-28 .... - @@ -1823,7 +1823,7 @@ - - - There may be multiple hunks. Each file gets an \"Index:\" and - equals line. Now the git format looks like this: - - diff --git a/ChangeLog b/ChangeLog - index 6ffbc8c..36e5c17 100644 - --- a/ChangeLog - +++ b/ChangeLog - @@ -3,6 +3,9 @@ - - - Again, there may be multiple hunks. - - When all hunks and all files are done, there may be additional - text below the actual text. - -And that's it. - -You may define the look of several things: pseudo headers, scissor -lines, three-dashes-line, equals lines, diffstat lines, diffstat -summary. Then there is added lines, removed lines, context lines, -diff-header lines and diff-file-header lines, for which we are -borrowing the highlighting faces for from `diff-mode'." - (if (ft/gnus-part-want-patch-treatment) - (save-excursion - (progn - (let ((inhibit-read-only t)) - (goto-char (point-min)) - (ft/gnus-article-treat-patch-state-machine)))))) - -(provide 'gnus-article-treat-patch) diff --git a/.emacs.d/lisp/smart-mode-line-tangomod-theme.el b/.emacs.d/lisp/smart-mode-line-tangomod-theme.el deleted file mode 100644 index b69eb7d..0000000 --- a/.emacs.d/lisp/smart-mode-line-tangomod-theme.el +++ /dev/null @@ -1,51 +0,0 @@ -;;; smart-mode-line-tangomod-theme.el --- tangomod theme for smart-mode-line - -;; Copyright (C) 2019 Amin Bandali - -;; Author: Amin Bandali -;; Version: 0.1.0 -;; Package-Requires: ((emacs "24.3") (smart-mode-line "2.10")) -;; Keywords: mode-line themes faces - -;;; Commentary: -;; -;; tangomod theme for smart-mode-line - -;;; License: -;; -;; This file is NOT part of GNU Emacs. -;; -;; 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. -;; - -;;; Code: - -(deftheme smart-mode-line-tangomod - "tangomod theme for smart-mode-line.") - -(custom-theme-set-faces - 'smart-mode-line-tangomod - '(mode-line-buffer-id ((t :inherit sml/filename :foreground nil :background nil))) - '(mode-line-inactive ((t :background "#e1e1e1"))) - '(mode-line ((t :background "#e7e7e7"))) - '(sml/global ((t :inherit font-lock-preprocessor-face))) - '(sml/filename ((t :inherit mode-line-buffer-id))) - '(sml/modes ((t :foreground nil :inherit sml/filename :weight normal))) - '(sml/prefix ((t :inherit (font-lock-variable-name-face sml/global)))) - '(sml/read-only ((t :inherit (font-lock-type-face sml/not-modified))))) - -;;;###autoload -(when load-file-name - (add-to-list 'custom-theme-load-path - (file-name-as-directory (file-name-directory load-file-name)))) - -(provide-theme 'smart-mode-line-tangomod) -;;; smart-mode-line-tangomod-theme.el ends here. diff --git a/.emacs.d/lisp/tangomod-theme.el b/.emacs.d/lisp/tangomod-theme.el deleted file mode 100644 index 5ec1bd1..0000000 --- a/.emacs.d/lisp/tangomod-theme.el +++ /dev/null @@ -1,154 +0,0 @@ -;;; tangomod-theme.el --- Tango-based custom theme for faces - -;; Copyright (C) 2010-2013 Free Software Foundation, Inc. - -;; Authors: Chong Yidong -;; Jan Moringen - -;; This file is part of GNU Emacs. - -;; GNU Emacs 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. - -;; GNU Emacs 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 GNU Emacs. If not, see . - -;;; Commentary - -;; The colors in this theme come from the Tango palette, which is in -;; the public domain: http://tango.freedesktop.org/ - -;;; Code: - -(deftheme tangomod - "Face colors using the Tango palette (light background). -Basic, Font Lock, Isearch, Gnus, Message, Ediff, Flyspell, -Semantic, and Ansi-Color faces are included.") - -(let ((class '((class color) (min-colors 89))) - ;; Tango palette colors. - (butter-1 "#fce94f") (butter-2 "#edd400") (butter-3 "#c4a000") - (orange-1 "#fcaf3e") (orange-2 "#f57900") (orange-3 "#ce5c00") - (choc-1 "#e9b96e") (choc-2 "#c17d11") (choc-3 "#8f5902") - (cham-1 "#8ae234") (cham-2 "#73d216") (cham-3 "#4e9a06") - (blue-1 "#729fcf") (blue-2 "#3465a4") (blue-3 "#204a87") - (plum-1 "#ad7fa8") (plum-2 "#75507b") (plum-3 "#5c3566") - (red-1 "#ef2929") (red-2 "#cc0000") (red-3 "#a40000") - (alum-1 "#ffffff") (alum-2 "#d3d7cf") (alum-3 "#babdb6") - (alum-4 "#888a85") (alum-5 "#5f615c") (alum-6 "#000000") - ;; Not in Tango palette; used for better contrast. - (cham-4 "#346604") (blue-0 "#8cc4ff") (orange-4 "#b35000")) - - (custom-theme-set-faces - 'tangomod - `(default ((,class (:foreground ,alum-6 :background ,alum-1)))) - `(cursor ((,class (:background ,blue-3)))) - ;; Highlighting faces - `(fringe ((,class (:background "#FFFFFF")))) ;; EDITED - `(highlight ((,class (:foreground ,alum-6 :background ,butter-2)))) - ;; Disabled for talk at PL offsite - ;; `(highlight ((,class (:background ,alum-3)))) - `(region ((,class (:background ,alum-3)))) - `(secondary-selection ((,class (:background ,blue-0)))) - `(isearch ((,class (:foreground "#ffffff" :background ,orange-3)))) - `(lazy-highlight ((,class (:background ,choc-1)))) - `(trailing-whitespace ((,class (:background ,red-1)))) - ;; Paren face - `(show-paren-match ((,class (:background ,blue-1)))) - ;; Mode line faces - `(mode-line ((,class (:box (:line-width -1 :style released-button) - :background ,alum-2 :foreground ,alum-6)))) - `(mode-line-inactive ((,class (:box (:line-width -1 :style released-button) - :background ,alum-4 :foreground ,alum-6)))) - ;; Escape and prompt faces - `(minibuffer-prompt ((,class (:weight bold :foreground ,blue-3)))) - `(escape-glyph ((,class (:foreground ,red-3)))) - `(error ((,class (:foreground ,red-3)))) - `(warning ((,class (:foreground ,orange-3)))) - `(success ((,class (:foreground ,cham-3)))) - ;; Font lock faces - `(font-lock-builtin-face ((,class (:foreground ,plum-2)))) - `(font-lock-comment-face ((,class (:slant italic :foreground ,alum-5)))) - `(font-lock-constant-face ((,class (:weight bold :foreground ,blue-3)))) - `(font-lock-function-name-face ((,class (:foreground ,red-3)))) - `(font-lock-keyword-face ((,class (:foreground ,cham-4)))) - `(font-lock-string-face ((,class (:foreground ,plum-3)))) - `(font-lock-type-face ((,class (:foreground ,blue-3)))) - `(font-lock-variable-name-face ((,class (:foreground ,orange-4)))) - ;; Button and link faces - `(link ((,class (:underline t :foreground ,blue-3)))) - `(link-visited ((,class (:underline t :foreground ,blue-2)))) - ;; Gnus faces - `(gnus-group-news-1 ((,class (:weight bold :foreground ,plum-3)))) - `(gnus-group-news-1-low ((,class (:foreground ,plum-3)))) - `(gnus-group-news-2 ((,class (:weight bold :foreground ,blue-3)))) - `(gnus-group-news-2-low ((,class (:foreground ,blue-3)))) - `(gnus-group-news-3 ((,class (:weight bold :foreground ,red-3)))) - `(gnus-group-news-3-low ((,class (:foreground ,red-3)))) - `(gnus-group-news-4 ((,class (:weight bold :foreground ,"#7a4c02")))) - `(gnus-group-news-4-low ((,class (:foreground ,"#7a4c02")))) - `(gnus-group-news-5 ((,class (:weight bold :foreground ,orange-3)))) - `(gnus-group-news-5-low ((,class (:foreground ,orange-3)))) - `(gnus-group-news-low ((,class (:foreground ,alum-4)))) - `(gnus-group-mail-1 ((,class (:weight bold :foreground ,plum-3)))) - `(gnus-group-mail-1-low ((,class (:foreground ,plum-3)))) - `(gnus-group-mail-2 ((,class (:weight bold :foreground ,blue-3)))) - `(gnus-group-mail-2-low ((,class (:foreground ,blue-3)))) - `(gnus-group-mail-3 ((,class (:weight bold :foreground ,cham-3)))) - `(gnus-group-mail-3-low ((,class (:foreground ,cham-3)))) - `(gnus-group-mail-low ((,class (:foreground ,alum-4)))) - `(gnus-header-content ((,class (:foreground ,cham-3)))) - `(gnus-header-from ((,class (:weight bold :foreground ,butter-3)))) - `(gnus-header-subject ((,class (:foreground ,red-3)))) - `(gnus-header-name ((,class (:foreground ,blue-3)))) - `(gnus-header-newsgroups ((,class (:foreground ,alum-4)))) - ;; Message faces - `(message-header-name ((,class (:foreground ,blue-3)))) - `(message-header-cc ((,class (:foreground ,butter-3)))) - `(message-header-other ((,class (:foreground ,choc-2)))) - `(message-header-subject ((,class (:foreground ,red-3)))) - `(message-header-to ((,class (:weight bold :foreground ,butter-3)))) - `(message-cited-text ((,class (:slant italic :foreground ,alum-5)))) - `(message-separator ((,class (:weight bold :foreground ,cham-3)))) - ;; SMerge - `(smerge-refined-change ((,class (:background ,plum-1)))) - ;; Ediff - `(ediff-current-diff-A ((,class (:background ,blue-1)))) - `(ediff-fine-diff-A ((,class (:background ,plum-1)))) - `(ediff-current-diff-B ((,class (:background ,butter-1)))) - `(ediff-fine-diff-B ((,class (:background ,orange-1)))) - ;; Flyspell - `(flyspell-duplicate ((,class (:underline ,orange-1)))) - `(flyspell-incorrect ((,class (:underline ,red-1)))) - ;; Semantic faces - `(semantic-decoration-on-includes ((,class (:underline ,cham-4)))) - `(semantic-decoration-on-private-members-face - ((,class (:background ,alum-2)))) - `(semantic-decoration-on-protected-members-face - ((,class (:background ,alum-2)))) - `(semantic-decoration-on-unknown-includes - ((,class (:background ,choc-3)))) - `(semantic-decoration-on-unparsed-includes - ((,class (:underline ,orange-3)))) - `(semantic-tag-boundary-face ((,class (:overline ,blue-1)))) - `(semantic-unmatched-syntax-face ((,class (:underline ,red-1))))) - - (custom-theme-set-variables - 'tangomod - `(ansi-color-names-vector [,alum-6 ,red-3 ,cham-3 ,butter-3 - ,blue-3 ,plum-3 ,blue-1 ,alum-1]))) - -(provide-theme 'tangomod) - -;; Local Variables: -;; no-byte-compile: t -;; End: - -;;; tangomod-theme.el ends here diff --git a/.emacs.d/straight/versions/default.el b/.emacs.d/straight/versions/default.el deleted file mode 100644 index a5e3a52..0000000 --- a/.emacs.d/straight/versions/default.el +++ /dev/null @@ -1,97 +0,0 @@ -(("alert" . "a73ede85c9cdd7d1a7593d4674cde8eec66c098b") - ("alloy-mode" . "0d05bdd10c77ec04c3d61eccf67e68c08284951f") - ("amx" . "3af93ca066aa42dd1342f1ee0ab0d02360075613") - ("auth-password-store" . "ff4940c647786914b3cbef69103d96a4ea334111") - ("biblio.el" . "efeeab720cb8e3f95ddb4298d0cc62393cf237e9") - ("boxquote.el" . "7e47e0e2853bc1215739b2e28f260e9eed93b2c5") - ("bui.el" . "508577a7225b3d07eaefa9444064410af2518675") - ("closql" . "1e78f96dc976badb59067c986f7766cce89405cc") - ("company-mode" . "3c11c30c9ab41d8a9c88560071c48fbcdcbcba5d") - ("crux" . "903db7b1a2052f4959d934cae26ec40a3f323ed4") - ("dash.el" . "ea7adeb09c13de58336caa16243e192ea6ee88fb") - ("debbugs" . "c50716621d1fd5d4f6ae56968d8a2f815e8051f1") - ("debpaste.el" . "6f2a400665062468ebd03a2ce1de2a73d9084958") - ("diff-hl" . "fb9eb1cd3c4c6ed24b93de1a7cfb369d2983be74") - ("ebdb" . "3a2ab4c03771ef6e8db573e5219ed1ed68a773ee") - ("edit-indirect" . "935ded353b9ed3da67bc61abf245c21b58d88864") - ("el-dmenu" . "e8cc9b27c79d3ecc252267c082ab8e9c82eab264") - ("elisp-refs" . "0a254e6a4dc7fa12857f8334fe6eefa72e49d1c9") - ("emacs-async" . "036b475a29bbbee52f88c7d0332341c2643155fb") - ("emacs-doom-themes" . "9cd6872b1af88165834230abd45743036861f925") - ("emacs-htmlize" . "86f22f211e9230857197c42a9823d3f05381deed") - ("emacs-which-key" . "1e3640e48c31f8062f018b5fc84acad696a0ea2a") - ("emacsmirror-mirror" . "f10bab7a1f63c41ded01e85dade0a1e012ab9768") - ("emacsql" . "a118b6c95af1306f0288a383d274b5dd93efbbda") - ("emmet-mode" . "1acb821e0142136344ccf40c1e5fb664d7db2e70") - ("epl" . "78ab7a85c08222cd15582a298a364774e3282ce6") - ("erc-hl-nicks" . "756c4438a8245ccd3e389bf6c9850ee8453783ec") - ("erc-scrolltoplace" . "feb0fbf1fd4bdf220ae2d31ea7c066d8e62089f9") - ("eshell-up" . "9c100bae5c3020e8d9307e4332d3b64e7dc28519") - ("exec-path-from-shell" . "76fbdf5d01bace97dbabf5a4b56b6d9414a7aea3") - ("expand-region.el" . "1c31447730443d98f90f65dfcb752f347d46ad1b") - ("exwm" . "02ac1ec0f61310cc5e3cd6d413da0737a5b0cb26") - ("exwm-edit" . "80c1cbecafde96a59e620d8fa7e5510a5a7bbd3d") - ("f.el" . "1814209e2ff43cf2e6d38c4cd476218915f550fb") - ("flycheck" . "269237f6529a4ad7db5bbbc5a40c1f038accf3cd") - ("forge" . "269effb4954071f590954c0e5b4faba3f27d03d0") - ("geiser" . "645e4775420c59bb10ef0693ed2631a8df8c0e29") - ("george-mode" . "e377ef5bd21783046fc5d02dd4fdc695e9baccc7") - ("ghub" . "a9c5ac44bc7691752e6bfea87ac75c7459ce88f3") - ("gntp.el" . "767571135e2c0985944017dc59b0be79af222ef5") - ("gnu-elpa-mirror" . "b58580c57aab8a451d2db4956c5d5c191ddcb2a6") - ("go-mode.el" . "fa2162b6b34af0d2e8038940d8fa13e775a1cae6") - ("guix.el" . "c2796e68868c91253b6aca422a9ae07363aa03a9") - ("helm" . "cb7050e42db2bf4128f3e231df7f5e22d295502d") - ("helm-bibtex" . "d4471232be26793fbf56c0ac3690b5f537c378b9") - ("helpful" . "982dd49c9c7e63fa94b56824f50dea4186081f8e") - ("hl-todo" . "5d2ea49f83a7e6953f9d71de94dee478d08f9543") - ("hydra" . "9db28034d7d61bfeff89899633b958f22befc53d") - ("key-chord" . "72443e9ff3c4f1c3ccaced3130236801efde3d83") - ("lean-mode" . "f26e40daad2c1bd090e440a2b931205ac3b9b613") - ("let-alist" . "681570f2abec73ec6494d67f8a904ac9ea15063f") - ("log4e" . "c69424e407be0d9d0e54b427d8b18b1ac5a607e2") - ("loop.el" . "e22807f83a0890dc8a904c51ee0742c34efccc6c") - ("magit" . "df191f42a21416ab73616769aa116928db2fec9f") - ("magit-popup" . "df9abf1a1bce3fadb5e0657eb8f4c7026efa3c69") - ("markdown-mode" . "e9dff50d572caa96b68a7466c18c97a8d6ed651c") - ("melpa" . "1ca43b6cf089d7c75b1fb483d8356a3ca7fec5bd") - ("message-x" . "5524de7bbfdd8749c110f48de5afb024d9f83133") - ("minions" . "c331c1516111b9d2136e632a218c1d7707215356") - ("multiple-cursors.el" . "b880554d04b8f61165afba7d4de19ac9e39bb7ab") - ("mwim.el" . "b4f3edb4c0fb8f8b71cecbf8095c2c25a8ffbf85") - ("no-littering" . "d1d6965c70fc6ce0cfb38a5115d0e112aefac1d7") - ("oddmuse-curl" . "167520342f206c6451344d271e66f0f520664021") - ("org" . "2fde90aa2e5b8ecfab57fb6203b2e33141ebd1d7") - ("org-pdftools" . "c48942e616bef7dcf477a0df4e2982e325f8f646") - ("org-ref" . "3e168956e1e23fd0899ae51f6baa6b7798b6989c") - ("page-break-lines" . "2e1d274e11071bb8daea4d6f4c0369c84466de7a") - ("parsebib" . "9a5f1730b8ef1fb6c29262a8ba79f8136e5548d4") - ("pass" . "919d8e3826d556433ab67d4ee21a509d209d1baa") - ("password-store" . "88936b11aff49e48f79842e4628c55620e0ad736") - ("password-store-otp.el" . "04998c8578a060ab4a4e8f46f2ee0aafad4ab4d5") - ("pdf-tools" . "cc29d4c9c2d81fcb1255f7172fd5b9b7851d656c") - ("pkg-info" . "76ba7415480687d05a4353b27fea2ae02b8d9d61") - ("po-mode" . "1916142f6a817c733d5ec37e3b4fbae3da67e499") - ("popup-el" . "80829dd46381754639fb764da11c67235fe63282") - ("projectile" . "1e7b37f0ae07a6b4ac1b1a5f0e5422cfcb8e1c55") - ("rich-minority" . "a03e693f6f9232cf75363aaaf1cb041f21675c19") - ("s.el" . "03410e6a7a2b11e47e1fea3b7d9899c7df26435e") - ("shrink-path.el" . "c14882c8599aec79a6e8ef2d06454254bb3e1e41") - ("smart-mode-line" . "999be065b195f2eddb4e1b629f99038d832d44b7") - ("soap-client" . "847b9c6919ae50bc576b1a887b4c609c6b2329ca") - ("straight.el" . "b4fc6c487553effb8782fe1a393041c4a233ae3f") - ("swiper" . "e7eca371522d96d27bc4b2f7d87f19c1b75e927c") - ("switch-buffer-functions-el" . "b8d8e01e21ae8c8c84234dddeb3cc8250814f7ba") - ("tablist" . "41a9612f51bad36d6689667c11f42f8143103bb2") - ("transient" . "846e0c200ce178026adcf6000a0725779261beba") - ("treepy.el" . "306f7031d26e4ebfc9ff36614acdc6993f3e23c3") - ("typoel" . "54a9dbcfb24a146fd14232e927109eec59b50171") - ("unkillable-scratch" . "b24c2a760529833f230c14cb02ff6e7ec92288ab") - ("use-package" . "4b58ab78177f636f862a66c7a8fdcf9b070e0925") - ("web-mode" . "cd000fcfce97152f8b831b7eef4ea0d0b1eed11a") - ("with-editor" . "7e0bf753709f1775d2bbbb6edf4482fca7fd286a") - ("xelb" . "5970017d9b35e838eb02ead9dece3998ea5375ae") - ("xml-rpc-el" . "8f624f8b964e9145acb504e4457c9510e87dd93c") - ("yasnippet" . "3bf9a3b1af37174a004798b7195826af0123fa6a") - ("znc" . "2fd359e556e05006e6976ba9b0f8cb220ea19863")) -:alpha diff --git a/.emacs.d/var/abbrev.el b/.emacs.d/var/abbrev.el deleted file mode 100644 index 76f19d8..0000000 --- a/.emacs.d/var/abbrev.el +++ /dev/null @@ -1,5 +0,0 @@ -;;-*-coding: utf-8;-*- -(define-abbrev-table 'message-mode-abbrev-table - '( - ("linux" "GNU/Linux" nil :count 4) - )) diff --git a/.emacs.d/var/eshell/alias b/.emacs.d/var/eshell/alias deleted file mode 100644 index d80c00b..0000000 --- a/.emacs.d/var/eshell/alias +++ /dev/null @@ -1,19 +0,0 @@ -alias .. cd .. -alias ... cd ../.. -alias e find-file-other-window $1 -alias ee find-file $1 -alias emacs find-file $1 -alias gd magit-diff-unstaged -alias gds magit-diff-staged -alias git git --no-pager $* -alias l ls -l $* -alias la ls -al $* -alias ll ls -al $* -alias man woman $1 -alias up eshell-up $1 -alias pk eshell-up-peek $1 -alias vi find-file $1 -alias vim find-file $1 -alias mbsync mbsync -c $XDG_CONFIG_HOME/isync/mbsyncrc $* -alias getmail getmail --getmaildir $XDG_CONFIG_HOME/getmail --rcfile getmailrc $* -alias m mbsync csclub; mbsync uwaterloo; mbsync shemshak; getmail diff --git a/.gitignore b/.gitignore index 72e8ffc..1a047bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -* +/var/** diff --git a/early-init.el b/early-init.el new file mode 100644 index 0000000..512068a --- /dev/null +++ b/early-init.el @@ -0,0 +1 @@ +(setq package-enable-at-startup nil) diff --git a/etc/.dir-locals.el b/etc/.dir-locals.el new file mode 100644 index 0000000..e007adb --- /dev/null +++ b/etc/.dir-locals.el @@ -0,0 +1,4 @@ +;;; Directory Local Variables +;;; For more information see (info "(emacs) Directory Variables") + +((emacs-lisp-mode . ((flycheck-disabled-checkers . (emacs-lisp-checkdoc))))) diff --git a/etc/custom.el b/etc/custom.el new file mode 100644 index 0000000..a831542 --- /dev/null +++ b/etc/custom.el @@ -0,0 +1,228 @@ +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(abbrev-file-name "/home/bandali/.emacs.d/var/abbrev.el") + '(auth-sources '("~/.authinfo.gpg")) + '(authinfo-hidden "\\(?:client-secret\\|password\\|token\\)") + '(auto-revert-verbose nil) + '(auto-save-file-name-transforms '((".*" "/home/bandali/.emacs.d/var/auto-save/" t))) + '(backup-by-copying t) + '(company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]" t) + '(company-dabbrev-downcase nil t) + '(company-dabbrev-ignore-case nil t) + '(company-minimum-prefix-length 1) + '(company-selection-wrap-around t) + '(debpaste-paste-is-hidden t t) + '(delete-old-versions t) + '(display-battery-mode t) + '(display-time-mode t) + '(dmenu-prompt-string "run: " t) + '(dmenu-save-file "/home/bandali/.emacs.d/var/dmenu-items" t) + '(ebdb-gnus-window-configuration + '(article + (vertical 1.0 + (summary 0.25 point) + (horizontal 1.0 + (article 1.0) + (ebdb-gnus 0.3))))) + '(ebdb-gnus-window-size 0.3 t) + '(ebdb-mua-pop-up t) + '(ediff-split-window-function 'split-window-horizontally t) + '(ediff-window-setup-function 'ediff-setup-windows-plain t) + '(epa-pinentry-mode 'loopback) + '(epg-gpg-program "/home/bandali/.guix-profile/bin/gpg") + '(epg-pinentry-mode 'loopback) + '(erc-fill-column 77) + '(erc-fill-function 'erc-fill-static) + '(erc-fill-static-center 18) + '(erc-join-buffer 'bury) + '(erc-lurker-hide-list '("JOIN" "PART" "QUIT")) + '(erc-nick "bandali") + '(erc-pcomplete-nick-postfix ", ") + '(erc-prompt "erc>") + '(erc-rename-buffers t) + '(erc-server-reconnect-attempts 5) + '(erc-server-reconnect-timeout 3) + '(erc-track-enable-keybindings nil) + '(erc-track-exclude-types + '("JOIN" "MODE" "NICK" "PART" "QUIT" "324" "329" "332" "333" "353" "477")) + '(erc-track-position-in-mode-line t) + '(erc-track-priority-faces-only 'all) + '(erc-track-shorten-function nil) + '(eshell-directory-name "/home/bandali/.emacs.d/var/eshell/") + '(eshell-hist-ignoredups t) + '(eshell-input-filter 'eshell-input-filter-initial-space) + '(fci-rule-color "#5B6268") + '(flycheck-mode-line-prefix "flyc") + '(global-auto-revert-non-file-buffers nil) + '(gnus-thread-sort-functions + '(gnus-thread-sort-by-number gnus-thread-sort-by-subject gnus-thread-sort-by-date)) + '(ibuffer-formats + '((mark modified read-only locked " " + (name 72 72 :left :elide) + " " + (size-h 9 -1 :right) + " " + (mode 16 16 :left :elide) + " " filename-and-process) + (mark " " + (name 16 -1) + " " filename))) + '(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) + (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 . go-mode) + (mode . alloy-mode))) + ("tex" + (or + (mode . bibtex-mode) + (mode . latex-mode))) + ("emacs" + (or + (name . "^\\*scratch\\*$") + (name . "^\\*Messages\\*$"))) + ("exwm" + (mode . exwm-mode)) + ("erc" + (mode . erc-mode))))) + '(inhibit-startup-buffer-menu t) + '(inhibit-startup-echo-area-message "bandali") + '(inhibit-startup-screen t) + '(initial-buffer-choice t) + '(initial-scratch-message nil) + '(isearch-allow-scroll t) + '(jdee-db-active-breakpoint-face-colors (cons "#1B2229" "#51afef")) + '(jdee-db-requested-breakpoint-face-colors (cons "#1B2229" "#98be65")) + '(jdee-db-spec-breakpoint-face-colors (cons "#1B2229" "#3f444a")) + '(ls-lisp-dirs-first t) + '(magit-diff-refine-hunk t) + '(magit-display-buffer-function 'magit-display-buffer-fullframe-status-v1) + '(message-elide-ellipsis "[...] +") + '(minions-mode t) + '(mm-uu-diff-groups-regexp + "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)") + '(mml-secure-key-preferences + '((OpenPGP + (sign) + (encrypt + ("ineiev@gnu.org" "BD9D4DEE7B2FF1CBEF2EE0C4E0ACD3E0CBE7874A"))) + (CMS + (sign) + (encrypt)))) + '(mml-secure-openpgp-encrypt-to-self t) + '(mml-secure-openpgp-sign-with-sender t) + '(objed-cursor-color "#ff6c6b") + '(oddmuse-username "bandali" t) + '(org-agenda-files + '("~/usr/org/todos/personal.org" "~/usr/org/todos/habits.org" "~/src/git/masters-thesis/todo.org")) + '(org-agenda-start-on-weekday 0) + '(org-agenda-time-leading-zero t) + '(org-habit-graph-column 44) + '(org-latex-packages-alist '(("" "listings") ("" "color"))) + '(org-pretty-entities t) + '(page-break-lines-max-width 70) + '(pdf-view-midnight-colors (cons "#bbc2cf" "#282c34")) + '(pdf-view-resize-factor 1.05) + '(projectile-completion-system 'ivy) + '(projectile-mode-line-prefix " proj") + '(recentf-max-saved-items 2000) + '(recentf-save-file "/home/bandali/.emacs.d/var/recentf-save.el") + '(require-final-newline t) + '(safe-local-variable-values + '((tex-main-file . "../thesis.tex") + (org-export-allow-bind-keywords . t) + (eval load-file "thesis.el") + (eval modify-syntax-entry 43 "'") + (eval modify-syntax-entry 36 "'") + (eval modify-syntax-entry 126 "'") + (eval require 'org-ref) + (eval when + (featurep 'typo + (typo-mode -1))) + (eval add-hook 'after-save-hook #'a/async-babel-tangle 'append 'local) + (eval add-hook 'after-save-hook 'org-beamer-export-to-latex t t) + (eval setq org-latex-prefer-user-labels t) + (eval add-hook 'after-save-hook 'org-latex-export-to-latex t t))) + '(save-interprogram-paste-before-kill t) + '(save-place-file "/home/bandali/.emacs.d/var/save-place.el" t) + '(savehist-file "/home/bandali/.emacs.d/var/savehist.el") + '(search-default-mode 'char-fold-to-regexp) + '(split-width-threshold 150) + '(text-scale-mode-step 1.05) + '(unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")) + '(vc-annotate-background "#282c34") + '(vc-annotate-color-map + (list + (cons 20 "#98be65") + (cons 40 "#b4be6c") + (cons 60 "#d0be73") + (cons 80 "#ECBE7B") + (cons 100 "#e6ab6a") + (cons 120 "#e09859") + (cons 140 "#da8548") + (cons 160 "#d38079") + (cons 180 "#cc7cab") + (cons 200 "#c678dd") + (cons 220 "#d974b7") + (cons 240 "#ec7091") + (cons 260 "#ff6c6b") + (cons 280 "#cf6162") + (cons 300 "#9f585a") + (cons 320 "#6f4e52") + (cons 340 "#5B6268") + (cons 360 "#5B6268"))) + '(vc-annotate-very-old-color nil) + '(vc-git-print-log-follow t) + '(version-control t) + '(view-read-only t) + '(web-mode-enable-auto-indentation nil t) + '(which-key-add-column-padding 5) + '(which-key-max-description-length 32)) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; 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-current-match ((((class color) (background light)) :background "#d7d7d7" :foreground "black") (((class color) (background dark)) :background "#65a7e2" :foreground "black"))) + '(ivy-minibuffer-match-face-1 ((t (:background "#eeeeee")))) + '(ivy-minibuffer-match-face-2 ((t (:background "#e7e7e7" :weight bold)))) + '(ivy-minibuffer-match-face-3 ((t (:background "light goldenrod" :weight semi-bold)))) + '(ivy-minibuffer-match-face-4 ((t (:background "misty rose" :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/etc/secrets.el b/etc/secrets.el new file mode 100644 index 0000000..edfa1a6 --- /dev/null +++ b/etc/secrets.el @@ -0,0 +1,5 @@ +(eval-when-compile (require 'auth-source)) +(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/etc/yasnippet/snippets/java-mode/format b/etc/yasnippet/snippets/java-mode/format new file mode 100644 index 0000000..7620366 --- /dev/null +++ b/etc/yasnippet/snippets/java-mode/format @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: String.format +# key: f +# -- +String.format("$1${2:%n}");$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/java-mode/new b/etc/yasnippet/snippets/java-mode/new new file mode 100644 index 0000000..1ffd2e5 --- /dev/null +++ b/etc/yasnippet/snippets/java-mode/new @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: new +# key: new +# -- +${1:Type} ${2:obj} = new ${3:Constr}(${4:args});$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/java-mode/printf b/etc/yasnippet/snippets/java-mode/printf new file mode 100644 index 0000000..1b8c277 --- /dev/null +++ b/etc/yasnippet/snippets/java-mode/printf @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: printf +# key: pf +# -- +System.out.printf("$1${2:%n}"$3);$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/java-mode/println b/etc/yasnippet/snippets/java-mode/println new file mode 100644 index 0000000..7bb944c --- /dev/null +++ b/etc/yasnippet/snippets/java-mode/println @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: println +# key: p +# -- +System.out.println($1);$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/java-mode/return b/etc/yasnippet/snippets/java-mode/return new file mode 100644 index 0000000..977859e --- /dev/null +++ b/etc/yasnippet/snippets/java-mode/return @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: return +# key: r +# -- +return $1;$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/cite b/etc/yasnippet/snippets/latex-mode/cite new file mode 100644 index 0000000..3b4d161 --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/cite @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: cite +# key: c +# -- +$1${2:~}\cite{${3:$$(unless yas-modified-p (mapconcat 'identity (reftex-citation 'dont-insert) ","))}}$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/eg b/etc/yasnippet/snippets/latex-mode/eg new file mode 100644 index 0000000..7c025e3 --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/eg @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: eg +# key: eg +# -- +\emph{e.g.}$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/emph b/etc/yasnippet/snippets/latex-mode/emph new file mode 100644 index 0000000..36b19d7 --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/emph @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: emph +# key: e +# -- +\emph{$1}$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/enumerate b/etc/yasnippet/snippets/latex-mode/enumerate new file mode 100644 index 0000000..bcb1df1 --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/enumerate @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: enumerate +# key: o +# -- +\begin{enumerate} +\item $0 +\end{enumerate} \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/etal b/etc/yasnippet/snippets/latex-mode/etal new file mode 100644 index 0000000..3f80334 --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/etal @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: etal +# key: etal +# -- +\emph{et al.}$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/etc b/etc/yasnippet/snippets/latex-mode/etc new file mode 100644 index 0000000..86b698e --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/etc @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: etc +# key: etc +# -- +\emph{etc.}$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/ie b/etc/yasnippet/snippets/latex-mode/ie new file mode 100644 index 0000000..cb91c2a --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/ie @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: ie +# key: ie +# -- +\emph{i.e.}$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/itemize b/etc/yasnippet/snippets/latex-mode/itemize new file mode 100644 index 0000000..b7a6949 --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/itemize @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: itemize +# key: u +# -- +\begin{itemize} +\item $0 +\end{itemize} \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/label b/etc/yasnippet/snippets/latex-mode/label new file mode 100644 index 0000000..8a98d7e --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/label @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: label +# key: lbl +# -- +\label{$0} \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/newcommand b/etc/yasnippet/snippets/latex-mode/newcommand new file mode 100644 index 0000000..e9e03ca --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/newcommand @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: newcommand +# key: cmd +# -- +\newcommand{\\${1:name}}${2:[${3:0}]}{$0} \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/ref b/etc/yasnippet/snippets/latex-mode/ref new file mode 100644 index 0000000..7eef596 --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/ref @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: ref +# key: r +# -- +$1${2:~}\ref{${3:$$(unless yas-modified-p (reftex-reference nil nil))}}$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/section b/etc/yasnippet/snippets/latex-mode/section new file mode 100644 index 0000000..e1a2710 --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/section @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: section +# key: s +# -- +\section{${1:name}} +\label{sec:${2:label}} + +$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/subsection b/etc/yasnippet/snippets/latex-mode/subsection new file mode 100644 index 0000000..ddfa13d --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/subsection @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: subsection +# key: ss +# -- +\subsection{${1:name}} +\label{sec:${2:label}} + +$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/textbf b/etc/yasnippet/snippets/latex-mode/textbf new file mode 100644 index 0000000..84171d7 --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/textbf @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: textbf +# key: b +# -- +\textbf{$1}$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/texttt b/etc/yasnippet/snippets/latex-mode/texttt new file mode 100644 index 0000000..43cd769 --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/texttt @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: texttt +# key: tt +# -- +\texttt{$1}$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/latex-mode/usepackage b/etc/yasnippet/snippets/latex-mode/usepackage new file mode 100644 index 0000000..3405077 --- /dev/null +++ b/etc/yasnippet/snippets/latex-mode/usepackage @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: usepackage +# key: p +# -- +\usepackage{$0} \ No newline at end of file diff --git a/etc/yasnippet/snippets/log-edit-mode/thankgnu b/etc/yasnippet/snippets/log-edit-mode/thankgnu new file mode 100644 index 0000000..bf29b63 --- /dev/null +++ b/etc/yasnippet/snippets/log-edit-mode/thankgnu @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: thankgnu +# key: th +# -- +[RT#$1] Add ${2:$$(yas-choose-value '("Contributor" "Sustaining Contributor" "Patron"))} $3 to the 20${4:20} ThankGNUs list$0 \ No newline at end of file diff --git a/etc/yasnippet/snippets/message-mode/thankgnu b/etc/yasnippet/snippets/message-mode/thankgnu new file mode 100644 index 0000000..0d10448 --- /dev/null +++ b/etc/yasnippet/snippets/message-mode/thankgnu @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: thankgnu +# key: th +# -- +Added ${2:$$(yas-choose-value '("Contributor" "Sustaining Contributor" "Patron"))} $3 to 20${4:20}supporters.html. + +Moving to campaigns.$0 diff --git a/init.el b/init.el new file mode 100644 index 0000000..04133fe --- /dev/null +++ b/init.el @@ -0,0 +1,2557 @@ +;;; init.el --- bandali's emacs configuration -*- lexical-binding: t -*- + +;; 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: + +;; GNU Emacs configuration of Amin Bandali, computer scientist, +;; Free Software activist, and GNU maintainer & webmaster. Packages +;; are installed through GNU Guix for a fully reproducible setup. +;; Before switching to Guix, I used straight.el, and before that Borg. + +;; Over the years, I've taken inspiration from configurations of many +;; great people. Some that I can remember off the top of my head are: +;; +;; - https://github.com/dieggsy/dotfiles +;; - https://github.com/dakra/dmacs +;; - http://pages.sachachua.com/.emacs.d/Sacha.html +;; - https://github.com/dakrone/eos +;; - http://doc.rix.si/cce/cce.html +;; - https://github.com/jwiegley/dot-emacs +;; - https://github.com/wasamasa/dotemacs +;; - https://github.com/hlissner/doom-emacs + +;;; Code: + +;;; Emacs initialization + +(defvar b/before-user-init-time (current-time) + "Value of `current-time' when Emacs begins loading `user-init-file'.") +(defvar b/emacs-initialized nil + "Whether Emacs has been initialized.") + +(when (not (bound-and-true-p b/emacs-initialized)) + (message "Loading Emacs...done (%.3fs)" + (float-time (time-subtract b/before-user-init-time + before-init-time)))) + +;; temporarily increase `gc-cons-threshhold' and `gc-cons-percentage' +;; during startup to reduce garbage collection frequency. clearing +;; `file-name-handler-alist' seems to help reduce startup time too. +(defvar b/gc-cons-threshold gc-cons-threshold) +(defvar b/gc-cons-percentage gc-cons-percentage) +(defvar b/file-name-handler-alist file-name-handler-alist) +(setq gc-cons-threshold (* 30 1024 1024) ; 30 MiB + gc-cons-percentage 0.6 + file-name-handler-alist nil + ;; sidesteps a bug when profiling with esup + esup-child-profile-require-level 0) + +;; set them back to their defaults once we're done initializing +(defun b/post-init () + "My post-initialize function, run after loading `user-init-file'." + (setq b/emacs-initialized t + gc-cons-threshold b/gc-cons-threshold + gc-cons-percentage b/gc-cons-percentage + file-name-handler-alist b/file-name-handler-alist) + (with-eval-after-load 'exwm-workspace + (setq-default + mode-line-format + (append + mode-line-format + '((:eval + (format + "[%s]" (number-to-string + exwm-workspace-current-index)))))))) +(add-hook 'after-init-hook #'b/post-init) + +;; increase number of lines kept in *Messages* log +(setq message-log-max 20000) + +;; optionally, uncomment to supress some byte-compiler warnings +;; (see C-h v byte-compile-warnings RET for more info) +;; (setq byte-compile-warnings +;; '(not free-vars unresolved noruntime lexical make-local)) + + +;;; whoami + +(setq user-full-name "Amin Bandali" + user-mail-address "bandali@gnu.org") + + +;;; comment macro + +;; useful for commenting out multiple sexps at a time +(defmacro comment (&rest _) + "Comment out one or more s-expressions." + (declare (indent defun)) + nil) + + +;;; Package management + +;; No package.el (for emacs 26 and before) +(when (version< emacs-version "27") + (setq package-enable-at-startup nil) + ;; (package-initialize) + ) +;; for emacs 27 and later, we use early-init.el. see +;; https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=24acb31c04b4048b85311d794e600ecd7ce60d3b + + +;; 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) + + +;;; Initial setup + +(defvar b/exwm-p (string= (system-name) "chaman") + "Whether or not we will be using `exwm'.") + +;; keep ~/.emacs.d clean +(use-package no-littering + :demand + :config + (defalias 'b/etc 'no-littering-expand-etc-file-name) + (defalias 'b/var 'no-littering-expand-var-file-name)) + +;; separate custom file (don't want it mixing with init.el) +(use-package custom + :no-require + :config + (setq custom-file (b/etc "custom.el")) + (when (file-exists-p custom-file) + (load custom-file)) + ;; while at it, treat themes as safe + (setf custom-safe-themes t) + ;; only one custom theme at a time + (comment + (defadvice load-theme (before clear-previous-themes activate) + "Clear existing theme settings instead of layering them" + (mapc #'disable-theme custom-enabled-themes)))) + +;; load the secrets file if it exists, otherwise show a warning +(comment + (with-demoted-errors + (load (b/etc "secrets")))) + +;; start up emacs server. see +;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html#Emacs-Server +(use-package server + :defer 0.4 + :config (or (server-running-p) (server-mode))) + + +;;; Useful utilities + +;; useful libraries +(require 'cl-lib) +(require 'subr-x) + +(defmacro b/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 b/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 b/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 #'b/start-process + program + (remove nil (list args (dired-get-file-for-visit))))) + +(defun b/add-elisp-section () + (interactive) + (insert "\n") + (previous-line) + (insert "\n \n;;; ")) + +;; (defvar b/fill-column 47 +;; "My custom `fill-column'.") + +(defconst b/asterism "* * *") + +(defun b/insert-asterism () + "Insert a centred asterism." + (interactive) + (insert + (concat + "\n\n" + (make-string (floor (/ (- fill-column (length b/asterism)) 2)) + ?\s) + b/asterism + "\n\n"))) + +(defun b/no-mouse-autoselect-window () + "Conveniently disable `focus-follows-mouse'. +For disabling the behaviour for certain buffers and/or modes." + (make-local-variable 'mouse-autoselect-window) + (setq mouse-autoselect-window nil)) + +(defun b/kill-current-buffer () + "Kill the current buffer." + ;; also see https://redd.it/64xb3q + (interactive) + (kill-buffer (current-buffer))) + + +;;; Defaults + +;;;; C-level customizations + +(setq + ;; minibuffer + enable-recursive-minibuffers t + resize-mini-windows t + ;; more useful frame titles + frame-title-format '("" invocation-name " - " + (:eval + (if (buffer-file-name) + (abbreviate-file-name (buffer-file-name)) + "%b"))) + ;; i don't feel like jumping out of my chair every now and again; so + ;; don't BEEP! at me, emacs + ring-bell-function 'ignore + ;; better scrolling + ;; scroll-margin 1 + ;; scroll-conservatively 10000 + scroll-step 1 + scroll-conservatively 10 + scroll-preserve-screen-position 1 + ;; focus follows mouse + mouse-autoselect-window t) + +(setq-default + ;; always use space for indentation + indent-tabs-mode nil + tab-width 4 + ;; cursor shape + cursor-type 'bar) + +;; unicode support +(comment + (dolist (ft (fontset-list)) + (set-fontset-font + ft + 'unicode + (font-spec :name "Source Code Pro" :size 14)) + (set-fontset-font + ft + 'unicode + (font-spec :name "DejaVu Sans Mono") + nil + 'append) + ;; (set-fontset-font + ;; ft + ;; 'unicode + ;; (font-spec + ;; :name "Symbola monospacified for DejaVu Sans Mono") + ;; nil + ;; 'append) + ;; (set-fontset-font + ;; ft + ;; #x2115 ; ℕ + ;; (font-spec :name "DejaVu Sans Mono") + ;; nil + ;; 'append) + (set-fontset-font + ft + (cons ?Α ?ω) + (font-spec :name "DejaVu Sans Mono" :size 14) + nil + 'prepend))) + +;;;; Elisp-level customizations + +(use-package startup + :no-require + :demand + :config + ;; don't need to see the startup echo area message + (advice-add #'display-startup-echo-area-message :override #'ignore) + :custom + ;; i want *scratch* as my startup buffer + (initial-buffer-choice t) + ;; i don't need the default hint + (initial-scratch-message nil) + ;; use customizable text-mode as major mode for *scratch* + ;; (initial-major-mode 'text-mode) + ;; inhibit buffer list when more than 2 files are loaded + (inhibit-startup-buffer-menu t) + ;; don't need to see the startup screen or echo area message + (inhibit-startup-screen t) + (inhibit-startup-echo-area-message user-login-name)) + +(use-package files + :no-require + :demand + :custom + ;; backups (C-h v make-backup-files RET) + (backup-by-copying t) + (version-control t) + (delete-old-versions t) + + ;; auto-save + (auto-save-file-name-transforms + `((".*" ,(b/var "auto-save/") t))) + + ;; insert newline at the end of files + (require-final-newline t) + + ;; open read-only file buffers in view-mode + ;; (enables niceties like `q' for quit) + (view-read-only t)) + +;; disable disabled commands +(setq disabled-command-function nil) + +;; lazy-person-friendly yes/no prompts +(defalias 'yes-or-no-p #'y-or-n-p) + +;; enable automatic reloading of changed buffers and files +(use-package autorevert + :demand + :config + (global-auto-revert-mode 1) + :custom + (auto-revert-verbose nil) + (global-auto-revert-non-file-buffers nil)) + +;; time and battery in mode-line +(use-package time + :demand + :config + (display-time-mode) + :custom + (display-time-default-load-average nil) + (display-time-format "%a %b %-e %-l:%M%P") + (display-time-mail-icon '(image :type xpm :file "gnus/gnus-pointer.xpm" :ascent center)) + (display-time-use-mail-icon t)) + +(use-package battery + :demand + :config + (display-battery-mode) + :custom + (battery-mode-line-format " %p%% %t")) + +(use-package fringe + :demand + :config + ;; smaller fringe + ;; (fringe-mode '(3 . 1)) + (fringe-mode nil)) + +(use-package winner + :demand + :config + ;; enable winner-mode (C-h f winner-mode RET) + (winner-mode 1)) + +(use-package compile + :config + ;; don't display *compilation* buffer on success. based on + ;; https://stackoverflow.com/a/17788551, with changes to use `cl-letf' + ;; instead of the now obsolete `flet'. + (defun b/compilation-finish-function (buffer outstr) + (unless (string-match "finished" outstr) + (switch-to-buffer-other-window buffer)) + t) + + (setq compilation-finish-functions #'b/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)) + +(use-package isearch + :custom + ;; allow scrolling in Isearch + (isearch-allow-scroll t) + ;; search for non-ASCII characters: i’d like non-ASCII characters such + ;; as ‘’“”«»‹›áⓐ𝒶 to be selected when i search for their ASCII + ;; counterpart. shoutout to + ;; http://endlessparentheses.com/new-in-emacs-25-1-easily-search-non-ascii-characters.html + (search-default-mode #'char-fold-to-regexp)) + +;; uncomment to extend the above behaviour to query-replace +(comment + (use-package replace + :custom + (replace-char-fold t))) + +(use-package vc + :bind ("C-x v C-=" . vc-ediff)) + +(use-package vc-git + :after vc + :custom + (vc-git-print-log-follow t)) + +(use-package ediff + :config (add-hook 'ediff-after-quit-hook-internal 'winner-undo) + :custom ((ediff-window-setup-function 'ediff-setup-windows-plain) + (ediff-split-window-function 'split-window-horizontally))) + +(use-package face-remap + :custom + ;; gentler font resizing + (text-scale-mode-step 1.05)) + +(use-package 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-package pixel-scroll + :defer 0.4 + :config (pixel-scroll-mode 1)) + +(use-package epg-config + :config + ;; ask for GPG passphrase in minibuffer + ;; this will fail if gpg>=2.1 is not available + (if (version< "27" emacs-version) + (setq epg-pinentry-mode 'loopback) + (setq epa-pinentry-mode 'loopback)) + :custom + (epg-gpg-program (executable-find "gpg"))) + +(use-package epg + :after epg-config) + +(use-package pinentry + :demand + :after (epa epg server) + :config + ;; workaround for systemd-based distros: + ;; (setq pinentry--socket-dir server-socket-dir) + (pinentry-start)) + +(use-package auth-source + :custom + (auth-sources '("~/.authinfo.gpg")) + (authinfo-hidden (regexp-opt '("password" "client-secret" "token")))) + + +;;; General bindings + +(bind-keys + ("C-c a i" . ielm) + + ("C-c e b" . eval-buffer) + ("C-c e e" . eval-last-sexp) + ("C-c e r" . eval-region) + + ("C-c e i" . emacs-init-time) + ("C-c e u" . emacs-uptime) + ("C-c e v" . emacs-version) + + ("C-c F m" . make-frame-command) + ("C-c F d" . delete-frame) + ("C-c F D" . server-edit) + + ("C-S-h C" . describe-char) + ("C-S-h F" . describe-face) + + ("C-x k" . b/kill-current-buffer) + ("C-x K" . kill-buffer) + ("C-x s" . save-buffer) + ("C-x S" . save-some-buffers) + + :map emacs-lisp-mode-map + ("" . b/add-elisp-section)) + +(when (display-graphic-p) + (unbind-key "C-z" global-map)) + +(bind-keys + ;; for back and forward mouse keys + ("" . previous-buffer) + ("" . previous-buffer) + ;; ("" . previous-buffer) + ("" . next-buffer) + ("" . next-buffer) + ;; ("" . next-buffer) + ;; ("" . kill-this-buffer) + ;; ("" . switch-to-buffer) + ) + + +;;; Essential packages + +(use-package exwm + :if b/exwm-p + :demand + :config + ;; make class name the buffer name, truncating beyond 60 characters + (defun b/exwm-rename-buffer () + (interactive) + (exwm-workspace-rename-buffer + (concat exwm-class-name ":" + (if (<= (length exwm-title) 60) exwm-title + (concat (substring exwm-title 0 59) "..."))))) + ;; Enable EXWM + (exwm-enable) + :hook ((exwm-update-class . b/exwm-rename-buffer) + (exwm-update-title . b/exwm-rename-buffer))) + +(use-package exwm-config + :demand + :after exwm + :hook (exwm-init . exwm-config--fix/ido-buffer-window-other-frame)) + +(use-package exwm-input + :demand + :after exwm + :config + (defun b/exwm-ws-prev-index () + "Return the index for the previous EXWM workspace, wrapping +around if needed." + (if (= exwm-workspace-current-index 0) + (1- exwm-workspace-number) + (1- exwm-workspace-current-index))) + + (defun b/exwm-ws-next-index () + "Return the index for the next EXWM workspace, wrapping +around if needed." + (if (= exwm-workspace-current-index + (1- exwm-workspace-number)) + 0 + (1+ exwm-workspace-current-index))) + + ;; shorten 'C-c C-q' to 'C-q' + (define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key) + + (setq exwm-workspace-number 4 + exwm-input-global-keys + `(([?\s-R] . exwm-reset) + ([?\s-\\] . exwm-workspace-switch) + ([?\s-\s] . dmenu) + ([?\S-\s-\s] . (lambda (command) + (interactive + (list (read-shell-command "➜ "))) + (start-process-shell-command + command nil command))) + ([s-return] . (lambda () + (interactive) + (start-process "" nil "urxvt"))) + ([?\C-\s-\s] . counsel-linux-app) + ([?\M-\s-\s] . (lambda () + (interactive) + (start-process-shell-command + "rofi-pass" nil "rofi-pass"))) + ([?\s-h] . windmove-left) + ([?\s-j] . windmove-down) + ([?\s-k] . windmove-up) + ([?\s-l] . windmove-right) + ([?\s-H] . windmove-swap-states-left) + ([?\s-J] . windmove-swap-states-down) + ([?\s-K] . windmove-swap-states-up) + ([?\s-L] . windmove-swap-states-right) + ([?\M-\s-h] . shrink-window-horizontally) + ([?\M-\s-l] . enlarge-window-horizontally) + ([?\M-\s-k] . shrink-window) + ([?\M-\s-j] . enlarge-window) + ([?\s-\[] . (lambda () + (interactive) + (exwm-workspace-switch-create + (b/exwm-ws-prev-index)))) + ([?\s-\]] . (lambda () + (interactive) + (exwm-workspace-switch-create + (b/exwm-ws-next-index)))) + ([?\s-{] . (lambda () + (interactive) + (exwm-workspace-move-window + (b/exwm-ws-prev-index)))) + ([?\s-}] . (lambda () + (interactive) + (exwm-workspace-move-window + (b/exwm-ws-next-index)))) + ,@(mapcar (lambda (i) + `(,(kbd (format "s-%d" i)) . + (lambda () + (interactive) + (exwm-workspace-switch-create ,i)))) + (number-sequence 0 (1- exwm-workspace-number))) + ([?\s-t] . exwm-floating-toggle-floating) + ([?\s-f] . exwm-layout-toggle-fullscreen) + ([?\s-W] . (lambda () + (interactive) + (kill-buffer (current-buffer)))) + ([?\s-Q] . (lambda () + (interactive) + (exwm-manage--kill-client))) + ([?\s-\'] . (lambda () + (interactive) + (start-process-shell-command + "rofi-light" nil "rofi-light"))) + ([XF86AudioMute] . + (lambda () + (interactive) + (start-process "" nil "amixer" "set" "'Master',0" "toggle"))) + ([XF86AudioLowerVolume] . + (lambda () + (interactive) + (start-process + "" nil "amixer" "set" "'Master',0" "5%-"))) + ([XF86AudioRaiseVolume] . + (lambda () + (interactive) + (start-process + "" nil "amixer" "set" "'Master',0" "5%+"))) + ([XF86AudioPlay] . + (lambda () + (interactive) + (start-process "" nil "mpc" "toggle"))) + ([XF86AudioPrev] . + (lambda () + (interactive) + (start-process "" nil "mpc" "prev"))) + ([XF86AudioNext] . + (lambda () + (interactive) + (start-process "" nil "mpc" "next"))) + ([XF86ScreenSaver] . + (lambda () + (interactive) + (start-process "" nil "dm-tool" "lock"))) + ([\s-XF86Back] . previous-buffer) + ([\s-XF86Forward] . next-buffer))) + + ;; Line-editing shortcuts + (setq exwm-input-simulation-keys + '(;; movement + ([?\C-b] . [left]) + ([?\M-b] . [C-left]) + ([?\C-f] . [right]) + ([?\M-f] . [C-right]) + ([?\C-p] . [up]) + ([?\C-n] . [down]) + ([?\C-a] . [home]) + ([?\C-e] . [end]) + ([?\M-v] . [prior]) + ([?\C-v] . [next]) + ([?\C-d] . [delete]) + ([?\C-k] . [S-end ?\C-x]) + ([?\M-<] . C-home) + ([?\M->] . C-end) + ;; cut/copy/paste + ([?\C-w] . [?\C-x]) + ([?\M-w] . [?\C-c]) + ([?\C-y] . [?\C-v]) + ([?\M-d] . [C-S-right ?\C-x]) + ([?\M-\d] . [C-S-left ?\C-x]) + ;; window + ([?\s-w] . [?\C-w]) + ([?\s-q] . [?\C-q]) + ;; misc + ([?\C-s] . [?\C-f]) + ([?\s-s] . [?\C-s]) + ([?\C-g] . [escape])))) + +(use-package exwm-manage + :demand + :after exwm + :hook + (exwm-manage-finish . (lambda () + (when exwm-class-name + (cond + ((string= exwm-class-name "IceCat") + (exwm-input-set-local-simulation-keys + `(,@exwm-input-simulation-keys + ([?\C-\S-d] . [?\C-d])))) + ((string= exwm-class-name "URxvt") + (exwm-input-set-local-simulation-keys + '(([?\C-c ?\C-c] . [?\C-c]) + ([?\C-c ?\C-u] . [?\C-u])))) + ((string= exwm-class-name "Zathura") + (exwm-input-set-local-simulation-keys + '(([?\C-p] . [C-up]) + ([?\C-n] . [C-down]))))))))) + +(use-package exwm-randr + :demand + :after exwm + :config + (exwm-randr-enable) + :custom + (exwm-randr-workspace-monitor-plist '(1 "VGA-1"))) + +(use-package exwm-systemtray + :demand + :after exwm + :config + (exwm-systemtray-enable)) + +(use-package exwm-workspace) + +(use-package exwm-edit + :demand + :after exwm) + +;; use the org-plus-contrib package to get the whole deal +(use-package org-plus-contrib) + +(use-package 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) + (when (version< org-version "9.3") + (setq org-email-link-description-format + org-link-email-description-format)) + (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t) + (add-to-list 'org-modules 'org-habit) + :bind + (("C-c a o a" . org-agenda) + :map org-mode-map + ("M-L" . org-insert-last-stored-link) + ("M-O" . org-toggle-link-display)) + :hook ((org-mode . org-indent-mode) + (org-mode . auto-fill-mode) + (org-mode . flyspell-mode)) + :custom + (org-pretty-entities t) + (org-agenda-files '("~/usr/org/todos/personal.org" + "~/usr/org/todos/habits.org" + "~/src/git/masters-thesis/todo.org")) + (org-agenda-start-on-weekday 0) + (org-agenda-time-leading-zero t) + (org-habit-graph-column 44) + (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-package 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-package ox-extra + :config + (ox-extras-activate '(latex-header-blocks ignore-headlines))) + +;; asynchronous tangle, using emacs-async to asynchronously tangle an +;; org file. closely inspired by +;; https://github.com/dieggsy/dotfiles/tree/cc10edf7701958eff1cd94d4081da544d882a28c/emacs.d#dotfiles +(with-eval-after-load 'org + (defvar b/show-async-tangle-results nil + "Keep *emacs* async buffers around for later inspection.") + + (defvar b/show-async-tangle-time nil + "Show the time spent tangling the file.") + + (defun b/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 b/show-async-tangle-results + `(lambda (result) + (if result + (message "Tangled %s%s" + ,file-nodir + (if b/show-async-tangle-time + (format " (%.3fs)" + (float-time (time-subtract (current-time) + ',file-tangle-start-time))) + "")) + (message "Tangling %s failed" ,file-nodir)))))))) + +(add-to-list + 'safe-local-variable-values + '(eval add-hook 'after-save-hook #'b/async-babel-tangle 'append 'local)) + +;; *the* right way to do git +(use-package magit + :defer 0.5 + :bind (("C-x g" . magit-status) + ("C-c g g" . magit-status) + ("C-c g b" . magit-blame-addition) + ("C-c g l" . magit-log-buffer-file)) + :config + (magit-add-section-hook 'magit-status-sections-hook + 'magit-insert-modules + 'magit-insert-stashes + 'append) + ;; (magit-add-section-hook 'magit-status-sections-hook + ;; 'magit-insert-ignored-files + ;; 'magit-insert-untracked-files + ;; 'append) + (setq magit-repository-directories '(("~/" . 0) + ("~/src/git/" . 2))) + (nconc magit-section-initial-visibility-alist + '(([unpulled status] . show) + ([unpushed status] . show))) + :custom + (magit-diff-refine-hunk t) + (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1) + ;; (magit-completing-read-function 'magit-ido-completing-read) + :custom-face (magit-diff-file-heading ((t (:weight normal))))) + +;; recently opened files +(use-package recentf + :defer 0.2 + ;; :config + ;; (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:") + :config + (recentf-mode) + :custom + (recentf-max-saved-items 2000)) + +;; smart M-x enhancement (needed by counsel for history) +;; (use-package smex) + +(bind-keys + ("C-c f ." . find-file) + ("C-c f d" . find-name-dired) + ("C-c f l" . find-library) + ;; ("C-c f r" . recentf-open-files) + ("C-c x" . execute-extended-command)) + +(comment + (use-package ido + :demand + :bind + (:map ido-common-completion-map + ([escape] . minibuffer-keyboard-quit) + ("DEL" . b/ido-backspace)) + :config + (require 'delsel) + (defun b/ido-backspace () + "Forward to `backward-delete-char'. On error (read-only), quit." + (interactive) + (condition-case nil + (backward-delete-char 1) + (error + (minibuffer-keyboard-quit)))) + (ido-mode 1) + (ido-everywhere 1) + :custom + (ido-enable-flex-matching t) + ;; (ido-enable-regexp t) + ;; (ido-enable-prefix t) + (ido-max-window-height 10) + (ido-use-virtual-buffers t)) + + (use-package ido-vertical-mode + :defer 0.3 + :config + (ido-vertical-mode 1) + :custom + (ido-vertical-define-keys 'C-n-C-p-up-and-down) + (ido-vertical-show-count t)) + + (use-package ido-completing-read+ + :defer 0.3 + :after ido + :config + (ido-ubiquitous-mode 1)) + + (use-package crm-custom + :defer 0.3 + :config + (crm-custom-mode 1)) + + (use-package icomplete + :defer 0.3 + :config + (icomplete-mode 1))) + +(use-package amx + :defer 0.3 + :config + (amx-mode)) + +(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 ") + + (defvar b/ivy-ignore-buffer-modes '(magit-mode erc-mode dired-mode)) + (defun b/ivy-ignore-buffer-p (str) + "Return non-nil if str names a buffer with a major mode +derived from one of `b/ivy-ignore-buffer-modes'. + +This function is intended for use with `ivy-ignore-buffers'." + (let* ((buf (get-buffer str)) + (mode (and buf (buffer-local-value 'major-mode buf)))) + (and mode + (apply #'provided-mode-derived-p mode b/ivy-ignore-buffer-modes)))) + (add-to-list 'ivy-ignore-buffers 'b/ivy-ignore-buffer-p) + + (ivy-mode 1) + :custom-face + (ivy-minibuffer-match-face-1 ((t (:background "#eeeeee")))) + (ivy-minibuffer-match-face-2 ((t (:background "#e7e7e7" :weight bold)))) + (ivy-minibuffer-match-face-3 ((t (:background "light goldenrod" :weight semi-bold)))) + (ivy-minibuffer-match-face-4 ((t (:background "misty rose" :weight semi-bold)))) + (ivy-current-match ((((class color) (background light)) + :background "#d7d7d7" :foreground "black") + (((class color) (background dark)) + :background "#65a7e2" :foreground "black")))) + +(use-package swiper + :demand + :after ivy + :bind (("C-S-s" . swiper-isearch))) + +(use-package counsel + :demand + :after ivy + :bind (("C-c f r" . counsel-recentf) + :map minibuffer-local-map + ("C-r" . counsel-minibuffer-history)) + :config + (counsel-mode 1) + (defalias 'locate #'counsel-locate)) + +(use-package eshell + :defer 0.5 + :commands eshell + :bind ("C-c a s e" . eshell) + :config + (eval-when-compile (defvar eshell-prompt-regexp)) + (defun b/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 b/eshell-clear () + (interactive) + (let ((inhibit-read-only t)) + (erase-buffer)) + (eshell-send-input)) + + (defun b/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" . b/eshell-quit-or-delete-char) + ("C-S-l" . b/eshell-clear) + ("M-r" . counsel-esh-history) + ;; ([tab] . company-complete) + ) + (if (version< "27" emacs-version) + (bind-keys :map eshell-hist-mode-map + ("M-r" . counsel-esh-history)) + (bind-keys :map eshell-mode-map + ("M-r" . counsel-esh-history)))) + + (setq + eshell-prompt-regexp "\\(.*\n\\)*[$#] " + eshell-prompt-function + (lambda () + (concat + (propertize (format "%s@%s:" (user-login-name) (system-name)) + 'face 'default) + (propertize (abbreviate-file-name default-directory) + 'face 'font-lock-comment-face) + (propertize "\n" 'face 'default) + (if (= (user-uid) 0) + (propertize "#" 'face 'red) + (propertize "$" 'face 'default)) + (propertize " " 'face 'default)))) + + :hook (eshell-mode . b/eshell-setup) + :custom + (eshell-hist-ignoredups t) + (eshell-input-filter 'eshell-input-filter-initial-space)) + +(use-package ibuffer + :bind + (("C-x C-b" . ibuffer) + :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 . mhtml-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 . go-mode) + (mode . alloy-mode))) + ("tex" + (or + (mode . bibtex-mode) + (mode . latex-mode))) + ("emacs" + (or + (name . "^\\*scratch\\*$") + (name . "^\\*Messages\\*$"))) + ("exwm" (mode . exwm-mode)) + ("erc" (mode . erc-mode))))) + (ibuffer-formats + '((mark modified read-only locked " " + (name 72 72 :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-package outline + :disabled + :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 b/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-package ls-lisp + :custom (ls-lisp-dirs-first t)) + +(use-package dired + :config + (setq dired-dwim-target t + 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")))) + + (require 'dired-x) + (setq dired-guess-shell-alist-user + '(("\\.pdf\\'" "evince" "zathura" "okular") + ("\\.doc\\'" "libreoffice") + ("\\.docx\\'" "libreoffice") + ("\\.ppt\\'" "libreoffice") + ("\\.pptx\\'" "libreoffice") + ("\\.xls\\'" "libreoffice") + ("\\.xlsx\\'" "libreoffice") + ("\\.flac\\'" "mpv"))) + :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) + (b/dired-start-process "zathura")))) + :hook (dired-mode . dired-hide-details-mode)) + +(use-package help + :config + (temp-buffer-resize-mode) + (setq help-window-select t)) + +(use-package 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 doc-view + :bind (:map doc-view-mode-map + ("M-RET" . image-previous-line))) + + +;;; Editing + +;; highlight uncommitted changes in the left fringe +(use-package diff-hl + :defer 0.6 + :config + (setq diff-hl-draw-borders nil) + (global-diff-hl-mode) + :hook (magit-post-refresh . diff-hl-magit-post-refresh)) + +;; display Lisp objects at point in the echo area +(use-package eldoc + :when (version< "25" emacs-version) + :config (global-eldoc-mode)) + +;; highlight matching parens +(use-package paren + :demand + :config (show-paren-mode)) + +(use-package elec-pair + :demand + :config (electric-pair-mode)) + +(use-package simple + :config (column-number-mode) + :custom + ;; Save what I copy into clipboard from other applications into Emacs' + ;; kill-ring, which would allow me to still be able to easily access + ;; it in case I kill (cut or copy) something else inside Emacs before + ;; yanking (pasting) what I'd originally intended to. + (save-interprogram-paste-before-kill t)) + +;; save minibuffer history +(use-package savehist + :demand + :config + (savehist-mode) + (add-to-list 'savehist-additional-variables 'kill-ring)) + +;; automatically save place in files +(use-package saveplace + :when (version< "25" emacs-version) + :config (save-place-mode)) + +(use-package 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-package text-mode + :bind (:map text-mode-map ("C-*" . b/insert-asterism)) + :hook ((text-mode . indicate-buffer-boundaries-left) + (text-mode . flyspell-mode))) + +(use-package conf-mode + :mode "\\.*rc$") + +(use-package sh-mode + :mode "\\.bashrc$") + +(use-package company + :disabled + :bind + (:map company-active-map + ([tab] . company-complete-common-or-cycle) + ([escape] . company-abort) + ("C-p" . company-select-previous-or-abort) + ("C-n" . company-select-next-or-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)) + :custom (flycheck-mode-line-prefix "flyc")) + +(use-package flyspell) + +;; 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)) + ispell-program-name (executable-find "hunspell")) + ;; 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-package abbrev + :hook (text-mode . abbrev-mode)) + + +;;; Programming modes + +(use-package lisp-mode + :config + (defun indent-spaces-mode () + (setq indent-tabs-mode nil)) + (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode)) + +(use-package reveal + :hook (emacs-lisp-mode . reveal-mode)) + +(use-package elisp-mode) + +;; (use-package alloy-mode +;; :straight (:host github :repo "dwwmmn/alloy-mode") +;; :mode "\\.\\(als\\|dsh\\)\\'" +;; :config +;; (setq alloy-basic-offset 2) +;; ;; (defun b/alloy-simple-indent (start end) +;; ;; (interactive "r") +;; ;; ;; (if (region-active-p) +;; ;; ;; (indent-rigidly start end alloy-basic-offset) +;; ;; ;; (if (bolp) +;; ;; ;; (indent-rigidly (line-beginning-position) +;; ;; ;; (line-end-position) +;; ;; ;; alloy-basic-offset))) +;; ;; (indent-to (+ (current-column) alloy-basic-offset))) +;; :bind (:map alloy-mode-map +;; ("RET" . electric-newline-and-maybe-indent) +;; ;; ("TAB" . b/alloy-simple-indent) +;; ("TAB" . indent-for-tab-command)) +;; :hook (alloy-mode . (lambda () (setq-local indent-tabs-mode nil)))) + +(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 mhtml-mode) + +(use-package sgml-mode + :config + (setq sgml-basic-offset 0)) + +(use-package css-mode + :config + (setq css-indent-offset 2)) + +(use-package emmet-mode + :after (:any mhtml-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 (css-mode html-mode sgml-mode)) + +(use-package geiser) + +(use-package geiser-guile + :config + (setq geiser-guile-load-path "~/src/git/guix")) + +(use-package guix) + +(comment + (use-package auctex + :custom + (font-latex-fontify-sectioning 'color))) + +(use-package go-mode + :disabled) + +(use-package po-mode + :hook + (po-mode . (lambda () (run-with-timer 0.1 nil 'View-exit)))) + +(use-package tex-mode + :config + (cl-delete-if + (lambda (p) (string-match "^---?" (car p))) + tex--prettify-symbols-alist) + :hook ((tex-mode . auto-fill-mode) + (tex-mode . flyspell-mode))) + +;; (use-package george-mode +;; :straight (:host nil :repo "https://git.shemshak.org/amin/george-mode") +;; :mode "\\.grg\\'") + + +;;; Theme + +(add-to-list 'custom-theme-load-path + (expand-file-name + (convert-standard-filename "lisp") user-emacs-directory)) +(load-theme 'tangomod t) + +(use-package smart-mode-line + :commands (sml/apply-theme) + :demand + :config + ;; thanks, but no thnaks; don't make fixed-width fills. + (defun sml/fill-for-buffer-identification () "") + (setq sml/theme 'tangomod) + (sml/setup) + (smart-mode-line-enable)) + +(use-package doom-modeline + :disabled + :demand + :hook (after-init . doom-modeline-init) + :custom + (doom-modeline-buffer-file-name-style 'relative-to-project)) + +(use-package doom-themes) + +(use-package moody + :disabled + :demand + :config + (setq x-underline-at-descent-line t) + (let ((line (face-attribute 'mode-line :underline))) + (set-face-attribute 'mode-line nil :overline line) + (set-face-attribute 'mode-line-inactive nil :overline line) + (set-face-attribute 'mode-line-inactive nil :underline line) + (set-face-attribute 'mode-line nil :box nil) + (set-face-attribute 'mode-line-inactive nil :box nil) + (set-face-attribute 'mode-line-inactive nil :background "#e1e1e1")) ; d3d7cf + (moody-replace-mode-line-buffer-identification) + (moody-replace-vc-mode)) + +(use-package mini-modeline + :disabled + :demand + :config (mini-modeline-mode)) + +(defvar b/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 + "For use with the `doom-tomorrow-night' theme.") + +(defun b/lights-on () + "Enable my favourite light theme." + (interactive) + (mapc #'disable-theme custom-enabled-themes) + (load-theme 'tangomod t) + (when (featurep 'smart-mode-line) + (sml/apply-theme 'tangomod)) + (font-lock-remove-keywords + 'org-mode b/org-mode-font-lock-keywords) + (when (featurep 'erc-hl-nicks) + (erc-hl-nicks-reset-face-table)) + (when (featurep 'exwm-systemtray) + (exwm-systemtray--refresh))) + +(defun b/lights-off () + "Go dark." + (interactive) + (mapc #'disable-theme custom-enabled-themes) + (load-theme 'doom-one t) + (when (featurep 'smart-mode-line) + (sml/apply-theme 'automatic)) + (font-lock-add-keywords + 'org-mode b/org-mode-font-lock-keywords t) + (when (featurep 'erc-hl-nicks) + (erc-hl-nicks-reset-face-table)) + (when (featurep 'exwm-systemtray) + (exwm-systemtray--refresh))) + +(bind-keys + ("C-c t d" . b/lights-off) + ("C-c t l" . b/lights-on)) + + +;;; Emacs enhancements & auxiliary packages + +(use-package 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-x RET" "coding system" + "C-x 8" "unicode" + "C-x @" "event modifiers" + "C-x a" "abbrev/expand" + "C-x r" "rectangle/register/bookmark" + "C-x t" "tabs" + "C-x v" "version control" + "C-x X" "edebug" + "C-x C-a" "edebug" + "C-x C-k" "kmacro" + ;; prefixes for my personal bindings + "C-c &" "yasnippet" + "C-c a" "applications" + "C-c a e" "erc" + "C-c a o" "org" + "C-c a s" "shells" + "C-c b" "buffers" + "C-c c" "compile-and-comments" + "C-c e" "eval" + "C-c f" "files" + "C-c F" "frames" + "C-c g" "magit" + "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" + "C-c t" "themes" + ;; "s-O" "outline" + ) + + ;; prefixes for major modes + (which-key-add-major-mode-key-based-replacements 'message-mode + "C-c f n" "footnote") + (which-key-add-major-mode-key-based-replacements 'org-mode + "C-c C-v" "org-babel") + + (which-key-mode) + :custom + (which-key-add-column-padding 5) + (which-key-max-description-length 32)) + +(use-package crux ; results in Waiting for git... [2 times] + :defer 0.4 + :bind (("C-c d" . crux-duplicate-current-line-or-region) + ("C-c M-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 + :disabled + :defer 0.5 + :bind-keymap ("C-c p" . projectile-command-map) + :config + (projectile-mode) + + (defun b/projectile-mode-line-fun () + "Report project name and type in the modeline." + (let ((project-name (projectile-project-name)) + (project-type (projectile-project-type))) + (format "%s%s" + projectile-mode-line-prefix + (if project-type + (format ":%s" project-type) + "")))) + (setq projectile-mode-line-function 'b/projectile-mode-line-fun) + + (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) + (projectile-mode-line-prefix " proj")) + +(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\\*$"))) + +;; ,---- +;; | make pretty boxed quotes like this +;; `---- +(use-package boxquote + :defer 0.6 + :bind + (:prefix-map b/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 + ;; breaks auto-fill-mode, showing this error: + ;; orgalist--boundaries: Lisp nesting exceeds ‘max-lisp-eval-depth’ + :disabled + :after message + :hook (message-mode . orgalist-mode)) + +;; highlight TODOs in buffers +(use-package hl-todo + :defer 0.5 + :config + (global-hl-todo-mode)) + +(use-package multi-term + :disabled + :defer 0.6 + :bind (("C-c a s m m" . multi-term) + ("C-c a s m d" . multi-term-dedicated-toggle) + ("C-c a s m p" . multi-term-prev) + ("C-c a s m n" . multi-term-next) + :map term-mode-map + ("C-c C-j" . term-char-mode)) + :config + (setq multi-term-program "screen" + multi-term-program-switches (concat "-c" + (getenv "XDG_CONFIG_HOME") + "/screen/screenrc") + ;; 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-c C-j" . term-line-mode) + ("C-k" . kill-line) + ;; ("C-y" . term-paste) + ("C-y" . term-send-raw) + ("M-f" . term-send-forward-word) + ("M-b" . term-send-backward-word) + ("M-p" . term-send-up) + ("M-n" . term-send-down) + ("M-j" . term-send-raw-meta) + ("M-y" . term-send-raw-meta) + ("M-/" . term-send-raw-meta) + ("M-0" . term-send-raw-meta) + ("M-1" . term-send-raw-meta) + ("M-2" . term-send-raw-meta) + ("M-3" . term-send-raw-meta) + ("M-4" . term-send-raw-meta) + ("M-5" . term-send-raw-meta) + ("M-6" . term-send-raw-meta) + ("M-7" . term-send-raw-meta) + ("M-8" . term-send-raw-meta) + ("M-9" . term-send-raw-meta) + ("" . 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 + :defer 0.5 + :custom + (page-break-lines-max-width fill-column) + :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 b/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 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" t) + (yas-reload-all) + (setq yas-verbosity yas-verbosity-cur) + + (defun b/yas--maybe-expand-key-filter (cmd) + (when (and (yas--maybe-expand-key-filter cmd) + (not (bound-and-true-p git-commit-mode))) + cmd)) + (defconst b/yas-maybe-expand + '(menu-item "" yas-expand :filter b/yas--maybe-expand-key-filter)) + (define-key yas-minor-mode-map + (kbd "SPC") b/yas-maybe-expand) + + (yas-global-mode)) + +(use-package debbugs + :bind + (("C-c D d" . debbugs-gnu) + ("C-c D b" . debbugs-gnu-bugs) + ("C-c D e" . + (lambda () + (interactive) ; bug-gnu-emacs + (setq debbugs-gnu-current-suppress t) + (debbugs-gnu debbugs-gnu-default-severities '("emacs")))) + ("C-c D g" . ; bug-gnuzilla + (lambda () + (interactive) + (setq debbugs-gnu-current-suppress t) + (debbugs-gnu debbugs-gnu-default-severities '("gnuzilla")))) + ("C-c D G b" . ; bug-guix + (lambda () + (interactive) + (setq debbugs-gnu-current-suppress t) + (debbugs-gnu debbugs-gnu-default-severities '("guix")))) + ("C-c D G p" . ; guix-patches + (lambda () + (interactive) + (setq debbugs-gnu-current-suppress t) + (debbugs-gnu debbugs-gnu-default-severities '("guix-patches")))))) + +(use-package org-ref + :init + (b/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 fill-column-indicator) + +(use-package window + :bind + (("C-c w e" . (lambda () + (interactive) + (split-window-right) + (other-window 1) + (erc-switch-to-buffer))) + ("C-c w s l" . (lambda () + (interactive) + (split-window-right) + (other-window 1))) + ("C-c w s j" . (lambda () + (interactive) + (split-window-below) + (other-window 1))) + ("C-c w q" . quit-window)) + :custom + (split-width-threshold 150)) + +(use-package windmove + :defer 0.6 + :bind + (("C-c w h" . windmove-left) + ("C-c w j" . windmove-down) + ("C-c w k" . windmove-up) + ("C-c w l" . windmove-right) + ("C-c w H" . windmove-swap-states-left) + ("C-c w J" . windmove-swap-states-down) + ("C-c w K" . windmove-swap-states-up) + ("C-c w L" . windmove-swap-states-right))) + +(use-package pass + :commands pass + :bind ("C-c a p" . pass) + :hook (pass-mode . View-exit)) + +(use-package pdf-tools + :defer 0.5 + :bind (:map pdf-view-mode-map + ("" . pdf-history-backward) + ("" . pdf-history-backward) + ("" . pdf-history-backward) + ("" . pdf-history-forward) + ("" . pdf-history-forward) + ("" . pdf-history-forward) + ("M-RET" . image-previous-line) + ("C-s" . isearch-forward) + ("s s" . isearch-forward)) + :config (pdf-tools-install nil t) + :custom (pdf-view-resize-factor 1.05)) + +(use-package org-pdftools + :disabled + :straight (:host github :repo "fuxialexander/org-pdftools") + :demand + :after org + :config + (with-eval-after-load 'org + (require 'org-pdftools))) + +(use-package biblio) + +(use-package reftex + :hook (latex-mode . reftex-mode)) + +(use-package reftex-cite + :after reftex + :disabled ; enable to disable + ; reftex-cite's default choice + ; of previous word + :config + (defun reftex-get-bibkey-default () + "If the cursor is in a citation macro, return the word before the macro." + (let* ((macro (reftex-what-macro 1))) + (save-excursion + (when (and macro (string-match "cite" (car macro))) + (goto-char (cdr macro))) + (reftex-this-word))))) + +(use-package minions + :demand + :config (minions-mode)) + +(use-package dmenu + :custom + (dmenu-prompt-string "run: ") + (dmenu-save-file (b/var "dmenu-items"))) + +(use-package eosd + ;; TODO: fix build by properly building the eosd-pixbuf.c module + ;; e.g. see https://github.com/raxod502/straight.el/issues/386 + :disabled + :straight (:host github :repo "clarete/eosd") + :demand + :after exwm + :config + (eosd-start)) + +(use-package scpaste + :disabled + :config + (setq scpaste-http-destination "https://p.bndl.org" + scpaste-scp-destination "nix:/var/www/p.bndl.org")) + +(use-package eww + :bind ("C-c a e w" . eww) + :custom + (eww-download-directory (file-name-as-directory + (getenv "XDG_DOWNLOAD_DIR")))) + + +;;; Email (with Gnus) + +(defvar b/maildir (expand-file-name "~/mail/")) +(with-eval-after-load 'recentf + (add-to-list 'recentf-exclude b/maildir)) + +(setq + b/gnus-init-file (b/etc "gnus") + mail-user-agent 'gnus-user-agent + read-mail-command 'gnus) + +(use-package gnus + :bind (("s-m" . gnus-plugged) + ("s-M" . gnus-unplugged) + ("C-c a m" . gnus-plugged) + ("C-c a M" . gnus-unplugged)) + :init + (setq + gnus-select-method '(nnnil "") + gnus-secondary-select-methods + '((nnimap "shemshak" + (nnimap-stream plain) + (nnimap-address "127.0.0.1") + (nnimap-server-port 143) + (nnimap-authenticator plain) + (nnimap-user "amin@shemshak.local")) + (nnimap "gnu" + (nnimap-stream plain) + (nnimap-address "127.0.0.1") + (nnimap-server-port 143) + (nnimap-authenticator plain) + (nnimap-user "bandali@gnu.local") + (nnimap-inbox "INBOX") + (nnimap-split-methods 'nnimap-split-fancy) + (nnimap-split-fancy (| + ;; (: gnus-registry-split-fancy-with-parent) + ;; (: gnus-group-split-fancy "INBOX" t "INBOX") + ;; gnu + (list ".*<\\(.*\\)\\.\\(non\\)?gnu\\.org>.*" "l.\\1") + ;; gnus + (list ".*<\\(.*\\)\\.gnus\\.org>.*" "l.\\1") + ;; libreplanet + (list ".*<\\(.*\\)\\.libreplanet\\.org>.*" "l.\\1") + ;; *.lists.sr.ht, omitting one dot if present + ;; add more \\.?\\([^.]*\\) if needed + (list ".*<~\\(.*\\)/\\([^.]*\\)\\.?\\([^.]*\\)\\.lists.sr.ht>.*" "l.~\\1.\\2\\3") + ;; webmasters + (from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters") + ;; other + (list ".*atreus.freelists.org" "l.atreus") + (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec") + ;; (list ".*haskell-art.we.lurk.org" "l.haskell.art") ;d + (list ".*haskell-cafe.haskell.org" "l.haskell-cafe") + ;; (list ".*notmuch.notmuchmail.org" "l.notmuch") ;u + ;; (list ".*dev.lists.parabola.nu" "l.parabola-dev") ;u + ;; ---------------------------------- + ;; legend: (u)nsubscribed | (d)ead + ;; ---------------------------------- + ;; otherwise, leave mail in INBOX + "INBOX"))) + (nnimap "uw" + (nnimap-stream plain) + (nnimap-address "127.0.0.1") + (nnimap-server-port 143) + (nnimap-authenticator plain) + (nnimap-user "abandali@uw.local") + (nnimap-inbox "INBOX") + (nnimap-split-methods 'nnimap-split-fancy) + (nnimap-split-fancy (| + ;; (: gnus-registry-split-fancy-with-parent) + ;; se212-f19 + ("subject" "SE\\s-?212" "course.se212-f19") + (from "SE\\s-?212" "course.se212-f19") + ;; catch-all + "INBOX"))) + (nnimap "csc" + (nnimap-stream plain) + (nnimap-address "127.0.0.1") + (nnimap-server-port 143) + (nnimap-authenticator plain) + (nnimap-user "abandali@csc.uw.local"))) + gnus-message-archive-group "nnimap+gnu:INBOX" + gnus-parameters + '(("l\\.atreus" + (to-address . "atreus@freelists.org") + (to-list . "atreus@freelists.org")) + ("l\\.deepspec" + (to-address . "deepspec@lists.cs.princeton.edu") + (to-list . "deepspec@lists.cs.princeton.edu") + (list-identifier . "\\[deepspec\\]")) + ("l\\.emacs-devel" + (to-address . "emacs-devel@gnu.org") + (to-list . "emacs-devel@gnu.org")) + ("l\\.help-gnu-emacs" + (to-address . "help-gnu-emacs@gnu.org") + (to-list . "help-gnu-emacs@gnu.org")) + ("l\\.info-gnu-emacs" + (to-address . "info-gnu-emacs@gnu.org") + (to-list . "info-gnu-emacs@gnu.org")) + ("l\\.emacs-orgmode" + (to-address . "emacs-orgmode@gnu.org") + (to-list . "emacs-orgmode@gnu.org") + (list-identifier . "\\[O\\]")) + ("l\\.emacs-tangents" + (to-address . "emacs-tangents@gnu.org") + (to-list . "emacs-tangents@gnu.org")) + ("l\\.emacsconf-committee" + (to-address . "emacsconf-committee@gnu.org") + (to-list . "emacsconf-committee@gnu.org")) + ("l\\.emacsconf-discuss" + (to-address . "emacsconf-discuss@gnu.org") + (to-list . "emacsconf-discuss@gnu.org")) + ("l\\.emacsconf-register" + (to-address . "emacsconf-register@gnu.org") + (to-list . "emacsconf-register@gnu.org")) + ("l\\.emacsconf-submit" + (to-address . "emacsconf-submit@gnu.org") + (to-list . "emacsconf-submit@gnu.org")) + ("l\\.fencepost-users" + (to-address . "fencepost-users@gnu.org") + (to-list . "fencepost-users@gnu.org") + (list-identifier . "\\[Fencepost-users\\]")) + ("l\\.gnewsense-art" + (to-address . "gnewsense-art@nongnu.org") + (to-list . "gnewsense-art@nongnu.org") + (list-identifier . "\\[gNewSense-art\\]")) + ("l\\.gnewsense-dev" + (to-address . "gnewsense-dev@nongnu.org") + (to-list . "gnewsense-dev@nongnu.org") + (list-identifier . "\\[Gnewsense-dev\\]")) + ("l\\.gnewsense-users" + (to-address . "gnewsense-users@nongnu.org") + (to-list . "gnewsense-users@nongnu.org") + (list-identifier . "\\[gNewSense-users\\]")) + ("l\\.gnunet-developers" + (to-address . "gnunet-developers@gnu.org") + (to-list . "gnunet-developers@gnu.org") + (list-identifier . "\\[GNUnet-developers\\]")) + ("l\\.help-gnunet" + (to-address . "help-gnunet@gnu.org") + (to-list . "help-gnunet@gnu.org") + (list-identifier . "\\[Help-gnunet\\]")) + ("l\\.bug-gnuzilla" + (to-address . "bug-gnuzilla@gnu.org") + (to-list . "bug-gnuzilla@gnu.org") + (list-identifier . "\\[Bug-gnuzilla\\]")) + ("l\\.gnuzilla-dev" + (to-address . "gnuzilla-dev@gnu.org") + (to-list . "gnuzilla-dev@gnu.org") + (list-identifier . "\\[Gnuzilla-dev\\]")) + ("l\\.guile-devel" + (to-address . "guile-devel@gnu.org") + (to-list . "guile-devel@gnu.org")) + ("l\\.guile-user" + (to-address . "guile-user@gnu.org") + (to-list . "guile-user@gnu.org")) + ("l\\.guix-devel" + (to-address . "guix-devel@gnu.org") + (to-list . "guix-devel@gnu.org")) + ("l\\.help-guix" + (to-address . "help-guix@gnu.org") + (to-list . "help-guix@gnu.org")) + ("l\\.info-guix" + (to-address . "info-guix@gnu.org") + (to-list . "info-guix@gnu.org")) + ("l\\.savannah-hackers-public" + (to-address . "savannah-hackers-public@gnu.org") + (to-list . "savannah-hackers-public@gnu.org")) + ("l\\.savannah-users" + (to-address . "savannah-users@gnu.org") + (to-list . "savannah-users@gnu.org")) + ("l\\.www-commits" + (to-address . "www-commits@gnu.org") + (to-list . "www-commits@gnu.org")) + ("l\\.www-discuss" + (to-address . "www-discuss@gnu.org") + (to-list . "www-discuss@gnu.org")) + ("l\\.haskell-art" + (to-address . "haskell-art@we.lurk.org") + (to-list . "haskell-art@we.lurk.org") + (list-identifier . "\\[haskell-art\\]")) + ("l\\.haskell-cafe" + (to-address . "haskell-cafe@haskell.org") + (to-list . "haskell-cafe@haskell.org") + (list-identifier . "\\[Haskell-cafe\\]")) + ("l\\.notmuch" + (to-address . "notmuch@notmuchmail.org") + (to-list . "notmuch@notmuchmail.org")) + ("l\\.parabola-dev" + (to-address . "dev@lists.parabola.nu") + (to-list . "dev@lists.parabola.nu") + (list-identifier . "\\[Dev\\]")) + ("l\\.~bandali\\.public-inbox" + (to-address . "~bandali/public-inbox@lists.sr.ht") + (to-list . "~bandali/public-inbox@lists.sr.ht")) + ("l\\.~sircmpwn\\.free-writers-club" + (to-address . "~sircmpwn/free-writers-club@lists.sr.ht") + (to-list . "~sircmpwn/free-writers-club@lists.sr.ht")) + ("l\\.~sircmpwn\\.srht-admins" + (to-address . "~sircmpwn/sr.ht-admins@lists.sr.ht") + (to-list . "~sircmpwn/sr.ht-admins@lists.sr.ht")) + ("l\\.~sircmpwn\\.srht-announce" + (to-address . "~sircmpwn/sr.ht-announce@lists.sr.ht") + (to-list . "~sircmpwn/sr.ht-announce@lists.sr.ht")) + ("l\\.~sircmpwn\\.srht-dev" + (to-address . "~sircmpwn/sr.ht-dev@lists.sr.ht") + (to-list . "~sircmpwn/sr.ht-dev@lists.sr.ht")) + ("l\\.~sircmpwn\\.srht-discuss" + (to-address . "~sircmpwn/sr.ht-discuss@lists.sr.ht") + (to-list . "~sircmpwn/sr.ht-discuss@lists.sr.ht")) + ("webmasters" + (to-address . "webmasters@gnu.org") + (to-list . "webmasters@gnu.org")) + ("gnu.*" + (gcc-self . t)) + ("l\\." + (subscribed . t)) + ("nnimap\\+uw:.*" + (gcc-self . t))) + gnus-large-newsgroup 50 + gnus-home-directory (b/var "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 + (when (version< emacs-version "27") + (with-eval-after-load 'nnmail + (add-to-list + 'nnmail-split-abbrev-alist + '(list . "list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop") + t))) + + ;; (gnus-registry-initialize) + + (with-eval-after-load 'recentf + (add-to-list 'recentf-exclude gnus-home-directory))) + +(use-package gnus-art + :config + (setq + gnus-buttonized-mime-types '("multipart/\\(signed\\|encrypted\\)") + gnus-sorted-header-list '("^From:" + "^X-RT-Originator" + "^Newsgroups:" + "^Subject:" + "^Date:" + "^Envelope-To:" + "^Followup-To:" + "^Reply-To:" + "^Organization:" + "^Summary:" + "^Abstract:" + "^Keywords:" + "^To:" + "^[BGF]?Cc:" + "^Posted-To:" + "^Mail-Copies-To:" + "^Mail-Followup-To:" + "^Apparently-To:" + "^Resent-From:" + "^User-Agent:" + "^X-detected-operating-system:" + "^Message-ID:" + ;; "^References:" + "^List-Id:" + "^Gnus-Warning:") + gnus-visible-headers (mapconcat 'identity + gnus-sorted-header-list + "\\|") + ;; 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-package gnus-sum + :bind (:map gnus-summary-mode-map + :prefix-map b/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 . b/no-mouse-autoselect-window) + :custom + (gnus-thread-sort-functions '(gnus-thread-sort-by-number + gnus-thread-sort-by-subject + gnus-thread-sort-by-date))) + +(use-package gnus-msg + :config + (defvar b/shemshak-signature "Amin Bandali +https://shemshak.org/~amin") + (defvar b/uw-signature "Amin Bandali, MMath Student +Cheriton School of Computer Science +University of Waterloo +https://bandali.eu.org") + (defvar b/csc-signature "Amin Bandali +System Administrator, Systems Committee +Computer Science Club, University of Waterloo +https://csclub.uwaterloo.ca/~abandali") + (setq gnus-message-replysign t + gnus-posting-styles + '((".*" + (address "bandali@gnu.org")) + ("nnimap\\+gnu:l\\..*" + (signature nil)) + ("nnimap\\+gnu:.*" + (organization "GNU")) + ((header "subject" "ThankCRM") + (to "webmasters-comment@gnu.org") + (body "") + (eval (setq b/message-cite-say-hi nil))) + ("nnimap\\+shemshak:.*" + (address "amin@shemshak.org") + (body "\nBest,\n") + (signature b/shemshak-signature) + (gcc "nnimap+shemshak:Sent") + (eval (setq b/message-cite-say-hi t))) + ("nnimap\\+uw:.*" + (address "bandali@uwaterloo.ca") + (body "\nBest,\n") + (signature b/uw-signature)) + ("nnimap\\+uw:INBOX" + (gcc "\"nnimap+uw:Sent Items\"")) + ("nnimap\\+csc:.*" + (address "bandali@csclub.uwaterloo.ca") + (signature b/csc-signature) + (gcc "nnimap+csc:Sent")))) + :hook (gnus-message-setup . (lambda () + (unless (mml-secure-is-encrypted-p) + (mml-secure-message-sign))))) + +(use-package gnus-topic + :hook (gnus-group-mode . gnus-topic-mode) + :config (setq gnus-topic-line-format "%i[ %A: %(%{%n%}%) ]%v\n")) + +(use-package gnus-agent + :config + (setq gnus-agent-synchronize-flags 'ask) + :hook (gnus-group-mode . gnus-agent-mode)) + +(use-package gnus-group + :config + (setq gnus-permanently-visible-groups "\\(:INBOX$\\|:gnu$\\)")) + +(comment + ;; problematic with ebdb's popup, *EBDB-Gnus* + (use-package gnus-win + :config + (setq gnus-use-full-window nil))) + +(use-package gnus-dired + :commands gnus-dired-mode + :init + (add-hook 'dired-mode-hook 'gnus-dired-mode)) + +(comment + (use-package gnus-utils + :custom + (gnus-completing-read-function 'gnus-ido-completing-read))) + +(use-package mm-decode + :config + (setq mm-discouraged-alternatives '("text/html" "text/richtext") + mm-decrypt-option 'known + mm-verify-option 'known)) + +(use-package mm-uu + :config + (when (version< "27" emacs-version) + (set-face-attribute 'mm-uu-extract nil :extend t)) + :custom + (mm-uu-diff-groups-regexp + "\\(gmane\\|gnu\\|l\\)\\..*\\(diff\\|commit\\|cvs\\|bug\\|dev\\)")) + +(use-package sendmail + :config + (setq sendmail-program (executable-find "msmtp") + ;; message-sendmail-extra-arguments '("-v" "-d") + mail-specify-envelope-from t + mail-envelope-from 'header)) + +(use-package message + :bind (:map message-mode-map ("" . b/insert-asterism)) + :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 b/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 b/message-cite-say-hi + (concat "Hi %F,\n\n" b/message-cite-style-format) + b/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@shemshak\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|\\(a?bandali@\\(csclub\\.\\)?uwaterloo\\.ca\\)\\)") + ;; (require 'company-ebdb) + :hook (;; (message-setup . mml-secure-message-sign-pgpmime) + (message-mode . flyspell-mode) + (message-mode . (lambda () + ;; (setq-local fill-column b/fill-column + ;; message-fill-column b/fill-column) + (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)))) + :custom + (message-elide-ellipsis "[...]\n")) + +(use-package mml) + +(use-package mml-sec + :custom + (mml-secure-openpgp-encrypt-to-self t) + (mml-secure-openpgp-sign-with-sender t)) + +(use-package footnote + :after message + ;; :config + ;; (setq footnote-start-tag "" + ;; footnote-end-tag "" + ;; footnote-style 'unicode) + :bind + (:map message-mode-map + :prefix-map b/footnote-prefix-map + :prefix "C-c f n" + ("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 + :demand + :after gnus + :bind (:map gnus-group-mode-map ("e" . ebdb)) + :config + (setq ebdb-sources (b/var "ebdb")) + (with-eval-after-load 'swiper + (add-to-list 'swiper-font-lock-exclude 'ebdb-mode t))) + +(use-package ebdb-com + :after ebdb) + +(use-package ebdb-complete + :after ebdb + :config + ;; (setq ebdb-complete-mail 'capf) + (ebdb-complete-enable)) + +(use-package ebdb-message + :demand + :after ebdb) + +;; (use-package company-ebdb +;; :config +;; (defun company-ebdb--post-complete (_) nil)) + +(use-package ebdb-gnus + :after ebdb + :custom + (ebdb-gnus-window-size 0.3)) + +(use-package ebdb-mua + :demand + :after ebdb + :custom (ebdb-mua-pop-up t)) + +;; (use-package ebdb-message +;; :after ebdb) + +;; (use-package ebdb-vcard +;; :after ebdb) + +(use-package message-x) + +(comment + (use-package message-x + :custom + (message-x-completion-alist + (quote + (("\\([rR]esent-\\|[rR]eply-\\)?[tT]o:\\|[bB]?[cC][cC]:" . gnus-harvest-find-address) + ((if + (boundp + (quote message-newgroups-header-regexp)) + message-newgroups-header-regexp message-newsgroups-header-regexp) + . message-expand-group)))))) + +(comment + (use-package gnus-harvest + :commands gnus-harvest-install + :demand t + :config + (if (featurep 'message-x) + (gnus-harvest-install 'message-x) + (gnus-harvest-install)))) + +(use-package gnus-article-treat-patch + :disabled + :demand + :load-path "lisp/" + :config + ;; note: be sure to customize faces with `:foreground "white"' when + ;; using a theme with a white/light background :) + (setq ft/gnus-article-patch-conditions + '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@"))) + + +;;; IRC (with ERC and ZNC) + +(use-package erc + :bind (("C-c b b" . erc-switch-to-buffer) + :map erc-mode-map + ("M-a" . erc-track-switch-buffer)) + :custom + (erc-join-buffer 'bury) + (erc-lurker-hide-list '("JOIN" "PART" "QUIT")) + (erc-nick "bandali") + (erc-prompt "erc>") + (erc-rename-buffers t) + (erc-server-reconnect-attempts 5) + (erc-server-reconnect-timeout 3) + :config + (defun erc-cmd-OPME () + "Request chanserv to op me." + (erc-message "PRIVMSG" + (format "chanserv op %s %s" + (erc-default-target) + (erc-current-nick)) nil)) + (defun erc-cmd-DEOPME () + "Deop myself from current channel." + (erc-cmd-DEOP (format "%s" (erc-current-nick)))) + (add-to-list 'erc-modules 'keep-place) + (add-to-list 'erc-modules 'notifications) + (add-to-list 'erc-modules 'smiley) + (add-to-list 'erc-modules 'spelling) + (add-to-list 'erc-modules 'scrolltoplace) + (erc-update-modules)) + +(use-package erc-fill + :after erc + :custom + (erc-fill-column 77) + (erc-fill-function 'erc-fill-static) + (erc-fill-static-center 18)) + +(use-package erc-pcomplete + :after erc + :custom + (erc-pcomplete-nick-postfix ", ")) + +(use-package erc-track + :after erc + :bind (("C-c a e t d" . erc-track-disable) + ("C-c a e t e" . erc-track-enable)) + :custom + (erc-track-enable-keybindings nil) + (erc-track-exclude-types '("JOIN" "MODE" "NICK" "PART" "QUIT" + "324" "329" "332" "333" "353" "477")) + (erc-track-position-in-mode-line t) + (erc-track-priority-faces-only 'all) + (erc-track-shorten-function nil)) + +(use-package erc-hl-nicks + :after erc) + +(use-package erc-scrolltoplace + :after erc) + +(use-package znc + :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.shemshak.org" 1337 t + ((freenode "amin/freenode" ,pwd))) + ("znc.shemshak.org" 1337 t + ((oftc "amin/oftc" ,pwd))))))) + + +;;; Post initialization + +(message "Loading %s...done (%.3fs)" user-init-file + (float-time (time-subtract (current-time) + b/before-user-init-time))) + +;;; init.el ends here diff --git a/lisp/gnus-article-treat-patch.el b/lisp/gnus-article-treat-patch.el new file mode 100644 index 0000000..f2f5c21 --- /dev/null +++ b/lisp/gnus-article-treat-patch.el @@ -0,0 +1,465 @@ +;;; gnus-article-treat-patch.el --- Highlight inline patches in articles +;; +;; Copyright © 2011-2019 Frank Terbeck +;; +;; This file is not part of GNU Emacs. +;; +;; This file 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 Soft- +;; ware Foundation; either version 3, or (at your option) any later version. +;; +;; This file 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 file. If not, see . +;; +;; +;;; Commentary: +;; +;; Gnus addon to beautify patch-like emails. This uses a "ft/" prefix for +;; everything to avoid clashing with anything upstream. That prefix can be +;; savely s,ft/,,'d - if this is to be submitted to the gnus developers. + +(require 'diff-mode) + +(add-hook 'gnus-part-display-hook 'ft/gnus-article-treat-patch) + +;; Colour handling and faces +(defun ft/gnus-colour-line (use-face) + "Set text overlay to `use-face' for the current line." + (overlay-put (make-overlay (point-at-bol) (point-at-eol)) 'face use-face)) + +(make-face 'ft/gnus-three-dashes) +(set-face-attribute 'ft/gnus-three-dashes nil :foreground "brightblue") +(make-face 'ft/gnus-scissors) +(set-face-attribute 'ft/gnus-scissors nil :foreground "brown") +(make-face 'ft/gnus-diff-index) +(set-face-attribute 'ft/gnus-diff-index nil :foreground "brightmagenta") +(make-face 'ft/gnus-diff-hunk) +(set-face-attribute 'ft/gnus-diff-hunk nil :foreground "brightblue") +(make-face 'ft/gnus-diff-equals) +(set-face-attribute 'ft/gnus-diff-equals nil :foreground "brightmagenta") +(make-face 'ft/gnus-commit-message) +(set-face-attribute 'ft/gnus-commit-message nil :foreground "white") +(make-face 'ft/gnus-diff-stat-file) +(set-face-attribute 'ft/gnus-diff-stat-file nil :foreground "yellow") +(make-face 'ft/gnus-diff-stat-bar) +(set-face-attribute 'ft/gnus-diff-stat-bar nil :foreground "magenta") +(make-face 'ft/gnus-diff-stat-num) +(set-face-attribute 'ft/gnus-diff-stat-num nil :foreground "white") +(make-face 'ft/gnus-diff-misc) +(set-face-attribute 'ft/gnus-diff-misc nil :foreground "magenta") +(make-face 'ft/gnus-commit-comment) +(set-face-attribute 'ft/gnus-commit-comment nil :inherit 'default) +(make-face 'ft/gnus-diff-header) +(set-face-attribute 'ft/gnus-diff-header nil :inherit 'diff-header) +(make-face 'ft/gnus-diff-add) +(set-face-attribute 'ft/gnus-diff-add nil :inherit 'diff-added) +(make-face 'ft/gnus-diff-remove) +(set-face-attribute 'ft/gnus-diff-remove nil :inherit 'diff-removed) + +;; Pseudo-headers +(defvar ft/gnus-article-patch-pseudo-headers + '(("^Acked-by: " 'gnus-header-name 'gnus-header-from) + ("^C\\(c\\|C\\): " 'gnus-header-name 'gnus-header-from) + ("^From: " 'gnus-header-name 'gnus-header-from) + ("^Link: " 'gnus-header-name 'gnus-header-from) + ("^Reported-by: " 'gnus-header-name 'gnus-header-from) + ("^Reviewed-by: " 'gnus-header-name 'gnus-header-from) + ("^Signed-off-by: " 'gnus-header-name 'gnus-header-from) + ("^Subject: " 'gnus-header-name 'gnus-header-from) + ("^Suggested-by: " 'gnus-header-name 'gnus-header-from)) + "List of lists of regular expressions (with two face names) +which are used to determine the highlighting of pseudo headers in +the commit message (such as \"Signed-off-by:\"). + +The first face if used to highlight the header's name; the second +highlights the header's value.") + +(defun ft/gnus-pseudo-header-get (line) + "Check if `line' is a pseudo header, and if so return its enty in +`ft/gnus-article-patch-pseudo-headers'." + (catch 'done + (dolist (entry ft/gnus-article-patch-pseudo-headers) + (let ((regex (car entry))) + (if (string-match regex line) + (throw 'done entry)))) + (throw 'done '()))) + +(defun ft/gnus-pseudo-header-p (line) + "Returns `t' if `line' looks like a pseudo-header; `nil' otherwise. + +`ft/gnus-article-patch-pseudo-headers' is used to determine what a pseudo-header +is." + (if (eq (ft/gnus-pseudo-header-get line) '()) nil t)) + +(defun ft/gnus-pseudo-header-colour (line) + "Colourise a pseudo-header line." + (let ((data (ft/gnus-pseudo-header-get line))) + (if (eq data '()) + nil + (let* ((s (point-at-bol)) + (e (point-at-eol)) + (colon (re-search-forward ":")) + (value (+ colon 1))) + (overlay-put (make-overlay s colon) 'face (nth 1 data)) + (overlay-put (make-overlay value e) 'face (nth 2 data)))))) + +;; diff-stat +(defun ft/gnus-diff-stat-colour (line) + "Colourise a diff-stat line." + (let ((s (point-at-bol)) + (e (point-at-eol)) + (bar (- (re-search-forward "|") 1)) + (num (- (re-search-forward "[0-9]") 1)) + (pm (- (re-search-forward "\\([+-]\\|$\\)") 1))) + + (overlay-put (make-overlay s (- bar 1)) 'face 'ft/gnus-diff-stat-file) + (overlay-put (make-overlay bar (+ bar 1)) 'face 'ft/gnus-diff-stat-bar) + (overlay-put (make-overlay num pm) 'face 'ft/gnus-diff-stat-num) + + (goto-char pm) + (let* ((plus (looking-at "\\+")) + (regex (if plus "-+" "\\++")) + (brk (if plus + (re-search-forward "-" e t) + (re-search-forward "\\+" e t))) + (first-face (if plus 'ft/gnus-diff-add 'ft/gnus-diff-remove)) + (second-face (if plus 'ft/gnus-diff-remove 'ft/gnus-diff-add))) + + (if (eq brk nil) + (overlay-put (make-overlay pm e) 'face first-face) + (progn + (setq brk (- brk 1)) + (overlay-put (make-overlay pm brk) 'face first-face) + (overlay-put (make-overlay brk e) 'face second-face)))))) + +(defun ft/gnus-diff-stat-summary-colour (line) + "Colourise a diff-stat summary-line." + (let* ((e (point-at-eol)) + (plus (- (re-search-forward "(\\+)" e t) 2)) + (minus (- (re-search-forward "(-)" e t) 2))) + (overlay-put (make-overlay plus (+ plus 1)) 'face 'ft/gnus-diff-add) + (overlay-put (make-overlay minus (+ minus 1)) 'face 'ft/gnus-diff-remove))) + +(defun ft/gnus-diff-stat-line-p (line) + "Return `t' if `line' is a diff-stat line; `nil' otherwise." + (string-match "^ *[^ ]+[^|]+| +[0-9]+\\( *\\| +[+-]+\\)$" line)) + +(defun ft/gnus-diff-stat-summary-p (line) + "Return `t' if `line' is a diff-stat summary-line; `nil' otherwise." + (string-match "^ *[0-9]+ file\\(s\\|\\) changed,.*insertion.*deletion" line)) + +;; unified-diffs +(defun ft/gnus-diff-header-p (line) + "Returns `t' if `line' looks like a diff-header; `nil' otherwise." + (cond + ((string-match "^\\(\\+\\+\\+\\|---\\) " line) t) + ((string-match "^diff -" line) t) + (t nil))) + +(defun ft/gnus-index-line-p (line) + "Returns `t' if `line' looks like an index-line; `nil' otherwise." + (cond + ((string-match "^Index: " line) t) + ((string-match "^index [0-9a-f]+\\.\\.[0-9a-f]+" line) t) + (t nil))) + +(defun ft/gnus-hunk-line-p (line) + "Returns `t' if `line' looks like a hunk-line; `nil' otherwise." + (string-match "^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@" line)) + +(defun ft/gnus-atp-misc-diff-p (line) + "Return `t' if `line' is a \"misc line\" with respect to patch +treatment; `nil' otherwise." + (let ((patterns '("^new file" + "^RCS file:" + "^retrieving revision "))) + (catch 'done + (dolist (regex patterns) + (if (string-match regex line) + (throw 'done t))) + (throw 'done nil)))) + +(defun ft/gnus-atp-looks-like-diff (line) + "Return `t' if `line' looks remotely like a line from a unified +diff; `nil' otherwise." + (or (ft/gnus-index-line-p line) + (ft/gnus-diff-header-p line) + (ft/gnus-hunk-line-p line))) + +;; miscellaneous line handlers +(defun ft/gnus-scissors-line-p (line) + "Returns `t' if `line' looks like a scissors-line; `nil' otherwise." + (cond + ((string-match "^\\( *--* *\\(8<\\|>8\\)\\)+ *-* *$" line) t) + (t nil))) + +;; Patch mail detection +(defvar ft/gnus-article-patch-conditions nil + "List of conditions that will enable patch treatment. String +values will be matched as regular expressions within the currently +processed part. Non-string value are supposed to be code fragments, +which determine whether or not to do treatment: The code needs to +return `t' if treatment is wanted.") + +(defun ft/gnus-part-want-patch-treatment () + "Run through `ft/gnus-article-patch-conditions' to determine whether +patch treatment is wanted or not. Return `t' or `nil' accordingly." + (catch 'done + (dolist (entry ft/gnus-article-patch-conditions) + (cond + ((stringp entry) + (if (re-search-forward entry nil t) + (throw 'done t))) + (t + (if (eval entry) + (throw 'done t))))) + (throw 'done nil))) + + +;; The actual article treatment code +(defun ft/gnus-article-treat-patch-state-machine () + "Implement the state machine which colourises a part of an article +if it looks patch-like. + +The state machine works like this: + + 0a. The machinery starts at the first line of the article's body. Not + the header lines. We don't care about header lines at all. + + 0b. The whole thing works line by line. It doesn't do any forward or + backward looks. + + 1. Initially, we assume, that what we'll see first is part of the + patch's commit-message. Hence this first initial state is + \"commit-message\". There are several ways out of this state: + + a) a scissors line is found (see 2.) + b) a pseudo-header line is found (see 3.) + c) a three-dashes line is found (see 4.) + d) something that looks like the start of a unified diff is + found (see 7.) + + 2. A scissors line is something that looks like a pair of scissors running + through a piece of paper. Like this: + + ------ 8< ----- 8< ------ + + or this: + + ------------>8----------- + + The function `ft/gnus-scissors-line-p' decides whether a line is a + scissors line or not. After a scissors line was treated, the machine + will switch back to the \"commit-mesage\" state. + + 3. This is very similar to a scissors line. It'll just return to the old + state after its being done. The `ft/gnus-pseudo-header-p' function + decides if a line is a pseudo header. The line will be appropriately + coloured. + + 4. A three-dashes line is a line that looks like this: \"---\". It's the + definite end of the \"commit-message\" state. The three dashes line is + coloured and the state switches to \"commit-comment\". (See 5.) + + 5. Nothing in \"commit-comment\" will appear in the generated commit (this + is git-am specific semantics, but it's useful, so...). It may contain + things like random comments or - promimently - a diff stat. (See 6.) + + 6. A diff stat provides statistics about how much changed in a given commit + by files and by whole commit (in a summary line). Two functions + `ft/gnus-diff-stat-line-p' and `ft/gnus-diff-stat-summary-p' decide if a + line belongs to a diff stat. It's coloured appropriately and the state + switches back to \"commit-comment\". + + 7. There is a function `ft/gnus-unified-diff-line-p' which will cause the + state to switch to \"unified-diff\" state from either \"commit-message\" + or \"commit-comment\". In this mode there can be a set of lines types: + + a) diff-header lines (`ft/gnus-diff-header-p') + b) index lines (`ft/gnus-index-line-p') + c) hunk lines (`ft/gnus-hunk-line-p') + d) equals line (\"^==*$\") + e) context lines (\"^ \") + f) add lines (\"^\\+\") + g) remove lines (\"^-\") + h) empty lines (\"^$\") + + This state runs until the end of the part." + (catch 'ft/gnus-atp-done + (let ((state 'commit-message) + line do-not-move) + + (while t + ;; Put the current line into an easy-to-handle string variable. + (setq line + (buffer-substring-no-properties (point-at-bol) (point-at-eol))) + (setq do-not-move nil) + + ;; Switched state machine. The "real" states are `commit-message', + ;; `commit-comment' and `unified-diff'. The other "states" are only + ;; single-line colourisations that return to their respective parent- + ;; state. Each state may (throw 'ft/gnus-atp-done) to leave the state- + ;; machine immediately. + (setq state + (cond + + ((eq state 'commit-message) + (cond + ((ft/gnus-scissors-line-p line) + (ft/gnus-colour-line 'ft/gnus-scissors) + 'commit-message) + ((ft/gnus-pseudo-header-p line) + (ft/gnus-pseudo-header-colour line) + 'commit-message) + ((string= line "---") + (ft/gnus-colour-line 'ft/gnus-three-dashes) + 'commit-comment) + ((ft/gnus-atp-looks-like-diff line) + (setq do-not-move t) + 'unified-diff) + (t + (ft/gnus-colour-line 'ft/gnus-commit-message) + 'commit-message))) + + ((eq state 'commit-comment) + (cond + ((ft/gnus-diff-stat-line-p line) + (ft/gnus-diff-stat-colour line) + 'commit-comment) + ((ft/gnus-diff-stat-summary-p line) + (ft/gnus-diff-stat-summary-colour line) + 'commit-comment) + ((ft/gnus-atp-looks-like-diff line) + (setq do-not-move t) + 'unified-diff) + (t + (ft/gnus-colour-line 'ft/gnus-commit-comment) + 'commit-comment))) + + ((eq state 'unified-diff) + (cond + ((ft/gnus-diff-header-p line) + (ft/gnus-colour-line 'ft/gnus-diff-header) + 'unified-diff) + ((ft/gnus-index-line-p line) + (ft/gnus-colour-line 'ft/gnus-diff-index) + 'unified-diff) + ((ft/gnus-hunk-line-p line) + (ft/gnus-colour-line 'ft/gnus-diff-hunk) + 'unified-diff) + ((string-match "^==*$" line) + (ft/gnus-colour-line 'ft/gnus-diff-equals) + 'unified-diff) + ((string-match "^$" line) + 'unified-diff) + ((string-match "^ " line) + (ft/gnus-colour-line 'ft/gnus-diff-context) + 'unified-diff) + ((ft/gnus-atp-misc-diff-p line) + (ft/gnus-colour-line 'ft/gnus-diff-misc) + 'unified-diff) + ((string-match "^\\+" line) + (ft/gnus-colour-line 'ft/gnus-diff-add) + 'unified-diff) + ((string-match "^-" line) + (ft/gnus-colour-line 'ft/gnus-diff-remove) + 'unified-diff) + (t 'unified-diff))))) + + (if (not do-not-move) + (if (> (forward-line) 0) + (throw 'ft/gnus-atp-done t))))))) + +(defun ft/gnus-article-treat-patch () + "Highlight mail parts, that look like patches (well, usually +they *are* patches - or possibly, when you take git's format-patch output, +entire commit exports - including comments). This treatment assumes the +use of unified diffs. Here is how it works: + +The most fancy type of patch mails look like this: + + From: ... + Subject: ... + Other-Headers: ... + + Body text, which can be reflecting the commit message but may + optionally be followed by a so called scissors line, which + looks like this (in case of a scissors line, the text above is + not part of the commit message): + + -------8<---------- + + If there really was a scissors line, then it's usually + followed by repeated mail-headers. Which do not *have* to + be the same as the one from the sender. + + From: ... + Subject: ... + + More text. Usually part of the commit message. Likely + multiline. What follows may be an optional diffstat. If + there is one, it's usually preceded by a line that contains + only three dashes and nothing more. Before the diffstat, + however, there may be a set of pseudo headers again, like + these: + + Acked-by: Mike Dev + Signed-off-by: Joe D. User + + --- + ChangeLog | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletions(-) + + Now, there is again room for optional text, which is not + part of the actual commit message. May be multiline. Actually, + anything between the three-dashes line and the diff content + is ignored as far as the commit message goes. + + Now for the actual diff part. I want this to work for as + many unified diff formats as possible. What comes to mind + is the format used by git and the format used by cvs and + quilt. + + CVS style looks like this: + + Index: foo/bar.c + ============================================================ + --- boo.orig/foo/bar.c 2010-02-24 .... + +++ boo/foo/bar.c 2010-02-28 .... + @@ -1823,7 +1823,7 @@ + + + There may be multiple hunks. Each file gets an \"Index:\" and + equals line. Now the git format looks like this: + + diff --git a/ChangeLog b/ChangeLog + index 6ffbc8c..36e5c17 100644 + --- a/ChangeLog + +++ b/ChangeLog + @@ -3,6 +3,9 @@ + + + Again, there may be multiple hunks. + + When all hunks and all files are done, there may be additional + text below the actual text. + +And that's it. + +You may define the look of several things: pseudo headers, scissor +lines, three-dashes-line, equals lines, diffstat lines, diffstat +summary. Then there is added lines, removed lines, context lines, +diff-header lines and diff-file-header lines, for which we are +borrowing the highlighting faces for from `diff-mode'." + (if (ft/gnus-part-want-patch-treatment) + (save-excursion + (progn + (let ((inhibit-read-only t)) + (goto-char (point-min)) + (ft/gnus-article-treat-patch-state-machine)))))) + +(provide 'gnus-article-treat-patch) diff --git a/lisp/smart-mode-line-tangomod-theme.el b/lisp/smart-mode-line-tangomod-theme.el new file mode 100644 index 0000000..b69eb7d --- /dev/null +++ b/lisp/smart-mode-line-tangomod-theme.el @@ -0,0 +1,51 @@ +;;; smart-mode-line-tangomod-theme.el --- tangomod theme for smart-mode-line + +;; Copyright (C) 2019 Amin Bandali + +;; Author: Amin Bandali +;; Version: 0.1.0 +;; Package-Requires: ((emacs "24.3") (smart-mode-line "2.10")) +;; Keywords: mode-line themes faces + +;;; Commentary: +;; +;; tangomod theme for smart-mode-line + +;;; License: +;; +;; This file is NOT part of GNU Emacs. +;; +;; 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. +;; + +;;; Code: + +(deftheme smart-mode-line-tangomod + "tangomod theme for smart-mode-line.") + +(custom-theme-set-faces + 'smart-mode-line-tangomod + '(mode-line-buffer-id ((t :inherit sml/filename :foreground nil :background nil))) + '(mode-line-inactive ((t :background "#e1e1e1"))) + '(mode-line ((t :background "#e7e7e7"))) + '(sml/global ((t :inherit font-lock-preprocessor-face))) + '(sml/filename ((t :inherit mode-line-buffer-id))) + '(sml/modes ((t :foreground nil :inherit sml/filename :weight normal))) + '(sml/prefix ((t :inherit (font-lock-variable-name-face sml/global)))) + '(sml/read-only ((t :inherit (font-lock-type-face sml/not-modified))))) + +;;;###autoload +(when load-file-name + (add-to-list 'custom-theme-load-path + (file-name-as-directory (file-name-directory load-file-name)))) + +(provide-theme 'smart-mode-line-tangomod) +;;; smart-mode-line-tangomod-theme.el ends here. diff --git a/lisp/tangomod-theme.el b/lisp/tangomod-theme.el new file mode 100644 index 0000000..5ec1bd1 --- /dev/null +++ b/lisp/tangomod-theme.el @@ -0,0 +1,154 @@ +;;; tangomod-theme.el --- Tango-based custom theme for faces + +;; Copyright (C) 2010-2013 Free Software Foundation, Inc. + +;; Authors: Chong Yidong +;; Jan Moringen + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see . + +;;; Commentary + +;; The colors in this theme come from the Tango palette, which is in +;; the public domain: http://tango.freedesktop.org/ + +;;; Code: + +(deftheme tangomod + "Face colors using the Tango palette (light background). +Basic, Font Lock, Isearch, Gnus, Message, Ediff, Flyspell, +Semantic, and Ansi-Color faces are included.") + +(let ((class '((class color) (min-colors 89))) + ;; Tango palette colors. + (butter-1 "#fce94f") (butter-2 "#edd400") (butter-3 "#c4a000") + (orange-1 "#fcaf3e") (orange-2 "#f57900") (orange-3 "#ce5c00") + (choc-1 "#e9b96e") (choc-2 "#c17d11") (choc-3 "#8f5902") + (cham-1 "#8ae234") (cham-2 "#73d216") (cham-3 "#4e9a06") + (blue-1 "#729fcf") (blue-2 "#3465a4") (blue-3 "#204a87") + (plum-1 "#ad7fa8") (plum-2 "#75507b") (plum-3 "#5c3566") + (red-1 "#ef2929") (red-2 "#cc0000") (red-3 "#a40000") + (alum-1 "#ffffff") (alum-2 "#d3d7cf") (alum-3 "#babdb6") + (alum-4 "#888a85") (alum-5 "#5f615c") (alum-6 "#000000") + ;; Not in Tango palette; used for better contrast. + (cham-4 "#346604") (blue-0 "#8cc4ff") (orange-4 "#b35000")) + + (custom-theme-set-faces + 'tangomod + `(default ((,class (:foreground ,alum-6 :background ,alum-1)))) + `(cursor ((,class (:background ,blue-3)))) + ;; Highlighting faces + `(fringe ((,class (:background "#FFFFFF")))) ;; EDITED + `(highlight ((,class (:foreground ,alum-6 :background ,butter-2)))) + ;; Disabled for talk at PL offsite + ;; `(highlight ((,class (:background ,alum-3)))) + `(region ((,class (:background ,alum-3)))) + `(secondary-selection ((,class (:background ,blue-0)))) + `(isearch ((,class (:foreground "#ffffff" :background ,orange-3)))) + `(lazy-highlight ((,class (:background ,choc-1)))) + `(trailing-whitespace ((,class (:background ,red-1)))) + ;; Paren face + `(show-paren-match ((,class (:background ,blue-1)))) + ;; Mode line faces + `(mode-line ((,class (:box (:line-width -1 :style released-button) + :background ,alum-2 :foreground ,alum-6)))) + `(mode-line-inactive ((,class (:box (:line-width -1 :style released-button) + :background ,alum-4 :foreground ,alum-6)))) + ;; Escape and prompt faces + `(minibuffer-prompt ((,class (:weight bold :foreground ,blue-3)))) + `(escape-glyph ((,class (:foreground ,red-3)))) + `(error ((,class (:foreground ,red-3)))) + `(warning ((,class (:foreground ,orange-3)))) + `(success ((,class (:foreground ,cham-3)))) + ;; Font lock faces + `(font-lock-builtin-face ((,class (:foreground ,plum-2)))) + `(font-lock-comment-face ((,class (:slant italic :foreground ,alum-5)))) + `(font-lock-constant-face ((,class (:weight bold :foreground ,blue-3)))) + `(font-lock-function-name-face ((,class (:foreground ,red-3)))) + `(font-lock-keyword-face ((,class (:foreground ,cham-4)))) + `(font-lock-string-face ((,class (:foreground ,plum-3)))) + `(font-lock-type-face ((,class (:foreground ,blue-3)))) + `(font-lock-variable-name-face ((,class (:foreground ,orange-4)))) + ;; Button and link faces + `(link ((,class (:underline t :foreground ,blue-3)))) + `(link-visited ((,class (:underline t :foreground ,blue-2)))) + ;; Gnus faces + `(gnus-group-news-1 ((,class (:weight bold :foreground ,plum-3)))) + `(gnus-group-news-1-low ((,class (:foreground ,plum-3)))) + `(gnus-group-news-2 ((,class (:weight bold :foreground ,blue-3)))) + `(gnus-group-news-2-low ((,class (:foreground ,blue-3)))) + `(gnus-group-news-3 ((,class (:weight bold :foreground ,red-3)))) + `(gnus-group-news-3-low ((,class (:foreground ,red-3)))) + `(gnus-group-news-4 ((,class (:weight bold :foreground ,"#7a4c02")))) + `(gnus-group-news-4-low ((,class (:foreground ,"#7a4c02")))) + `(gnus-group-news-5 ((,class (:weight bold :foreground ,orange-3)))) + `(gnus-group-news-5-low ((,class (:foreground ,orange-3)))) + `(gnus-group-news-low ((,class (:foreground ,alum-4)))) + `(gnus-group-mail-1 ((,class (:weight bold :foreground ,plum-3)))) + `(gnus-group-mail-1-low ((,class (:foreground ,plum-3)))) + `(gnus-group-mail-2 ((,class (:weight bold :foreground ,blue-3)))) + `(gnus-group-mail-2-low ((,class (:foreground ,blue-3)))) + `(gnus-group-mail-3 ((,class (:weight bold :foreground ,cham-3)))) + `(gnus-group-mail-3-low ((,class (:foreground ,cham-3)))) + `(gnus-group-mail-low ((,class (:foreground ,alum-4)))) + `(gnus-header-content ((,class (:foreground ,cham-3)))) + `(gnus-header-from ((,class (:weight bold :foreground ,butter-3)))) + `(gnus-header-subject ((,class (:foreground ,red-3)))) + `(gnus-header-name ((,class (:foreground ,blue-3)))) + `(gnus-header-newsgroups ((,class (:foreground ,alum-4)))) + ;; Message faces + `(message-header-name ((,class (:foreground ,blue-3)))) + `(message-header-cc ((,class (:foreground ,butter-3)))) + `(message-header-other ((,class (:foreground ,choc-2)))) + `(message-header-subject ((,class (:foreground ,red-3)))) + `(message-header-to ((,class (:weight bold :foreground ,butter-3)))) + `(message-cited-text ((,class (:slant italic :foreground ,alum-5)))) + `(message-separator ((,class (:weight bold :foreground ,cham-3)))) + ;; SMerge + `(smerge-refined-change ((,class (:background ,plum-1)))) + ;; Ediff + `(ediff-current-diff-A ((,class (:background ,blue-1)))) + `(ediff-fine-diff-A ((,class (:background ,plum-1)))) + `(ediff-current-diff-B ((,class (:background ,butter-1)))) + `(ediff-fine-diff-B ((,class (:background ,orange-1)))) + ;; Flyspell + `(flyspell-duplicate ((,class (:underline ,orange-1)))) + `(flyspell-incorrect ((,class (:underline ,red-1)))) + ;; Semantic faces + `(semantic-decoration-on-includes ((,class (:underline ,cham-4)))) + `(semantic-decoration-on-private-members-face + ((,class (:background ,alum-2)))) + `(semantic-decoration-on-protected-members-face + ((,class (:background ,alum-2)))) + `(semantic-decoration-on-unknown-includes + ((,class (:background ,choc-3)))) + `(semantic-decoration-on-unparsed-includes + ((,class (:underline ,orange-3)))) + `(semantic-tag-boundary-face ((,class (:overline ,blue-1)))) + `(semantic-unmatched-syntax-face ((,class (:underline ,red-1))))) + + (custom-theme-set-variables + 'tangomod + `(ansi-color-names-vector [,alum-6 ,red-3 ,cham-3 ,butter-3 + ,blue-3 ,plum-3 ,blue-1 ,alum-1]))) + +(provide-theme 'tangomod) + +;; Local Variables: +;; no-byte-compile: t +;; End: + +;;; tangomod-theme.el ends here diff --git a/var/abbrev.el b/var/abbrev.el new file mode 100644 index 0000000..76f19d8 --- /dev/null +++ b/var/abbrev.el @@ -0,0 +1,5 @@ +;;-*-coding: utf-8;-*- +(define-abbrev-table 'message-mode-abbrev-table + '( + ("linux" "GNU/Linux" nil :count 4) + )) diff --git a/var/eshell/alias b/var/eshell/alias new file mode 100644 index 0000000..d80c00b --- /dev/null +++ b/var/eshell/alias @@ -0,0 +1,19 @@ +alias .. cd .. +alias ... cd ../.. +alias e find-file-other-window $1 +alias ee find-file $1 +alias emacs find-file $1 +alias gd magit-diff-unstaged +alias gds magit-diff-staged +alias git git --no-pager $* +alias l ls -l $* +alias la ls -al $* +alias ll ls -al $* +alias man woman $1 +alias up eshell-up $1 +alias pk eshell-up-peek $1 +alias vi find-file $1 +alias vim find-file $1 +alias mbsync mbsync -c $XDG_CONFIG_HOME/isync/mbsyncrc $* +alias getmail getmail --getmaildir $XDG_CONFIG_HOME/getmail --rcfile getmailrc $* +alias m mbsync csclub; mbsync uwaterloo; mbsync shemshak; getmail -- cgit v1.2.3-60-g2f50