dotfiles

Personal dotfiles.
git clone git://vcs.sapka.me/dotfiles
Log | Files | Refs | Submodules

commit bb2b567a05947d8ac67c529b9ad39364f73921be
parent 51b360087bcc509ff68751ef0d07047771e32fe4
Author: Michał M. Sapka <michal@sapka.me>
Date:   Fri,  2 Jun 2023 17:30:51 +0200

feat: move emacs conf to org file

Diffstat:
Aemacs/.emacs.d/config.org | 338+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Memacs/.emacs.d/init.el | 289+------------------------------------------------------------------------------
2 files changed, 339 insertions(+), 288 deletions(-)

diff --git a/emacs/.emacs.d/config.org b/emacs/.emacs.d/config.org @@ -0,0 +1,338 @@ +#+TITLE: Michał Sapka's Emacs Config +#+AUTHOR: Michał Sapka +#+STARTUP: overview + +* General configuration +** Lexical binding + +#+BEGIN_SRC emacs-lisp + ;;; -*- lexical-binding: t -*- +#+END_SRC + +#+RESULTS: + +** Package management + +#+BEGIN_SRC emacs-lisp + (require 'package) + + (setq package-archives '(("melpa" . "https://melpa.org/packages/") + ("org" . "https://orgmode.org/elpa/") + ("elpa" . "https://elpa.gnu.org/packages/"))) + + (package-initialize) + (unless package-archive-contents (package-refresh-contents)) + + ;; Initialize use-package on non-Linux platforms + (unless (package-installed-p 'use-package) + (package-install 'use-package)) + + (require 'use-package) + + (use-package auto-package-update + :custom + (auto-package-update-interval 7) + (auto-package-update-prompt-before-update t) + (auto-package-update-hide-results t) + :config + (auto-package-update-maybe) + (auto-package-update-at-time "09:00")) +#+END_SRC + +** Encoding + +I want to use UTF-8 everywhere + +#+BEGIN_SRC emacs-lisp + (prefer-coding-system 'utf-8) + (set-default-coding-systems 'utf-8) + (set-language-environment "UTF-8") +#+END_SRC + +** Set look and behavior + +Hide the UI + +#+BEGIN_SRC emacs-lisp + (setq require-final-newline t) + (tool-bar-mode -1) + (setq visible-bell t) +#+END_SRC + +** Autocomplete user input + +FIDO mode is all I need + +#+BEGIN_SRC emacs-lisp + (fido-vertical-mode t) +#+END_SRC + +** ASDF + +I use ASDF as my unified version manager. It doesn't play nicely with Emacs out of the box + +#+BEGIN_SRC emacs-lisp + (add-to-list 'exec-path "~/.asdf/shims") +#+END_SRC + +** Tree sitter + +#+BEGIN_SRC emacs-lisp + (use-package tree-sitter + :ensure t + :config + ;; activate tree-sitter on any buffer containing code for which it has a parser available + (global-tree-sitter-mode) + ;; you can easily see the difference tree-sitter-hl-mode makes for python, ts or tsx + ;; by switching on and off + ;; (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode) + ) + + (use-package tree-sitter-langs + :ensure t + :after tree-sitter) +#+END_SRC + +** Which Key + +#+BEGIN_SRC emacs-lisp + (use-package which-key + :config + (setq which-key-idle-delay 0.3) + (setq which-key-popup-type 'frame) + (which-key-mode) + (which-key-setup-side-window-bottom) + (set-face-attribute 'which-key-local-map-description-face nil + :weight 'bold) + :ensure t) +#+END_SRC + +* Programing + +** Git + +*** Magit +#+BEGIN_SRC emacs-lisp + (use-package magit + :ensure t + :bind ("C-x g" . magit-status) + :config + (setq magit-save-repository-buffers nil)) +#+END_SRC + +*** Git gutter + +#+BEGIN_SRC emacs-lisp + (use-package git-gutter + :ensure t + :hook (prog-mode . git-gutter-mode) + :config + (setq git-gutter:update-interval 0.02)) +#+END_SRC + +** Flyckeck + +#+BEGIN_SRC emacs-lisp + (use-package flycheck + :ensure t + :init (global-flycheck-mode)) + + (setq flycheck-command-wrapper-function + (lambda (command) + (append '("bundle" "exec") command))) +#+END_SRC + +** Company mode + +#+BEGIN_SRC emacs-lisp + (use-package company + :after lsp-mode + :hook (prog-mode . company-mode) + ;; :bind (:map company-active-map + ;; ("<tab>" . company-complete-selection)) + ;; (:map lsp-mode-map + ;; ("<tab>" . company-indent-or-complete-common)) + :custom + (company-minimum-prefix-length 1) + (company-idle-delay 0.0) + (company-global-modes '(not org-mode))) +#+END_SRC + +** Indentation + +Yeah, force indentation + +#+BEGIN_SRC emacs-lisp + (use-package aggressive-indent + :config + (global-aggressive-indent-mode 1) + (add-to-list 'aggressive-indent-excluded-modes 'org-mode) + :ensure t) +#+END_SRC + +** Regrep + +#+BEGIN_SRC emacs-lisp + (use-package rg + :ensure t + :config + (rg-enable-default-bindings) + ) +#+END_SRC + +** LSP + +#+BEGIN_SRC emacs-lisp + (use-package lsp-mode + :init + ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l") + (setq lsp-keymap-prefix "C-c l") + :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode) + (typescriptreact-mode . lsp) + (typescript-moode . lsp) + (ruby-mode . lsp) + ;; if you want which-key integration + ) + :commands lsp) + + (use-package lsp-ltex + :ensure t + :hook (text-mode . (lambda () + (require 'lsp-ltex) + (lsp))) ; or lsp-deferred + :init + (setq lsp-ltex-version "16.0.0")) + + ;; optionally + (use-package lsp-ui :commands lsp-ui-mode) +#+END_SRC + +** Ruby + +* Using Emacs as a shell + +** Email + +#+BEGIN_SRC emacs-lisp + (use-package notmuch + :ensure t + :commands notmuch-hello + :bind (("C-c m" . notmuch-hello))) +#+END_SRC + +** Mastodon + +#+BEGIN_SRC emacs-lisp + (use-package mastodon + :ensure t + :config + (setq mastodon-instance-url "https://emacs.ch/" + mastodon-active-user "ms")) +#+END_SRC + +** RSS + +#+BEGIN_SRC emacs-lisp + (use-package elfeed + :ensure t + :config + (setq elfeed-feeds + '( + ("https://michal.sapka.me/index.xml") + + ("https://cprss.s3.amazonaws.com/rubyweekly.com.xml" engineering) + ("https://feeds.feedburner.com/digest-programming" engineering) + ("https://zendesk.engineering/feed" engineering) + ("https://shopify.engineering/blog.atom" engineering) + ("https://rss.slashdot.org/Slashdot/slashdotMain" news) + ("https://gideonwolfe.com/index.xml" blog imporant) + ("https://fabiensanglard.net/rss.xml" blog important) + ("https://grumpygamer.com/rss" blog important) + ("https://lunduke.substack.com/feed" blog) + ("https://frame.work/blog.rss" company) + ("https://lukesmith.xyz/rss.xml" blog important) + ("https://protesilaos.com/master.xml" blog) + + ("https://odysee.com/$/rss/@AlphaNerd:8" video) + ("https://odysee.com/$/rss/@DistroTube:2" video) + ("https://odysee.com/$/rss/@danwood:0" video) + ("https://odysee.com/$/rss/@SystemCrafters:e" video) + ("https://odysee.com/$/rss/@RoboNuggie:0" video) + ("https://odysee.com/$/rss/@Pine64:a" video) + ("https://odysee.com/$/rss/@jblow:0" video) + ("https://odysee.com/$/rss/@GaryHTech:0" video) + ("https://odysee.com/$/rss/@fireship:6" video) + + ("https://tilvids.com/feeds/videos.xml?videoChannelId=2775" video) ;; Veronica Explains + ("https://tilvids.com/feeds/videos.xml?videoChannelId=47" video) ;; Linux Experiment + ("https://videos.lukesmith.xyz/feeds/videos.xml?sort=-publishedAt" video important) + + ("https://world.hey.com/dhh/feed.atom" blog) + ("https://dev.37signals.com/feed/posts.xml" engineering important) + ("https://www.pine64.org/feed/" company) + + ("https://github.com/koekeishiya/yabai/releases.atom" repo) + + ("https://www.youtube.com/feeds/videos.xml?channel_id=gUCsnGwSIHyoYN0kiINAGUKx" video) ;; Wolfgang's Channel + ("https://www.youtube.com/feeds/videos.xml?channel_id=UClOGLGPOqlAiLmOvXW5lKbw" video) ;; MandaloreGaming + ("https://www.youtube.com/feeds/videos.xml?channel_id=UCNmv1Cmjm3Hk8Vc9kIgv0AQ" video) ;; Grim Beard + ("https://www.youtube.com/feeds/videos.xml?channel_id=UCEHFikgnRuLd1HYKTLrae9Q" video) ;; A Life Engineered + ("https://www.youtube.com/feeds/videos.xml?channel_id=UCJ6KZTTnkE-s2XFJJmoTAkw" video) ;; Accursed Farm + ("https://www.youtube.com/feeds/videos.xml?channel_id=UC2Xd-TjJByJyK2w1zNwY0zQ" video) ;; Beyond Fireship + ("https://www.youtube.com/feeds/videos.xml?channel_id=UC4w1YQAJMWOz4qtxinq55LQ" video) ;; Level1Techs + + ("https://www.datagubbe.se/atom.xml tech" blog important) + ("https://feeds.arstechnica.com/arstechnica/features" news) + ("https://www.theregister.com/headlines.atom" news) + ("https://jvns.ca/atom.xml" blog) + ("https://rubenerd.com/feed/" blog important) + ("https://a3nm.net/blog/feed.xml" blog) + ("https://brainbaking.com/index.xml" blog important) + ("https://www.dosgameclub.com/category/episodes/feed/" gaming) + ("https://www.zendesk.com/public/assets/sitemaps/en/feed.xml" company) + ("https://bt.ht/atom.xml" blog) + ("https://robert.bearblog.dev/feed/" blog) + ("https://susam.net/blog/feed.xml" blog) + ("https://josem.co//articles/index.xml" blog) + ("https://pragmaticemacs.wordpress.com/feed/" blog emacs) + )) + (defface important-elfeed-entry + '((t :foreground "#f77")) + "Marks an important Elfeed entry." + :group 'elfeed) + + (defface nonimportant-elfeed-entry + '((t :foreground "#C0C0C0")) + "Marks an nonimportant Elfeed entry." + :group 'elfeed) + + (push '(important important-elfeed-entry) + elfeed-search-face-alist) + (push '(company nonimportant-elfeed-entry) + elfeed-search-face-alist) + (push '(news nonimportant-elfeed-entry) + elfeed-search-face-alist) + + ) +#+END_SRC + +** Ebooks reading + +#+BEGIN_SRC emacs-lisp + (use-package nov + :config + (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)) + ) +#+END_SRC + +* Org-mode + +#+BEGIN_SRC emacs-lisp + (use-package org + :ensure t + :init + (setq org-directory (expand-file-name "~/org")) + (unless (file-exists-p org-directory) + (mkdir org-directory t)) + ) +#+END_SRC diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el @@ -1,288 +1 @@ -;;; init.el --- -*- lexical-binding: t -*- -;;;; Commentary: - -;;;; Code: -(prefer-coding-system 'utf-8) -(set-default-coding-systems 'utf-8) -(set-language-environment "UTF-8") - -(defvar linux-p (eq system-type 'gnu/linux) "Non-nil if using Linux, nil otherwise.") -(defvar macosx-p (eq system-type 'darwin) "Non-nil if using Mac OS X, nil otherwise.") -(defvar mswindows-p (eq system-type 'windows-nt) "Non-nil if using windows, nil otherwise.") - -(setq require-final-newline t) - -(tool-bar-mode -1) -(setq visible-bell t) - -(autoload 'notmuch "notmuch" "notmuch mail" t) - -(global-display-line-numbers-mode) - -;; Initialize package sources -(require 'package) - -(setq package-archives '(("melpa" . "https://melpa.org/packages/") - ("org" . "https://orgmode.org/elpa/") - ("elpa" . "https://elpa.gnu.org/packages/"))) - -(package-initialize) -(unless package-archive-contents - (package-refresh-contents)) - -;; Initialize use-package on non-Linux platforms -(unless (package-installed-p 'use-package) - (package-install 'use-package)) - -(require 'use-package) - -;; rg -(use-package rg - :ensure t - :config - (rg-enable-default-bindings) -) - -;; qASDF -(add-to-list 'exec-path "~/.asdf/shims") - -;; LSP -(use-package lsp-mode - :init - ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l") - (setq lsp-keymap-prefix "C-c l") - :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode) - (typescriptreact-mode . lsp) - (typescript-moode . lsp) - (ruby-mode . lsp) - ;; if you want which-key integration - ) - :commands lsp) - -(use-package lsp-ltex - :ensure t - :hook (text-mode . (lambda () - (require 'lsp-ltex) - (lsp))) ; or lsp-deferred - :init - (setq lsp-ltex-version "16.0.0")) - -;; optionally -;;(use-package lsp-ui :commands lsp-ui-mode) -;; if you are helm user -;;(use-package helm-lsp :commands helm-lsp-workspace-symbol) -;; if you are ivy user -;;(use-package lsp-ivy :commands lsp-ivy-workspace-symbol) -(use-package lsp-treemacs :commands lsp-treemacs-errors-list) - -;; optionally if you want to use debugger -;;(use-package dap-mode) -;; (use-package dap-LANGUAGE) to load the dap adapter for your language - -;; General life improvements -(use-package which-key - :ensure t - :config - (which-key-setup-side-window-bottom) - (which-key-mode)) - -;; Treesitter -(use-package tree-sitter - :ensure t - :config - ;; activate tree-sitter on any buffer containing code for which it has a parser available - (global-tree-sitter-mode) - ;; you can easily see the difference tree-sitter-hl-mode makes for python, ts or tsx - ;; by switching on and off - (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)) - -(use-package tree-sitter-langs - :ensure t - :after tree-sitter) - -;; Flychekck -(use-package flycheck - :ensure t - :init (global-flycheck-mode)) - -(setq flycheck-command-wrapper-function - (lambda (command) - (append '("bundle" "exec") command))) - -;; Company mode -(use-package company - :after lsp-mode - :hook (prog-mode . company-mode) - :bind (:map company-active-map - ("<tab>" . company-complete-selection)) - (:map lsp-mode-map - ("<tab>" . company-indent-or-complete-common)) - :custom - (company-minimum-prefix-length 1) - (company-idle-delay 0.0) - (company-global-modes '(not org-mode))) - -;; Email -(use-package notmuch - :ensure t - :commands notmuch-hello - :bind (("C-c m" . notmuch-hello))) - -;; Blogging -(use-package ox-hugo - :ensure t - :after ox) - -;; IRC -(use-package circe - :ensure t - :config - (require 'circe-lagmon) - (ignore-errors - (require 'circe-rainbow) - (require 'circe-probe)) - (require 'circe-color-nicks) - (require 'circe-new-day-notifier) - (require 'lui-irc-colors) - (setq circe-default-realname "https://d-s.sh" - circe-default-user "d-s" - circe-ignore-list nil - circe-server-coding-system '(utf-8 . undecided) - lui-max-buffer-size 30000 - lui-flyspell-p t - lui-flyspell-alist '(("." "american")) - circe-network-options '(("AfterNET" :host "irc.afternet.org" :port (6697 . 9998) - :nick "d-s" - :tls t - :channels ("#dosgameclub") - ))) - (enable-lui-track-bar) - (enable-circe-color-nicks) - (add-hook 'circe-chat-mode-hook 'my-circe-prompt) - (defun my-circe-prompt () - (lui-set-prompt - (concat (propertize (concat (buffer-name) ">") - 'face 'circe-prompt-face) - " ")))) - -;; Music -(use-package bongo - :ensure t) - -;; Git - -(use-package magit - :ensure t - :bind ("C-x g" . magit-status)) - - -(use-package git-gutter+ - :ensure t - :diminish git-gutter+-mode - :commands (git-gutter+-mode) - :config - (setq git-gutter+-hide-gutter nil)) -(setq-default indent-tabs-mode nil) - -(use-package org - :ensure t) - -(use-package nov) -(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)) - -(use-package elfeed - :ensure t - :config - (setq elfeed-feeds - '( - ("https://cprss.s3.amazonaws.com/rubyweekly.com.xml" engineering) - ("https://feeds.feedburner.com/digest-programming" engineering) - ("https://zendesk.engineering/feed" engineering) - ("https://shopify.engineering/blog.atom" engineering) - ("https://rss.slashdot.org/Slashdot/slashdotMain" news) - ("https://gideonwolfe.com/index.xml" blog imporant) - ("https://fabiensanglard.net/rss.xml" blog important) - ("https://grumpygamer.com/rss" blog important) - ("https://lunduke.substack.com/feed" blog) - ("https://frame.work/blog.rss" company) - ("https://lukesmith.xyz/rss.xml" blog important) - ("https://protesilaos.com/master.xml" blog) - - ("https://odysee.com/$/rss/@AlphaNerd:8" video) - ("https://odysee.com/$/rss/@DistroTube:2" video) - ("https://odysee.com/$/rss/@danwood:0" video) - ("https://odysee.com/$/rss/@SystemCrafters:e" video) - ("https://odysee.com/$/rss/@RoboNuggie:0" video) - ("https://odysee.com/$/rss/@Pine64:a" video) - ("https://odysee.com/$/rss/@jblow:0" video) - ("https://odysee.com/$/rss/@GaryHTech:0" video) - ("https://odysee.com/$/rss/@fireship:6" video) - - ("https://tilvids.com/feeds/videos.xml?videoChannelId=2775" video) ;; Veronica Explains - ("https://tilvids.com/feeds/videos.xml?videoChannelId=47" video) ;; Linux Experiment - ("https://videos.lukesmith.xyz/feeds/videos.xml?sort=-publishedAt" video important) - - ("https://world.hey.com/dhh/feed.atom" blog) - ("https://dev.37signals.com/feed/posts.xml" engineering important) - ("https://www.pine64.org/feed/" company) - - ("https://github.com/koekeishiya/yabai/releases.atom" repo) - - ("https://www.youtube.com/feeds/videos.xml?channel_id=gUCsnGwSIHyoYN0kiINAGUKx" video) ;; Wolfgang's Channel - ("https://www.youtube.com/feeds/videos.xml?channel_id=UClOGLGPOqlAiLmOvXW5lKbw" video) ;; MandaloreGaming - ("https://www.youtube.com/feeds/videos.xml?channel_id=UCNmv1Cmjm3Hk8Vc9kIgv0AQ" video) ;; Grim Beard - ("https://www.youtube.com/feeds/videos.xml?channel_id=UCEHFikgnRuLd1HYKTLrae9Q" video) ;; A Life Engineered - ("https://www.youtube.com/feeds/videos.xml?channel_id=UCJ6KZTTnkE-s2XFJJmoTAkw" video) ;; Accursed Farm - ("https://www.youtube.com/feeds/videos.xml?channel_id=UC2Xd-TjJByJyK2w1zNwY0zQ" video) ;; Beyond Fireship - ("https://www.youtube.com/feeds/videos.xml?channel_id=UC4w1YQAJMWOz4qtxinq55LQ" video) ;; Level1Techs - - ("https://www.datagubbe.se/atom.xml tech" blog important) - ("https://feeds.arstechnica.com/arstechnica/features" news) - ("https://www.theregister.com/headlines.atom" news) - ("https://jvns.ca/atom.xml" blog) - ("https://rubenerd.com/feed/" blog important) - ("https://a3nm.net/blog/feed.xml" blog) - ("https://brainbaking.com/index.xml" blog important) - ("https://www.dosgameclub.com/category/episodes/feed/" gaming) - ("https://www.zendesk.com/public/assets/sitemaps/en/feed.xml" company) - ("https://bt.ht/atom.xml" blog) - ("https://robert.bearblog.dev/feed/" blog) - ("https://susam.net/blog/feed.xml" blog) - ("https://josem.co//articles/index.xml" blog) - ("https://pragmaticemacs.wordpress.com/feed/" blog emacs) - )) - (defface important-elfeed-entry - '((t :foreground "#f77")) - "Marks an important Elfeed entry." - :group 'elfeed) - - (defface nonimportant-elfeed-entry - '((t :foreground "#C0C0C0")) - "Marks an nonimportant Elfeed entry." - :group 'elfeed) - - (push '(important important-elfeed-entry) - elfeed-search-face-alist) - (push '(company nonimportant-elfeed-entry) - elfeed-search-face-alist) - (push '(news nonimportant-elfeed-entry) - elfeed-search-face-alist) - - ) - -(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. - '(package-selected-packages - '(slack ox-hugo org-roam lsp-ltex company typescript-mode tree-sitter-langs tree-sitter company-nmode asdf lsp-treemacs lsp-ivy lsp-ui lsp-mode which-key fido bongo magit circe nov notmuch git-gutter+ robe use-package)) - '(warning-suppress-log-types '((use-package)))) -(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. - ) - -;;; init.el ends here +(org-babel-load-file "~/.emacs.d/config.org")