Compare commits

...
Sign in to create a new pull request.

7 commits

14 changed files with 423 additions and 450 deletions

5
.gitignore vendored
View file

@ -8,7 +8,6 @@ custom.el
eln-cache
elpa
games
games
ido.last
irony
org-latex-preview
@ -20,4 +19,6 @@ smex-items
straight
transient
history
tramp
tramp
*.eln
*.elc

3
bin/ec
View file

@ -1,3 +0,0 @@
#!/bin/sh
emacsclient -c -a="" $@

View file

@ -1,3 +0,0 @@
#!/bin/sh
emacsclient -t -a="" $@

239
init.el
View file

@ -1,65 +1,104 @@
(add-to-list 'load-path "~/.emacs.d/lisp/")
;;; -*- lexical-binding: t -*-
;; supress nativecomp warnings
(setq native-comp-async-report-warnings-errors 'silent)
;;; straight for package management
(require 'oxa/package-mgmt)
;; I use custom vars for local config, so let's put them to separate
;; file, where it's easier for git to ignore it
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file 'noerror)
;;; basic bits
(require 'oxa/sane-defaults)
(require 'oxa/utils)
(require 'oxa/misc)
(require 'oxa/completion)
;; straight.el bootstrap
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 6))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(require 'oxa/org)
(require 'oxa/latex)
(straight-use-package 'use-package)
(require 'oxa/mail)
;;; basic interface stuff
(menu-bar-mode 1)
(global-display-line-numbers-mode -1)
(column-number-mode 1)
;;; theme
(setq modus-themes-italic-constructs t
modus-themes-bold-constructs t)
(setq inhibit-startup-screen t)
(setq-default indicate-buffer-boundaries 'left)
(setq auto-save-default nil)
(setq visible-bell t)
(load-theme 'modus-operandi)
(setq-default indicate-empty-lines t)
(setq-default show-trailing-whitespace t)
(add-hook 'prog-mode-hook #'(lambda () (whitespace-mode t)))
;; TODO Proper graphical setup
(add-hook 'after-make-frame-functions
#'(lambda (frame)
(toggle-scroll-bar -1)
(tool-bar-mode -1)))
;; match system theme
;; https://freerangebits.com/posts/2025/02/emacs-light-dark/
(defvar oxa:dark-theme 'modus-vivendi)
(defvar oxa:light-theme 'modus-operandi)
(defun oxa:theme-from-dbus (value)
(load-theme (if (= 1 (car (flatten-list value)))
oxa:dark-theme
oxa:light-theme)
t))
;;; improvements to compilation buffer
(require 'compile)
(setq compilation-scroll-output t)
(require 'ansi-color)
(add-hook 'compilation-filter-hook 'ansi-color-compilation-filter)
(require 'dbus)
;;; override default annoyances
;; I'm the only cowboy on this mainframe
;; (setq create-lockfiles nil)
;; X is dead
(setq inhibit-x-resources t)
;; use ibuffer instead of standard buffer list
(global-set-key (kbd "C-x C-b") 'ibuffer)
(fset 'yes-or-no-p 'y-or-n-p)
(setq confirm-nonexistent-file-or-buffer nil)
;; Set the current theme based on what the system theme is right now:
(dbus-call-method-asynchronously
:session "org.freedesktop.portal.Desktop"
"/org/freedesktop/portal/desktop"
"org.freedesktop.portal.Settings"
"Read"
#'oxa:theme-from-dbus
"org.freedesktop.appearance"
"color-scheme")
;; let's delete a tab as a whole...
(setq backward-delete-char-untabify-method 'nil)
;;; identation holywar contribution
(setq-default indent-tabs-mode 'nil)
;; Register to be notified when the system theme changes:
(dbus-register-signal
:session "org.freedesktop.portal.Desktop"
"/org/freedesktop/portal/desktop"
"org.freedesktop.portal.Settings"
"SettingChanged"
(lambda (path var value)
(when (and (string-equal path "org.freedesktop.appearance")
(string-equal var "color-scheme"))
(oxa:theme-from-dbus value))))
;; highlight the parens
(setq show-paren-delay 0)
(show-paren-mode 1)
;; follow symlinks to version-controlled files
(setq vc-follow-symlinks t)
;; backup management
(setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
(setq delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t)
;; default frame size
(add-to-list 'default-frame-alist '(height . 53))
(add-to-list 'default-frame-alist '(width . 107))
(if (eq system-type 'gnu/linux)
(pixel-scroll-precision-mode t))
;; Stolen from https://github.com/rexim/dotfiles
(defun rc/duplicate-line ()
"Duplicate current line"
(interactive)
(let ((column (- (point) (point-at-bol)))
(line (let ((s (thing-at-point 'line t)))
(if s (string-remove-suffix "\n" s) ""))))
(move-end-of-line 1)
(newline)
(insert line)
(move-beginning-of-line 1)
(forward-char column)))
(global-set-key (kbd "C-,") 'rc/duplicate-line)
;; faster window switch
(global-set-key (kbd "C-;") #'other-window)
;;; personal framework bits
;; my personal keymap
(define-prefix-command 'oxamap)
(global-set-key (kbd "C-z") 'oxamap)
@ -70,111 +109,17 @@
(defun tabs-yay ()
"Function to enable tab indentation in buffer."
(setq indent-tabs-mode t))
(add-hook 'c-mode-hook 'tabs-yay)
;;; expand region
(straight-use-package 'expand-region)
(require 'expand-region)
(global-set-key (kbd "C-=") 'er/expand-region)
;;; move text
(straight-use-package 'move-text)
(global-set-key (kbd "M-n") 'move-text-down)
(global-set-key (kbd "M-p") 'move-text-up)
;; direnv
(straight-use-package 'direnv)
(direnv-mode 1)
;; magit
(straight-use-package 'magit)
(require 'magit)
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "C-x M-g") 'magit-dispatch)
(global-set-key (kbd "C-c M-g") 'magit-file-dispatch)
;;; Language support
(straight-use-package 'nix-mode)
(setq nix-nixfmt-bin "nixpkgs-fmt")
(straight-use-package 'markdown-mode)
(straight-use-package 'yaml-mode)
(straight-use-package 'rust-mode)
(require 'rust-mode)
(oxa/hook rust-mode-hook
(setq-local fill-column 100))
(require 'cc-mode)
;;; Copypasta of llvm/utils/emacs/emacs.el
;; LLVM coding style guidelines in emacs
;; Maintainer: LLVM Team, http://llvm.org/
(defun llvm-lineup-statement (langelem)
(let ((in-assign (c-lineup-assignments langelem)))
(if (not in-assign)
'++
(aset in-assign 0
(+ (aref in-assign 0)
(* 2 c-basic-offset)))
in-assign)))
;; Add a cc-mode style for editing LLVM C and C++ code
(c-add-style "llvm.org"
'("gnu"
(fill-column . 80)
(c++-indent-level . 2)
(c-basic-offset . 2)
(indent-tabs-mode . nil)
(c-offsets-alist . ((arglist-intro . ++)
(innamespace . 0)
(member-init-intro . ++)
(statement-cont . llvm-lineup-statement)))))
;; Files with "llvm" in their names will automatically be set to the
;; llvm.org coding style.
(add-hook 'c-mode-common-hook
(function
(lambda nil
(if (string-match "llvm" buffer-file-name)
(progn
(c-set-style "llvm.org"))))))
(setq c-default-style '((java-mode . "java")
(awk-mode . "awk")
(c-mode . "linux")
(c++-mode . "llvm.org")
(other . "stroustrup")))
;; completion
(straight-use-package 'company)
(global-company-mode)
;;; Monday is the fist day of the week
(require 'calendar)
(setq calendar-week-start-day 1)
(custom-set-variables
'(whitespace-style
(quote
(face tabs spaces trailing space-before-tab newline indentation empty space-after-tab tab-mark))))
;; nya-nya-nya-nya-nya-nya
(straight-use-package 'nyan-mode)
(require 'nyan-mode)
(setq nyan-animate-nyancat t
nyan-wavy-trail t)
(nyan-mode 1)
;; ess
(straight-use-package 'ess)
;; faster window switch
(global-set-key (kbd "C-;") #'other-window)
(straight-use-package 'dired-sidebar)
(setq dired-sidebar-theme 'ascii)
(define-key 'oxamap (kbd "t") 'dired-sidebar-toggle-sidebar)
(load "~/.emacs.d/packages")
;; I use custom vars for local config, so let's put them to separate
;; file, where it's easier for git to ignore it
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file 'noerror)

View file

@ -1,81 +0,0 @@
(straight-use-package 'vertico)
(straight-use-package 'orderless)
(straight-use-package 'marginalia)
(straight-use-package 'consult)
;; vertico uses history
(require 'savehist)
(savehist-mode)
;; orderless completion
(require 'orderless)
(setq completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((file (styles partial-completion))))
;; completion framework
(require 'vertico)
(vertico-mode)
(setq enable-recursive-minibuffers t)
(keymap-set vertico-map "?" #'minibuffer-completion-help)
(keymap-set vertico-map "M-RET" #'minibuffer-force-complete-and-exit)
(keymap-set vertico-map "M-TAB" #'minibuffer-complete)
;; annotations for minibuffer
(require 'marginalia)
(marginalia-mode)
(keymap-set minibuffer-local-map "M-A" #'marginalia-cycle)
;; vertico-enabled replacements
(require 'consult)
(setq consult-narrow-key "<")
;; global binds
(global-set-key (kbd "C-c M-x") 'consult-mode-command)
(global-set-key (kbd "C-c h") 'consult-history)
(global-set-key (kbd "C-c k") 'consult-kmacro)
(global-set-key (kbd "C-c m") 'consult-man)
(global-set-key (kbd "C-c i") 'consult-info)
(global-set-key (kbd "M-y") 'consult-yank-pop)
(global-set-key (kbd "C-x b") 'consult-buffer) ;; orig. switch-to-buffer
(global-set-key (kbd "C-x M-:") 'consult-complex-command) ;; orig. repeat-complex-command
(global-set-key (kbd "C-x 4 b") 'consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
(global-set-key (kbd "C-x 5 b") 'consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
(global-set-key (kbd "C-x r b") 'consult-bookmark) ;; orig. bookmark-jump
(global-set-key (kbd "C-x p b") 'consult-project-buffer) ;; orig. project-switch-to-buffer
;; goto-map
(global-set-key (kbd "M-g e") 'consult-compile-error)
(global-set-key (kbd "M-g f") 'consult-flymake) ;; Alternative: consult-flycheck
(global-set-key (kbd "M-g g") 'consult-goto-line) ;; orig. goto-line
(global-set-key (kbd "M-g M-g") 'consult-goto-line) ;; orig. goto-line
(global-set-key (kbd "M-g o") 'consult-outline) ;; Alternative: consult-org-heading
(global-set-key (kbd "M-g m") 'consult-mark)
(global-set-key (kbd "M-g k") 'consult-global-mark)
(global-set-key (kbd "M-g i") 'consult-imenu)
(global-set-key (kbd "M-g I") 'consult-imenu-multi)
;; search map
(global-set-key (kbd "M-s d") 'consult-find)
(global-set-key (kbd "M-s D") 'consult-locate)
(global-set-key (kbd "M-s g") 'consult-grep)
(global-set-key (kbd "M-s G") 'consult-git-grep)
(global-set-key (kbd "M-s r") 'consult-ripgrep)
(global-set-key (kbd "M-s l") 'consult-line)
(global-set-key (kbd "M-s L") 'consult-line-multi)
(global-set-key (kbd "M-s k") 'consult-keep-lines)
(global-set-key (kbd "M-s u") 'consult-focus-lines)
;; finding files
;; minibuffer
(keymap-set minibuffer-local-map "M-s" #'consult-history)
(keymap-set minibuffer-local-map "M-r" #'consult-history)
(provide 'oxa/completion)

View file

@ -1,12 +0,0 @@
(straight-use-package 'auctex)
(require 'tex-site)
(require 'reftex)
(add-hook 'LaTeX-mode-hook 'TeX-PDF-mode)
(add-hook 'LaTeX-mode-hook 'reftex-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(setq TeX-parse-self t)
(setq reftex-plug-into-AUCTeX t)
(provide 'oxa/latex)

View file

View file

@ -1,40 +0,0 @@
(require 'mu4e)
(setq mu4e-change-filenames-when-moving t)
(setq mu4e-maildir "~/mail")
(setq mu4e-update-interval (* 11 60))
(setq mu4e-contexts
(list
(make-mu4e-context
:name "oxapentane.com"
:match-func (lambda (msg)
(when msg
(string-prefix-p "/grigory@shipunov.xyz" (mu4e-message-field msg :maildir))))
:vars '((user-mail-address . "grigory@shipunov.xyz")
(user-full-name . "Grisha Shipunov")
(mu4e-drafts-folder . "/grigory@shipunov.xyz/Drafts")
(mu4e-sent-folder . "/grigory@shipunov.xyz/Sent")
(mu4e-trash-folder . "/grigory@shipunov.xyz/Trash")
(mu4e-refile-folder . "/grigory@shipunov.xyz/Archive")
(mu4e-maildir-shortcuts . (("/grigory@shipunov.xyz/INBOX" . "?i")
("/grigory@shipunov.xyz/Drafts" . "?d")
("/grigory@shipunov.xyz/Sent" . "?s")))))
(make-mu4e-context
:name "oxapentane.com"
:match-func (lambda (msg)
(when msg
(string-prefix-p "/mail@oxapentane.com" (mu4e-message-field msg :maildir))))
:vars '((user-mail-address . "mail@oxapentane.com")
(user-full-name . "Grisha Shipunov")
(mu4e-drafts-folder . "/mail@oxapentane.com/Drafts")
(mu4e-sent-folder . "/mail@oxapentane.com/Sent")
(mu4e-trash-folder . "/mail@oxapentane.com/Trash")
(mu4e-refile-folder . "/mail@oxapentane.com/Archive")
(mu4e-maildir-shortcuts . (("/mail@oxapentane.com/INBOX" . "?i")
("/mail@oxapentane.com/Drafts" . "?d")
("/mail@oxapentane.com/Sent" . "?s")
("/mail@oxapentane.com/sinkhole" . "?S")))))))
(provide 'oxa/mail)

View file

@ -1,16 +0,0 @@
;; Stolen from https://github.com/rexim/dotfiles
(defun rc/duplicate-line ()
"Duplicate current line"
(interactive)
(let ((column (- (point) (point-at-bol)))
(line (let ((s (thing-at-point 'line t)))
(if s (string-remove-suffix "\n" s) ""))))
(move-end-of-line 1)
(newline)
(insert line)
(move-beginning-of-line 1)
(forward-char column)))
(global-set-key (kbd "C-,") 'rc/duplicate-line)
(provide 'oxa/misc)

View file

@ -1,68 +0,0 @@
;;; Monday is the fist day of the week
(require 'calendar)
(setq calendar-week-start-day 1)
(straight-use-package 'org)
(straight-use-package 'org-roam)
(require 'org)
(require 'org-roam)
;; expose org functions
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c c") 'org-capture)
(global-set-key (kbd "C-c l") 'org-store-link)
(define-key org-mode-map (kbd "C-c 1") 'org-time-stamp-inactive)
;; autosave advises for agenda and org-capture
(advice-add 'org-agenda-quit :before 'org-save-all-org-buffers)
(advice-add 'org-capture-finalize :after 'org-save-all-org-buffers)
(advice-add 'org-capture-refile :after 'org-save-all-org-buffers)
;; latex preview settings
(setq org-preview-latex-image-directory "~/.emacs.d/org-latex-preview/") ; Hide all previews in one place
;; habits support
(require 'org-habit)
(add-to-list 'org-modules 'org-habit)
;; babel
(org-babel-do-load-languages
'org-babel-load-languages
'((R . t)))
;; org-id - link by UUID
(require 'org-id)
(setq org-id-method 'uuid
org-id-link-to-org-use-id t)
;; abbrev expansion in org-mode
(require 'org-tempo)
;; we need indentation
(setq org-startup-indented nil
org-indent-mode-turns-on-hiding-stars nil
org-hide-leading-stars nil
org-startup-folded 'content)
;; default agenda files
(setq org-agenda-files '("~/org/"))
;; default agenda view
(setq org-agenda-start-day "-3d"
org-agenda-span 13)
;; templates
(setq org-capture-templates
'(("n" "note" entry
(file+headline "~/org/inbox.org" "Notes")
"** %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n")
("t" "TODO" entry
(file+headline "~/org/inbox.org" "Tasks")
"** TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n")
("j" "Journal" entry
(file+olp+datetree "~/org/log.org.gpg")
"**** %U %?\n")
("b" "Bookmark" entry
(file+headline "~/org/bookmarks.org" "bookmarks-inbox")
"** TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n[[%x]]\n")))
;; TODO: roam config
(provide 'oxa/org)

View file

@ -1,15 +0,0 @@
;; straight.el bootstrap
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 6))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(provide 'oxa/package-mgmt)

View file

@ -1,58 +0,0 @@
;;; basic interface stuff
(menu-bar-mode 1)
(global-display-line-numbers-mode -1)
(column-number-mode 1)
(setq inhibit-startup-screen t)
(setq-default indicate-buffer-boundaries 'left)
(setq auto-save-default nil)
(setq visible-bell t)
;; (setq-default fill-column 80)
;; TODO Proper graphical setup
(add-hook 'after-make-frame-functions
#'(lambda (frame)
(toggle-scroll-bar -1)
(tool-bar-mode -1)))
;;; improvements to compilation buffer
(require 'compile)
(setq compilation-scroll-output t)
(require 'ansi-color)
(add-hook 'compilation-filter-hook 'ansi-color-compilation-filter)
;;; override default annoyances
;; I'm the only cowboy on this mainframe
;; (setq create-lockfiles nil)
;; X is dead
(setq inhibit-x-resources t)
;; use ibuffer instead of standard buffer list
(global-set-key (kbd "C-x C-b") 'ibuffer)
(fset 'yes-or-no-p 'y-or-n-p)
(setq confirm-nonexistent-file-or-buffer nil)
;; let's delete a tab as a whole...
(setq backward-delete-char-untabify-method 'nil)
;;; identation holywar contribution
(setq-default indent-tabs-mode 'nil)
;; highlight the parens
(setq show-paren-delay 0)
(show-paren-mode 1)
;; follow symlinks to version-controlled files
(setq vc-follow-symlinks t)
;; backup management
(setq backup-directory-alist `(("." . "~/.emacs.d/backups")))
(setq delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t)
;; default frame size
(add-to-list 'default-frame-alist '(height . 53))
(add-to-list 'default-frame-alist '(width . 107))
(pixel-scroll-precision-mode t)
(provide 'oxa/sane-defaults)

View file

@ -1,5 +0,0 @@
;; Macro to simplify setting mode-local vars
(defmacro oxa/hook (hook-name &rest body)
`(add-hook ',hook-name #'(lambda nil ,@body)))
(provide 'oxa/utils)

328
packages.el Normal file
View file

@ -0,0 +1,328 @@
;;; -*- lexical-binding: t -*-
(use-package savehist
:config (savehist-mode))
(use-package orderless
:straight t
:config
(setq completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((file (styles partial-completion)))))
(use-package marginalia
:straight t
:bind (:map minibuffer-local-map
("M-A" . marginalia-cycle))
:config
(marginalia-mode))
(use-package consult
:straight t
:bind (;; global binds
("C-c M-x" . consult-mode-command)
("C-c h" . consult-history)
("C-c k" . consult-kmacro)
("C-c m" . consult-man)
("C-c i" . consult-info)
("M-y" . consult-yank-pop)
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
;; goto-map
("M-g e" . consult-compile-error)
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
("M-g g" . consult-goto-line) ;; orig. goto-line
("M-g M-g" . consult-goto-line) ;; orig. goto-line
("M-g o" . consult-outline) ;; Alternative: consult-org-heading
("M-g m" . consult-mark)
("M-g k" . consult-global-mark)
("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi)
;; search map
("M-s d" . consult-find)
("M-s D" . consult-locate)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
:map minibuffer-local-map
("M-s" . consult-history)
("M-r" . consult-history))
:config
(setq consult-narrow-key "<"))
(use-package vertico
:straight t
:bind (:map vertico-map
("?" . minibuffer-completion-help)
("M-TAB" . minibuffer-complete))
:init
(vertico-mode))
(use-package emacs
:custom
(context-menu-mode 1)
(enable-recursive-minibuffers t))
(use-package org
:straight t
:bind (("C-c a" . org-agenda)
("C-c c" . org-capture)
("C-c l" . org-store-link)
:map org-mode-map
("C-c 1" . org-time-stamp-inactive))
:config
;; autosave advises for agenda and org-capture
(advice-add 'org-agenda-quit :before 'org-save-all-org-buffers)
(advice-add 'org-capture-finalize :after 'org-save-all-org-buffers)
(advice-add 'org-capture-refile :after 'org-save-all-org-buffers)
;; latex preview settings
(setq org-preview-latex-image-directory "~/.emacs.d/org-latex-preview/") ; Hide all previews in one place
;; habits support
(require 'org-habit)
(add-to-list 'org-modules 'org-habit)
;; babel
(org-babel-do-load-languages
'org-babel-load-languages
'((R . t)))
;; org-id - link by UUID
(require 'org-id)
(setq org-id-method 'uuid
org-id-link-to-org-use-id t)
;; abbrev expansion in org-mode
(require 'org-tempo)
;; we need indentation
(setq org-startup-indented nil
org-indent-mode-turns-on-hiding-stars nil
org-hide-leading-stars nil
org-startup-folded 'content)
;; default agenda files
(setq org-agenda-files '("~/org/"))
;; default agenda view
(setq org-agenda-start-day "-3d"
org-agenda-span 13)
;; templates
(setq org-capture-templates
'(("n" "note" entry
(file+headline "~/org/inbox.org" "Notes")
"** %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n")
("t" "TODO" entry
(file+headline "~/org/inbox.org" "Tasks")
"** TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n")
("j" "Journal" entry
(file+olp+datetree "~/org/log.org.gpg")
"**** %U %?\n")
("b" "Bookmark" entry
(file+headline "~/org/bookmarks.org" "bookmarks-inbox")
"** TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n[[%x]]\n"))))
(use-package tex-site
:straight auctex
:hook ((LaTeX-mode . TeX-PDF-mode)
(LaTeX-mode . reftex-mode)
(LaTeX-mode . LaTeX-math-mode))
:config
(require 'auctex)
(setq TeX-parse-self t)
(setq reftex-plug-into-AUCTeX t))
(use-package mu4e
:commands mu4e
:config
(setq mu4e-change-filenames-when-moving t)
(setq mu4e-maildir "~/mail")
(setq mu4e-update-interval (* 11 60))
(setq mu4e-contexts
(list
(make-mu4e-context
:name "oxapentane.com"
:match-func (lambda (msg)
(when msg
(string-prefix-p "/grigory@shipunov.xyz" (mu4e-message-field msg :maildir))))
:vars '((user-mail-address . "grigory@shipunov.xyz")
(user-full-name . "Grisha Shipunov")
(mu4e-drafts-folder . "/grigory@shipunov.xyz/Drafts")
(mu4e-sent-folder . "/grigory@shipunov.xyz/Sent")
(mu4e-trash-folder . "/grigory@shipunov.xyz/Trash")
(mu4e-refile-folder . "/grigory@shipunov.xyz/Archive")
(mu4e-maildir-shortcuts . (("/grigory@shipunov.xyz/INBOX" . "?i")
("/grigory@shipunov.xyz/Drafts" . "?d")
("/grigory@shipunov.xyz/Sent" . "?s")))))
(make-mu4e-context
:name "oxapentane.com"
:match-func (lambda (msg)
(when msg
(string-prefix-p "/mail@oxapentane.com" (mu4e-message-field msg :maildir))))
:vars '((user-mail-address . "mail@oxapentane.com")
(user-full-name . "Grisha Shipunov")
(mu4e-drafts-folder . "/mail@oxapentane.com/Drafts")
(mu4e-sent-folder . "/mail@oxapentane.com/Sent")
(mu4e-trash-folder . "/mail@oxapentane.com/Trash")
(mu4e-refile-folder . "/mail@oxapentane.com/Archive")
(mu4e-maildir-shortcuts . (("/mail@oxapentane.com/INBOX" . "?i")
("/mail@oxapentane.com/Drafts" . "?d")
("/mail@oxapentane.com/Sent" . "?s")
("/mail@oxapentane.com/sinkhole" . "?S"))))))))
(use-package modus-themes
:straight t
:demand t
:init
(setq modus-themes-italic-constructs t
modus-themes-bold-constructs t)
:config
(load-theme 'modus-operandi 1)
(setq-default indicate-empty-lines t)
(setq-default show-trailing-whitespace t)
(add-hook 'prog-mode-hook #'(lambda () (whitespace-mode t)))
(if (eq system-type 'gnu/linux)
(progn
;; match system theme
;; https://freerangebits.com/posts/2025/02/emacs-light-dark/
(defvar oxa:dark-theme 'modus-vivendi)
(defvar oxa:light-theme 'modus-operandi)
(defun oxa:theme-from-dbus (value)
(load-theme (if (= 1 (car (flatten-list value)))
oxa:dark-theme
oxa:light-theme)
t))
(require 'dbus)
;; Set the current theme based on what the system theme is right now:
(dbus-call-method-asynchronously
:session "org.freedesktop.portal.Desktop"
"/org/freedesktop/portal/desktop"
"org.freedesktop.portal.Settings"
"Read"
#'oxa:theme-from-dbus
"org.freedesktop.appearance"
"color-scheme")
;; Register to be notified when the system theme changes:
(dbus-register-signal
:session "org.freedesktop.portal.Desktop"
"/org/freedesktop/portal/desktop"
"org.freedesktop.portal.Settings"
"SettingChanged"
(lambda (path var value)
(when (and (string-equal path "org.freedesktop.appearance")
(string-equal var "color-scheme"))
(oxa:theme-from-dbus value)))))))
(use-package expand-region
:straight t
:bind ("C-=" . er/expand-region))
(use-package move-text
:straight t
:bind (("M-n" . move-text-down)
("M-p" . move-text-up)))
(use-package envrc
:straight t
:hook (after-init . envrc-global-mode))
(use-package magit
:straight t
:bind (("C-x g" . magit-status)
("C-x M-g" . magit-dispatch)
("C-c M-g" . magit-file-dispatch)))
(use-package dired-sidebar
:straight t
:bind (:map oxamap
("t" . dired-sidebar-toggle-sidebar))
:config
(setq dired-sidebar-theme 'ascii))
(use-package nyan-mode
:straight t
:config
(setq nyan-animate-nyancat t
nyan-wavy-trail t)
(nyan-mode 1))
(use-package company
:straight t
:config
(global-company-mode))
;; language support
(use-package nix-mode
:straight t
:init (setq nix-nixfmt-bin "nixpkgs-fmt"))
(use-package markdown-mode
:straight t)
(use-package yaml-mode
:straight t)
(use-package rust-mode
:straight t)
(use-package ess
:straight t)
(use-package cc-mode
:config
;;; Copypasta of llvm/utils/emacs/emacs.el
;; LLVM codi style guidelines in emacs
;; Maintainer: LLVM Team, http://llvm.org/
(defun llvm-lineup-statement (langelem)
(let ((in-assign (c-lineup-assignments langelem)))
(if (not in-assign)
'++
(aset in-assign 0
(+ (aref in-assign 0)
(* 2 c-basic-offset)))
in-assign)))
;; Add a cc-mode style for editing LLVM C and C++ code
(c-add-style "llvm.org"
'("gnu"
(fill-column . 80)
(c++-indent-level . 2)
(c-basic-offset . 2)
(indent-tabs-mode . nil)
(c-offsets-alist . ((arglist-intro . ++)
(innamespace . 0)
(member-init-intro . ++)
(statement-cont . llvm-lineup-statement)))))
;; Files with "llvm" in their names will automatically be set to the
;; llvm.org coding style.
(add-hook 'c-mode-common-hook
(function
(lambda nil
(if (string-match "llvm" buffer-file-name)
(progn
(c-set-style "llvm.org"))))))
(setq c-default-style '((java-mode . "java")
(awk-mode . "awk")
(c-mode . "linux")
(c++-mode . "llvm.org")
(other . "stroustrup"))))
(use-package pet
:straight t
:config
(add-hook 'python-base-mode-hook 'pet-mode -10))