diff options
| author | 2026-02-09 23:19:19 +0000 | |
|---|---|---|
| committer | 2026-02-09 23:56:57 +0000 | |
| commit | e9cd60bf35685d17f0be97bb849683dec0825efd (patch) | |
| tree | 75e7521ea542431220ef51ae1d3467b30da54fab /dot_config/emacs/init.el | |
| download | dotfiles-e9cd60bf35685d17f0be97bb849683dec0825efd.tar.gz | |
add emacs config
Diffstat (limited to 'dot_config/emacs/init.el')
| -rw-r--r-- | dot_config/emacs/init.el | 1475 |
1 files changed, 1475 insertions, 0 deletions
diff --git a/dot_config/emacs/init.el b/dot_config/emacs/init.el new file mode 100644 index 0000000..e9fc0fb --- /dev/null +++ b/dot_config/emacs/init.el | |||
| @@ -0,0 +1,1475 @@ | |||
| 1 | ;; Example Elpaca configuration -*- lexical-binding: t; -*- | ||
| 2 | (defvar elpaca-installer-version 0.11) | ||
| 3 | (defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) | ||
| 4 | (defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) | ||
| 5 | (defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory)) | ||
| 6 | (defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git" | ||
| 7 | :ref nil :depth 1 :inherit ignore | ||
| 8 | :files (:defaults "elpaca-test.el" (:exclude "extensions")) | ||
| 9 | :build (:not elpaca--activate-package))) | ||
| 10 | (let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory)) | ||
| 11 | (build (expand-file-name "elpaca/" elpaca-builds-directory)) | ||
| 12 | (order (cdr elpaca-order)) | ||
| 13 | (default-directory repo)) | ||
| 14 | (add-to-list 'load-path (if (file-exists-p build) build repo)) | ||
| 15 | (unless (file-exists-p repo) | ||
| 16 | (make-directory repo t) | ||
| 17 | (when (<= emacs-major-version 28) (require 'subr-x)) | ||
| 18 | (condition-case-unless-debug err | ||
| 19 | (if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*")) | ||
| 20 | ((zerop (apply #'call-process `("git" nil ,buffer t "clone" | ||
| 21 | ,@(when-let* ((depth (plist-get order :depth))) | ||
| 22 | (list (format "--depth=%d" depth) "--no-single-branch")) | ||
| 23 | ,(plist-get order :repo) ,repo)))) | ||
| 24 | ((zerop (call-process "git" nil buffer t "checkout" | ||
| 25 | (or (plist-get order :ref) "--")))) | ||
| 26 | (emacs (concat invocation-directory invocation-name)) | ||
| 27 | ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch" | ||
| 28 | "--eval" "(byte-recompile-directory \".\" 0 'force)"))) | ||
| 29 | ((require 'elpaca)) | ||
| 30 | ((elpaca-generate-autoloads "elpaca" repo))) | ||
| 31 | (progn (message "%s" (buffer-string)) (kill-buffer buffer)) | ||
| 32 | (error "%s" (with-current-buffer buffer (buffer-string)))) | ||
| 33 | ((error) (warn "%s" err) (delete-directory repo 'recursive)))) | ||
| 34 | (unless (require 'elpaca-autoloads nil t) | ||
| 35 | (require 'elpaca) | ||
| 36 | (elpaca-generate-autoloads "elpaca" repo) | ||
| 37 | (let ((load-source-file-function nil)) (load "./elpaca-autoloads")))) | ||
| 38 | (add-hook 'after-init-hook #'elpaca-process-queues) | ||
| 39 | (elpaca `(,@elpaca-order)) | ||
| 40 | |||
| 41 | ;; Install use-package support | ||
| 42 | (elpaca elpaca-use-package | ||
| 43 | ;; Enable use-package :ensure support for Elpaca. | ||
| 44 | (elpaca-use-package-mode) | ||
| 45 | ;; Auto ensure | ||
| 46 | (require 'use-package-ensure) | ||
| 47 | (setq use-package-always-ensure t)) | ||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 | (use-package project | ||
| 52 | :ensure (:wait t)) | ||
| 53 | |||
| 54 | (use-package emacs | ||
| 55 | :ensure nil | ||
| 56 | :custom | ||
| 57 | (default-frame-alist (assq-delete-all 'background-color default-frame-alist)) | ||
| 58 | (context-menu-mode t) | ||
| 59 | (enable-recursive-minibuffers t) | ||
| 60 | (read-extended-command-predicate #'command-completion-default-include-p) | ||
| 61 | (read-file-name-completion-ignore-case t) | ||
| 62 | (read-buffer-completion-ignore-case t) | ||
| 63 | (completion-ignore-case t) | ||
| 64 | (minibuffer-prompt-properties | ||
| 65 | '(read-only t cursor-intangible t face minibuffer-prompt)) | ||
| 66 | (ring-bell-function #'ignore) | ||
| 67 | (display-time-24hr-format t) | ||
| 68 | (custom-file (expand-file-name "customs.el" user-emacs-directory)) | ||
| 69 | (history-length 10000) | ||
| 70 | (savehist-file (concat (or (getenv "XDG_CACHE_HOME") "~/.cache") | ||
| 71 | "/emacs/history")) | ||
| 72 | :config | ||
| 73 | (blink-cursor-mode 0) | ||
| 74 | (set-face-attribute 'default nil :font "Aporetic Serif Mono" :height 125) | ||
| 75 | (set-face-attribute 'variable-pitch nil :font "Aporetic Serif" :inherit 'default) | ||
| 76 | (set-face-attribute 'fixed-pitch nil :inherit 'default) | ||
| 77 | (set-fontset-font t 'emoji (font-spec :family "Noto Emoji") nil 'prepend) | ||
| 78 | |||
| 79 | (server-start) | ||
| 80 | |||
| 81 | (column-number-mode 1) | ||
| 82 | |||
| 83 | (setq mode-line-compact 'long) | ||
| 84 | |||
| 85 | ;; Save all tempfiles in $TMPDIR/emacs$UID/ | ||
| 86 | (defconst emacs-tmp-dir (expand-file-name (format "emacs%d" (user-uid)) temporary-file-directory)) | ||
| 87 | (setq backup-directory-alist `((".*" . ,emacs-tmp-dir))) | ||
| 88 | (setq auto-save-file-name-transforms `((".*" ,emacs-tmp-dir t))) | ||
| 89 | (setq auto-save-list-file-prefix emacs-tmp-dir) | ||
| 90 | |||
| 91 | (prefer-coding-system 'utf-8) | ||
| 92 | (set-language-environment "UTF-8") | ||
| 93 | (set-default-coding-systems 'utf-8) | ||
| 94 | (set-terminal-coding-system 'utf-8) | ||
| 95 | (setq-default buffer-file-coding-system 'utf-8) | ||
| 96 | |||
| 97 | (defalias 'yes-or-no-p 'y-or-n-p)) | ||
| 98 | |||
| 99 | (setq default-input-method "russian-computer") | ||
| 100 | |||
| 101 | (define-prefix-command 'cmmm/toggle-map nil) | ||
| 102 | (define-key mode-specific-map (kbd "x") '("toggles" . cmmm/toggle-map)) | ||
| 103 | |||
| 104 | (define-prefix-command 'cmmm/application-map nil) | ||
| 105 | (define-key mode-specific-map (kbd "a") '("applications" . cmmm/application-map)) | ||
| 106 | (define-key cmmm/application-map (kbd "w") 'woman) | ||
| 107 | (define-key cmmm/application-map (kbd "m") 'man) | ||
| 108 | |||
| 109 | (use-package modus-themes | ||
| 110 | :custom | ||
| 111 | (modus-themes-bold-constructs t) | ||
| 112 | (modus-themes-italic-constructs t) | ||
| 113 | (modus-themes-slanted-constructs t) | ||
| 114 | (modus-themes-mixed-fonts t) | ||
| 115 | (modus-themes-variable-pitch-ui t) | ||
| 116 | (modus-themes-common-palette-overrides '((border-mode-line-active unspecified) | ||
| 117 | (border-mode-line-inactive unspecified) | ||
| 118 | (fringe unspecified) | ||
| 119 | (fg-line-number-inactive "gray50") | ||
| 120 | (fg-line-number-active fg-main) | ||
| 121 | (bg-line-number-inactive unspecified) | ||
| 122 | (bg-line-number-active unspecified) | ||
| 123 | (bg-region bg-ochre) | ||
| 124 | (fg-region unspecified) | ||
| 125 | ;; (comment green-warmer) | ||
| 126 | )) | ||
| 127 | (modus-themes-headings '(((1 . (1.15)) | ||
| 128 | (2 . (1.1)) | ||
| 129 | (3 . (1.1)) | ||
| 130 | (4 . (1.0)) | ||
| 131 | (5 . (1.0)) | ||
| 132 | (6 . (1.0)) | ||
| 133 | (7 . (0.9)) | ||
| 134 | (8 . (0.9))))) | ||
| 135 | :bind | ||
| 136 | (:map cmmm/toggle-map | ||
| 137 | ("t" . modus-themes-toggle)) | ||
| 138 | :hook (after-init . cmmm/modus-themes-load-vivendi) | ||
| 139 | :config | ||
| 140 | (defun cmmm/modus-themes-load-vivendi () | ||
| 141 | (modus-themes-load-theme 'modus-vivendi)) | ||
| 142 | ;; (modus-themes-load-theme 'modus-vivendi) | ||
| 143 | ) | ||
| 144 | |||
| 145 | (defun cmmm/sync-gtk-theme () | ||
| 146 | (interactive) | ||
| 147 | (let ((gtk-theme (pcase (car custom-enabled-themes) | ||
| 148 | ('modus-operandi "Adwaita-light") | ||
| 149 | ('modus-vivendi "Adwaita")))) | ||
| 150 | (shell-command (format "gsettings set org.gnome.desktop.interface gtk-theme %s" gtk-theme) nil))) | ||
| 151 | (advice-add 'modus-themes-toggle :after 'cmmm/sync-gtk-theme) | ||
| 152 | |||
| 153 | (use-package savehist | ||
| 154 | :ensure nil | ||
| 155 | :config | ||
| 156 | (savehist-mode)) | ||
| 157 | |||
| 158 | (use-package spacious-padding) | ||
| 159 | |||
| 160 | (use-package subword | ||
| 161 | :ensure nil | ||
| 162 | :config | ||
| 163 | (global-subword-mode)) | ||
| 164 | |||
| 165 | (use-package ansi-color | ||
| 166 | :ensure nil | ||
| 167 | :config | ||
| 168 | (add-hook 'compilation-filter-hook 'ansi-color-compilation-filter) | ||
| 169 | (add-hook 'compilation-mode-hook 'toggle-truncate-lines)) | ||
| 170 | |||
| 171 | (use-package eshell | ||
| 172 | :ensure nil | ||
| 173 | :init | ||
| 174 | (require 'esh-mode) | ||
| 175 | :bind | ||
| 176 | (:map eshell-mode-map | ||
| 177 | ("C-c M-o" . eshell/clear))) | ||
| 178 | |||
| 179 | (use-package eshell-syntax-highlighting | ||
| 180 | :config | ||
| 181 | (eshell-syntax-highlighting-global-mode)) | ||
| 182 | |||
| 183 | (use-package eshell-prompt-extras | ||
| 184 | :config | ||
| 185 | (with-eval-after-load 'em-prompt | ||
| 186 | (autoload 'epe-theme-lambda "eshell-prompt-extras") | ||
| 187 | (setq eshell-prompt-function 'epe-theme-lambda) | ||
| 188 | (setq eshell-highlight-prompt nil))) | ||
| 189 | |||
| 190 | (setq world-clock-list | ||
| 191 | '(("UTC" "UTC") | ||
| 192 | ("Europe/Bratislava" "Bratislava") | ||
| 193 | ("Europe/Moscow" "Moscow") | ||
| 194 | ("America/La_Paz" "La Paz"))) | ||
| 195 | |||
| 196 | (with-eval-after-load 'xref | ||
| 197 | (setq xref-auto-jump-to-first-definition 'move) | ||
| 198 | (setq xref-auto-jump-to-first-xref 'move) | ||
| 199 | ;; (setq xref-prompt-for-identifier | ||
| 200 | ;; '(not xref-find-definitions-other-window | ||
| 201 | ;; xref-find-definitions-other-frame)) | ||
| 202 | (setq xref-show-xrefs-function 'consult-xref) | ||
| 203 | (setq xref-show-definitions-function 'consult-xref)) | ||
| 204 | |||
| 205 | (define-key global-map (kbd "s-d") 'dired-jump) | ||
| 206 | (define-key global-map (kbd "s-r") 'recompile) | ||
| 207 | (define-key global-map (kbd "s-b") 'consult-buffer) | ||
| 208 | (define-key minibuffer-local-map (kbd "s-b") 'exit-minibuffer) | ||
| 209 | (define-key global-map (kbd "C-x C-b") 'ibuffer) | ||
| 210 | (defun cmmm/switch-to-prev-buffer-or-eshell (arg) | ||
| 211 | (interactive "P") | ||
| 212 | (if arg | ||
| 213 | (eshell arg) | ||
| 214 | (switch-to-buffer (other-buffer (current-buffer) 1)))) | ||
| 215 | (with-eval-after-load 'esh-mode | ||
| 216 | (define-key eshell-mode-map (kbd "s-e") 'cmmm/switch-to-prev-buffer-or-eshell)) | ||
| 217 | (define-key global-map (kbd "s-e") 'eshell) | ||
| 218 | (define-key global-map (kbd "s-t") 'vterm) | ||
| 219 | (define-key global-map (kbd "s-w") 'kill-current-buffer) | ||
| 220 | (define-key global-map (kbd "s-W") 'kill-buffer-and-window) | ||
| 221 | (define-key global-map (kbd "s-o") 'other-window) | ||
| 222 | |||
| 223 | (use-package dired | ||
| 224 | :ensure nil | ||
| 225 | :custom | ||
| 226 | (dired-clean-confirm-killing-deleted-buffers nil) | ||
| 227 | (dired-auto-revert-buffer t) | ||
| 228 | (dired-listing-switches "-Alh --time-style=long-iso") | ||
| 229 | (dired-dwim-target t) | ||
| 230 | (dired-recursive-copies 'always) | ||
| 231 | (dired-recursive-deletes 'always) | ||
| 232 | (dired-omit-files (string-join '("\\`[.]?#" "\\`[.][.]?" "\\`[.].*" "\\`[_].*" | ||
| 233 | "\\`compile_commands.json" | ||
| 234 | "\\`GPATH" "\\`GRTAGS" "\\`GTAGS\\'") | ||
| 235 | "\\|")) | ||
| 236 | :hook | ||
| 237 | (dired-mode . dired-omit-mode) | ||
| 238 | (dired-mode . dired-hide-details-mode)) | ||
| 239 | (use-package dired-rsync) | ||
| 240 | (use-package dired-rsync-transient | ||
| 241 | :after (transient dired-rsync)) | ||
| 242 | |||
| 243 | (defvar cmmm/monocle--previous-window-configuration nil | ||
| 244 | "Window configuration for restoring on monocle exit.") | ||
| 245 | (defun cmmm/toggle-monocle (arg) | ||
| 246 | "Make window occupy whole frame if there are many windows. Restore | ||
| 247 | previous window layout otherwise. With universal argument toggles | ||
| 248 | `global-olivetti-mode'." | ||
| 249 | (interactive "P") | ||
| 250 | |||
| 251 | (if arg | ||
| 252 | (if (and global-olivetti-mode global-hide-mode-line-mode) | ||
| 253 | (progn | ||
| 254 | (global-hide-mode-line-mode -1) | ||
| 255 | (global-olivetti-mode -1)) | ||
| 256 | (progn | ||
| 257 | (global-hide-mode-line-mode 1) | ||
| 258 | (global-olivetti-mode 1))) | ||
| 259 | (if (one-window-p) | ||
| 260 | (if cmmm/monocle--previous-window-configuration | ||
| 261 | (let ((cur-buffer (current-buffer))) | ||
| 262 | (set-window-configuration | ||
| 263 | cmmm/monocle--previous-window-configuration) | ||
| 264 | (setq cmmm/monocle--previous-window-configuration nil) | ||
| 265 | (switch-to-buffer cur-buffer))) | ||
| 266 | (setq cmmm/monocle--previous-window-configuration | ||
| 267 | (current-window-configuration)) | ||
| 268 | (delete-other-windows)))) | ||
| 269 | (define-key global-map (kbd "s-f") 'cmmm/toggle-monocle) | ||
| 270 | |||
| 271 | (use-package which-key | ||
| 272 | :config | ||
| 273 | (which-key-mode)) | ||
| 274 | |||
| 275 | (use-package keycast) | ||
| 276 | |||
| 277 | (use-package xref | ||
| 278 | :ensure nil | ||
| 279 | :config | ||
| 280 | (setq xref-search-program 'ripgrep)) | ||
| 281 | |||
| 282 | ;; https://coredumped.dev/2025/06/18/making-tramp-go-brrrr./ | ||
| 283 | (use-package tramp | ||
| 284 | :custom | ||
| 285 | (tramp-copy-size-limit (* 1024 1024)) ; 1MB | ||
| 286 | (tramp-use-scp-direct-remote-copying t) | ||
| 287 | (tramp-allow-unsafe-temporary-files t) | ||
| 288 | (tramp-file-name-with-method "doas") | ||
| 289 | (tramp-verbose 2) | ||
| 290 | (tramp-ssh-controlmaster-options | ||
| 291 | (concat "-o ControlPath=/tmp/ssh-ControlPath-%%r@%%h:%%p " | ||
| 292 | "-o ControlMaster=auto -o ControlPersist=yes")) | ||
| 293 | (tramp-use-connection-share nil) | ||
| 294 | :config | ||
| 295 | (connection-local-set-profile-variables | ||
| 296 | 'vps-profile | ||
| 297 | '((dired-listing-switches . "-Alh --full-time"))) | ||
| 298 | |||
| 299 | (connection-local-set-profiles | ||
| 300 | '(:application tramp :machine "vps") | ||
| 301 | 'vps-profile) | ||
| 302 | |||
| 303 | (connection-local-set-profile-variables | ||
| 304 | 'remote-profile | ||
| 305 | `((tramp-direct-async-process . t) | ||
| 306 | (vc-ignore-dir-regexp . ,(format "\\(%s\\)\\|\\(%s\\)" | ||
| 307 | vc-ignore-dir-regexp | ||
| 308 | tramp-file-name-regexp)))) | ||
| 309 | |||
| 310 | (connection-local-set-profiles | ||
| 311 | '(:application tramp :protocol "ssh") | ||
| 312 | 'remote-profile) | ||
| 313 | |||
| 314 | (with-eval-after-load 'compile | ||
| 315 | (remove-hook 'compilation-mode-hook #'tramp-compile-disable-ssh-controlmaster-options))) | ||
| 316 | |||
| 317 | (use-package vc-hooks | ||
| 318 | :ensure nil | ||
| 319 | :config | ||
| 320 | (setq vc-handled-backends '(Git))) | ||
| 321 | |||
| 322 | (use-package files | ||
| 323 | :ensure nil | ||
| 324 | :custom | ||
| 325 | (remote-file-name-inhibit-locks t) | ||
| 326 | (remote-file-name-inhibit-cache t) | ||
| 327 | (remote-file-name-inhibit-delete-by-moving-to-trash t)) | ||
| 328 | |||
| 329 | (use-package treesit | ||
| 330 | :ensure nil | ||
| 331 | :custom | ||
| 332 | (treesit-language-source-alist | ||
| 333 | '((c "https://github.com/tree-sitter/tree-sitter-c") | ||
| 334 | (cpp "https://github.com/tree-sitter/tree-sitter-cpp") | ||
| 335 | (json "https://github.com/tree-sitter/tree-sitter-json") | ||
| 336 | (cmake "https://github.com/uyha/tree-sitter-cmake") | ||
| 337 | (python "https://github.com/tree-sitter/tree-sitter-python"))) | ||
| 338 | (treesit-font-lock-level 4) | ||
| 339 | (add-to-list 'major-mode-remap-alist (c-mode . c-ts-mode)) | ||
| 340 | (add-to-list 'major-mode-remap-alist (c++-m ode . c++-ts-mode)) | ||
| 341 | (add-to-list 'major-mode-remap-alist (json- mode . json-ts-mode)) | ||
| 342 | (add-to-list 'major-mode-remap-alist (pytho n-mode . python-ts-mode)) | ||
| 343 | :hook | ||
| 344 | (c-ts-mode . c-ts-mode-toggle-comment-style)) | ||
| 345 | |||
| 346 | (use-package olivetti | ||
| 347 | :config | ||
| 348 | (add-hook 'org-mode-hook 'olivetti-mode) | ||
| 349 | (define-key cmmm/toggle-map (kbd "o") 'olivetti-mode) | ||
| 350 | (define-key cmmm/toggle-map (kbd "O") 'global-olivetti-mode)) | ||
| 351 | |||
| 352 | (use-package hide-mode-line | ||
| 353 | :config | ||
| 354 | (define-key cmmm/toggle-map (kbd "m") 'hide-mode-line-mode) | ||
| 355 | (define-key cmmm/toggle-map (kbd "M") 'global-hide-mode-line-mode)) | ||
| 356 | |||
| 357 | (use-package helpful | ||
| 358 | :custom | ||
| 359 | (help-window-select t) | ||
| 360 | :bind (:map help-map | ||
| 361 | ("o" . helpful-at-point)) | ||
| 362 | :init | ||
| 363 | (with-eval-after-load 'embark | ||
| 364 | (define-key embark-symbol-map (vector 'remap 'describe-symbol) 'helpful-symbol) | ||
| 365 | (let ((map embark-become-help-map)) | ||
| 366 | (define-key map (vector 'remap 'describe-function) 'helpful-callable) | ||
| 367 | (define-key map (vector 'remap 'describe-variable) 'helpful-variable) | ||
| 368 | (define-key map (vector 'remap 'describe-symbol) 'helpful-symbol) | ||
| 369 | (define-key map (vector 'remap 'describe-command) 'helpful-command))) | ||
| 370 | (add-hook 'helpful-mode-hook 'visual-line-mode) | ||
| 371 | (let ((map global-map)) | ||
| 372 | (define-key map (vector 'remap 'describe-function ) 'helpful-callable) | ||
| 373 | (define-key map (vector 'remap 'describe-variable ) 'helpful-variable) | ||
| 374 | (define-key map (vector 'remap 'describe-key ) 'helpful-key ) | ||
| 375 | (define-key map (vector 'remap 'describe-command ) 'helpful-command ) | ||
| 376 | (define-key map (vector 'Info-goto-emacs-command-node) 'helpful-function))) | ||
| 377 | |||
| 378 | (use-package lorem-ipsum) | ||
| 379 | |||
| 380 | (use-package crontab-mode) | ||
| 381 | (defun cmmm/crontab-e () | ||
| 382 | "Run `crontab -e' in a emacs buffer." | ||
| 383 | (interactive) | ||
| 384 | (with-editor-async-shell-command "crontab -e" nil nil "VISUAL")) | ||
| 385 | (define-key cmmm/application-map (kbd "c") 'cmmm/crontab-e) | ||
| 386 | |||
| 387 | (add-hook 'comint-preoutput-filter-functions 'ansi-color-apply nil t) | ||
| 388 | |||
| 389 | (use-package dashboard | ||
| 390 | :custom (dashboard-center-content t) | ||
| 391 | :config | ||
| 392 | (add-hook 'elpaca-after-init-hook #'dashboard-insert-startupify-lists) | ||
| 393 | (add-hook 'elpaca-after-init-hook #'dashboard-initialize) | ||
| 394 | (dashboard-setup-startup-hook)) | ||
| 395 | |||
| 396 | (unload-feature 'eldoc t) | ||
| 397 | (setq custom-delayed-init-variables '()) | ||
| 398 | (defvar global-eldoc-mode nil) | ||
| 399 | (elpaca eldoc | ||
| 400 | (require 'eldoc) | ||
| 401 | (global-eldoc-mode)) | ||
| 402 | (use-package flymake | ||
| 403 | :after (eldoc)) | ||
| 404 | (use-package jsonrpc) | ||
| 405 | (use-package eglot | ||
| 406 | :after (eldoc) | ||
| 407 | :config | ||
| 408 | (defun cmmm/eglot-dissable-features () | ||
| 409 | (eglot-inlay-hints-mode -1) | ||
| 410 | (flymake-mode -1)) | ||
| 411 | :hook | ||
| 412 | (eglot-managed-mode . cmmm/eglot-dissable-features) | ||
| 413 | (c-mode . eglot-ensure) | ||
| 414 | (c++-mode . eglot-ensure)) | ||
| 415 | |||
| 416 | (use-package orderless | ||
| 417 | :init | ||
| 418 | (setq orderless-component-separator | ||
| 419 | #'orderless-escapable-split-on-space) | ||
| 420 | :custom | ||
| 421 | (completion-styles '(orderless basic)) | ||
| 422 | (completion-category-defaults nil) | ||
| 423 | (completion-category-overrides '((file (styles partial-completion))))) | ||
| 424 | |||
| 425 | (use-package simple-modeline | ||
| 426 | :init | ||
| 427 | (defun cmmm/move-modeline-to-header () | ||
| 428 | (setq-default header-line-format mode-line-format) | ||
| 429 | (setq-default mode-line-format nil)) | ||
| 430 | (defun cmmm/simple-modeline-segment-spacer () | ||
| 431 | " ") | ||
| 432 | :custom | ||
| 433 | (simple-modeline-segments '((simple-modeline-segment-modified | ||
| 434 | simple-modeline-segment-buffer-name | ||
| 435 | cmmm/simple-modeline-segment-spacer | ||
| 436 | simple-modeline-segment-major-mode | ||
| 437 | cmmm/simple-modeline-segment-spacer | ||
| 438 | simple-modeline-segment-position) | ||
| 439 | (simple-modeline-segment-input-method | ||
| 440 | simple-modeline-segment-vc | ||
| 441 | simple-modeline-segment-misc-info | ||
| 442 | simple-modeline-segment-process))) | ||
| 443 | :hook | ||
| 444 | (after-init . simple-modeline-mode) | ||
| 445 | (simple-modeline-mode . cmmm/move-modeline-to-header)) | ||
| 446 | |||
| 447 | (use-package marginalia | ||
| 448 | :config | ||
| 449 | (marginalia-mode)) | ||
| 450 | |||
| 451 | (use-package vertico | ||
| 452 | :init | ||
| 453 | (vertico-mode) | ||
| 454 | ;; (setq vertico-scroll-margin 0) | ||
| 455 | ;; (setq vertico-count 20) | ||
| 456 | ;; (setq vertico-resize t) | ||
| 457 | (vertico-multiform-mode) | ||
| 458 | :bind | ||
| 459 | (:map vertico-map | ||
| 460 | ("M-?" . minibuffer-completion-help) | ||
| 461 | ("M-RET" . minibuffer-force-complete-and-exit) | ||
| 462 | ("M-TAB" . minibuffer-complete)) | ||
| 463 | |||
| 464 | :custom | ||
| 465 | (vertico-cycle t) | ||
| 466 | (vertico-multiform-categories | ||
| 467 | '((consult-grep buffer) | ||
| 468 | (imenu buffer) | ||
| 469 | (buffer) | ||
| 470 | ;; (file buffer) | ||
| 471 | ;; (project-file buffer) | ||
| 472 | (info-menu buffer) | ||
| 473 | (consult-org-heading buffer) | ||
| 474 | (consult-history buffer) | ||
| 475 | (consult-lsp-symbols buffer) | ||
| 476 | (consult-xref buffer) | ||
| 477 | (embark-keybinding buffer) | ||
| 478 | (consult-location buffer))) | ||
| 479 | (vertico-multiform-commands | ||
| 480 | '((telega-chat-with buffer) | ||
| 481 | (magit:--author flat) | ||
| 482 | ;; For some reason it doesn't have an info-menu | ||
| 483 | ;; category and also setting | ||
| 484 | ;; marginalia-command-categories doesn't help | ||
| 485 | ;; (org-roam-node-find buffer) | ||
| 486 | (Info-goto-node buffer) | ||
| 487 | (info-lookup-symbol buffer) | ||
| 488 | (Info-follow-reference buffer) | ||
| 489 | (consult-yank-pop buffer))) | ||
| 490 | :bind | ||
| 491 | (("s-s" . vertico-repeat)) | ||
| 492 | :hook | ||
| 493 | (minibuffer-setup . vertico-repeat-save) | ||
| 494 | :config | ||
| 495 | (advice-add | ||
| 496 | 'vertico--format-candidate :around | ||
| 497 | (lambda (orig cand prefix suffix index _start) | ||
| 498 | (let ((cand (funcall orig cand prefix suffix index _start))) | ||
| 499 | (concat | ||
| 500 | (if (= vertico--index index) | ||
| 501 | (propertize "» " 'face 'vertico-current) | ||
| 502 | " ") | ||
| 503 | cand)))) | ||
| 504 | |||
| 505 | ;; TODO(cmmm): add monocle support | ||
| 506 | |||
| 507 | (with-eval-after-load | ||
| 508 | 'minibuffer | ||
| 509 | (setq completion-in-region-function 'consult-completion-in-region))) | ||
| 510 | |||
| 511 | (use-package consult | ||
| 512 | :init | ||
| 513 | (require 'em-hist) | ||
| 514 | :bind | ||
| 515 | (;; C-c bindings in `mode-specific-map' | ||
| 516 | ("C-c M-x" . consult-mode-command) | ||
| 517 | ("C-c h" . consult-history) | ||
| 518 | ("C-c k" . consult-kmacro) | ||
| 519 | ("C-c m" . consult-man) | ||
| 520 | ("C-c i" . consult-info) | ||
| 521 | ([remap Info-search] . consult-info) | ||
| 522 | ;; C-x bindings in `ctl-x-map' | ||
| 523 | ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command | ||
| 524 | ("C-x b" . consult-buffer) ;; orig. switch-to-buffer | ||
| 525 | ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window | ||
| 526 | ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame | ||
| 527 | ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump | ||
| 528 | ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer | ||
| 529 | ;; Custom M-# bindings for fast register access | ||
| 530 | ("M-#" . consult-register-load) | ||
| 531 | ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated) | ||
| 532 | ("C-M-#" . consult-register) | ||
| 533 | ;; Other custom bindings | ||
| 534 | ("M-y" . consult-yank-pop) ;; orig. yank-pop | ||
| 535 | ;; M-g bindings in `goto-map' | ||
| 536 | ("M-g e" . consult-compile-error) | ||
| 537 | ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck | ||
| 538 | ("M-g g" . consult-goto-line) ;; orig. goto-line | ||
| 539 | ("M-g M-g" . consult-goto-line) ;; orig. goto-line | ||
| 540 | ("M-g o" . consult-outline) ;; Alternative: consult-org-heading | ||
| 541 | ("M-g m" . consult-mark) | ||
| 542 | ("M-g k" . consult-global-mark) | ||
| 543 | ("M-g i" . consult-imenu) | ||
| 544 | ("M-g I" . consult-imenu-multi) | ||
| 545 | ;; M-s bindings in `search-map' | ||
| 546 | ("M-s d" . consult-find) ;; Alternative: consult-fd | ||
| 547 | ("M-s D" . consult-locate) | ||
| 548 | ("M-s g" . consult-grep) | ||
| 549 | ("M-s G" . consult-git-grep) | ||
| 550 | ("M-s r" . consult-ripgrep) | ||
| 551 | ("M-s l" . consult-line) | ||
| 552 | ("M-s L" . consult-line-multi) | ||
| 553 | ("M-s k" . consult-keep-lines) | ||
| 554 | ("M-s u" . consult-focus-lines) | ||
| 555 | ;; Isearch integration | ||
| 556 | ("M-s e" . consult-isearch-history) | ||
| 557 | :map isearch-mode-map | ||
| 558 | ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string | ||
| 559 | ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string | ||
| 560 | ("M-s l" . consult-line) ;; needed by consult-line to detect isearch | ||
| 561 | ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch | ||
| 562 | ;; Minibuffer history | ||
| 563 | :map minibuffer-local-map | ||
| 564 | ("M-s" . consult-history) ;; orig. next-matching-history-element | ||
| 565 | ("M-r" . consult-history) ;; orig. previous-matching-history-element | ||
| 566 | :map eshell-hist-mode-map | ||
| 567 | ("M-r" . consult-history)) | ||
| 568 | |||
| 569 | ;; Enable automatic preview at point in the *Completions* buffer. This is | ||
| 570 | ;; relevant when you use the default completion UI. | ||
| 571 | :hook (completion-list-mode . consult-preview-at-point-mode) | ||
| 572 | :init | ||
| 573 | ;; Optionally configure the register formatting. This improves the register | ||
| 574 | ;; preview for `consult-register', `consult-register-load', | ||
| 575 | ;; `consult-register-store' and the Emacs built-ins. | ||
| 576 | (setq register-preview-delay 0.5 | ||
| 577 | register-preview-function #'consult-register-format) | ||
| 578 | |||
| 579 | ;; Optionally tweak the register preview window. | ||
| 580 | ;; This adds thin lines, sorting and hides the mode line of the window. | ||
| 581 | (advice-add #'register-preview :override #'consult-register-window) | ||
| 582 | |||
| 583 | ;; Use Consult to select xref locations with preview | ||
| 584 | (setq xref-show-xrefs-function #'consult-xref | ||
| 585 | xref-show-definitions-function #'consult-xref) | ||
| 586 | |||
| 587 | ;; Configure other variables and modes in the :config section, | ||
| 588 | ;; after lazily loading the package. | ||
| 589 | :config | ||
| 590 | |||
| 591 | ;; Optionally configure preview. The default value | ||
| 592 | ;; is 'any, such that any key triggers the preview. | ||
| 593 | ;; (setq consult-preview-key 'any) | ||
| 594 | ;; (setq consult-preview-key "M-.") | ||
| 595 | ;; (setq consult-preview-key '("S-<down>" "S-<up>")) | ||
| 596 | ;; For some commands and buffer sources it is useful to configure the | ||
| 597 | ;; :preview-key on a per-command basis using the `consult-customize' macro. | ||
| 598 | (consult-customize | ||
| 599 | consult-theme :preview-key '(:debounce 0.2 any) | ||
| 600 | consult-ripgrep consult-git-grep consult-grep | ||
| 601 | consult-bookmark consult-recent-file consult-xref | ||
| 602 | ;; :preview-key "M-." | ||
| 603 | :preview-key '(:debounce 0.4 any)) | ||
| 604 | |||
| 605 | ;; Optionally configure the narrowing key. | ||
| 606 | ;; Both < and C-+ work reasonably well. | ||
| 607 | (setq consult-narrow-key "<") ;; "C-+" | ||
| 608 | |||
| 609 | ;; Optionally make narrowing help available in the minibuffer. | ||
| 610 | ;; You may want to use `embark-prefix-help-command' or which-key instead. | ||
| 611 | ;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help) | ||
| 612 | ) | ||
| 613 | |||
| 614 | (use-package corfu | ||
| 615 | :custom | ||
| 616 | (corfu-min-width 60) | ||
| 617 | (corfu-cycle t) ;; Enable cycling for `corfu-next/previous' | ||
| 618 | (corfu-auto t) ;; Enable auto completion | ||
| 619 | (corfu-separator ?\s) ;; Orderless field separator | ||
| 620 | (corfu-preview-current nil) ;; Disable current candidate preview | ||
| 621 | (corfu-preselect 'prompt) ;; Preselect the prompt | ||
| 622 | (corfu-scroll-margin 2) ;; Use scroll margin | ||
| 623 | :init | ||
| 624 | (global-corfu-mode) | ||
| 625 | (corfu-echo-mode) | ||
| 626 | (corfu-history-mode) | ||
| 627 | :bind | ||
| 628 | (:map corfu-map | ||
| 629 | ("M-SPC" . corfu-insert-separator))) | ||
| 630 | |||
| 631 | ;; cloning failed -- busy | ||
| 632 | ;; (use-package corfu-candidate-overylay) | ||
| 633 | |||
| 634 | (use-package detached | ||
| 635 | :init | ||
| 636 | (detached-init) | ||
| 637 | :bind | ||
| 638 | (;; Replace `async-shell-command' with `detached-shell-command' | ||
| 639 | ([remap async-shell-command] . detached-shell-command) | ||
| 640 | ;; Replace `compile' with `detached-compile' | ||
| 641 | ;; For recompile buffer has to have session... bad | ||
| 642 | ;; ([remap compile] . detached-compile) | ||
| 643 | ;; ([remap recompile] . detached-compile-recompile) | ||
| 644 | ;; Replace built in completion of sessions with `consult' | ||
| 645 | ([remap detached-open-session] . detached-consult-session)) | ||
| 646 | :custom | ||
| 647 | (detached-init-block-list '(nano-modeline projectile)) | ||
| 648 | (detached-show-output-on-attach t) | ||
| 649 | (detached-terminal-data-command system-type) | ||
| 650 | (detached-metadata-annotators-alist '((branch . detached--metadata-git-branch))) | ||
| 651 | (detached-degraded-commands '("^ls "))) | ||
| 652 | |||
| 653 | (use-package simple | ||
| 654 | :ensure nil | ||
| 655 | :custom | ||
| 656 | (display-fill-column-indicator-column 79) | ||
| 657 | :config | ||
| 658 | (indent-tabs-mode -1) | ||
| 659 | :hook | ||
| 660 | (prog-mode . display-fill-column-indicator-mode)) | ||
| 661 | |||
| 662 | (use-package copyright | ||
| 663 | :ensure nil | ||
| 664 | :config | ||
| 665 | (setq copyright-names-regexp | ||
| 666 | (format "%s <%s>" user-full-name user-mail-address)) | ||
| 667 | (add-hook 'after-save-hook (lambda () (copyright-update nil nil)))) | ||
| 668 | |||
| 669 | (use-package flyspell | ||
| 670 | :ensure nil | ||
| 671 | :config | ||
| 672 | (defun cmmm/flyspell-on-for-buffer-type | ||
| 673 | () | ||
| 674 | "Enable Flyspell appropriately for the major mode of the current\nbuffer. Uses `flyspell-prog-mode' for modes derived from `prog-mode',\nso only strings and comments get checked. All other buffers get\n`flyspell-mode' to check all text. If flyspell is already enabled,\ndoes nothing." | ||
| 675 | (if (not (symbol-value flyspell-mode)) | ||
| 676 | (progn (if (derived-mode-p 'prog-mode) | ||
| 677 | (progn (message "Flyspell on (code)") (flyspell-prog-mode)) | ||
| 678 | (progn (message "Flyspell on (text)") | ||
| 679 | (flyspell-mode 1)))))) | ||
| 680 | (defun cmmm/flyspell-toggle | ||
| 681 | () | ||
| 682 | "Turn Flyspell on if it is off, or off if it is on. When turning\non, it uses `flyspell-on-for-buffer-type' so code-vs-text is\nhandled appropriately." | ||
| 683 | (interactive) | ||
| 684 | (if (symbol-value flyspell-mode) | ||
| 685 | (progn (message "Flyspell off") (flyspell-mode -1)) | ||
| 686 | (cmmm/flyspell-on-for-buffer-type))) | ||
| 687 | (setq flyspell-consider-dash-as-word-delimiter-flag t) | ||
| 688 | (define-key global-map (kbd "C-c x s") 'cmmm/flyspell-toggle) | ||
| 689 | (add-hook 'telega-chat-mode-hook 'cmmm/flyspell-on-for-buffer-type) | ||
| 690 | (add-hook 'text-mode-hook 'cmmm/flyspell-on-for-buffer-type) | ||
| 691 | (add-hook 'prog-mode-hook 'cmmm/flyspell-on-for-buffer-type)) | ||
| 692 | |||
| 693 | (use-package embark | ||
| 694 | :bind | ||
| 695 | (("s-." . embark-act) | ||
| 696 | ("s->" . embark-become) | ||
| 697 | :map embark-general-map | ||
| 698 | ("R n" . eglot-rename) | ||
| 699 | ("R g" . rg-project))) | ||
| 700 | (use-package embark-consult) | ||
| 701 | |||
| 702 | (setq nobreak-char-display nil) | ||
| 703 | |||
| 704 | (use-package trashed | ||
| 705 | :custom | ||
| 706 | (delete-by-moving-to-trash t)) | ||
| 707 | |||
| 708 | (use-package page-break-lines | ||
| 709 | :custom | ||
| 710 | (page-break-lines-modes '(prog-mode conf-mode | ||
| 711 | compilation-mode outline-mode help-mode)) | ||
| 712 | :config | ||
| 713 | (global-page-break-lines-mode)) | ||
| 714 | |||
| 715 | (use-package pdf-tools | ||
| 716 | :demand t | ||
| 717 | :hook (pdf-view-mode . pdf-view-themed-minor-mode) | ||
| 718 | :custom | ||
| 719 | ;; Enable seamless scrolling between pages | ||
| 720 | (pdf-view-continuous-scroll-mode t) | ||
| 721 | ;; Use normal Emacs keybindings for scrolling | ||
| 722 | (pdf-view-continuous-scroll-keystrokes nil) | ||
| 723 | (pdf-view-display-size 'fit-page) | ||
| 724 | (pdf-view-use-scaling t) | ||
| 725 | (pdf-view-resize-factor 1.025) | ||
| 726 | :config | ||
| 727 | ;; Initialize the package | ||
| 728 | (pdf-tools-install) | ||
| 729 | ;; Associate pdf-view-mode with PDF files | ||
| 730 | (add-to-list 'auto-mode-alist '("\\.[pP][dD][fF]\\'" . pdf-view-mode)) | ||
| 731 | (add-to-list 'magic-mode-alist '("%PDF" . pdf-view-mode)) | ||
| 732 | (with-eval-after-load 'saveplace | ||
| 733 | (require 'saveplace-pdf-view))) | ||
| 734 | |||
| 735 | (use-package nov | ||
| 736 | :custom | ||
| 737 | (nov-text-width t) | ||
| 738 | :config | ||
| 739 | (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)) | ||
| 740 | (require 'justify-kp) | ||
| 741 | (defun cmmm/nov-window-configuration-change-hook () | ||
| 742 | (cmmm/nov-post-html-render-hook) | ||
| 743 | (remove-hook 'window-configuration-change-hook | ||
| 744 | 'cmmm/nov-window-configuration-change-hook | ||
| 745 | t)) | ||
| 746 | (defun cmmm/nov-post-html-render-hook () | ||
| 747 | (if (get-buffer-window) | ||
| 748 | (let ((max-width (pj-line-width)) | ||
| 749 | buffer-read-only) | ||
| 750 | (save-excursion | ||
| 751 | (goto-char (point-min)) | ||
| 752 | (while (not (eobp)) | ||
| 753 | (when (not (looking-at "^[[:space:]]*$")) | ||
| 754 | (goto-char (line-end-position)) | ||
| 755 | (when (> (shr-pixel-column) max-width) | ||
| 756 | (goto-char (line-beginning-position)) | ||
| 757 | (pj-justify))) | ||
| 758 | (forward-line 1)))) | ||
| 759 | (add-hook 'window-configuration-change-hook | ||
| 760 | 'cmmm/nov-window-configuration-change-hook | ||
| 761 | nil t))) | ||
| 762 | :hook | ||
| 763 | (nov-mode . olivetti-mode) | ||
| 764 | (nov-post-html-render-hook . cmmm/nov-post-html-render-hook)) | ||
| 765 | |||
| 766 | (use-package vterm) | ||
| 767 | (use-package eat) | ||
| 768 | |||
| 769 | (use-package telega | ||
| 770 | :custom | ||
| 771 | (telega-server-libs-prefix "/usr") | ||
| 772 | (telega-chat-fill-column 70) | ||
| 773 | (telega-open-file-function 'embark-open-externally) | ||
| 774 | (telega-open-message-as-file '(video audio voice-note animation video-note)) | ||
| 775 | :config | ||
| 776 | (defun cmmm/telega-chatbuf-attach-markdown2 () | ||
| 777 | (interactive) | ||
| 778 | (telega-chatbuf-attach-markup "markdown2")) | ||
| 779 | :bind | ||
| 780 | (:map cmmm/application-map | ||
| 781 | ("t" . telega) | ||
| 782 | :map telega-root-mode-map | ||
| 783 | ("s-B" . telega-chat-with) | ||
| 784 | :map telega-chat-mode-map | ||
| 785 | ("s-B" . telega-chat-with) | ||
| 786 | ("C-c C-m" . cmmm/telega-chatbut-attach-markdown2)) | ||
| 787 | :hook (telega-load-hook . telega-notifications-mode)) | ||
| 788 | |||
| 789 | (use-package highlight-doxygen | ||
| 790 | :config | ||
| 791 | (highlight-doxygen-global-mode) | ||
| 792 | (set-face-background 'highlight-doxygen-comment nil)) | ||
| 793 | |||
| 794 | (setq ispell-program-name "aspell") | ||
| 795 | (defun cmmm/ispell-change-dictionary-input-method | ||
| 796 | () | ||
| 797 | (ispell-change-dictionary | ||
| 798 | (pcase current-input-method-title | ||
| 799 | ("RU" "ru-yeyo") | ||
| 800 | ("SK" "sk")))) | ||
| 801 | (add-hook | ||
| 802 | 'input-method-activate-hook | ||
| 803 | 'cmmm/ispell-change-dictionary-input-method) | ||
| 804 | (add-hook | ||
| 805 | 'input-method-deactivate-hook | ||
| 806 | 'cmmm/ispell-change-dictionary-input-method) | ||
| 807 | ;; (defun cmmm/sync-cursor-color () | ||
| 808 | ;; (set-cursor-color (if current-input-method "orange" "white"))) | ||
| 809 | ;; (add-hook 'post-command-hook 'cmmm/sync-cursor-color) | ||
| 810 | |||
| 811 | (use-package multiple-cursors | ||
| 812 | :bind | ||
| 813 | (("C-S-c" . mc/edit-lines) | ||
| 814 | ("C->" . mc/mark-next-like-this) | ||
| 815 | ("C-<" . mc/mark-previous-like-this) | ||
| 816 | ("C-c C-S-c" . mc/mark-all-like-this) | ||
| 817 | ("C-\"" . mc/skip-to-next-like-this) | ||
| 818 | ("C-:" . mc/skip-to-previous-like-this))) | ||
| 819 | |||
| 820 | (use-package expand-region | ||
| 821 | :bind | ||
| 822 | (("C-=" . er/expand-region))) | ||
| 823 | |||
| 824 | (use-package move-text | ||
| 825 | :config | ||
| 826 | (define-key global-map (kbd "M-P") 'move-text-up) | ||
| 827 | (define-key global-map (kbd "M-N") 'move-text-down)) | ||
| 828 | (define-key global-map (kbd "C-'") 'duplicate-dwim) | ||
| 829 | (setq duplicate-line-final-position 1) | ||
| 830 | |||
| 831 | (use-package hl-todo | ||
| 832 | :config | ||
| 833 | (global-hl-todo-mode 1)) | ||
| 834 | |||
| 835 | (use-package ligature | ||
| 836 | :config | ||
| 837 | (ligature-set-ligatures | ||
| 838 | 't '("-<<" "-<" "-<-" "<--" "<---" "<<-" "<-" "->" "->>" "-->" "--->" "->-" ">-" ">>-" | ||
| 839 | "=<<" "=<" "=<=" "<==" "<===" "<<=" "<=" "=>" "=>>" "==>" "===>" "=>=" ">=" ">>=" | ||
| 840 | "<->" "<-->" "<--->" "<---->" "<=>" "<==>" "<===>" "<====>" "::" ":::" "__" | ||
| 841 | "<~~" "</" "</>" "/>" "~~>" "==" "!=" "/=" "~=" "<>" "===" "!==" "!===" "=/=" "=!=" | ||
| 842 | "<:" ":=" "*=" "*+" "<*" "<*>" "*>" "<|" "<|>" "|>" "<." "<.>" ".>" "+*" "=*" "=:" ":>" | ||
| 843 | "(*" "*)" "/*" "*/" "[|" "|]" "{|" "|}" "++" "+++" "\\/" "/\\" "|-" "-|" "<!--" "<!---")) | ||
| 844 | (global-ligature-mode -1)) | ||
| 845 | |||
| 846 | (use-package bluetooth) | ||
| 847 | (use-package iwd-manager | ||
| 848 | :bind | ||
| 849 | (:map iwd-manager-mode-map | ||
| 850 | ("s" . iwd-manager-scan) | ||
| 851 | ("f" . iwd-manager-delete-network) | ||
| 852 | ("c" . iwd-manager-connect) | ||
| 853 | ("d" . iwd-manager-disconnect))) | ||
| 854 | |||
| 855 | (with-eval-after-load | ||
| 856 | 'org | ||
| 857 | (setq org-agenda-include-diary t) | ||
| 858 | (setq org-agenda-hide-tags-regexp "agenda") | ||
| 859 | (defun cmmm/refresh-org-agenda-files | ||
| 860 | () | ||
| 861 | "Refresh org agenda files." | ||
| 862 | (interactive) | ||
| 863 | (setq org-agenda-files | ||
| 864 | (butlast | ||
| 865 | (split-string | ||
| 866 | (shell-command-to-string | ||
| 867 | (string-join | ||
| 868 | '("find ~/documents/ -type f -name ORG" | ||
| 869 | "-or -name '*.org' -and -not -name '.*'" | ||
| 870 | "| xargs -d'\n' grep -li '^#+FILETAGS:.*agenda'") | ||
| 871 | " ")) | ||
| 872 | "\n")))) | ||
| 873 | (cmmm/refresh-org-agenda-files)) | ||
| 874 | (setq consult-find-args "find .") | ||
| 875 | (setq consult-ripgrep-args | ||
| 876 | "rg --null --line-buffered --color=never --max-columns=1000 --path-separator / --smart-case --no-heading --with-filename --line-number --search-zip --unrestricted --follow") | ||
| 877 | ;; (ligature-set-ligatures 't '("-<<" "-<" "-<-" "<--" "<---" "<<-" "<-" "->" "->>" "-->" "--->" "->-" ">-" ">>-" "=<<" "=<" "=<=" "<==" "<===" "<<=" "<=" "=>" "=>>" "==>" "===>" "=>=" ">=" ">>=" "<->" "<-->" "<--->" "<---->" "<=>" "<==>" "<===>" "<====>" "::" ":::" "__" "<~~" "</" "</>" "/>" "~~>" "==" "!=" "/=" "~=" "<>" "===" "!==" "!===" "=/=" "=!=" "<:" ":=" "*=" "*+" "<*" "<*>" "*>" "<|" "<|>" "|>" "<." "<.>" ".>" "+*" "=*" "=:" ":>" "(*" "*)" "/*" "*/" "[|" "|]" "{|" "|}" "++" "+++" "\\/" "/\\" "|-" "-|" "<!--" "<!---")) | ||
| 878 | (with-eval-after-load 'org (setq org-image-actual-width nil)) | ||
| 879 | (setq browse-url-browser-function | ||
| 880 | 'eww-browse-url | ||
| 881 | shr-use-fonts | ||
| 882 | nil | ||
| 883 | shr-use-colors | ||
| 884 | nil | ||
| 885 | shr-width | ||
| 886 | 70) | ||
| 887 | (repeat-mode 1) | ||
| 888 | |||
| 889 | ;; (global-hl-todo-mode 1) | ||
| 890 | |||
| 891 | ;; (set-face-attribute | ||
| 892 | ;; 'page-break-lines | ||
| 893 | ;; nil | ||
| 894 | ;; :foreground | ||
| 895 | ;; 'unspecified | ||
| 896 | ;; :inherit | ||
| 897 | ;; 'font-lock-comment-face) | ||
| 898 | ;; (setq page-break-lines-modes | ||
| 899 | ;; '(text-mode fundemental-mode prog-mode special-mode conf-mode)) | ||
| 900 | ;; (global-page-break-lines-mode) | ||
| 901 | |||
| 902 | (defun cmmm/find-proxy-for-url | ||
| 903 | (url host) | ||
| 904 | (let ((ipv4 (dns-query host 'A)) (ipv6 (dns-query host 'AAAA))) | ||
| 905 | (cond ((or (equal ipv4 "127.0.0.1") | ||
| 906 | (equal ipv6 "::1") | ||
| 907 | (and ipv6 | ||
| 908 | (eq 3 (string-search ":" ipv6)) | ||
| 909 | (or (string-prefix-p "2" ipv6) | ||
| 910 | (string-prefix-p "3" ipv6))) | ||
| 911 | (and (assoc "no_proxy" url-proxy-services) | ||
| 912 | (string-match | ||
| 913 | (cdr (assoc "no_proxy" url-proxy-services)) | ||
| 914 | host))) | ||
| 915 | "DIRECT") | ||
| 916 | ((string-suffix-p ".i2p" host) "PROXY 127.0.0.1:4444") | ||
| 917 | ((string-suffix-p ".onion" host) "PROXY 127.0.0.1:9052") | ||
| 918 | (t "PROXY 324:71e:281a:9ed3::fa11:3128")))) | ||
| 919 | (setq url-proxy-services | ||
| 920 | '(("no_proxy" . "^\\(.*\\.\\)?michalec.dev$")) | ||
| 921 | url-privacy-level | ||
| 922 | 'paranoid | ||
| 923 | url-proxy-locator | ||
| 924 | 'cmmm/find-proxy-for-url) | ||
| 925 | (c-add-style | ||
| 926 | "cosmos" | ||
| 927 | '((c-basic-offset . 2) | ||
| 928 | (indent-tabs-mode . nil) | ||
| 929 | (c-backslash-column . 0) | ||
| 930 | (c-backslash-max-column . 79) | ||
| 931 | (c-doc-comment-style . doxygen) | ||
| 932 | (comment-style . extra-line) | ||
| 933 | (c-tab-always-indent . t) | ||
| 934 | (c-comment-only-line-offset . 0) | ||
| 935 | (c-electric-pound-behavior alignleft) | ||
| 936 | (c-cleanup-list brace-else-brace brace-elseif-brace defun-close-semi) | ||
| 937 | (c-offsets-alist | ||
| 938 | (substatement-open . 0) | ||
| 939 | (func-decl-cont . 0) | ||
| 940 | (topmost-intro-cont . 0) | ||
| 941 | (inline-open . +) | ||
| 942 | (block-open . 0) | ||
| 943 | (brace-list-entry . c-lineup-2nd-brace-entry-in-arglist) | ||
| 944 | (statement-cont c-lineup-ternary-bodies c-lineup-string-cont +) | ||
| 945 | (case-label . +) | ||
| 946 | (statement-case-intro . +) | ||
| 947 | (label . 0) | ||
| 948 | (defun-block-intro . +) | ||
| 949 | (substatement-open . 0) | ||
| 950 | (inline-open . 0) | ||
| 951 | (arglist-cont | ||
| 952 | c-lineup-ternary-bodies | ||
| 953 | c-lineup-argcont | ||
| 954 | c-lineup-arglist-operators) | ||
| 955 | (arglist-cont-nonempty | ||
| 956 | c-lineup-ternary-bodies | ||
| 957 | c-lineup-argcont | ||
| 958 | c-lineup-arglist | ||
| 959 | c-lineup-arglist-operators) | ||
| 960 | (arglist-close . 0) | ||
| 961 | (comment-intro . 0)))) | ||
| 962 | (setq c-default-style "cosmos") | ||
| 963 | (defun cmmm/c-initialization | ||
| 964 | () | ||
| 965 | (keymap-set c-mode-base-map "C-m" 'c-context-line-break)) | ||
| 966 | (add-hook 'c-initialization-hook 'cmmm/c-initialization) | ||
| 967 | (defun cmmm/c-mode-common | ||
| 968 | () | ||
| 969 | (face-remap-add-relative 'font-lock-variable-name-face 'default) | ||
| 970 | (face-remap-add-relative 'font-lock-function-name-face 'default) | ||
| 971 | (c-toggle-comment-style -1) | ||
| 972 | (subword-mode 1)) | ||
| 973 | (add-hook 'c-mode-common-hook 'cmmm/c-mode-common) | ||
| 974 | ;; (global-prettify-symbols-mode 1) | ||
| 975 | |||
| 976 | (add-to-list 'auto-mode-alist '("\\.info\\'" . Info-on-current-buffer)) | ||
| 977 | |||
| 978 | (use-package hideshow | ||
| 979 | :ensure nil | ||
| 980 | :config | ||
| 981 | (add-hook 'prog-mode-hook 'hs-minor-mode) | ||
| 982 | (define-key hs-minor-mode-map (kbd "C-c h s") 'hs-show-block) | ||
| 983 | (define-key hs-minor-mode-map (kbd "C-c h h") 'hs-hide-block) | ||
| 984 | (define-key hs-minor-mode-map (kbd "C-c h S") 'hs-show-all) | ||
| 985 | (define-key hs-minor-mode-map (kbd "C-c h H") 'hs-hide-all)) | ||
| 986 | |||
| 987 | (with-eval-after-load 'info+ (setq Info-fontify-emphasis-flag nil)) | ||
| 988 | (with-eval-after-load | ||
| 989 | 'info-look | ||
| 990 | (setq info-lookup-cache nil) | ||
| 991 | (info-lookup-add-help | ||
| 992 | :topic | ||
| 993 | 'symbol | ||
| 994 | :mode | ||
| 995 | 'c-mode | ||
| 996 | :regexp | ||
| 997 | (info-lookup->regexp 'symbol 'c-mode) | ||
| 998 | :doc-spec | ||
| 999 | (append | ||
| 1000 | (info-lookup->doc-spec 'symbol 'c-mode) | ||
| 1001 | '(("(mpfr)Function and Type Index" | ||
| 1002 | nil | ||
| 1003 | "^[ \t]+-+ \\(Function\\|Macro\\): .*\\<" | ||
| 1004 | "\\>") | ||
| 1005 | ("(gmp)Function Index" | ||
| 1006 | nil | ||
| 1007 | "^[ \t]+-+ \\(Function\\|Macro\\): .*\\<" | ||
| 1008 | "\\>") | ||
| 1009 | ("(gsl-ref)Index" | ||
| 1010 | nil | ||
| 1011 | "^[ \t]+-+ \\(Function\\|Macro\\|Variable\\): .*\\<" | ||
| 1012 | "\\>") | ||
| 1013 | ("(gcc)Concept and Symbol Index" | ||
| 1014 | nil | ||
| 1015 | "^[ \t]+-+ \\(Built-in Function\\): .*\\<" | ||
| 1016 | "\\>"))) | ||
| 1017 | :parse-rule | ||
| 1018 | (info-lookup->parse-rule 'symbol 'c-mode)) | ||
| 1019 | (info-lookup-maybe-add-help | ||
| 1020 | :topic | ||
| 1021 | 'symbol | ||
| 1022 | :mode | ||
| 1023 | 'c-ts-mode | ||
| 1024 | :regexp | ||
| 1025 | (info-lookup->regexp 'symbol 'c-mode) | ||
| 1026 | :parse-rule | ||
| 1027 | (info-lookup->parse-rule 'symbol 'c-mode) | ||
| 1028 | :other-modes | ||
| 1029 | '(c-mode))) | ||
| 1030 | (setq xref-search-program 'ripgrep) | ||
| 1031 | |||
| 1032 | (auto-insert-mode t) | ||
| 1033 | (setf (alist-get | ||
| 1034 | '("\\.\\([Hh]\\|hh\\|hpp\\|hxx\\|h\\+\\+\\)\\'" . "C / C++ header") | ||
| 1035 | auto-insert-alist | ||
| 1036 | nil | ||
| 1037 | nil | ||
| 1038 | 'equal) | ||
| 1039 | '((concat | ||
| 1040 | "INCLUDED_" | ||
| 1041 | (replace-regexp-in-string | ||
| 1042 | "[^A-Z0-9]" | ||
| 1043 | "_" | ||
| 1044 | (string-replace | ||
| 1045 | "+" | ||
| 1046 | "P" | ||
| 1047 | (upcase (file-name-nondirectory buffer-file-name))))) | ||
| 1048 | "#ifndef " | ||
| 1049 | str | ||
| 1050 | n | ||
| 1051 | "#define " | ||
| 1052 | str | ||
| 1053 | n | ||
| 1054 | n | ||
| 1055 | _ | ||
| 1056 | n | ||
| 1057 | n | ||
| 1058 | "#endif // " | ||
| 1059 | str)) | ||
| 1060 | ;; (with-eval-after-load | ||
| 1061 | ;; 'org | ||
| 1062 | ;; (require 'ob-emacs-lisp) | ||
| 1063 | ;; (require 'ob-latex) | ||
| 1064 | ;; (require 'ob-octave) | ||
| 1065 | ;; (require 'ob-scheme) | ||
| 1066 | ;; (require 'ob-sql) | ||
| 1067 | ;; (require 'ob-shell) | ||
| 1068 | ;; (require 'ob-dot) | ||
| 1069 | ;; (require 'ox-extra) | ||
| 1070 | ;; (ox-extras-activate '(ignore-headlines))) | ||
| 1071 | |||
| 1072 | ;; (setq transmission-refresh-interval 1) | ||
| 1073 | ;; (setq transmission-refresh-modes | ||
| 1074 | ;; '(transmission-mode | ||
| 1075 | ;; transmission-files-mode | ||
| 1076 | ;; transmission-info-mode | ||
| 1077 | ;; transmission-peers-mode)) | ||
| 1078 | |||
| 1079 | (use-package transient | ||
| 1080 | :ensure (:wait t)) | ||
| 1081 | (use-package magit | ||
| 1082 | :after (transient) | ||
| 1083 | :custom | ||
| 1084 | (magit-tramp-pipe-stty-settings 'pty) | ||
| 1085 | (magit-clone-default-directory "~/downloads/repos/")) | ||
| 1086 | |||
| 1087 | (use-package git-gutter | ||
| 1088 | :custom | ||
| 1089 | (git-gutter:modified-sign "~") | ||
| 1090 | :config | ||
| 1091 | (global-git-gutter-mode t)) | ||
| 1092 | |||
| 1093 | (use-package substitute | ||
| 1094 | :config | ||
| 1095 | (define-key global-map (kbd "C-c C-s") 'substitute-target-in-buffer)) | ||
| 1096 | |||
| 1097 | (auto-insert-mode t) | ||
| 1098 | (setf (alist-get | ||
| 1099 | '("\\.\\([Hh]\\|hh\\|hpp\\|hxx\\|h\\+\\+\\)\\'" . "C / C++ header") | ||
| 1100 | auto-insert-alist | ||
| 1101 | nil | ||
| 1102 | nil | ||
| 1103 | 'equal) | ||
| 1104 | '((concat | ||
| 1105 | "INCLUDED_" | ||
| 1106 | (replace-regexp-in-string | ||
| 1107 | "[^A-Z0-9]" | ||
| 1108 | "_" | ||
| 1109 | (string-replace | ||
| 1110 | "+" | ||
| 1111 | "P" | ||
| 1112 | (upcase (file-name-nondirectory buffer-file-name))))) | ||
| 1113 | "#ifndef " | ||
| 1114 | str | ||
| 1115 | n | ||
| 1116 | "#define " | ||
| 1117 | str | ||
| 1118 | n | ||
| 1119 | n | ||
| 1120 | _ | ||
| 1121 | n | ||
| 1122 | n | ||
| 1123 | "#endif // " | ||
| 1124 | str)) | ||
| 1125 | |||
| 1126 | (use-package org | ||
| 1127 | :ensure (:wait t) | ||
| 1128 | :custom | ||
| 1129 | (org-src-preserve-indentation t) | ||
| 1130 | :config | ||
| 1131 | (keymap-unset org-mode-map "C-'") | ||
| 1132 | (keymap-unset org-mode-map "C-,")) | ||
| 1133 | |||
| 1134 | (use-package org-modern | ||
| 1135 | :config | ||
| 1136 | (global-org-modern-mode)) | ||
| 1137 | |||
| 1138 | (use-package org-contrib | ||
| 1139 | :config | ||
| 1140 | ;; (ox-extras-activate '(ignore-headlines)) | ||
| 1141 | (setq org-use-speed-commands t)) | ||
| 1142 | |||
| 1143 | (use-package ox-rss) | ||
| 1144 | (use-package htmlize) | ||
| 1145 | |||
| 1146 | (use-package smartparens | ||
| 1147 | :after (org) | ||
| 1148 | :custom | ||
| 1149 | (sp-highlight-pair-overlay nil) | ||
| 1150 | :config | ||
| 1151 | (require 'smartparens-config) | ||
| 1152 | (sp-use-smartparens-bindings) | ||
| 1153 | (define-key smartparens-mode-map (kbd "M-S") 'sp-forward-slurp-sexp) | ||
| 1154 | (keymap-unset smartparens-mode-map "C-<right>") | ||
| 1155 | (keymap-unset smartparens-mode-map "M-<right>") | ||
| 1156 | (keymap-unset smartparens-mode-map "C-M-<right>") | ||
| 1157 | (keymap-unset smartparens-mode-map "C-<left>") | ||
| 1158 | (keymap-unset smartparens-mode-map "M-<left>") | ||
| 1159 | (keymap-unset smartparens-mode-map "C-M-<left>") | ||
| 1160 | ;; (keymap-unset smartparens-mode-map "M-<backspace>") | ||
| 1161 | (smartparens-global-mode t) | ||
| 1162 | (show-paren-mode -1) | ||
| 1163 | (show-smartparens-global-mode t)) | ||
| 1164 | |||
| 1165 | (setq transmission-refresh-interval 1) | ||
| 1166 | (setq transmission-refresh-modes | ||
| 1167 | '(transmission-mode | ||
| 1168 | transmission-files-mode | ||
| 1169 | transmission-info-mode | ||
| 1170 | transmission-peers-mode)) | ||
| 1171 | |||
| 1172 | (use-package cape) | ||
| 1173 | (use-package company) | ||
| 1174 | |||
| 1175 | (use-package notmuch | ||
| 1176 | :init | ||
| 1177 | (defvar cmmm/notmuch-todo-tags '("+todo" "-inbox")) | ||
| 1178 | (defvar cmmm/notmuch-spam-tags '("+spam" "-inbox")) | ||
| 1179 | (defvar cmmm/notmuch-trash-tags '("+trash" "-inbox" "-draft")) | ||
| 1180 | (defvar cmmm/notmuch-delete-tags '("+deleted" "-inbox" "-draft")) | ||
| 1181 | |||
| 1182 | (defun cmmm/notmuch-search-watch () | ||
| 1183 | (interactive) | ||
| 1184 | (notmuch-tag | ||
| 1185 | (concat | ||
| 1186 | "id:" (car (notmuch-query-get-message-ids | ||
| 1187 | (notmuch-search-find-thread-id)))) | ||
| 1188 | (list "+watch")) | ||
| 1189 | (notmuch-tree-next-message)) | ||
| 1190 | |||
| 1191 | (defun cmmm/notmuch-search-trash () | ||
| 1192 | (interactive) | ||
| 1193 | (notmuch-search-add-tag cmmm/notmuch-trash-tags) | ||
| 1194 | (notmuch-tree-next-message)) | ||
| 1195 | |||
| 1196 | (defun cmmm/notmuch-search-delete () | ||
| 1197 | (interactive) | ||
| 1198 | (notmuch-search-add-tag cmmm/notmuch-delete-tags) | ||
| 1199 | (notmuch-tree-next-message)) | ||
| 1200 | |||
| 1201 | (defun cmmm/notmuch-search-todo () | ||
| 1202 | (interactive) | ||
| 1203 | ;; TODO: Change it to only matched, not the whole thread | ||
| 1204 | (notmuch-search-add-tag cmmm/notmuch-todo-tags) | ||
| 1205 | (notmuch-tree-next-message)) | ||
| 1206 | |||
| 1207 | :bind | ||
| 1208 | (("s-m" . notmuch-jump-search) | ||
| 1209 | :map cmmm/application-map | ||
| 1210 | ("n" . notmuch) | ||
| 1211 | :map notmuch-show-part-map | ||
| 1212 | ("d" . cmmm/notmuch-show-view-as-patch) | ||
| 1213 | ("h" . cmmm/notmuch-show-view-html-part) | ||
| 1214 | :map notmuch-search-mode-map | ||
| 1215 | ("w" . cmmm/notmuch-search-watch) | ||
| 1216 | ("d" . cmmm/notmuch-search-trash) | ||
| 1217 | ("D" . cmmm/notmuch-search-delete) | ||
| 1218 | ("T" . cmmm/notmuch-search-todo)) | ||
| 1219 | :custom | ||
| 1220 | ;; (notmuch-saved-searches '()) | ||
| 1221 | (notmuch-search-oldest-first t) | ||
| 1222 | (mail-user-agent 'notmuch-user-agent) | ||
| 1223 | (notmuch-message-headers '("Subject" "To" "Cc" "Reply-To" "Date")) | ||
| 1224 | (notmuch-fcc-dirs '(("martin@michalec.dev" . "accounts/professional/sent +sent") | ||
| 1225 | ("martin.michalec.2003@gmail.com" . "accounts/personal/sent +sent") | ||
| 1226 | ("mcmitarrr@gmail.com" . "accounts/gaming/sent +sent") | ||
| 1227 | ("mihalets.m@edu.spbstu.ru" . "accounts/academia/sent +sent"))) | ||
| 1228 | (notmuch-identities '("Martin Michalec <martin@michalec.dev>")) | ||
| 1229 | (notmuch-address-use-company nil) | ||
| 1230 | (notmuch-unthreaded-show-out nil) | ||
| 1231 | (notmuch-show-empty-saved-searches t) | ||
| 1232 | (notmuch-mua-cite-function 'message-cite-original-without-signature) | ||
| 1233 | |||
| 1234 | (notmuch-show-stash-mlarchive-link-default "yhetil") | ||
| 1235 | |||
| 1236 | (notmuch-search-result-format '(("date" . "%12s ") | ||
| 1237 | ("count" . "%-7s ") | ||
| 1238 | ("authors" . "%-20s ") | ||
| 1239 | ("subject" . "%-80s ") | ||
| 1240 | ("tags" . "(%s)"))) | ||
| 1241 | (notmuch-tree-result-format '(("date" . "%12s ") | ||
| 1242 | ("authors" . "%-20s") | ||
| 1243 | ((("tree" . "%s") | ||
| 1244 | ("subject" . "%s")) | ||
| 1245 | . " %-88s ") | ||
| 1246 | ("tags" . "(%s)"))) | ||
| 1247 | (notmuch-unthreaded-result-format '(("date" . "%12s ") | ||
| 1248 | ("authors" . "%-20s") | ||
| 1249 | ((("subject" . "%s")) | ||
| 1250 | . " %-88s ") | ||
| 1251 | ("tags" . "(%s)"))) | ||
| 1252 | |||
| 1253 | (notmuch-show-logo nil) | ||
| 1254 | |||
| 1255 | (notmuch-saved-searches | ||
| 1256 | '((:name "TODO" :query "tag:todo" :key "t") | ||
| 1257 | (:name "Inbox" :query "tag:inbox" :key "i") | ||
| 1258 | (:name "Watching" :query "thread:{tag:watch} and tag:unread" :key "w") | ||
| 1259 | (:name "Drafts" :query "tag:draft" :key "d") | ||
| 1260 | (:name "Flagged" :query "tag:flagged" :key "f") | ||
| 1261 | (:name "Sent" :query "tag:sent" :key "s") | ||
| 1262 | (:name "All mail" :query "*" :key "a") | ||
| 1263 | (:name "Professional Inbox" :query "tag:professional and tag:inbox" :key "M") | ||
| 1264 | ;; (:name "Community Inbox" :query "tag:community and tag:inbox" :key "C") | ||
| 1265 | (:name "Academic Inbox" :query "tag:academia and tag:inbox" :key "A") | ||
| 1266 | (:name "Personal Inbox" :query "tag:personal and tag:inbox" :key "P") | ||
| 1267 | (:name "Gaming Inbox" :query "tag:gaming and tag:inbox" :key "G"))) | ||
| 1268 | |||
| 1269 | (notmuch-hello-sections | ||
| 1270 | (list #'notmuch-hello-insert-header | ||
| 1271 | #'notmuch-hello-insert-saved-searches | ||
| 1272 | #'notmuch-hello-insert-search | ||
| 1273 | #'notmuch-hello-insert-recent-searches | ||
| 1274 | #'notmuch-hello-insert-alltags)) | ||
| 1275 | |||
| 1276 | (notmuch-archive-tags '("-inbox" "-todo")) | ||
| 1277 | (notmuch-tagging-keys | ||
| 1278 | '(("a" notmuch-archive-tags "Archive") | ||
| 1279 | ("r" notmuch-show-mark-read-tags "Mark read") | ||
| 1280 | ("f" ("+flagged") "Flag (favorite)") | ||
| 1281 | ;; ("w" ("+watch") "Watch") | ||
| 1282 | ("t" cmmm/notmuch-todo-tags "Mark as todo") | ||
| 1283 | ("s" cmmm/notmuch-spam-tags "Mark as spam") | ||
| 1284 | ("d" cmmm/notmuch-trash-tags "Trash") | ||
| 1285 | ("D" cmmm/notmuch-delete-tags "Delete"))) | ||
| 1286 | |||
| 1287 | :config | ||
| 1288 | (mapcar | ||
| 1289 | (lambda (x) | ||
| 1290 | (add-to-list 'notmuch-show-stash-mlarchive-link-alist x)) | ||
| 1291 | `(("yhetil" . "https://yhetil.org/") | ||
| 1292 | ("mail-archive" . "https://www.mail-archive.com/search?l=mid&q="))) | ||
| 1293 | |||
| 1294 | (defun cmmm/notmuch-show-view-html-part () | ||
| 1295 | "Open the text/html part of the current message using | ||
| 1296 | `notmuch-show-view-part'." | ||
| 1297 | (interactive) | ||
| 1298 | (save-excursion | ||
| 1299 | (goto-char | ||
| 1300 | (prop-match-beginning | ||
| 1301 | (text-property-search-forward | ||
| 1302 | :notmuch-part | ||
| 1303 | "text/html" | ||
| 1304 | (lambda (value notmuch-part) | ||
| 1305 | (equal (plist-get notmuch-part :content-type) value))))) | ||
| 1306 | (notmuch-show-view-part))) | ||
| 1307 | |||
| 1308 | ;; https://notmuchmail.org/emacstips/#index25h2 | ||
| 1309 | (defun cmmm/notmuch-show-view-as-patch () | ||
| 1310 | "View the the current message as a patch." | ||
| 1311 | (interactive) | ||
| 1312 | (let* ((id (notmuch-show-get-message-id)) | ||
| 1313 | (msg (notmuch-show-get-message-properties)) | ||
| 1314 | (part (notmuch-show-get-part-properties)) | ||
| 1315 | (subject (concat "Subject: " (notmuch-show-get-subject) "\n")) | ||
| 1316 | (diff-default-read-only t) | ||
| 1317 | (buf (get-buffer-create (concat "*notmuch-patch-" id "*"))) | ||
| 1318 | (map (make-sparse-keymap))) | ||
| 1319 | (define-key map "q" 'notmuch-bury-or-kill-this-buffer) | ||
| 1320 | (switch-to-buffer buf) | ||
| 1321 | (let ((inhibit-read-only t)) | ||
| 1322 | (erase-buffer) | ||
| 1323 | (insert subject) | ||
| 1324 | (insert (notmuch-get-bodypart-text msg part nil))) | ||
| 1325 | (set-buffer-modified-p nil) | ||
| 1326 | (diff-mode) | ||
| 1327 | (let ((new-ro-bind (cons 'buffer-read-only map))) | ||
| 1328 | (add-to-list 'minor-mode-overriding-map-alist new-ro-bind)) | ||
| 1329 | (goto-char (point-min)))) | ||
| 1330 | |||
| 1331 | (defun cmmm/notmuch-message-mode () | ||
| 1332 | "Add completion at point functions made from company backends." | ||
| 1333 | (setq-local | ||
| 1334 | completion-at-point-functions | ||
| 1335 | (append | ||
| 1336 | ;; FIXME: doesn't work well with consult-completion-in-region | ||
| 1337 | ;; list of candidates doesn't get updated when removing characters. | ||
| 1338 | (list (cape-company-to-capf 'notmuch-company)) | ||
| 1339 | completion-at-point-functions))) | ||
| 1340 | :hook (message-mode . cmmm/notmuch-message-mode)) | ||
| 1341 | (use-package ol-notmuch | ||
| 1342 | :after (notmuch)) | ||
| 1343 | (use-package consult-notmuch | ||
| 1344 | :after (notmuch) | ||
| 1345 | :bind | ||
| 1346 | ("M-s n" . consult-notmuch-tree)) | ||
| 1347 | |||
| 1348 | (use-package message | ||
| 1349 | :ensure nil | ||
| 1350 | :custom | ||
| 1351 | (message-hidden-headers '()) | ||
| 1352 | (message-mail-user-agent t) | ||
| 1353 | (message-kill-buffer-on-exit t) | ||
| 1354 | (message-directory "~/mail/") | ||
| 1355 | (message-signature "Martin Michalec") | ||
| 1356 | (sendmail-program "/usr/bin/msmtp") | ||
| 1357 | (message-send-mail-function 'message-send-mail-with-sendmail) | ||
| 1358 | (message-sendmail-f-is-evil t) | ||
| 1359 | (message-sendmail-extra-arguments '("--read-envelope-from")) | ||
| 1360 | (mml-secure-openpgp-signers '("EC8B9BEEC52ADE94D44F9F1649D78C69C2FCBB11")) | ||
| 1361 | (mml-secure-openpgp-encrypt-to-self t) | ||
| 1362 | (mml-secure-openpgp-sign-with-sender t) | ||
| 1363 | (message-citation-line-function 'message-insert-formatted-citation-line) | ||
| 1364 | (message-citation-line-format "On %Y-%m-%d %R, %N wrote:\n") | ||
| 1365 | (message-auto-save-directory (concat (or (getenv "XDG_CACHE_HOME") "~/.cache") | ||
| 1366 | "/emacs/mail-drafts")) | ||
| 1367 | :hook | ||
| 1368 | (message-setup . mml-secure-message-sign-pgpmime) | ||
| 1369 | ;; :config | ||
| 1370 | ;; MAYBE: Move to feature-sourcehut | ||
| 1371 | ;; <https://git.sr.ht/~protesilaos/dotfiles/tree/a72ed49ea8/item/emacs/.emacs.d/prot-lisp/prot-notmuch.el#L352> | ||
| 1372 | ;; (defconst rde-message-patch-control-codes | ||
| 1373 | ;; '("PROPOSED" "NEEDS_REVISION" "SUPERSEDED" | ||
| 1374 | ;; "APPROVED" "REJECTED" "APPLIED") | ||
| 1375 | ;; "Control codes for SourceHut patches. See | ||
| 1376 | ;; `rde-message-srht-add-email-control-code' for how to apply them.") | ||
| 1377 | |||
| 1378 | ;; (defun rde-message-srht-add-email-control-code (control-code) | ||
| 1379 | ;; "Add custom header for SourceHut email controls. The CONTROL-CODE | ||
| 1380 | ;; is among `rde-notmuch-patch-control-codes'." | ||
| 1381 | ;; (interactive | ||
| 1382 | ;; (list (completing-read "Select control code: " | ||
| 1383 | ;; rde-message-patch-control-codes nil t))) | ||
| 1384 | ;; (if (member control-code rde-message-patch-control-codes) | ||
| 1385 | ;; (message-replace-header | ||
| 1386 | ;; "X-Sourcehut-Patchset-Update" control-code) | ||
| 1387 | ;; (user-error "%s is not specified in | ||
| 1388 | ;; `rde-notmuch-patch-control-codes'" control-code))) | ||
| 1389 | ) | ||
| 1390 | |||
| 1391 | (use-package transmission | ||
| 1392 | :bind | ||
| 1393 | (:map cmmm/application-map | ||
| 1394 | ("T" . transmission) | ||
| 1395 | :map transmission-mode-map | ||
| 1396 | ("R" . transmission-move))) | ||
| 1397 | |||
| 1398 | (use-package tempel | ||
| 1399 | :bind | ||
| 1400 | (("M-+" . tempel-complete) | ||
| 1401 | ("M-*" . tempel-insert)) | ||
| 1402 | :init | ||
| 1403 | ;; Setup completion at point | ||
| 1404 | (defun cmmm/tempel-setup-capf () | ||
| 1405 | ;; Add the Tempel Capf to `completion-at-point-functions'. `tempel-expand' | ||
| 1406 | ;; only triggers on exact matches. We add `tempel-expand' *before* the main | ||
| 1407 | ;; programming mode Capf, such that it will be tried first. | ||
| 1408 | (setq-local completion-at-point-functions | ||
| 1409 | (cons #'tempel-expand completion-at-point-functions)) | ||
| 1410 | |||
| 1411 | ;; Alternatively use `tempel-complete' if you want to see all matches. Use | ||
| 1412 | ;; a trigger prefix character in order to prevent Tempel from triggering | ||
| 1413 | ;; unexpectly. | ||
| 1414 | (setq-local corfu-auto-trigger "<" | ||
| 1415 | completion-at-point-functions | ||
| 1416 | (cons (cape-capf-trigger #'tempel-complete ?/) | ||
| 1417 | completion-at-point-functions))) | ||
| 1418 | |||
| 1419 | (add-hook 'conf-mode-hook 'cmmm/tempel-setup-capf) | ||
| 1420 | (add-hook 'prog-mode-hook 'cmmm/tempel-setup-capf) | ||
| 1421 | (add-hook 'text-mode-hook 'cmmm/tempel-setup-capf) | ||
| 1422 | (add-hook 'fundamental-mode-hook 'cmmm/tempel-setup-capf) | ||
| 1423 | |||
| 1424 | (add-hook 'prog-mode-hook #'tempel-abbrev-mode) | ||
| 1425 | (global-tempel-abbrev-mode)) | ||
| 1426 | |||
| 1427 | ;; (use-package hledger-mode) | ||
| 1428 | (use-package wgrep) | ||
| 1429 | (use-package rg) | ||
| 1430 | (use-package constants) | ||
| 1431 | (use-package consult-dir | ||
| 1432 | :bind (("C-x C-d" . consult-dir) | ||
| 1433 | :map minibuffer-local-completion-map | ||
| 1434 | ("C-x C-d" . consult-dir) | ||
| 1435 | ("C-x C-j" . consult-dir-jump-file))) | ||
| 1436 | ;; (use-package jabber) | ||
| 1437 | (use-package crdt | ||
| 1438 | :ensure (:repo ("https://github.com/emacs-straight/crdt"))) | ||
| 1439 | (use-package simple-httpd) | ||
| 1440 | |||
| 1441 | (use-package window | ||
| 1442 | :ensure nil | ||
| 1443 | :custom | ||
| 1444 | (split-width-threshold 145)) | ||
| 1445 | |||
| 1446 | (use-package browse-url | ||
| 1447 | :ensure nil | ||
| 1448 | :custom | ||
| 1449 | (browse-url-browser-function 'browse-url-chromium)) | ||
| 1450 | |||
| 1451 | ;; yeetube | ||
| 1452 | ;; gnuplot | ||
| 1453 | ;; eldoc-box | ||
| 1454 | (use-package plantuml-mode) | ||
| 1455 | (use-package glsl-mode) | ||
| 1456 | |||
| 1457 | (use-package mmm-mode | ||
| 1458 | :custom | ||
| 1459 | (mmm-global-mode 'maybe)) | ||
| 1460 | (use-package mmm-jinja2) | ||
| 1461 | |||
| 1462 | (use-package chezmoi) | ||
| 1463 | |||
| 1464 | ;; org-mime | ||
| 1465 | ;; org-roam-ui | ||
| 1466 | ;; org-contrib | ||
| 1467 | ;; org-noter | ||
| 1468 | ;; org-present | ||
| 1469 | ;; org-wild-notifier | ||
| 1470 | |||
| 1471 | ;; Local Variables: | ||
| 1472 | ;; no-byte-compile: t | ||
| 1473 | ;; no-native-compile: t | ||
| 1474 | ;; no-update-autoloads: t | ||
| 1475 | ;; End: | ||
