commit c8da36906474f5f6f82f3720b52308eb3d84c222
parent 31bfcd824bf1a53a9738a165a435c3ea6a7ded06
Author: MichaĆ M. Sapka <michal@sapka.me>
Date: Fri, 30 Jun 2023 23:38:24 +0200
feat: mail gh workflow
Diffstat:
5 files changed, 259 insertions(+), 30 deletions(-)
diff --git a/emacs/.emacs.d/.gitignore b/emacs/.emacs.d/.gitignore
@@ -3,4 +3,4 @@
!.gitignore
!init.el
!config.org
-
+!early-init.el
diff --git a/emacs/.emacs.d/config.org b/emacs/.emacs.d/config.org
@@ -8,8 +8,9 @@
- [[#package-management][Package management]]
- [[#encoding][Encoding]]
- [[#set-look-and-behavior][Set look and behavior]]
+ - [[#allow-for-diminished-mode][Allow for diminished mode]]
- [[#modus-themes-configuration][Modus themes configuration]]
- - [[#autocomplete-user-input][Autocomplete user input]]
+ - [[#auto-complete-user-input][Auto-complete user input]]
- [[#marginalia][Marginalia]]
- [[#savehist][Savehist]]
- [[#asdf][ASDF]]
@@ -18,18 +19,22 @@
- [[#tramp][Tramp]]
- [[#isearch][Isearch]]
- [[#whitespace-cycle][Whitespace cycle]]
+ - [[#spelling-autocorrect][Spelling autocorrect]]
- [[#programing][Programing]]
- [[#git][Git]]
- [[#magit][Magit]]
- [[#forge][Forge]]
- [[#git-gutter][Git gutter]]
- [[#diff][Diff]]
+ - [[#ruby][Ruby]]
+ - [[#rspec][Rspec]]
+ - [[#rubocop][Rubocop]]
- [[#flycheck][Flycheck]]
- [[#company-mode][Company mode]]
- [[#indentation][Indentation]]
- [[#ripgrep][Ripgrep]]
- [[#lsp][LSP]]
- - [[#ruby][Ruby]]
+ - [[#ruby-1][Ruby]]
- [[#using-emacs-as-a-shell][Using Emacs as a shell]]
- [[#email][Email]]
- [[#mastodon][Mastodon]]
@@ -45,9 +50,12 @@
- [[#ebooks-reading][Ebooks reading]]
- [[#org-mode][Org-mode]]
- [[#org-mode-1][Org-mode]]
+ - [[#org-agenda][Org-agenda]]
- [[#toc-mode][TOC-mode]]
- [[#babel][Babel]]
- [[#literate-calc-mode][Literate calc mode]]
+ - [[#auto-commit][auto commit]]
+ - [[#jira][jira]]
- [[#bibtex][Bibtex]]
* General configuration
@@ -59,6 +67,8 @@
** Package management
+Recently, I have migrated to Elpaca.
+
#+BEGIN_SRC emacs-lisp
(defvar elpaca-installer-version 0.4)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
@@ -137,7 +147,7 @@ Hide the UI
#+BEGIN_SRC emacs-lisp
(setq require-final-newline t)
(tool-bar-mode -1)
-(setq visible-bell nil)
+ (setq visible-bell nil)
#+END_SRC
#+RESULTS:
@@ -148,9 +158,17 @@ Show line numbers in the gutter
(global-display-line-numbers-mode)
#+END_SRC
+** Allow for diminished mode
+
+#+begin_src emacs-lisp
+ (use-package diminish)
+#+end_src
+
+#+RESULTS:
+
*** Modus themes configuration
-I use Modus themes from =Prot= with a few personalisations. Prot's work is amazing and I have yet to see such personalized theme anywhwere.
+I use Modus themes from =Prot= with a few personalizations. Prot's work is amazing and I have yet to see such personalized theme inhere.
ref: https://protesilaos.com/emacs/modus-themes
A lot of those values are taken directly from the theme's documentation.
@@ -197,9 +215,9 @@ We can use a keyboard key to switch between light and dark theme. Since my windo
(define-key global-map (kbd "<f5>") #'modus-themes-toggle)
#+end_src
-** Autocomplete user input
+** Auto-complete user input
-FIDO mode is all I need
+FIDO mode is all I need.
REF: https://michal.sapka.me/2023/input-completition-in-emacs/
#+BEGIN_SRC emacs-lisp
@@ -208,8 +226,7 @@ REF: https://michal.sapka.me/2023/input-completition-in-emacs/
** Marginalia
-Marginalia adds extra information to the autocomplete minibuffer. Looks nice, but it sees slow
-so we'll see.
+Marginalia adds extra information to the auto-complete mini-buffer. Looks nice, but it sees slow, so we'll see.
#+begin_src emacs-lisp
(use-package marginalia
@@ -228,8 +245,8 @@ so we'll see.
#+begin_src emacs-lisp
(use-package savehist
:elpaca nil
- :init
- (savehist-mode))
+ :init
+ (savehist-mode))
#+end_src
#+RESULTS:
@@ -247,8 +264,8 @@ I use ASDF as my unified version manager. It doesn't play nicely with Emacs out
I don't get Tree Sitter but it makes syntax coloring more accurate.
#+BEGIN_SRC emacs-lisp
- (use-package tree-sitter
- :elpaca t
+ (use-package tree-sitter
+ :elpaca t
:config
(global-tree-sitter-mode))
@@ -263,21 +280,21 @@ Essential package. An automatic cheat sheet for keyboard bindings.
#+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)
+ :config
+ (setq which-key-idle-delay 0.3)
+ (setq which-key-popup-type 'fame)
+ (which-key-mode)
+ (which-key-setup-side-window-bottom)
+ (set-face-attribute 'which-key-local-map-description-face nil
+ :weight 'bold)
:elpaca t)
#+END_SRC
** Tramp
#+begin_src emacs-lisp
-(require 'tramp-cache)
-(setq tramp-persistency-file-name "~/tmp/tramp.log")
+ (require 'tramp-cache)
+ (setq tramp-persistency-file-name "~/tmp/tramp.log")
#+end_src
#+RESULTS:
@@ -302,6 +319,36 @@ REF: https://www.youtube.com/watch?v=4-ubCJF9htw
#+end_src
+** Spelling autocorrect
+
+REF: https://www.youtube.com/watch?v=RtkiHW9yoG0
+
+
+#+begin_src emacs-lisp
+ (use-package ispell
+ :elpaca nil
+ :config
+ (setq ispell-disctionar "british")
+ (setq ispell-highlight-face (quote flyspel-incorrect))
+ (setq ispell-silently-savep t))
+#+end_src
+
+Auto enable flyspell
+
+#+begin_src emacs-lisp
+ (use-package flyspell
+ :elpaca nil
+ :init)
+
+ (add-hook 'message-mode-hook 'flyspell-mode)
+
+ (add-hook 'prog-mode-hook 'flyspell-prog-mode)
+
+#+end_src
+
+#+RESULTS:
+| flyspell-prog-mode |
+
* Programing
I'm a programmer by trade and passion. This part of the config may be the most expansive.
@@ -317,6 +364,8 @@ They say it's the best UI for Git. I can't disagree.
:bind ("C-x g" . magit-status)
:config
(setq magit-save-repository-buffers nil))
+
+ (add-hook 'git-commit-setup-hook 'flyspell-mode)
#+END_SRC
*** Forge
@@ -356,6 +405,45 @@ Show changed lines in the gutter
(add-to-list 'command-switch-alist '("-diff" . my/command-line-diff)))
#+end_src
+** Ruby
+
+#+begin_src emacs-lisp
+
+ (use-package ruby-mode
+ :elpaca nil
+ :config
+ (add-hook 'ruby-mode-hook
+ (lambda ()
+ (setq-local flycheck-command-wrapper-function
+ (lambda (command) (append `(,(funcall flycheck-executable-find "bundle") "exec") command)))))
+ (add-hook 'ruby-mode-hook #'rubocop-mode))
+#+end_src
+
+#+RESULTS:
+: t
+
+*** Rspec
+
+#+begin_src emacs-lisp
+ (use-package rspec-mode
+ :elpaca t)
+#+end_src
+
+#+RESULTS:
+
+*** Rubocop
+
+#+begin_src emacs-lisp
+(use-package rubocop
+ :config
+ (setq
+ rubocop-check-command "rubocop --format emacs"
+ rubocop-autocorrect-command "rubocop -A --format emacs"
+ rubocop-format-command "rubocop -x --format emacs"))
+#+end_src
+
+#+RESULTS:
+
** Flycheck
#+BEGIN_SRC emacs-lisp
@@ -442,13 +530,50 @@ A much faster Grep
** Email
+REF: https://gitlab.com/protesilaos/dotfiles/-/blob/master/emacs/.emacs.d/prot-emacs-modules/prot-emacs-email-notmuch.el
+
#+BEGIN_SRC emacs-lisp
(use-package notmuch
:elpaca t
:commands notmuch-hello
- :bind (("C-c m" . notmuch-hello)))
+ :bind (("C-c m" . notmuch-hello))
+ :config
+ (setq notmuch-hello-auto-refresh t
+ notmuch-show-all-tags-list t
+ notmuch-show-logo nil
+ notmuch-search-oldest-first nil
+ notmuch-show-empty-saved-searches nil
+ notmuch-search-line-faces
+ '(("gh-pr-todo" . ((t :foreground "#f77"))))
+ notmuch-saved-searches
+ '(( :name "Unread"
+ :query "tag:unread"
+ :sort-order newest-first)
+ ( :name "GitHub[all]"
+ :query "tag:gh"
+ :sort-order newest-first)
+ ( :name "GitHub[reviews]"
+ :query "tag:gh-pr-todo"
+ :sort-order newest-first))))
#+END_SRC
+#+begin_src emacs-lisp
+ (use-package notmuch-indicator
+ :elpaca t
+ :config
+ (notmuch-indicator-mode 1)
+ (setq notmuch-indicator-refresh-count (* 60 3)
+ notmuch-indicator-hide-empty-counters t
+ notmuch-indicator-args
+ '((:terms "tag:gh-pr-todo" :label "pr: ")
+ (:terms "tag:unread" :label "unread:")
+ ))
+ (diminish 'notmuch-indicator-mode)
+ )
+#+end_src
+
+#+RESULTS:
+
** Mastodon
You can find me at https://emacs.ch/@ms
@@ -457,8 +582,11 @@ You can find me at https://emacs.ch/@ms
(use-package mastodon
:elpaca t
:config
+
(setq mastodon-instance-url "https://emacs.ch/"
mastodon-active-user "ms"))
+
+ (add-hook 'mastodon-toot-mode-hook 'flyspell-mode)
#+END_SRC
** RSS
@@ -517,6 +645,8 @@ REF: https://michal.sapka.me/2023/elfeed-literate-config/
***** https://robert.bearblog.dev/feed/
***** https:/www.datagubbe.se/atom.xml :important:
***** https://xpil.eu/feed/
+***** https://www.zenspider.com/atom.xml
+***** https://mwl.io/blog/feed
**** Vlogs
@@ -588,16 +718,46 @@ Epub in Emacs? Why not!
* Org-mode
** Org-mode
+
+Define dirs
+
#+BEGIN_SRC emacs-lisp
- (use-package org
- :elpaca t
- :init
(setq org-directory (expand-file-name "~/org"))
(unless (file-exists-p org-directory)
(mkdir org-directory t))
- )
+
#+END_SRC
+Store datestamps for tasks done date
+
+#+begin_src emacs-lisp
+ (setq org-log-into-drawer t)
+#+end_src
+
+#+RESULTS:
+: t
+
+=return= follows links
+
+#+begin_src emacs-lisp
+ (setq org-return-follows-link t)
+#+end_src
+
+Enable flyspell
+
+#+begin_src emacs-lisp
+ (add-hook 'org-mode-hook 'flyspell-mode)
+#+end_src
+
+** Org-agenda
+
+Weeks starts on Monday
+
+#+begin_src emacs-lisp
+ (setq org-agenda-start-on-weekday 1)
+#+end_src
+
+
** TOC-mode
A cool package which adds table of contents. Ref: [[https://github.com/snosov1/toc-org][repository]]
@@ -644,15 +804,33 @@ Typing code blocks is tedious, so let's make it easier. Typing =<el<TAB>= will c
(use-package literate-calc-mode
:elpaca t)
#+end_src
-* Bibtex
-I'd love to keep bibligraphy in a managable way. Grown ups seem to agree that bibtex is the standard and it has a nice emacs plugin
+** auto commit
#+begin_src emacs-lisp
- (use-package ebib
+ (use-package git-auto-commit-mode
:elpaca t)
#+end_src
#+RESULTS:
+** jira
+
+#+begin_src emacs-lisp
+ (use-package org-jira
+ :config
+ (setq jiralib-url "https://zendesk.atlassian.net")
+ )
+#+end_src
+
+#+RESULTS:
+
+* Bibtex
+
+I'd love to keep bibliography in a manageable way. Grown ups seem to agree that bibtex is the standard and it has a nice emacs plugin
+
+#+begin_src emacs-lisp
+ (use-package ebib
+ :elpaca t)
+#+end_src
diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el
@@ -1,2 +1,21 @@
(org-babel-load-file "~/.emacs.d/config.org")
+(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.
+ '(notmuch-saved-searches
+ '((:name "inbox" :query "tag:inbox" :key "i")
+ (:name "unread" :query "tag:unread" :key "u")
+ (:name "flagged" :query "tag:flagged" :key "f")
+ (:name "sent" :query "tag:sent" :key "t")
+ (:name "drafts" :query "tag:draft" :key "d")
+ (:name "all mail" :query "*" :key "a")
+ (:name "Github[all]" :query "tag:github"))))
+(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.
+ )
diff --git a/scripts/mail-sync.sh b/scripts/mail-sync.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+killall mbsync
+
+/opt/homebrew/bin/mbsync -a
+/opt/homebrew/bin/notmuch new
+
+~/.config/scripts/notmuch-tag.sh
diff --git a/scripts/notmuch-tag.sh b/scripts/notmuch-tag.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env sh
+
+#
+# GitHub
+#
+
+notmuch tag +gh -unread -- '(from:notifications@github.com)'
+
+# Mark new review requests
+for thread in $(notmuch search --sort=oldest-first --output=threads -- "\"requested your review on\" and tag:gh and -tag:gh-pr-done"); do
+ for msg in $(notmuch search --sort=oldest-first --output=messages -- "$thread"); do
+ txt=$(notmuch show "$msg")
+
+ (echo "$txt" | grep "requested your review on") && notmuch tag +gh-pr-todo -- "$thread"
+ (echo "$txt" | grep "@michalsapka approved this pull request") && notmuch tag -gh-pr-todo -- "$thread"
+ (echo "$txt" | grep "@michalsapka requested changes on this pull request") && notmuch tag -gh-pr-todo -- "$thread"
+ (echo "$txt" | grep "Merged.*into") && notmuch tag -gh-pr-todo +gh-pr-done -- "$thread"
+ done
+done
+
+# JIRA
+notmuch tag +jira -- '(from:jira@zendesk.atlassian.net)'
+
+date >> ~/notmuch-hook-log