X-Git-Url: https://git.shemshak.org/~bandali/configs/blobdiff_plain/639bdc53e77ac4c2f7c3eb6f68539b5009e053ac..30b5e6f0416b7ca2a71e52b3850d91e55867fd61:/.emacs.d/init.el diff --git a/.emacs.d/init.el b/.emacs.d/init.el index dafb120..e249f9b 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -266,6 +266,10 @@ (previous-line) (insert "\n \n;;; ")) +(defun b/insert-asterism () + (interactive) + (insert "\n\n * * *\n\n")) + (defun b/no-mouse-autoselect-window () "Conveniently disable `focus-follows-mouse'. For disabling the behaviour for certain buffers and/or modes." @@ -468,6 +472,11 @@ For disabling the behaviour for certain buffers and/or modes." (use-feature vc :bind ("C-x v C-=" . vc-ediff)) +(use-feature vc-git + :after vc + :custom + (vc-git-print-log-follow t)) + (use-feature ediff :config (add-hook 'ediff-after-quit-hook-internal 'winner-undo) :custom ((ediff-window-setup-function 'ediff-setup-windows-plain) @@ -539,7 +548,7 @@ For disabling the behaviour for certain buffers and/or modes." ("" . next-buffer) ("" . next-buffer) ("" . kill-this-buffer) - ("" . ivy-switch-buffer)) + ("" . switch-to-buffer)) (bind-keys :prefix-map b/straight-prefix-map @@ -905,6 +914,7 @@ around if needed." :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 @@ -912,11 +922,73 @@ around if needed." :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) +;; (use-package smex) + +(bind-keys + ("C-c f ." . find-file) + ("C-c f l" . find-library) + ("C-c f r" . recentf-open-files) + ("C-c x" . execute-extended-command)) + +(comment + (use-feature 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-feature icomplete + :defer 0.3 + :config + (icomplete-mode 1))) + +(use-package amx + :defer 0.3 + :config + (amx-mode)) (use-package ivy :defer 0.3 @@ -928,7 +1000,7 @@ around if needed." ("DEL" . ivy-backward-delete-char)) :config (setq ivy-wrap t - ivy-height 14 + ;; ivy-height 14 ivy-use-virtual-buffers t ivy-virtual-abbreviate 'abbreviate ivy-count-format "%d/%d ") @@ -946,29 +1018,29 @@ This function is intended for use with `ivy-ignore-buffers'." (add-to-list 'ivy-ignore-buffers 'b/ivy-ignore-buffer-p) (ivy-mode 1) - ;; :custom-face - ;; (ivy-minibuffer-match-face-2 ((t (:background "#e99ce8" :weight semi-bold)))) - ;; (ivy-minibuffer-match-face-3 ((t (:background "#bbbbff" :weight semi-bold)))) - ;; (ivy-minibuffer-match-face-4 ((t (:background "#ffbbff" :weight semi-bold)))) -) + :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" . swiper-isearch) - ("C-r" . swiper) - ("C-S-s" . isearch-forward))) + ("C-r" . swiper-isearch-backward) + ("C-S-s" . swiper-isearch))) (use-package counsel - :after ivy - :bind (([remap execute-extended-command] . counsel-M-x) - ([remap find-file] . counsel-find-file) - ("C-c b b" . ivy-switch-buffer) - ("C-c f ." . counsel-find-file) - ("C-c f l" . counsel-find-library) - ("C-c f r" . counsel-recentf) - ("C-c x" . counsel-M-x) + :bind (;; ([remap execute-extended-command] . counsel-M-x) + ;; ([remap find-file] . counsel-find-file) + ("C-c f r" . counsel-recentf) :map minibuffer-local-map - ("C-r" . counsel-minibuffer-history)) + ("C-r" . counsel-minibuffer-history)) :config (counsel-mode 1) (defalias 'locate #'counsel-locate)) @@ -1015,7 +1087,8 @@ This function is intended for use with `ivy-ignore-buffers'." ("C-d" . b/eshell-quit-or-delete-char) ("C-S-l" . b/eshell-clear) ("M-r" . counsel-esh-history) - ([tab] . company-complete))) + ;; ([tab] . company-complete) + )) :hook (eshell-mode . b/eshell-setup) :custom @@ -1240,6 +1313,7 @@ This function is intended for use with `ivy-ignore-buffers'." (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left)) (use-feature text-mode + :bind (:map text-mode-map ("C-*" . b/insert-asterism)) :hook (text-mode . indicate-buffer-boundaries-left)) (use-feature conf-mode @@ -1252,15 +1326,18 @@ This function is intended for use with `ivy-ignore-buffers'." :bind (:map company-active-map ([tab] . company-complete-common-or-cycle) - ([escape] . company-abort)) + ([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)) + ;; :config + ;; (global-company-mode t) + ) (use-package flycheck :defer 0.6 @@ -1564,6 +1641,8 @@ This function is intended for use with `ivy-ignore-buffers'." (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))) @@ -1575,6 +1654,8 @@ This function is intended for use with `ivy-ignore-buffers'." (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))) @@ -1599,11 +1680,18 @@ This function is intended for use with `ivy-ignore-buffers'." "C-c 8 -" "typo/dashes" "C-c 8 <" "typo/left-brackets" "C-c 8 >" "typo/right-brackets" + "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" @@ -1620,6 +1708,10 @@ This function is intended for use with `ivy-ignore-buffers'." "C-c P s" "projectile/search" "C-c P x" "projectile/execute" "C-c P 4" "projectile/other-window" + "C-c p" "package management" + "C-c ps" "straight" + "C-c psa" "all" + "C-c psp" "package" "C-c q" "boxquote" "C-c t" "themes" ;; "s-O" "outline" @@ -1899,18 +1991,20 @@ This function is intended for use with `ivy-ignore-buffers'." (use-feature window :bind - (("C-c w s l" . b/split-window-right) - ("C-c w s j" . b/split-window-below) + (("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)) - :init - (defun b/split-window-right () - (interactive) - (split-window-right) - (other-window 1)) - (defun b/split-window-below () - (interactive) - (split-window-below) - (other-window 1)) :custom (split-width-threshold 150)) @@ -2006,6 +2100,22 @@ This function is intended for use with `ivy-ignore-buffers'." :files ("*.el" ("kotl" "kotl/*.el") "DEMO" "man/*.info" "man/*.texi"))) +(use-package oddmuse-curl + :straight (:host github :repo "kensanata/oddmuse-curl") + :config + (setq + oddmuse-wikis + (append + '(("EmacsConf" "https://emacsconf.org" utf-8 "question" nil) + ("EmacsConf 2019" "https://emacsconf.org/2019" utf-8 "question" nil)) + oddmuse-wikis)) + :custom + (oddmuse-username "bandali")) + +(use-package debpaste + :custom + (debpaste-paste-is-hidden t)) + ;;; Email (with Gnus) @@ -2247,13 +2357,34 @@ This function is intended for use with `ivy-ignore-buffers'." :config (setq gnus-buttonized-mime-types '("multipart/\\(signed\\|encrypted\\)") - 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:") + 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) @@ -2304,11 +2435,11 @@ https://bandali.eu.org") Systems Committee Computer Science Club, University of Waterloo https://csclub.uwaterloo.ca/~abandali") - (setq gnus-posting-styles + (setq gnus-message-replysign t + gnus-posting-styles '((".*" (address "bandali@gnu.org") - (signature b/gnu-signature) - (eval (set (make-local-variable 'message-user-fqdn) "fencepost.gnu.org"))) + (signature b/gnu-signature)) ("nnimap\\+gnu:l\\..*" (signature nil)) ((header "subject" "ThankCRM") @@ -2331,7 +2462,8 @@ https://csclub.uwaterloo.ca/~abandali") (address "bandali@csclub.uwaterloo.ca") (signature b/csc-signature) (gcc "nnimap+csc:Sent")))) - :hook (gnus-message-setup . mml-secure-message-sign)) + ;; :hook (gnus-message-setup . mml-secure-message-sign) + ) (use-feature gnus-topic :hook (gnus-group-mode . gnus-topic-mode) @@ -2357,6 +2489,11 @@ https://csclub.uwaterloo.ca/~abandali") :init (add-hook 'dired-mode-hook 'gnus-dired-mode)) +(comment + (use-feature gnus-utils + :custom + (gnus-completing-read-function 'gnus-ido-completing-read))) + (use-feature mm-decode :config (setq mm-discouraged-alternatives '("text/html" "text/richtext") @@ -2376,6 +2513,7 @@ https://csclub.uwaterloo.ca/~abandali") mail-envelope-from 'header)) (use-feature 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) @@ -2408,7 +2546,7 @@ https://csclub.uwaterloo.ca/~abandali") '(gnus-find-subscribed-addresses) message-dont-reply-to-names "\\(\\(\\(amin\\|mab\\)@shemshak\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|\\(a?bandali@\\(csclub\\.\\)?uwaterloo\\.ca\\)\\)") - (require 'company-ebdb) + ;; (require 'company-ebdb) :hook (;; (message-setup . mml-secure-message-sign-pgpmime) (message-mode . flyspell-mode) (message-mode . (lambda () @@ -2460,14 +2598,19 @@ https://csclub.uwaterloo.ca/~abandali") (use-feature ebdb-com :after ebdb) -;; (use-package ebdb-complete -;; :after ebdb -;; :config -;; (ebdb-complete-enable)) - -(use-package company-ebdb +(use-feature ebdb-complete + :after ebdb :config - (defun company-ebdb--post-complete (_) nil)) + ;; (setq ebdb-complete-mail 'capf) + (ebdb-complete-enable)) + +(use-feature ebdb-message + :demand + :after ebdb) + +;; (use-package company-ebdb +;; :config +;; (defun company-ebdb--post-complete (_) nil)) (use-feature ebdb-gnus :after ebdb @@ -2522,7 +2665,7 @@ https://csclub.uwaterloo.ca/~abandali") ;;; IRC (with ERC and ZNC) (use-feature erc - :bind (("C-c b e" . erc-switch-to-buffer) + :bind (("C-c b b" . erc-switch-to-buffer) :map erc-mode-map ("M-a" . erc-track-switch-buffer)) :custom @@ -2559,7 +2702,7 @@ https://csclub.uwaterloo.ca/~abandali") (use-feature erc-pcomplete :after erc :custom - (erc-pcomplete-nick-postfix ",")) + (erc-pcomplete-nick-postfix ", ")) (use-feature erc-track :after erc