-(use-package shrink-path
- :after eshell
- :config
- (setq eshell-prompt-regexp "\\(.*\n\\)*λ "
- eshell-prompt-function #'+eshell/prompt)
-
- (defun +eshell/prompt ()
- (let ((base/dir (shrink-path-prompt default-directory)))
- (concat (propertize (car base/dir)
- 'face 'font-lock-comment-face)
- (propertize (cdr base/dir)
- 'face 'font-lock-constant-face)
- (propertize (+eshell--current-git-branch)
- 'face 'font-lock-function-name-face)
- "\n"
- (propertize "λ" 'face 'eshell-prompt-face)
- ;; needed for the input text to not have prompt face
- (propertize " " 'face 'default))))
-
- (defun +eshell--current-git-branch ()
- (let ((branch (car (loop for match in (split-string (shell-command-to-string "git branch") "\n")
- when (string-match "^\*" match)
- collect match))))
- (if (not (eq branch nil))
- (concat " " (substring branch 2))
- ""))))
-
-(use-package slack
- :disabled t
- :commands (slack-start)
- :init
- (eval-when-compile ; silence the byte-compiler
- (defvar url-http-data nil)
- (defvar url-http-extra-headers nil)
- (defvar url-http-method nil)
- (defvar url-callback-function nil)
- (defvar url-callback-arguments nil)
- (defvar oauth--token-data nil))
- (setq slack-buffer-emojify t
- slack-prefer-current-team t)
- :config
- (slack-register-team
- :name "uw-apv"
- :default t
- :client-id uw-apv-client-id
- :client-secret uw-apv-client-secret
- :token uw-apv-token
- :subscribed-channels '(general)
- :full-and-display-names t)
- (slack-register-team
- :name "watform"
- :default nil
- :client-id watform-client-id
- :client-secret watform-client-secret
- :token watform-token
- :subscribed-channels '(general)
- :full-and-display-names t)
- (add-to-list 'swiper-font-lock-exclude 'slack-message-buffer-mode t)
- (setq lui-time-stamp-format "[%Y-%m-%d %H:%M:%S]"
- lui-time-stamp-only-when-changed-p t
- lui-time-stamp-position 'right)
- :bind
- (("C-c s s" . slack-start)
- ("C-c s u" . slack-select-unread-rooms)
- ("C-c s b" . slack-select-rooms)
- ("C-c s t" . slack-change-current-team)
- ("C-c s c" . slack-ws-close)
- :map slack-mode-map
- ("M-p" . slack-buffer-goto-prev-message)
- ("M-n" . slack-buffer-goto-next-message)
- ("C-c e" . slack-message-edit)
- ("C-c k" . slack-message-delete)
- ("C-c C-k" . slack-channel-leave)
- ("C-c r a" . slack-message-add-reaction)
- ("C-c r r" . slack-message-remove-reaction)
- ("C-c r s" . slack-message-show-reaction-users)
- ("C-c p l" . slack-room-pins-list)
- ("C-c p a" . slack-message-pins-add)
- ("C-c p r" . slack-message-pins-remove)
- ("@" . slack-message-embed-mention)
- ("#" . slack-message-embed-channel)))
-
-(use-package alert
- :commands (alert)
- :init
- (setq alert-default-style 'notifier))
-
-(use-package eshell-up
- :after eshell)
-
-(use-package multi-term
- :defer 1
- :bind (("C-c C-j" . term-line-mode)
- ("C-c m m" . multi-term)
- ("C-c m p" . multi-term-dedicated-toggle))
- :config
- (setq multi-term-program "/bin/screen"
- ;; TODO: add separate bindings for connecting to existing
- ;; session vs. always creating a new one
- multi-term-dedicated-select-after-open-p t
- multi-term-dedicated-window-height 20
- multi-term-dedicated-max-window-height 30
- term-bind-key-alist
- '(("C-c C-c" . term-interrupt-subjob)
- ("C-c C-e" . term-send-esc)
- ("C-k" . kill-line)
- ("C-y" . term-paste)
- ("M-f" . term-send-forward-word)
- ("M-b" . term-send-backward-word)
- ("M-p" . term-send-up)
- ("M-n" . term-send-down)
- ("<C-backspace>" . term-send-backward-kill-word)
- ("<M-DEL>" . 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" "<ESC>")))
-
-(defvar amin-maildir (expand-file-name "~/mail/"))
-(after! recentf
- (add-to-list 'recentf-exclude amin-maildir))
-
-(setq
- amin-gnus-init-file (no-littering-expand-etc-file-name "gnus")
- mail-user-agent 'gnus-user-agent
- read-mail-command 'gnus)
-
-(use-package gnus
- :bind (("s-m" . gnus)
- ("s-M" . gnus-unplugged))
- :init
- (setq
- gnus-select-method '(nnnil "")
- gnus-secondary-select-methods
- '((nnimap "amin"
- (nnimap-stream plain)
- (nnimap-address "127.0.0.1")
- (nnimap-server-port 143)
- (nnimap-authenticator plain)
- (nnimap-user "amin@aminb.org"))
- (nnimap "uwaterloo"
- (nnimap-stream plain)
- (nnimap-address "127.0.0.1")
- (nnimap-server-port 143)
- (nnimap-authenticator plain)
- (nnimap-user "abandali@uwaterloo.ca")))
- gnus-message-archive-group "nnimap+amin:Sent"
- gnus-parameters
- '(("gnu.*"
- (gcc-self . t)))
- gnus-large-newsgroup 50
- gnus-home-directory (no-littering-expand-var-file-name "gnus/")
- gnus-directory (concat gnus-home-directory "news/")
- message-directory (concat gnus-home-directory "mail/")
- nndraft-directory (concat gnus-home-directory "drafts/")
- gnus-save-newsrc-file nil
- gnus-read-newsrc-file nil
- gnus-interactive-exit nil
- gnus-gcc-mark-as-read t))
-
-(use-package gnus-art
- :config
- (setq
- gnus-visible-headers
- (concat gnus-visible-headers "\\|^List-Id:\\|^X-RT-Originator:\\|^User-Agent:")
- gnus-sorted-header-list
- '("^From:" "^Subject:" "^Summary:" "^Keywords:"
- "^Followup-To:" "^To:" "^Cc:" "X-RT-Originator"
- "^Newsgroups:" "List-Id:" "^Organization:"
- "^User-Agent:" "^Date:")
- ;; local-lapsed article dates
- ;; from https://www.emacswiki.org/emacs/GnusFormatting#toc11
- gnus-article-date-headers '(user-defined)
- gnus-article-time-format
- (lambda (time)
- (let* ((date (format-time-string "%a, %d %b %Y %T %z" time))
- (local (article-make-date-line date 'local))
- (combined-lapsed (article-make-date-line date
- 'combined-lapsed))
- (lapsed (progn
- (string-match " (.+" combined-lapsed)
- (match-string 0 combined-lapsed))))
- (concat local lapsed))))
- (bind-keys
- :map gnus-article-mode-map
- ("r" . gnus-article-reply-with-original)
- ("R" . gnus-article-wide-reply-with-original)
- ("M-L" . org-store-link)))
-
-(use-package gnus-sum
- :bind (:map gnus-summary-mode-map
- :prefix-map amin--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
- ("r" . gnus-summary-reply-with-original)
- ("R" . gnus-summary-wide-reply-with-original)
- ("M-L" . org-store-link))
- :hook (gnus-summary-mode . amin--no-mouse-autoselect-window))
-
-(use-package gnus-msg
- :config
- (setq gnus-posting-styles
- '((".*"
- (address "amin@aminb.org")
- (body "\nBest,\namin\n")
- (eval (setq amin--message-cite-say-hi t)))
- ("gnu.*"
- (address "bandali@gnu.org"))
- ((header "subject" "ThankCRM")
- (to "webmasters-comment@gnu.org")
- (body "\nAdded to 2018supporters.html.\n\nMoving to campaigns.\n\n-amin\n")
- (eval (setq amin--message-cite-say-hi nil)))
- ("nnimap\\+uwaterloo:.*"
- (address "abandali@uwaterloo.ca")
- (gcc "\"nnimap+uwaterloo:Sent Items\"")))))
-
-(use-package gnus-topic
- :hook (gnus-group-mode . gnus-topic-mode))
-
-(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$\\)"))
-
-(use-package mm-decode
- :config
- (setq mm-discouraged-alternatives '("text/html" "text/richtext")))
-
-(use-package sendmail
- :config
- (setq sendmail-program "/usr/bin/msmtp"
- ;; message-sendmail-extra-arguments '("-v" "-d")
- mail-specify-envelope-from t
- mail-envelope-from 'header))
-
-(use-package message
- :config
- (defconst amin--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 amin--message-cite-say-hi
- (concat "Hi %F,\n\n" amin--message-cite-style-format)
- amin--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-dont-reply-to-names
- "\\(\\(.*@aminb\\.org\\)\\|\\(amin@bandali\\.me\\)\\|\\(\\(aminb?\\|mab\\|bandali\\)@gnu\\.org\\)\\|\\(\\(m\\|a\\(min\\.\\)?\\)bandali@uwaterloo\\.ca\\)\\)"
- message-user-fqdn "aminb.org")
- :hook (;; (message-setup . mml-secure-message-sign-pgpmime)
- (message-mode . flyspell-mode)
- (message-mode . (lambda ()
- ;; (setq fill-column 65
- ;; message-fill-column 65)
- (make-local-variable 'company-idle-delay)
- (setq company-idle-delay 0.2))))
- ;; :custom-face
- ;; (message-header-subject ((t (:foreground "#111" :weight semi-bold))))
- ;; (message-header-to ((t (:foreground "#111" :weight normal))))
- ;; (message-header-cc ((t (:foreground "#333" :weight normal))))
- )
-
-(after! mml-sec
- (setq mml-secure-openpgp-encrypt-to-self t
- mml-secure-openpgp-sign-with-sender t))
-
-(use-package footnote
- :after message
- :bind
- (:map message-mode-map
- :prefix-map amin--footnote-prefix-map
- :prefix "C-c f"
- ("a" . footnote-add-footnote)
- ("b" . footnote-back-to-message)
- ("c" . footnote-cycle-style)
- ("d" . footnote-delete-footnote)
- ("g" . footnote-goto-footnote)
- ("r" . footnote-renumber-footnotes)
- ("s" . footnote-set-style))
- :config
- (setq footnote-start-tag ""
- footnote-end-tag ""
- footnote-style 'unicode))
-
-(use-package bbdb
- :load-path "lisp/bbdb"
- :init
- (load (expand-file-name "lisp/bbdb/bbdb-autoloads.el" user-emacs-directory))
- ;; (bbdb-mua-auto-update-init 'message)
- (setq bbdb-mua-auto-update-p 'query
- bbdb-complete-mail nil)
- (bbdb-initialize 'gnus 'message))
-
-(use-package message-x
- :disabled t
- :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)))))
-
-(use-package gnus-harvest
- :disabled t
- :commands gnus-harvest-install
- :demand t
- :config
- (if (featurep 'message-x)
- (gnus-harvest-install 'message-x)
- (gnus-harvest-install)))
-
-(use-package ox-hugo
- :after ox)
-
-(use-package ox-hugo-auto-export
- :load-path "lib/ox-hugo")
+(run-with-idle-timer 0.5 nil #'require 'page-break-lines)
+(with-eval-after-load 'page-break-lines
+ (csetq page-break-lines-max-width fill-column)
+ (global-page-break-lines-mode))
+
+;; expand-region
+(global-set-key (kbd "C-=") #'er/expand-region)
+
+(run-with-idle-timer 0.6 nil #'require 'yasnippet)
+(with-eval-after-load 'yasnippet
+ (declare-function yas-reload-all
+ "yasnippet" (&optional no-jit interactive))
+ (declare-function yas-maybe-expand-abbrev-key-filter
+ "yasnippet" (cmd))
+
+ (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-abbrev-key-filter (cmd)
+ (when (and (yas-maybe-expand-abbrev-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-abbrev-key-filter))
+ (define-key yas-minor-mode-map (kbd "SPC") b/yas-maybe-expand)
+
+ (yas-global-mode))
+
+;; debbugs
+(global-set-key (kbd "C-c D d") #'debbugs-gnu)
+(global-set-key (kbd "C-c D b") #'debbugs-gnu-bugs)
+(global-set-key (kbd "C-c D e") ; bug-gnu-emacs
+ (lambda ()
+ (interactive)
+ (setq debbugs-gnu-current-suppress t)
+ (debbugs-gnu debbugs-gnu-default-severities
+ '("emacs"))))
+(global-set-key (kbd "C-c D g") ; bug-gnuzilla
+ (lambda ()
+ (interactive)
+ (setq debbugs-gnu-current-suppress t)
+ (debbugs-gnu debbugs-gnu-default-severities
+ '("gnuzilla"))))
+(global-set-key (kbd "C-c D G b") ; bug-guix
+ (lambda ()
+ (interactive)
+ (setq debbugs-gnu-current-suppress t)
+ (debbugs-gnu debbugs-gnu-default-severities
+ '("guix"))))
+(global-set-key (kbd "C-c D G p") ; guix-patches
+ (lambda ()
+ (interactive)
+ (setq debbugs-gnu-current-suppress t)
+ (debbugs-gnu debbugs-gnu-default-severities
+ '("guix-patches"))))
+
+;; eww
+(csetq eww-download-directory (file-name-as-directory
+ (getenv "XDG_DOWNLOAD_DIR")))
+(global-set-key (kbd "C-c a e w") #'eww)
+
+(comment
+
+;; org-ref
+(csetq
+ reftex-default-bibliography '("~/usr/org/references.bib")
+ org-ref-default-bibliography '("~/usr/org/references.bib")
+ org-ref-bibliography-notes "~/usr/org/notes.org"
+ org-ref-pdf-directory "~/usr/org/bibtex-pdfs/")
+
+;; fill-column-indicator ?
+
+;; window
+(csetq split-width-threshold 150)
+(global-set-key (kbd "C-c w s l")
+ (lambda ()
+ (interactive)
+ (split-window-right)
+ (other-window 1)))
+(global-set-key (kbd "C-c w s j")
+ (lambda ()
+ (interactive)
+ (split-window-below)
+ (other-window 1)))
+(global-set-key (kbd "C-c w q") #'quit-window)
+
+(run-with-idle-timer 0.6 nil #'require 'windmove)
+(global-set-key (kbd "C-c w h") #'windmove-left)
+(global-set-key (kbd "C-c w j") #'windmove-down)
+(global-set-key (kbd "C-c w k") #'windmove-up)
+(global-set-key (kbd "C-c w l") #'windmove-right)
+(global-set-key (kbd "C-c w H") #'windmove-swap-states-left)
+(global-set-key (kbd "C-c w J") #'windmove-swap-states-down)
+(global-set-key (kbd "C-c w K") #'windmove-swap-states-up)
+(global-set-key (kbd "C-c w L") #'windmove-swap-states-right)
+
+;; pass
+(global-set-key (kbd "C-c a p") #'pass)
+(add-hook 'pass-mode-hook #'View-exit)
+
+;; reftex
+;; uncomment to disable reftex-cite's default choice of previous word
+;; (with-eval-after-load 'reftex
+;; (require 'reftex-cite)
+;; (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)))))
+(add-hook 'latex-mode-hook #'reftex-mode)
+
+;; dmenu
+(csetq
+ dmenu-prompt-string "run: "
+ dmenu-save-file (b/var "dmenu-items"))
+
+;; eosd ?
+
+\f
+;;; Post initialization