another bankruptcy

This commit is contained in:
Grisha Shipunov 2025-06-08 16:03:59 +02:00
parent 23a4d80ace
commit b2e3e7505c
15 changed files with 430 additions and 450 deletions

247
init.el
View file

@ -1,65 +1,112 @@
(add-to-list 'load-path "~/.emacs.d/lisp/")
;; 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)
;; compile angel
(use-package compile-angel
:when (native-comp-available-p)
:straight t
:demand t
:config
(setq compile-angel-verbose t)
(compile-angel-on-load-mode))
;;; theme
(setq modus-themes-italic-constructs t
modus-themes-bold-constructs t)
;;; basic interface stuff
(menu-bar-mode 1)
(global-display-line-numbers-mode -1)
(column-number-mode 1)
(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)))
(setq inhibit-startup-screen t)
(setq-default indicate-buffer-boundaries 'left)
(setq auto-save-default nil)
(setq visible-bell t)
;; 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))
;; TODO Proper graphical setup
(add-hook 'after-make-frame-functions
#'(lambda (frame)
(toggle-scroll-bar -1)
(tool-bar-mode -1)))
(require 'dbus)
;;; improvements to compilation buffer
(require 'compile)
(setq compilation-scroll-output t)
(require 'ansi-color)
(add-hook 'compilation-filter-hook 'ansi-color-compilation-filter)
;; 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")
;;; 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)
;; 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))))
;; 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))
(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 +117,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)
(require '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)