zero/home-environments/radio/files/.config/emacs/init.el

313 lines
12 KiB
EmacsLisp

;; Who am I?
(setq user-full-name "Luis Guilherme Coelho"
user-email-address "lgcoelho@disroot.org"
copyright-names-regexp (format "%s <%s>"
user-full-name
user-mail-address))
(load-file "~/projects/code/scm/guix/etc/copyright.el")
;; Emacs directories
(setq user-emacs-directory "~/.config/emacs")
;; Organizing backups
(setq backup-directory-alist
'(("." . "~/.local/share/emacs/saves")))
;; Emacs load path
(add-to-list 'load-path
"~/.guix-home/profile/share/emacs/site-lisp")
(setq-default buffer-file-coding-system
'utf-8-unix)
;; Garbage collection
(setq gc-cons-threshold (* 50 1000 1000))
;; No more tabs
(setq-default indent-line-function 'insert-tab
indent-tabs-mode nil)
;; Profile emacs startup
(add-hook 'emacs-startup-hook
(lambda () (message
"*:** Emacs loaded in %s seconds with %d garbage collections."
(emacs-init-time "%.2f")
gcs-done)))
;; Disable compiler and large file warnings
(setq native-comp-async-report-warnings-errors nil
large-file-warning-threshold nil)
;; Remove start message and scratch message
(setq inhibit-startup-message t
initial-scratch-message nil)
;; Enable some minor modes globally
(dolist (mode '(server-mode ; Emacs server
savehist-mode ; Command history
column-number-mode ; Cursor column number
global-prettify-symbols-mode ; Pretty symbols
delete-selection-mode)) ; Normal selection behavior
(funcall mode 1))
;; Disable some minor modes globally
(dolist (mode '(tool-bar-mode menu-bar-mode ; Menus
scroll-bar-mode ; Scroll-bar
tooltip-mode ; Tooltip
indent-tabs-mode ; Tabs
blink-cursor-mode ; Cursor
fringe-mode)) ; Fringe
(funcall mode 0))
;; Line numbers settings
(setq display-line-numbers-type 'relative
display-line-numbers-current-absolute t
display-line-numbers-grow-only t
display-line-numbers-width-start t)
;; Display whitespaces
(setq-default fill-column 80)
(setq whitespace-display-mappings
'((space-mark ?\ [?⋅] [?.])
(space-mark ?\xA0 [?⋅] [?_])
(newline-mark ?\n [ ?\n] [?$ ?\n])
(tab-mark ?\t [ ?\t] [?\\ ?\t])))
(dolist (mode '(text-mode-hook
prog-mode-hook
conf-mode-hook))
(add-hook mode (lambda ()
(setq display-line-numbers-witdth
(length (format "%s" (count-lines (point-max)
(point-min)))))
(dolist (mode '(display-line-numbers-mode
rainbow-delimiters-mode
display-fill-column-indicator-mode
whitespace-mode))
(funcall mode 1)))))
(add-hook 'org-mode-hook
(lambda ()
(dolist (mode '(whitespace-mode
display-fill-column-indicator-mode))
(funcall mode 0))
(setq org-pretty-entities t)))
;; Aesthetics
(load-theme 'meimuna t)
(setq cursor-type 'box)
;; Smooth scroll
(setq scroll-step 1)
;; Please never show me a dialog box again
(setq use-dialog-box nil)
;; IRC
(setq circe-nick "anemofilia")
(setq circe-channels
'("#emacs" "#gnu" "#guile" "#guix" "#libreboot" "#spritely"))
(require 'meow)
(defun meow-setup ()
(setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty)
(apply 'meow-motion-overwrite-define-key
'(("j" . meow-next)
("k" . meow-prev)
("<escape>" . ignore)))
(apply 'meow-leader-define-key
'(;; SPC j/k will run the original command in MOTION state.
("j" . "H-j")
("k" . "H-k")
;; Use SPC (0-9) for digit arguments.
("1" . meow-digit-argument)
("2" . meow-digit-argument)
("3" . meow-digit-argument)
("4" . meow-digit-argument)
("5" . meow-digit-argument)
("6" . meow-digit-argument)
("7" . meow-digit-argument)
("8" . meow-digit-argument)
("9" . meow-digit-argument)
("0" . meow-digit-argument)
("/" . meow-keypad-describe-key)
("?" . meow-cheatsheet)))
(apply 'meow-normal-define-key
'(("0" . meow-expand-0)
("9" . meow-expand-9)
("8" . meow-expand-8)
("7" . meow-expand-7)
("6" . meow-expand-6)
("5" . meow-expand-5)
("4" . meow-expand-4)
("3" . meow-expand-3)
("2" . meow-expand-2)
("1" . meow-expand-1)
("-" . negative-argument)
(";" . meow-reverse)
("," . meow-inner-of-thing)
("." . meow-bounds-of-thing)
("[" . meow-beginning-of-thing)
("]" . meow-end-of-thing)
("a" . meow-append)
("A" . meow-open-below)
("b" . meow-back-word)
("B" . meow-back-symbol)
("c" . meow-change)
("d" . meow-delete)
("D" . meow-backward-delete)
("e" . meow-next-word)
("E" . meow-next-symbol)
("f" . meow-find)
("g" . meow-cancel-selection)
("G" . meow-grab)
("h" . meow-left)
("H" . meow-left-expand)
("i" . meow-insert)
("I" . meow-open-above)
("j" . meow-next)
("J" . meow-next-expand)
("k" . meow-prev)
("K" . meow-prev-expand)
("l" . meow-right)
("L" . meow-right-expand)
("m" . meow-join)
("n" . meow-search)
("o" . meow-block)
("O" . meow-to-block)
("p" . meow-yank)
("q" . meow-quit)
("Q" . meow-goto-line)
("r" . meow-replace)
("R" . meow-swap-grab)
("s" . meow-kill)
("t" . meow-till)
("u" . meow-undo)
("U" . meow-undo-in-selection)
("v" . meow-visit)
("w" . meow-mark-word)
("W" . meow-mark-symbol)
("x" . meow-line)
("X" . meow-goto-line)
("y" . meow-save)
("Y" . meow-sync-grab)
("z" . meow-pop-selection)
("'" . repeat)
("<escape>" . ignore))))
(meow-setup)
(meow-global-mode)
;(require 'setup)
;(setup-define :pkg
; (lambda (feature-or-package)
; `(unless (locate-file ,(symbol-name feature-or-package)
; load-path
; (get-load-suffixes))
; (:package ',feature-or-package)))
; :documentation "Install PACKAGE if it is not available locally.
;This macro can be used as NAME, and it will replace itself with
;the first PACKAGE."
; :repeatable t
; :shorthand #'cadr)
;
;(setup-define :disabled
; (lambda () `,(setup-quit))
; :documentation "Always stop evaluating the body.")
;
;(setup-define :load-after
; (lambda (features &rest body)
; (let ((body `(progn
; (require ',(setup-get 'feature))
; ,@body)))
; (dolist (feature (if (listp features)
; (nreverse features)
; (list features)))
; (setq body `(with-eval-after-load ',feature ,body)))
; body))
; :documentation "Load the current feature after FEATURES."
; :indent 1)
;
;(setup-define :file-match
; (lambda (regexp)
; `(add-to-list 'auto-mode-alist (cons ,regexp ',(setup-get 'mode))))
; :documentation "Associate the current mode with files that match REGEXP."
; :debug '(form)
; :repeatable t)
;
;(setup-define :leader
; (lambda (&rest args)
; `(with-eval-after-load 'general
; (general-define-key ,@args
; :states 'normal
; :keymaps 'override
; :prefix "SPC"
; :global-prefix "C-SPC")))
; :documentation "Define a leader keybind"
; :debug '(form)
; :indent 0)
;
;(setup-define :local-leader
; (lambda (&rest args)
; `(with-eval-after-load 'general
; (let ((map ',(setup-get 'map)))
; (general-define-key ,@args
; :states 'normal
; :keymaps map
; :prefix "SPC m"
; :global-prefix "C-SPC m"))))
; :documentation "Define a local leader keybind"
; :debug '(form)
; :indent 0)
;
;(setup-define :ignore-buffers
; (lambda (&rest buffers)
; `(setq ignored-buffers (append ignored-buffers ',buffers)))
; :documentation "Ignore buffers")
;
;(setup-define :display-rule
; (lambda (condition &rest actions)
; `(add-to-list 'display-buffer-alist '(,condition . ,actions)))
; :documentation "Add to display buffer alist")
;
;(setup (:pkg kakoune)
; (:option ryo-modal-cursor-type 'box
; ryo-modal-cursor-color "#8581E0")
; (:global "<escape>"
; (lambda ()
; (interactive)
; (if (minibufferp)
; (keyboard-escape-quit)
; (ryo-modal-mode))))
; (kakoune-setup-keybinds)
; (ryo-modal-keys
; ("M-s" mc/split-region)))
;:
;;; Use a real file manager
;(setup (:pkg dirvish)
; (:hook hl-line-mode)
; (:option dirvish-attributes nil
; dirvish-listing-switches '(--group-directories-first --classify))
; ;'(vc-state subtree-state all-the-icons collapse git-msg file-time file-size))
; (dirvish-override-dired-mode))
;
;(setup (:pkg org-bullets org-present org-roam org-modern))
;(setup (:pkg elfeed elfeed-org))
;(setup (:pkg geiser geiser-guile macrostep-geiser))
;(setup (:pkg cape corfu corfu-doc consult-lsp vertico orderless))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes '(meimuna))
'(custom-safe-themes
'("5df271e8c563dcd5b7be07ab5b5a615567b20a36b7c748475df0bb512332f0e1" "c202b7618764218b8ecb21a13c5dc9b318f0879f54105847fa5e1868afb19369" "044d60490c760e63bd39232445702271257a47ab384a3871649ea03a3d2b430a" "322a73057be183963dcd4fbfaa859e636fc8aa5f76f2a24f32a8ee5cc73be484" "671f76d55e2917bcae38168c2363fc21a335683583543b3fe49018cf5542908d" "f2db82bef0fb3e3922053605326d82b3e6494aed5c938440358710e9b78da7d9" "47263df55a6df473a5b9ba13107523f285db25dbbfd793ed5beaf47b7ec11c8e" "452da09d018e5f7bffa1e293c224c8711aa37dc9e7dd1dce24c9be6a0f6067c3" "f2c28b88fc49c9577269afcfdbf4630135c2bc2a4813f379c9a8a3979953e706" "38d107472028475f6d47938a91abf170587b718f4ca84f258ea8d72babe25201" "12bd9d840d3e0f54c607ca63acca59b083eca3cb18b9e5c7b34dfb6a400eaf4b" default))
'(package-selected-packages
'(eat mines setup kakoune magit-popup edit-indirect bui geiser-guile auctex))
'(whitespace-style
'(face trailing tabs spaces lines lines-tail lines-char newline missing-newline-at-eof empty indentation::tab indentation::space indentation big-indent space-after-tab::tab space-after-tab::space space-after-tab space-before-tab::tab space-before-tab::space space-before-tab space-mark tab-mark newline-mark)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(whitespace-line ((t nil))))