mirror of
https://github.com/SqrtMinusOne/sqrtminusone.github.io.git
synced 2025-12-10 15:53:03 +03:00
upd
This commit is contained in:
parent
88ff4927f9
commit
d0070d81ee
19 changed files with 1218 additions and 427 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
||||||
org/configs/**
|
org/configs/**
|
||||||
!org/configs/publish.el
|
!org/configs/publish.el
|
||||||
|
/_data/
|
||||||
|
|
|
||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "repos/dotfiles"]
|
||||||
|
path = repos/dotfiles
|
||||||
|
url = git@github.com:SqrtMinusOne/dotfiles.git
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -4,11 +4,8 @@ author = ["Pavel"]
|
||||||
draft = false
|
draft = false
|
||||||
+++
|
+++
|
||||||
|
|
||||||
> One day we won't hate one another, no young boy will march to war and I will clean up my Emacs config. But that day isn't today.
|
\#+begin\_quote
|
||||||
|
One day we won't hate one another, no young boy will march to war and I will clean up my Emacs config. But that day isn'.
|
||||||
My [Emacs](https://www.gnu.org/software/emacs/) configuration.
|
|
||||||
|
|
||||||
As with other files in the repo, parts prefixed with (OFF) are not used but kept for historic purposes.
|
|
||||||
|
|
||||||
<div class="ox-hugo-toc toc">
|
<div class="ox-hugo-toc toc">
|
||||||
<div></div>
|
<div></div>
|
||||||
|
|
@ -89,7 +86,12 @@ As with other files in the repo, parts prefixed with (OFF) are not used but kept
|
||||||
- [<span class="org-todo done OFF">OFF</span> (OFF) Tab bar](#off--tab-bar)
|
- [<span class="org-todo done OFF">OFF</span> (OFF) Tab bar](#off--tab-bar)
|
||||||
- [Setup](#setup)
|
- [Setup](#setup)
|
||||||
- [My title](#my-title)
|
- [My title](#my-title)
|
||||||
- [Modeline](#modeline)
|
- [Doom Modeline](#doom-modeline)
|
||||||
|
- [<span class="org-todo done OFF">OFF</span> (OFF) Spaceline](#off--spaceline)
|
||||||
|
- [Perspectives](#perspectives)
|
||||||
|
- [EXWM workspace](#exwm-workspace)
|
||||||
|
- [Debug](#debug)
|
||||||
|
- [My theme](#my-theme)
|
||||||
- [Font stuff](#font-stuff)
|
- [Font stuff](#font-stuff)
|
||||||
- [Ligatures](#ligatures)
|
- [Ligatures](#ligatures)
|
||||||
- [Icons](#icons)
|
- [Icons](#icons)
|
||||||
|
|
@ -379,7 +381,8 @@ The following is true if Emacs is meant to be used with TRAMP over slow ssh. Tak
|
||||||
(setq my/slow-ssh
|
(setq my/slow-ssh
|
||||||
(or
|
(or
|
||||||
(string= (getenv "IS_TRAMP") "true")
|
(string= (getenv "IS_TRAMP") "true")
|
||||||
(string= (system-name) "dev-digital")))
|
(string= (system-name) "dev-digital")
|
||||||
|
(string= (system-name) "violet")))
|
||||||
```
|
```
|
||||||
|
|
||||||
The following is true is Emacs is ran on a remote server where I don't need stuff like my org workflow
|
The following is true is Emacs is ran on a remote server where I don't need stuff like my org workflow
|
||||||
|
|
@ -387,7 +390,8 @@ The following is true is Emacs is ran on a remote server where I don't need stuf
|
||||||
```emacs-lisp
|
```emacs-lisp
|
||||||
(setq my/remote-server
|
(setq my/remote-server
|
||||||
(or (string= (getenv "IS_REMOTE") "true")
|
(or (string= (getenv "IS_REMOTE") "true")
|
||||||
(string= (system-name) "dev-digital")))
|
(string= (system-name) "dev-digital")
|
||||||
|
(string= (system-name) "violet")))
|
||||||
```
|
```
|
||||||
|
|
||||||
And the following is true if Emacs is run from termux on Android.
|
And the following is true if Emacs is run from termux on Android.
|
||||||
|
|
@ -503,8 +507,8 @@ I have some variables which I don't commit to the repo, e.g. my current location
|
||||||
|
|
||||||
```emacs-lisp
|
```emacs-lisp
|
||||||
(let ((private-file (expand-file-name "private.el" user-emacs-directory)))
|
(let ((private-file (expand-file-name "private.el" user-emacs-directory)))
|
||||||
(when (file-exists-p private-file)
|
|
||||||
(load-file private-file)))
|
(load-file private-file))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1593,11 +1597,12 @@ References:
|
||||||
(general-imap "C-SPC" 'company-complete)
|
(general-imap "C-SPC" 'company-complete)
|
||||||
```
|
```
|
||||||
|
|
||||||
A company frontend with nice icons.
|
A company frontend with nice icons. Disabled since the base company got icons support and since company-box has some issues with spaceline.
|
||||||
|
|
||||||
```emacs-lisp
|
```emacs-lisp
|
||||||
(use-package company-box
|
(use-package company-box
|
||||||
:straight t
|
:straight t
|
||||||
|
:disabled
|
||||||
:if (and (display-graphic-p) (not my/lowpower))
|
:if (and (display-graphic-p) (not my/lowpower))
|
||||||
:after (company)
|
:after (company)
|
||||||
:hook (company-mode . company-box-mode))
|
:hook (company-mode . company-box-mode))
|
||||||
|
|
@ -1874,11 +1879,11 @@ Also, a hook allows me to change doom-theme more or less at will, although I do
|
||||||
|
|
||||||
```emacs-lisp
|
```emacs-lisp
|
||||||
(unless my/is-termux
|
(unless my/is-termux
|
||||||
(deftheme my-theme)
|
(deftheme my-theme-1)
|
||||||
|
|
||||||
(defun my/update-my-theme (&rest _)
|
(defun my/update-my-theme (&rest _)
|
||||||
(custom-theme-set-faces
|
(custom-theme-set-faces
|
||||||
'my-theme
|
'my-theme-1
|
||||||
`(tab-bar-tab ((t (
|
`(tab-bar-tab ((t (
|
||||||
:background ,(doom-color 'bg)
|
:background ,(doom-color 'bg)
|
||||||
:foreground ,(doom-color 'yellow)
|
:foreground ,(doom-color 'yellow)
|
||||||
|
|
@ -1895,12 +1900,24 @@ Also, a hook allows me to change doom-theme more or less at will, although I do
|
||||||
`(epe-pipeline-time-face ((t (:foreground ,(doom-color 'yellow)))))
|
`(epe-pipeline-time-face ((t (:foreground ,(doom-color 'yellow)))))
|
||||||
`(epe-pipeline-user-face ((t (:foreground ,(doom-color 'red)))))
|
`(epe-pipeline-user-face ((t (:foreground ,(doom-color 'red)))))
|
||||||
`(elfeed-search-tag-face ((t (:foreground ,(doom-color 'yellow)))))
|
`(elfeed-search-tag-face ((t (:foreground ,(doom-color 'yellow)))))
|
||||||
`(notmuch-wash-cited-text ((t (:foreground ,(doom-color 'yellow))))))
|
`(notmuch-wash-cited-text ((t (:foreground ,(doom-color 'yellow)))))
|
||||||
|
`(spaceline-evil-emacs ((t :background ,(doom-color 'bg)
|
||||||
|
:foreground ,(doom-color 'fg))))
|
||||||
|
`(spaceline-evil-insert ((t :background ,(doom-color 'green)
|
||||||
|
:foreground ,(doom-color 'base0))))
|
||||||
|
`(spaceline-evil-motion ((t :background ,(doom-color 'magenta)
|
||||||
|
:foreground ,(doom-color 'base0))))
|
||||||
|
`(spaceline-evil-normal ((t :background ,(doom-color 'blue)
|
||||||
|
:foreground ,(doom-color 'base0))))
|
||||||
|
`(spaceline-evil-replace ((t :background ,(doom-color 'yellow)
|
||||||
|
:foreground ,(doom-color 'base0))))
|
||||||
|
`(spaceline-evil-visual ((t :background ,(doom-color 'grey)
|
||||||
|
:foreground ,(doom-color 'base0)))))
|
||||||
(custom-theme-set-variables
|
(custom-theme-set-variables
|
||||||
'my-theme
|
'my-theme-1
|
||||||
`(aweshell-invalid-command-color ,(doom-color 'red))
|
`(aweshell-invalid-command-color ,(doom-color 'red))
|
||||||
`(aweshell-valid-command-color ,(doom-color 'green)))
|
`(aweshell-valid-command-color ,(doom-color 'green)))
|
||||||
(enable-theme 'my-theme))
|
(enable-theme 'my-theme-1))
|
||||||
|
|
||||||
(advice-add 'load-theme :after #'my/update-my-theme)
|
(advice-add 'load-theme :after #'my/update-my-theme)
|
||||||
(when (fboundp 'doom-color)
|
(when (fboundp 'doom-color)
|
||||||
|
|
@ -2082,10 +2099,12 @@ Prepend tab name with the shortened projectile project title
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Modeline {#modeline}
|
### Doom Modeline {#doom-modeline}
|
||||||
|
|
||||||
A modeline from Doom Emacs.
|
A modeline from Doom Emacs.
|
||||||
|
|
||||||
|
A big advantage of this package is that it just works out of the box and does not require much customization. For now I opted out of it in favour of spaceline because I want to have a more powerline-ish look.
|
||||||
|
|
||||||
References:
|
References:
|
||||||
|
|
||||||
- [Doom Modeline](https://github.com/seagle0128/doom-modeline)
|
- [Doom Modeline](https://github.com/seagle0128/doom-modeline)
|
||||||
|
|
@ -2095,9 +2114,12 @@ References:
|
||||||
```emacs-lisp
|
```emacs-lisp
|
||||||
(use-package doom-modeline
|
(use-package doom-modeline
|
||||||
:straight t
|
:straight t
|
||||||
|
;; :if (not (display-graphic-p))
|
||||||
:init
|
:init
|
||||||
(setq doom-modeline-env-enable-python nil)
|
(setq doom-modeline-env-enable-python nil)
|
||||||
(setq doom-modeline-env-enable-go nil)
|
(setq doom-modeline-env-enable-go nil)
|
||||||
|
(setq doom-modeline-buffer-encoding 'nondefault)
|
||||||
|
(setq doom-modeline-hud t)
|
||||||
:config
|
:config
|
||||||
(doom-modeline-mode 1)
|
(doom-modeline-mode 1)
|
||||||
(setq doom-modeline-minor-modes nil)
|
(setq doom-modeline-minor-modes nil)
|
||||||
|
|
@ -2105,6 +2127,126 @@ References:
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### <span class="org-todo done OFF">OFF</span> (OFF) Spaceline {#off--spaceline}
|
||||||
|
|
||||||
|
A modeline from Spacemacs. It provides a different look than Doom modeline, but also needs to be tuned more.
|
||||||
|
|
||||||
|
```emacs-lisp
|
||||||
|
(use-package spaceline
|
||||||
|
:straight t
|
||||||
|
:disabled
|
||||||
|
:config
|
||||||
|
<<spaceline-conf>>)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Perspectives {#perspectives}
|
||||||
|
|
||||||
|
Definining a bunch of custom powerline segments. First, a list of perspectives.
|
||||||
|
|
||||||
|
```emacs-lisp
|
||||||
|
(defun my/format-perspective-list ()
|
||||||
|
(format "[%s]"
|
||||||
|
(let ((curr (persp-current-name)))
|
||||||
|
(mapconcat
|
||||||
|
(lambda (name)
|
||||||
|
(if (string-equal name curr)
|
||||||
|
(propertize
|
||||||
|
name
|
||||||
|
'face
|
||||||
|
'persp-selected-face)
|
||||||
|
name))
|
||||||
|
(persp-names)
|
||||||
|
"|"))))
|
||||||
|
|
||||||
|
(defvar my/spaceline-persp-list "")
|
||||||
|
|
||||||
|
(defun my/persp-update-advice (&rest _)
|
||||||
|
(setq my/spaceline-persp-list (my/format-perspective-list)))
|
||||||
|
|
||||||
|
(advice-add #'persp-update-modestring :after #'my/persp-update-advice)
|
||||||
|
(add-hook 'buffer-list-update-hook #'my/persp-update-advice)
|
||||||
|
(add-hook 'find-file-hook #'my/persp-update-advice)
|
||||||
|
|
||||||
|
(spaceline-define-segment perspective
|
||||||
|
"Perspective.el"
|
||||||
|
my/spaceline-persp-list)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### EXWM workspace {#exwm-workspace}
|
||||||
|
|
||||||
|
Current EXWM workspace. The variable is being set in the EXWM config, the segment just displays it.
|
||||||
|
|
||||||
|
```emacs-lisp
|
||||||
|
(defvar my/exwm-mode-line-info-no-props "")
|
||||||
|
|
||||||
|
(spaceline-define-segment exwm
|
||||||
|
my/exwm-mode-line-info-no-props)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Debug {#debug}
|
||||||
|
|
||||||
|
Indicators for `debug-on-error` and `debug-on-quit`.
|
||||||
|
|
||||||
|
```emacs-lisp
|
||||||
|
(spaceline-define-segment debug-on-error
|
||||||
|
(when debug-on-error
|
||||||
|
(propertize
|
||||||
|
""
|
||||||
|
'face 'warning
|
||||||
|
'local-map (let ((map (make-sparse-keymap)))
|
||||||
|
(define-key map
|
||||||
|
[mode-line mouse-1]
|
||||||
|
#'toggle-debug-on-error)
|
||||||
|
map))))
|
||||||
|
|
||||||
|
(spaceline-define-segment debug-on-quit
|
||||||
|
(when debug-on-quit
|
||||||
|
(propertize
|
||||||
|
""
|
||||||
|
'face 'error
|
||||||
|
'local-map (let ((map (make-sparse-keymap)))
|
||||||
|
(define-key map
|
||||||
|
[mode-line mouse-1]
|
||||||
|
#'toggle-debug-on-quit)
|
||||||
|
map))))
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### My theme {#my-theme}
|
||||||
|
|
||||||
|
And a custom spaceline config with segments I like.
|
||||||
|
|
||||||
|
```emacs-lisp
|
||||||
|
(require 'spaceline-config)
|
||||||
|
|
||||||
|
(spaceline-compile
|
||||||
|
"my"
|
||||||
|
'((evil-state :priority 100 :face (spaceline-highlight-face-evil-state))
|
||||||
|
(buffer-modified :priority 50)
|
||||||
|
(version-control :priority 25 :when active)
|
||||||
|
(buffer-id :priority 90))
|
||||||
|
'(;; (global)
|
||||||
|
(exwm :when active)
|
||||||
|
(perspective :when active)
|
||||||
|
(flycheck-error :when active)
|
||||||
|
(flycheck-warning :when active)
|
||||||
|
(debug-on-error :when active)
|
||||||
|
(debug-on-quit :when active)
|
||||||
|
(major-mode :when active :priority 90)
|
||||||
|
(selection-info :priority 95)
|
||||||
|
(line-column :when active :priority 99)
|
||||||
|
(hud :when active :priority 99)))
|
||||||
|
|
||||||
|
(spaceline-ml-my)
|
||||||
|
|
||||||
|
(setq-default mode-line-format '("%e" (:eval (spaceline-ml-my))))
|
||||||
|
(setq mode-line-format '("%e" (:eval (spaceline-ml-my))))
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Font stuff {#font-stuff}
|
### Font stuff {#font-stuff}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -3588,7 +3730,16 @@ References:
|
||||||
`(("d" "default" plain "%?"
|
`(("d" "default" plain "%?"
|
||||||
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
|
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
|
||||||
:unnarrowed t)))
|
:unnarrowed t)))
|
||||||
(require 'org-roam-protocol))
|
(require 'org-roam-protocol)
|
||||||
|
(general-define-key
|
||||||
|
:keymaps 'org-roam-mode-map
|
||||||
|
:states '(normal)
|
||||||
|
"TAB" #'magit-section-toggle
|
||||||
|
"q" #'quit-window
|
||||||
|
"k" #'magit-section-backward
|
||||||
|
"j" #'magit-section-forward
|
||||||
|
"gr" #'revert-buffer
|
||||||
|
"RET" #'org-roam-buffer-visit-thing))
|
||||||
|
|
||||||
(my-leader-def
|
(my-leader-def
|
||||||
:infix "or"
|
:infix "or"
|
||||||
|
|
@ -4287,6 +4438,8 @@ References:
|
||||||
;; (csharp-mode . lsp)
|
;; (csharp-mode . lsp)
|
||||||
)
|
)
|
||||||
:commands lsp
|
:commands lsp
|
||||||
|
:init
|
||||||
|
(setq lsp-keymap-prefix nil)
|
||||||
:config
|
:config
|
||||||
(setq lsp-idle-delay 1)
|
(setq lsp-idle-delay 1)
|
||||||
(setq lsp-eslint-server-command '("node" "/home/pavel/.emacs.d/.cache/lsp/eslint/unzipped/extension/server/out/eslintServer.js" "--stdio"))
|
(setq lsp-eslint-server-command '("node" "/home/pavel/.emacs.d/.cache/lsp/eslint/unzipped/extension/server/out/eslintServer.js" "--stdio"))
|
||||||
|
|
@ -6259,14 +6412,14 @@ Also a function to automatically adjust these colors with the Doom theme.
|
||||||
```emacs-lisp
|
```emacs-lisp
|
||||||
(defun my/update-my-theme-elfeed (&rest _)
|
(defun my/update-my-theme-elfeed (&rest _)
|
||||||
(custom-theme-set-faces
|
(custom-theme-set-faces
|
||||||
'my-theme
|
'my-theme-1
|
||||||
`(elfeed-videos-entry ((t :foreground ,(doom-color 'red))))
|
`(elfeed-videos-entry ((t :foreground ,(doom-color 'red))))
|
||||||
`(elfeed-twitter-entry ((t :foreground ,(doom-color 'blue))))
|
`(elfeed-twitter-entry ((t :foreground ,(doom-color 'blue))))
|
||||||
`(elfeed-emacs-entry ((t :foreground ,(doom-color 'magenta))))
|
`(elfeed-emacs-entry ((t :foreground ,(doom-color 'magenta))))
|
||||||
`(elfeed-music-entry ((t :foreground ,(doom-color 'green))))
|
`(elfeed-music-entry ((t :foreground ,(doom-color 'green))))
|
||||||
`(elfeed-podcasts-entry ((t :foreground ,(doom-color 'yellow))))
|
`(elfeed-podcasts-entry ((t :foreground ,(doom-color 'yellow))))
|
||||||
`(elfeed-blogs-entry ((t :foreground ,(doom-color 'orange)))))
|
`(elfeed-blogs-entry ((t :foreground ,(doom-color 'orange)))))
|
||||||
(enable-theme 'my-theme))
|
(enable-theme 'my-theme-1))
|
||||||
|
|
||||||
(advice-add 'load-theme :after #'my/update-my-theme-elfeed)
|
(advice-add 'load-theme :after #'my/update-my-theme-elfeed)
|
||||||
(when (fboundp 'doom-color)
|
(when (fboundp 'doom-color)
|
||||||
|
|
|
||||||
|
|
@ -79,11 +79,11 @@ If you are viewing the file in Emacs, eval the following to show the pictures wi
|
||||||
|
|
||||||
### History {#history}
|
### History {#history}
|
||||||
|
|
||||||
{{< figure src="/ox-hugo/all.png" >}}
|
{{< figure src="./dot-stats/img/all.png" >}}
|
||||||
|
|
||||||
{{< figure src="/ox-hugo/emacs-vim.png" >}}
|
{{< figure src="./dot-stats/img/emacs-vim.png" >}}
|
||||||
|
|
||||||
{{< figure src="/ox-hugo/literate-config.png" >}}
|
{{< figure src="./dot-stats/img/literate-config.png" >}}
|
||||||
|
|
||||||
|
|
||||||
## Misc {#misc}
|
## Misc {#misc}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
(require 'package)
|
(require 'package)
|
||||||
|
(require 'vc)
|
||||||
|
|
||||||
(setq package-user-dir (expand-file-name "./.packages"))
|
(setq package-user-dir (expand-file-name "./.packages"))
|
||||||
|
|
||||||
|
|
@ -28,7 +29,7 @@
|
||||||
(setq org-make-toc-link-type-fn #'org-make-toc--link-entry-org)
|
(setq org-make-toc-link-type-fn #'org-make-toc--link-entry-org)
|
||||||
|
|
||||||
(setq org-hugo-section "configs")
|
(setq org-hugo-section "configs")
|
||||||
(setq org-hugo-base-dir "../../")
|
(setq org-hugo-base-dir (vc-find-root default-directory ".git"))
|
||||||
|
|
||||||
;; (setq org-hugo-export-with-toc 6)
|
;; (setq org-hugo-export-with-toc 6)
|
||||||
|
|
||||||
|
|
@ -39,10 +40,15 @@
|
||||||
"Mail.org"
|
"Mail.org"
|
||||||
"Guix.org"))
|
"Guix.org"))
|
||||||
|
|
||||||
(dolist (file my/config-files)
|
|
||||||
(copy-file (expand-file-name (format "~/%s" file)) file 'overwrite))
|
|
||||||
|
|
||||||
(copy-directory (expand-file-name "~/dot-stats/img") "dot-stats/img" t t)
|
(dolist (file my/config-files)
|
||||||
|
(copy-file (expand-file-name
|
||||||
|
(format "%s/repos/dotfiles/%s"
|
||||||
|
(vc-find-root default-directory ".git")
|
||||||
|
file))
|
||||||
|
file 'overwrite))
|
||||||
|
|
||||||
|
;; (copy-directory (expand-file-name "~/dot-stats/img") "dot-stats/img" t t)
|
||||||
|
|
||||||
(dolist (file my/config-files)
|
(dolist (file my/config-files)
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
|
|
|
||||||
|
|
@ -339,13 +339,13 @@
|
||||||
<p>If you are viewing the file in Emacs, eval the following to show the pictures with reasonable width:</p>
|
<p>If you are viewing the file in Emacs, eval the following to show the pictures with reasonable width:</p>
|
||||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-elisp" data-lang="elisp">(setq-local org-image-actual-width <span style="color:#f92672">'</span>(<span style="color:#ae81ff">1024</span>))
|
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-elisp" data-lang="elisp">(setq-local org-image-actual-width <span style="color:#f92672">'</span>(<span style="color:#ae81ff">1024</span>))
|
||||||
</code></pre></div><h3 id="history">History</h3>
|
</code></pre></div><h3 id="history">History</h3>
|
||||||
<figure><img src="/ox-hugo/all.png"/>
|
<figure><img src="./dot-stats/img/all.png"/>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
||||||
<figure><img src="/ox-hugo/emacs-vim.png"/>
|
<figure><img src="./dot-stats/img/emacs-vim.png"/>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
||||||
<figure><img src="/ox-hugo/literate-config.png"/>
|
<figure><img src="./dot-stats/img/literate-config.png"/>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
||||||
<h2 id="misc">Misc</h2>
|
<h2 id="misc">Misc</h2>
|
||||||
|
|
|
||||||
BIN
public/stats/all.png
Normal file
BIN
public/stats/all.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 118 KiB |
BIN
public/stats/emacs-vim.png
Normal file
BIN
public/stats/emacs-vim.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
BIN
public/stats/literate-config.png
Normal file
BIN
public/stats/literate-config.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
1
repos/dotfiles
Submodule
1
repos/dotfiles
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit c30062c70f8a0b7ef2454996a670ab9eb6193c86
|
||||||
58
scripts/dot-stats-get-lengths.sh
Normal file
58
scripts/dot-stats-get-lengths.sh
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
ROOT=$(git rev-parse --show-toplevel)
|
||||||
|
DOTFILES_REPO=$(git rev-parse --show-toplevel)/repos/dotfiles
|
||||||
|
DATA_ROOT=$(git rev-parse --show-toplevel)/_data
|
||||||
|
|
||||||
|
echo $ROOT
|
||||||
|
echo $DOTFILES_REPO
|
||||||
|
echo $DATA_ROOT
|
||||||
|
|
||||||
|
if [ ! -d "$ROOT/static/stats" ]; then
|
||||||
|
mkdir "$ROOT/static/stats"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$DATA_ROOT" ]; then
|
||||||
|
mkdir "$DATA_ROOT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
declare -A paths
|
||||||
|
|
||||||
|
keys=("Emacs.org" "init.el" "init.vim" "Desktop.org" "Console.org" "Mail.org" "Guix.org")
|
||||||
|
|
||||||
|
paths["Emacs.org"]="Emacs.org;.emacs.d/emacs.org;config/.emacs.d/emacs.org"
|
||||||
|
paths["init.el"]=".emacs.d/init.el;config/.emacs.d/init.el"
|
||||||
|
paths["init.vim"]=".config/nvim/init.vim;config/nvim/init.vim;nvim/init.vim"
|
||||||
|
paths["Desktop.org"]="Desktop.org"
|
||||||
|
paths["Console.org"]="Console.org"
|
||||||
|
paths["Guix.org"]="Guix.org"
|
||||||
|
paths["Mail.org"]="Mail.org"
|
||||||
|
|
||||||
|
get_lengths () {
|
||||||
|
while IFS=' ' read commit date; do
|
||||||
|
|
||||||
|
result="$commit,$date"
|
||||||
|
|
||||||
|
for key in "${keys[@]}"
|
||||||
|
do
|
||||||
|
val=0
|
||||||
|
IFS=';' read -r -a files <<< "${paths[$key]}"
|
||||||
|
for file in "${files[@]}"
|
||||||
|
do
|
||||||
|
if (( val == 0 )); then
|
||||||
|
val=$(git -C $DOTFILES_REPO show $commit:$file 2>/dev/null | wc -l || 0)
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
result+=",$val"
|
||||||
|
done
|
||||||
|
# result=${result%,*}
|
||||||
|
echo $result
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
header="commit,date"
|
||||||
|
for key in "${keys[@]}"
|
||||||
|
do
|
||||||
|
header+=",$key"
|
||||||
|
done
|
||||||
|
echo $header > $DATA_ROOT/lengths.csv
|
||||||
|
git -C $DOTFILES_REPO log --pretty="%H %cI" | get_lengths >> $DATA_ROOT/lengths.csv
|
||||||
191
scripts/dot-stats-plot-history.py
Normal file
191
scripts/dot-stats-plot-history.py
Normal file
|
|
@ -0,0 +1,191 @@
|
||||||
|
import copy
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
import matplotlib as mpl
|
||||||
|
from matplotlib import dates as mdates
|
||||||
|
from matplotlib import pyplot as plt
|
||||||
|
|
||||||
|
mpl.rcParams['figure.dpi'] = 125
|
||||||
|
mpl.rcParams['hatch.linewidth'] = 4.0
|
||||||
|
|
||||||
|
root_process = subprocess.run(
|
||||||
|
['git', 'rev-parse', '--show-toplevel'], stdout=subprocess.PIPE
|
||||||
|
)
|
||||||
|
ROOT = root_process.stdout.decode('utf-8')[:-1]
|
||||||
|
DATA = os.path.join(ROOT, 'repos', 'dotfiles', 'dot-stats', 'history.json')
|
||||||
|
PICS_ROOT = os.path.join(ROOT, 'static', 'stats')
|
||||||
|
CAT_W = 0.3
|
||||||
|
|
||||||
|
plt.style.use(os.path.join(ROOT, 'scripts', 'palenight.mplstyle'))
|
||||||
|
|
||||||
|
COLORS = {
|
||||||
|
'k': '#292d3e',
|
||||||
|
'r': '#f07178',
|
||||||
|
'g': '#c3e88d',
|
||||||
|
'y': '#ffcb6b',
|
||||||
|
'b': '#82aaff',
|
||||||
|
'm': '#c792ea',
|
||||||
|
'c': '#89ddff',
|
||||||
|
'w': '#d0d0d0',
|
||||||
|
'k-l': '#434758',
|
||||||
|
'r-l': '#ff8b92',
|
||||||
|
'g-l': '#ddffa7',
|
||||||
|
'y-l': '#ffe585',
|
||||||
|
'b-l': '#9cc4ff',
|
||||||
|
'm-l': '#e1acff',
|
||||||
|
'c-l': '#a3f7ff',
|
||||||
|
'w-l': '#ffffff'
|
||||||
|
}
|
||||||
|
|
||||||
|
with open(DATA, 'r') as f:
|
||||||
|
data_o = json.load(f)
|
||||||
|
|
||||||
|
|
||||||
|
def preprocess_data(data):
|
||||||
|
data = copy.deepcopy(data)
|
||||||
|
for category in data:
|
||||||
|
for elem in category['elements']:
|
||||||
|
for state in elem['states']:
|
||||||
|
if 'TODO' in state['startDate']:
|
||||||
|
print(f'TODO in {elem["name"]} (startDate)')
|
||||||
|
state['startDate'] = state['startDate'].replace('TODO',
|
||||||
|
'').strip()
|
||||||
|
state['startDate'] = datetime.strptime(
|
||||||
|
state['startDate'], '%Y-%m-%d'
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
if 'TODO' in state['endDate']:
|
||||||
|
print(f'TODO in {elem["name"]} (endDate)')
|
||||||
|
state['endDate'] = state['endDate'].replace('TODO',
|
||||||
|
'').strip()
|
||||||
|
state['endDate'] = datetime.strptime(
|
||||||
|
state['endDate'], '%Y-%m-%d'
|
||||||
|
)
|
||||||
|
except KeyError:
|
||||||
|
state['endDate'] = datetime.today()
|
||||||
|
try:
|
||||||
|
state['hatchColor'] = COLORS.get(
|
||||||
|
state['hatchColor'], state['hatchColor']
|
||||||
|
)
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
elem['states'].sort(key=lambda k: k['startDate'])
|
||||||
|
try:
|
||||||
|
elem['color'] = COLORS.get(elem['color'], elem['color'])
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
category['elements'].sort(key=lambda k: k['states'][0]['startDate'])
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def crop_data(data, start_date):
|
||||||
|
data = copy.deepcopy(data)
|
||||||
|
for category in data:
|
||||||
|
for elem in category['elements']:
|
||||||
|
elem['states'] = [
|
||||||
|
state
|
||||||
|
for state in elem['states'] if state['endDate'] >= start_date
|
||||||
|
]
|
||||||
|
for state in elem['states']:
|
||||||
|
if state['startDate'] <= start_date:
|
||||||
|
state['startDate'] = start_date
|
||||||
|
|
||||||
|
category['elements'] = [
|
||||||
|
element
|
||||||
|
for element in category['elements'] if len(element['states']) > 0
|
||||||
|
]
|
||||||
|
|
||||||
|
data = [category for category in data if len(category['elements']) > 0]
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def process_category(category, ax, is_last=True, notes=None):
|
||||||
|
ticks = list(range(0, -len(category['elements']), -1))
|
||||||
|
if notes is None:
|
||||||
|
notes = []
|
||||||
|
min_start_date = 10**9
|
||||||
|
for elem, k in zip(category['elements'], ticks):
|
||||||
|
for state in elem['states']:
|
||||||
|
start_date, end_date = mdates.date2num(
|
||||||
|
state['startDate']
|
||||||
|
), mdates.date2num(state['endDate'])
|
||||||
|
min_start_date = min(min_start_date, start_date)
|
||||||
|
kwargs = {}
|
||||||
|
kwargs['color'] = elem.get('color', None)
|
||||||
|
|
||||||
|
if state.get('state', None) == 'dashed':
|
||||||
|
kwargs['hatch'] = '//'
|
||||||
|
kwargs['edgecolor'] = state.get('hatchColor', 'y')
|
||||||
|
kwargs['lw'] = 0
|
||||||
|
|
||||||
|
note = state.get('note', None)
|
||||||
|
if note is not None:
|
||||||
|
notes.append(note)
|
||||||
|
stars = '*' * len(notes)
|
||||||
|
ax.text(end_date, k + CAT_W * 0.7, stars, size=15)
|
||||||
|
|
||||||
|
bars = ax.broken_barh(
|
||||||
|
[(start_date, end_date - start_date)], (k - CAT_W, CAT_W * 2),
|
||||||
|
**kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
ax.set_yticks(ticks)
|
||||||
|
ax.set_yticklabels([elem['name'] for elem in category['elements']])
|
||||||
|
ax.set_axisbelow(True)
|
||||||
|
ax.grid(True, alpha=0.25)
|
||||||
|
if not is_last:
|
||||||
|
ax.tick_params(axis='x', which='both', labelbottom=False, length=0)
|
||||||
|
else:
|
||||||
|
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m'))
|
||||||
|
|
||||||
|
return notes
|
||||||
|
|
||||||
|
|
||||||
|
def plot_notes(fig, ax, notes, x=0.9, y=0.03):
|
||||||
|
if len(notes) > 0:
|
||||||
|
notes_text = ''
|
||||||
|
for i, note in enumerate(notes):
|
||||||
|
notes_text += '*' * (i + 1) + ' ' + note + '\n'
|
||||||
|
ax.text(
|
||||||
|
x, y, notes_text, transform=fig.transFigure, va='top', ha='right'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def plot_all(data):
|
||||||
|
fig, axes = plt.subplots(
|
||||||
|
len(data),
|
||||||
|
gridspec_kw={
|
||||||
|
'height_ratios': [len(datum['elements']) for datum in data]
|
||||||
|
},
|
||||||
|
figsize=(14, 11),
|
||||||
|
sharex=True
|
||||||
|
)
|
||||||
|
notes = []
|
||||||
|
for i, [datum, ax] in enumerate(zip(data, axes)):
|
||||||
|
is_last = i == len(data) - 1
|
||||||
|
notes = process_category(datum, ax, is_last=is_last, notes=notes)
|
||||||
|
ax.yaxis.set_label_position("right")
|
||||||
|
ax.set_ylabel(datum['title'], labelpad=16, rotation=270)
|
||||||
|
plot_notes(fig, ax, notes, y=0.07, x=0.95)
|
||||||
|
# fig.tight_layout()
|
||||||
|
fig.subplots_adjust(hspace=0.15)
|
||||||
|
ax.text(
|
||||||
|
0.075,
|
||||||
|
0.06,
|
||||||
|
f'upd. {datetime.now().strftime("%Y-%m-%d")}',
|
||||||
|
transform=fig.transFigure,
|
||||||
|
va='top',
|
||||||
|
ha='left'
|
||||||
|
)
|
||||||
|
return fig
|
||||||
|
|
||||||
|
|
||||||
|
data = preprocess_data(data_o)
|
||||||
|
data = crop_data(data, datetime(2017, 1, 1))
|
||||||
|
fig = plot_all(data)
|
||||||
|
plt.tight_layout()
|
||||||
|
fig.savefig(os.path.join(PICS_ROOT, 'all.png'))
|
||||||
87
scripts/dot-stats-plot-lengths.py
Normal file
87
scripts/dot-stats-plot-lengths.py
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
import matplotlib as mpl
|
||||||
|
import numpy as np
|
||||||
|
import pandas as pd
|
||||||
|
from matplotlib import pyplot as plt
|
||||||
|
|
||||||
|
mpl.rcParams['figure.dpi'] = 125
|
||||||
|
mpl.rcParams['hatch.linewidth'] = 4.0
|
||||||
|
|
||||||
|
root_process = subprocess.run(
|
||||||
|
['git', 'rev-parse', '--show-toplevel'], stdout=subprocess.PIPE
|
||||||
|
)
|
||||||
|
ROOT = root_process.stdout.decode('utf-8')[:-1]
|
||||||
|
DATA_ROOT = os.path.join(ROOT, '_data')
|
||||||
|
PICS_ROOT = os.path.join(ROOT, 'static', 'stats')
|
||||||
|
|
||||||
|
plt.style.use(os.path.join(ROOT, 'scripts', 'palenight.mplstyle'))
|
||||||
|
|
||||||
|
|
||||||
|
def remove_zeros(data):
|
||||||
|
last = -1
|
||||||
|
result = []
|
||||||
|
for datum in data:
|
||||||
|
if last <= 0 and datum > 0:
|
||||||
|
if len(result) > 0:
|
||||||
|
result[-1] = 0
|
||||||
|
result.append(datum)
|
||||||
|
last = datum
|
||||||
|
elif last <= 0 and datum <= 0:
|
||||||
|
result.append(np.nan)
|
||||||
|
elif last > 0 and datum <= 0:
|
||||||
|
result.append(last)
|
||||||
|
else:
|
||||||
|
result.append(datum)
|
||||||
|
last = datum
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
df = pd.read_csv(os.path.join(DATA_ROOT, 'lengths.csv'), parse_dates=['date'])
|
||||||
|
files = [c for c in df.columns if c not in ['commit', 'date']]
|
||||||
|
df = df[df[files].sum(axis=1) > 0]
|
||||||
|
df = df.drop('commit', axis=1)
|
||||||
|
df = df.sort_values('date').set_index('date')
|
||||||
|
df = df.apply(
|
||||||
|
lambda col: remove_zeros(col) if col.name not in ['commit', 'date'] else col
|
||||||
|
)
|
||||||
|
|
||||||
|
# Plot Emacs vs vim
|
||||||
|
fig, ax = plt.subplots(figsize=(12, 6))
|
||||||
|
df[['Emacs.org', 'init.vim', 'init.el']].plot(ax=ax)
|
||||||
|
ax.grid(True, alpha=0.25)
|
||||||
|
ax.set_axisbelow(True)
|
||||||
|
ax.set_title('Emacs vs neovim config size growth')
|
||||||
|
ax.set_ylabel('LoC')
|
||||||
|
ax.text(
|
||||||
|
0.075,
|
||||||
|
0.08,
|
||||||
|
f'upd. {datetime.now().strftime("%Y-%m-%d")}',
|
||||||
|
transform=fig.transFigure,
|
||||||
|
va='top',
|
||||||
|
ha='left'
|
||||||
|
)
|
||||||
|
plt.tight_layout()
|
||||||
|
fig.savefig(os.path.join(PICS_ROOT, 'emacs-vim.png'))
|
||||||
|
|
||||||
|
# Plot literate configuration files
|
||||||
|
fig, ax = plt.subplots(figsize=(12, 6))
|
||||||
|
df[['Emacs.org', 'Desktop.org', 'Mail.org', 'Guix.org',
|
||||||
|
'Console.org']].plot(ax=ax)
|
||||||
|
ax.grid(True, alpha=0.25)
|
||||||
|
ax.set_axisbelow(True)
|
||||||
|
ax.set_title('Literate configuration size growth')
|
||||||
|
ax.set_ylabel('LoC')
|
||||||
|
ax.text(
|
||||||
|
0.075,
|
||||||
|
0.08,
|
||||||
|
f'upd. {datetime.now().strftime("%Y-%m-%d")}',
|
||||||
|
transform=fig.transFigure,
|
||||||
|
va='top',
|
||||||
|
ha='left'
|
||||||
|
)
|
||||||
|
plt.tight_layout()
|
||||||
|
fig.savefig(os.path.join(PICS_ROOT, 'literate-config.png'))
|
||||||
24
scripts/palenight.mplstyle
Normal file
24
scripts/palenight.mplstyle
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
### FONT
|
||||||
|
text.color: D0D0D0
|
||||||
|
|
||||||
|
### AXES
|
||||||
|
axes.facecolor: 363B52
|
||||||
|
axes.edgecolor: FFFFFF
|
||||||
|
axes.labelcolor: FFFFFF
|
||||||
|
axes.prop_cycle: cycler('color', ['f07178', 'c3e88d', 'ffcb6b', '82aaff', 'c792ea', '89ddff', 'd0d0d0', '434758', 'ff8b92', 'ddffa7', 'ffe585', '9cc4ff', 'e1acff', 'a3f7ff'])
|
||||||
|
|
||||||
|
### TICKS
|
||||||
|
xtick.color: FFFFFF
|
||||||
|
ytick.color: FFFFFF
|
||||||
|
|
||||||
|
### GRIDS
|
||||||
|
grid.color: FFFFFF
|
||||||
|
|
||||||
|
### Legend
|
||||||
|
legend.facecolor: inherit
|
||||||
|
legend.edgecolor: C792EA
|
||||||
|
|
||||||
|
### FIGURE
|
||||||
|
|
||||||
|
figure.facecolor: 292D3E
|
||||||
|
savefig.facecolor: 292D3E
|
||||||
BIN
static/stats/all.png
Normal file
BIN
static/stats/all.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 118 KiB |
BIN
static/stats/emacs-vim.png
Normal file
BIN
static/stats/emacs-vim.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
BIN
static/stats/literate-config.png
Normal file
BIN
static/stats/literate-config.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
(cd ./org/configs/ && emacs -Q --batch -l publish.el)
|
|
||||||
hugo -D
|
|
||||||
Loading…
Add table
Reference in a new issue