diff --git a/content/configs/Console.md b/content/configs/Console.md index 672c7aa..42884da 100644 --- a/content/configs/Console.md +++ b/content/configs/Console.md @@ -17,7 +17,6 @@ draft = false # export BROWSER=/usr/bin/firefox export QT_QPA_PLATFORMTHEME="qt5ct" export QT_AUTO_SCREEN_SCALE_FACTOR=0 -export TZ="Asia/Yekaterinburg" # export GTK2_RC_FILES="$HOME/.gtkrc-2.0" ``` diff --git a/content/configs/Console.md~ b/content/configs/Console.md~ index d0dc47e..672c7aa 100644 --- a/content/configs/Console.md~ +++ b/content/configs/Console.md~ @@ -937,7 +937,7 @@ fi ``` -### `autocommmit` {#autocommmit} +### `autocommit` {#autocommit} A script to autocommit files in a repository. I use it to sync my org directory and password store. I guess it's not how git is intended to be used, but it works for me. diff --git a/content/configs/Desktop.md b/content/configs/Desktop.md index b062752..166d31d 100644 --- a/content/configs/Desktop.md +++ b/content/configs/Desktop.md @@ -68,6 +68,7 @@ Parts prefixed with (OFF) are not used, but kept for historic purposes. For some - [Scripts](#scripts) - [Buku bookmarks](#buku-bookmarks) - [Man pages](#man-pages) + - [pass](#pass) - [Flameshot](#flameshot) - [dunst](#dunst) - [keynav](#keynav) @@ -576,7 +577,7 @@ bindsym $mod+Shift+g mode "outer gaps" A more or less standard set of keybindings to move & resize floating windows. -Just be careful to always make a way to return from these new modes, otherwise, you'd end up in a rather precarious position. +Just be careful to always make a way to return from these new modes, otherwise you'd end up in a rather precarious situation. ```vim # resize window (you can also use the mouse for that) @@ -665,6 +666,7 @@ Keybindings to launch [rofi](https://github.com/davatorium/rofi). For more detai ```vim bindsym $mod+d exec "rofi -modi 'drun,run' -show drun" bindsym $mod+b exec --no-startup-id rofi-buku-mine +bindsym $mod+minus exec rofi-pass; mode default bindsym $mod+apostrophe mode "rofi" @@ -672,7 +674,7 @@ mode "rofi" { bindsym d exec "rofi -modi 'drun,run' -show drun" bindsym m exec rofi-man; mode default bindsym b exec rofi-buku-mine; mode default - bindsym k exec rofi-keepassxc -d ~/MEGAsync/Passwords.kdbx; mode default + bindsym k exec rofi-pass; mode default bindsym Escape mode "default" } ``` @@ -936,7 +938,7 @@ declare -A BLOCKS=( ) # Geolocation for some modules -export LOC="TMN" +export LOC="SPB" export IPSTACK_API_KEY=$(pass show My_Online/APIs/ipstack | head -n 1) @@ -1713,6 +1715,23 @@ fi ``` +#### pass {#pass} + +| Guix dependency | +|-----------------| +| rofi-pass | +| xset | + +A nice [pass frontend for Rofi](https://github.com/carnager/rofi-pass), which is even packaged for Guix. + +```bash +USERNAME_field='username' +EDITOR=vim +default_autotype='username :tab pass' +clip=both +``` + + ## Flameshot {#flameshot} | Guix dependency | @@ -1813,7 +1832,7 @@ References: # Show how many messages are currently hidden (because of geometry). indicate_hidden = yes - # Shrink window if it's smaller than the width. Will be ignored if + # Shrink window if its smaller than the width. Will be ignored if # width is 0. shrink = no @@ -2347,6 +2366,10 @@ This section generates manifests for various desktop software that I'm using. | dev | openjdk | | dev | go | | dev | gcc-toolchain | +| dev | lua | +| dev | libfaketime | +| dev | hugo-extended | +| dev | make | ### Manifests {#manifests} @@ -2731,6 +2754,8 @@ Other desktop programs I use are listed below. | fontconfig | | | polkit-gnome | Polkit authentication agent | | anydesk | Remote desktop software | +| gnome-disk-utility | Manage disks | +| gparted | Manage partitions | ```emacs-lisp diff --git a/content/configs/Emacs.md b/content/configs/Emacs.md index 62ce64a..b3142cc 100644 --- a/content/configs/Emacs.md +++ b/content/configs/Emacs.md @@ -19,15 +19,16 @@ As with other files in the repo, parts prefixed with (OFF) are not used but kept - [Measure startup speed](#measure-startup-speed) - [straight.el](#straight-dot-el) - [use-package](#use-package) + - [config variants & environment](#config-variants-and-environment) - [Performance](#performance) - [Garbage collection](#garbage-collection) - [Run garbage collection when Emacs is unfocused](#run-garbage-collection-when-emacs-is-unfocused) - - [Misc](#misc) - [Native compilation](#native-compilation) - - [Anaconda & environment](#anaconda-and-environment) + - [Anaconda](#anaconda) - [Custom file location](#custom-file-location) - [Private config](#private-config) - [No littering](#no-littering) + - [Prevent Emacs from closing](#prevent-emacs-from-closing) - [Global editing configuration](#global-editing-configuration) - [General keybindings stuff](#general-keybindings-stuff) - [general.el](#general-dot-el) @@ -150,7 +151,9 @@ As with other files in the repo, parts prefixed with (OFF) are not used but kept - [Keybindings & stuff](#keybindings-and-stuff) - [Copy a link](#copy-a-link) - [Presentations](#presentations) - - [TOC](#toc) + - [Tools](#tools) + - [TOC](#toc) + - [Screenshots](#screenshots) - [System configuration](#system-configuration) - [Tables for Guix Dependencies](#tables-for-guix-dependencies) - [Noweb evaluations](#noweb-evaluations) @@ -171,7 +174,7 @@ As with other files in the repo, parts prefixed with (OFF) are not used but kept - [OFF (OFF) Code Compass](#off--code-compass) - [Dependencies](#dependencies) - [Plugin](#plugin) - - [CHECK (OFF) Format-all](#off--format-all) + - [Reformatter](#reformatter) - [General additional config](#general-additional-config) - [Web development](#web-development) - [Emmet](#emmet) @@ -225,7 +228,9 @@ As with other files in the repo, parts prefixed with (OFF) are not used but kept - [fish](#fish) - [sh](#sh) - [Haskell](#haskell) + - [Lua](#lua) - [JSON](#json) + - [SQL](#sql) - [YAML](#yaml) - [.env](#dot-env) - [CSV](#csv) @@ -342,6 +347,56 @@ References: ``` +### config variants & environment {#config-variants-and-environment} + +The following variable is true when my machine is not powerful enough for some resource-heavy packages. + +```emacs-lisp +(setq my/lowpower (string= (system-name) "azure")) +``` + +The following is true if Emacs is meant to be used with TRAMP over slow ssh. + +```emacs-lisp +(setq my/slow-ssh + (or + (string= (getenv "IS_TRAMP") "true") + (string= (system-name) "dev-digital"))) +``` + +The following is true is Emacs is ran on a remote server where I don't need stuff like my org workflow + +```emacs-lisp +(setq my/remote-server + (or (string= (getenv "IS_REMOTE") "true") + (string= (system-name) "dev-digital"))) +``` + +And the following is true if Emacs is run from termux on Android. + +```emacs-lisp +(setq my/is-termux (string-match-p (rx (* nonl) "com.termux" (* nonl)) (getenv "HOME"))) +``` + +Also, I sometimes need to know if a program is running inside Emacs (say, inside a terminal emulator). To do that, I set the following environment variable: + +```emacs-lisp +(setenv "IS_EMACS" "true") +``` + +Finally, I want to have a minimal Emacs config for debugging purposes. This has just straight.el, use-packages and evil. + +```emacs-lisp +<> +``` + +To launch Emacs with this config, run + +```bash +emacs -q -l ~/.emacs.d/init-minimal.el +``` + + ### Performance {#performance} @@ -373,27 +428,6 @@ Some time has passed, and I still don't know if there is any quantifiable advant ``` -#### Misc {#misc} - -The following variable is true when my machine is not powerful enough for some resource-heavy packages. - -```emacs-lisp -(setq my/lowpower (string= (system-name) "azure")) -``` - -The following is true if Emacs is meant to be used with TRAMP over slow ssh. - -```emacs-lisp -(setq my/slow-ssh (string= (getenv "IS_TRAMP") "true")) -``` - -And the following is true if Emacs is run from termux on Android. - -```emacs-lisp -(setq my/is-termux (string-match-p (rx (* nonl) "com.termux" (* nonl)) (getenv "HOME"))) -``` - - #### Native compilation {#native-compilation} Set number of jobs to 1 on low-power machines @@ -404,7 +438,7 @@ Set number of jobs to 1 on low-power machines ``` -### Anaconda & environment {#anaconda-and-environment} +### Anaconda {#anaconda} [Anaconda](https://www.anaconda.com/) is a free package and environment manager. I currently use it to manage multiple versions of Python and Node.js @@ -434,12 +468,6 @@ References: (conda-env-activate "general"))) ``` -Also, I sometimes need to know if a program is running inside Emacs (say, inside a terminal emulator). To do that, I set the following environment variable: - -```emacs-lisp -(setenv "IS_EMACS" "true") -``` - ### Custom file location {#custom-file-location} @@ -472,6 +500,15 @@ By default emacs and its packages create a lot files in `.emacs.d` and in other ``` +### Prevent Emacs from closing {#prevent-emacs-from-closing} + +This adds a confirmation to avoid accidental Emacs closing. + +```emacs-lisp +(setq confirm-kill-emacs 'y-or-n-p) +``` + + ## Global editing configuration {#global-editing-configuration} @@ -1437,7 +1474,7 @@ A company frontend with nice icons. ```emacs-lisp (use-package company-box :straight t - :if (not my/lowpower) + :if (and (display-graphic-p) (not my/lowpower)) :after (company) :hook (company-mode . company-box-mode)) ``` @@ -1556,7 +1593,7 @@ Before I figure out how to package this for Guix: ```emacs-lisp (use-package wakatime-mode :straight (:host github :repo "SqrtMinusOne/wakatime-mode") - :if (not my/is-termux) + :if (not (or my/is-termux my/remote-server)) :config (setq wakatime-ignore-exit-codes '(0 1 102)) (advice-add 'wakatime-init :after (lambda () (setq wakatime-cli-path "/home/pavel/bin/wakatime-cli"))) @@ -1573,7 +1610,7 @@ Before I figure out how to package this for Guix: (use-package activity-watch-mode :straight t - :if (not my/is-termux) + :if (not (or my/is-termux my/remote-server)) :config (global-activity-watch-mode)) ``` @@ -1692,7 +1729,9 @@ My colorscheme of choice. :config (setq doom-themes-enable-bold t doom-themes-enable-italic t) - (load-theme 'doom-palenight t) + (if my/remote-server + (load-theme 'doom-gruvbox t) + (load-theme 'doom-palenight t)) (doom-themes-visual-bell-config) (setq doom-themes-treemacs-theme "doom-colors") (doom-themes-treemacs-config)) @@ -1952,7 +1991,7 @@ References: ```emacs-lisp (use-package emojify :straight t - :if (not (or my/lowpower my/is-termux)) + :if (and (display-graphic-p) (not (or my/lowpower my/is-termux))) :hook (after-init . global-emojify-mode)) ``` @@ -1964,7 +2003,7 @@ Ligature setup for the JetBrainsMono font. ```emacs-lisp (use-package ligature :straight (:host github :repo "mickeynp/ligature.el") - :if (not my/is-termux) + :if (display-graphic-p) :config (ligature-set-ligatures '( @@ -1980,7 +2019,8 @@ Ligature setup for the JetBrainsMono font. clojure-mode go-mode sh-mode - haskell-mode) + haskell-mode + web-mode) '("--" "---" "==" "===" "!=" "!==" "=!=" "=:=" "=/=" "<=" ">=" "&&" "&&&" "&=" "++" "+++" "***" ";;" "!!" "??" "?:" "?." "?=" "<:" ":<" ":>" ">:" "<>" "<<<" ">>>" @@ -2003,6 +2043,7 @@ Ligature setup for the JetBrainsMono font. ```emacs-lisp (use-package all-the-icons + :if (display-graphic-p) :straight t) ``` @@ -2023,7 +2064,7 @@ Highlight indent guides. ```emacs-lisp (use-package highlight-indent-guides :straight t - :if (not my/lowpower) + :if (not (or my/lowpower my/remote-server)) :hook ( (prog-mode . highlight-indent-guides-mode) (vue-mode . highlight-indent-guides-mode) @@ -2136,7 +2177,7 @@ Display icons for files. ```emacs-lisp (use-package all-the-icons-dired :straight t - :if (not (or my/lowpower my/slow-ssh)) + :if (not (or my/lowpower my/slow-ssh (not (display-graphic-p)))) :hook (dired-mode . (lambda () (unless (string-match-p "/gnu/store" default-directory) (all-the-icons-dired-mode)))) @@ -2249,6 +2290,13 @@ Some other optimization settings: tramp-file-name-regexp)) ``` +Set the default shell to `bin/bash` for TRAMP or on a remote server. + +```emacs-lisp +(when (or my/remote-server my/slow-ssh) + (setq explicit-shell-file-name "/bin/bash")) +``` + Also, here is a hack to make TRAMP find `ls` on Guix: ```emacs-lisp @@ -2390,6 +2438,7 @@ Open a terminal in the lower third of the frame with the `` ` `` key. (kill-buffer (current-buffer)) (select-window vterm-window)) (vterm-other-window "vterm-subterminal")))) + (unless my/slow-ssh (general-nmap "`" 'my/toggle-vterm-subteminal) (general-nmap "~" 'vterm)) @@ -2509,6 +2558,7 @@ Use the built-in org mode. ```emacs-lisp (use-package org :straight t + :if (not my/remote-server) :defer t :config (setq org-startup-indented t) @@ -2884,7 +2934,7 @@ Used files ```emacs-lisp (setq org-directory (expand-file-name "~/Documents/org-mode")) -(setq org-agenda-files '("inbox.org" "projects.org" "work.org")) +(setq org-agenda-files '("inbox.org" "projects.org" "work.org" "sem-11.org" "life.org")) ;; (setq org-default-notes-file (concat org-directory "/notes.org")) ``` @@ -2903,7 +2953,9 @@ Refile targets ```emacs-lisp (setq org-refile-targets '(("projects.org" :maxlevel . 2) - ("work.org" :maxlevel . 2))) + ("work.org" :maxlevel . 2) + ("sem-11.org" :maxlevel . 3) + ("life.org" :maxlevel . 2))) (setq org-refile-use-outline-path 'file) (setq org-outline-path-complete-in-steps nil) ``` @@ -3235,6 +3287,7 @@ A template looks like this: ```emacs-lisp (use-package org-journal :straight t + :if (not my/remote-server) :after org :config (setq org-journal-dir (concat org-directory "/journal")) @@ -3305,7 +3358,8 @@ References: (use-package org-roam :straight (:host github :repo "org-roam/org-roam" - :files (:defaults "extensions/*.el")) + :files (:defaults "extensions/*.el")) + :if (not my/remote-server) :after org :init (setq org-roam-directory (concat org-directory "/roam")) @@ -3392,6 +3446,7 @@ As of now, this package loads Helm on start. To avoid this, I have to exclude He ```emacs-lisp (use-package org-ref :straight (:files (:defaults (:exclude "*helm*"))) + :if (not my/remote-server) :init (setq org-ref-completion-library 'org-ref-ivy-cite) (setq bibtex-dialect 'biblatex) @@ -3698,6 +3753,7 @@ Doing presentations with [org-present](https://github.com/rlister/org-present). (use-package org-present :straight (:host github :repo "rlister/org-present") + :if (not my/remote-server) :commands (org-present) :config (general-define-key @@ -3716,8 +3772,7 @@ Doing presentations with [org-present](https://github.com/rlister/org-present). (setq-local org-format-latex-options (plist-put org-format-latex-options :scale (* org-present-text-scale my/org-latex-scale 0.5))) - (org-latex-preview '(16)) - (tab-bar-mode 0))) + (org-latex-preview '(16)))) (add-hook 'org-present-mode-quit-hook (lambda () (blink-cursor-mode 1) @@ -3728,12 +3783,16 @@ Doing presentations with [org-present](https://github.com/rlister/org-present). (display-line-numbers-mode 1) (hide-mode-line-mode 0) (setq-local org-format-latex-options (plist-put org-format-latex-options :scale my/org-latex-scale)) - (org-latex-preview '(64)) - (tab-bar-mode 1)))) + (org-latex-preview '(64))))) ``` -### TOC {#toc} +### Tools {#tools} + +Various small packages. + + +#### TOC {#toc} Make a TOC inside the org file. @@ -3746,6 +3805,7 @@ References: ```emacs-lisp (use-package org-make-toc :after (org) + :if (not my/remote-server) :commands (org-make-toc org-make-toc-insert @@ -3755,6 +3815,17 @@ References: ``` +#### Screenshots {#screenshots} + +A nice package to make screenshots and insert them to the Org document. + +```emacs-lisp +(use-package org-attach-screenshot + :commands (org-attach-screenshot) + :straight t) +``` + + ### System configuration {#system-configuration} Functions used across my literate config files. @@ -3947,7 +4018,7 @@ References: ```emacs-lisp (use-package lsp-mode :straight t - :if (not (or my/slow-ssh my/is-termux)) + :if (not (or my/slow-ssh my/is-termux my/remote-server)) :hook ( (typescript-mode . lsp) (vue-mode . lsp) @@ -4000,6 +4071,7 @@ Origami should've leveraged LSP folding, but it was too unstable at the moment I ;; (add-hook 'lsp-after-open-hook #'lsp-origami-try-enable)) (use-package lsp-treemacs + :after (lsp) :straight t :commands lsp-treemacs-errors-list) ``` @@ -4076,6 +4148,7 @@ References: (use-package tree-sitter :straight t + :if (not my/remote-server) :hook ((typescript-mode . my/tree-sitter-if-not-mmm) (js-mode . my/tree-sitter-if-not-mmm) (python-mode . tree-sitter-mode) @@ -4204,10 +4277,12 @@ References: ``` -#### CHECK (OFF) Format-all {#off--format-all} +#### Reformatter {#reformatter} + +A general-purpose package to run formattters on files. While the most popular formatters are already packaged for Emacs, those that aren't can be invoked with this package. ```emacs-lisp -(use-package format-all +(use-package reformatter :straight t) ``` @@ -4870,7 +4945,6 @@ References: - [LanguageTool homepage](https://languagetool.org/) - [LanguageTool http server](https://dev.languagetool.org/http-server) -- [LanguageTool for Emacs repo](https://github.com/mhayashi1120/Emacs-langtool) @@ -4879,7 +4953,7 @@ References: :straight t :commands (langtool-check) :config - (setq langtool-language-tool-server-jar "/home/pavel/Programs/LanguageTool-5.1/languagetool-server.jar") + (setq langtool-language-tool-server-jar "/home/pavel/bin/LanguageTool-5.4/languagetool-server.jar") (setq langtool-mother-tongue "ru") (setq langtool-default-language "en-US")) @@ -5358,6 +5432,18 @@ A function to start up [TensorBoard](https://www.tensorflow.org/tensorboard). ``` +### Lua {#lua} + +```emacs-lisp +(use-package lua-mode + :straight t + :mode "\\.lua\\'" + :hook (lua-mode . smartparens-mode)) + +(my/set-smartparens-indent 'lua-mode) +``` + + ### JSON {#json} ```emacs-lisp @@ -5371,6 +5457,36 @@ A function to start up [TensorBoard](https://www.tensorflow.org/tensorboard). ``` +### SQL {#sql} + +[sql-formatter](https://github.com/zeroturnaround/sql-formatter) is a nice JavaScript package for pretty-printing SQL queries. It is not packaged for Emacs, so the easiest way to use it seems to be to define a custom formatter via [reformatter](https://github.com/purcell/emacs-reformatter). + +Also, I've a simple function to switch dialects because I often alternate between them. + +So far I didn't find a nice SQL client for Emacs, but I occasionally run SQL queries in Org Mode, so this qute package is handy. + +```emacs-lisp +(setq my/sqlformatter-dialect-choice + '("db2" "mariadb" "mysql" "n1ql" "plsql" "postgresql" "redshift" "spark" "sql" "tsql")) + +(setq my/sqlformatter-dialect "postgresql") + +(defun my/sqlformatter-set-dialect () + "Set dialect for sql-formatter" + (interactive) + (setq my/sqlformatter-dialect + (completing-read "Dialect: " my/sqlformatter-dialect-choice))) + +(reformatter-define sqlformat + :program (executable-find "sql-formatter") + :args `("-l" ,my/sqlformatter-dialect)) + +(my-leader-def + :keymaps '(sql-mode-map) + "rr" #'sqlformat-buffer) +``` + + ### YAML {#yaml} ```emacs-lisp @@ -5516,7 +5632,7 @@ Open a file managed by yadm. My notmuch config now resides in [Mail.org]({{< relref "Mail" >}}). ```emacs-lisp -(unless my/is-termux +(unless (or my/is-termux my/remote-server) (load-file (expand-file-name "mail.el" user-emacs-directory))) ``` @@ -5532,12 +5648,13 @@ Using my own fork until the modifications are merged into master. ```emacs-lisp (use-package elfeed :straight (:repo "SqrtMinusOne/elfeed" :host github) + :if (not my/remote-server) :commands (elfeed) :init (my-leader-def "ae" 'elfeed) :config (setq elfeed-db-directory "~/.elfeed") - (setq elfeed-enclosure-default-dir (expand-file-name "~")) + (setq elfeed-enclosure-default-dir (expand-file-name "~/Downloads")) (advice-add #'elfeed-insert-html :around (lambda (fun &rest r) @@ -5655,6 +5772,7 @@ References: ```emacs-lisp (use-package emms :straight t + :if (not my/remote-server) :commands (emms-smart-browse emms-browser emms-add-url @@ -5683,11 +5801,11 @@ References: ;; MPV setup <> ;; evil-lion and evil-commentary shadow some gX bindings - (add-hook 'emms-browser-mode-hook - (lambda () - (evil-lion-mode -1) - ;; (evil-commentary-mode -1) - )) + ;; (add-hook 'emms-browser-mode-hook + ;; (lambda () + ;; (evil-lion-mode -1) + ;; (evil-commentary-mode -1) + ;; )) ;; I have everything I need in polybar (emms-mode-line-mode -1) (emms-playing-time-display-mode -1) @@ -5742,7 +5860,7 @@ After all this is done, run `M-x emms-cache-set-from-mpd-all` to set cache from [mpv](https://mpv.io/) is a decent media player, which has found a place in this configuration because it integrates with youtube-dl. ```emacs-lisp -(add-to-list 'emms-player-list 'emms-player-mpv) +(add-to-list 'emms-player-list 'emms-player-mpv t) ``` Also a custom regex. My demands for MPV include running `youtube-dl`, so there is a regex that matches youtube.com or some of the video formats. @@ -5783,7 +5901,7 @@ Now `emms-add-url` should work on YouTube URLs just fine. Just keep in mind that ##### Cache cleanup {#cache-cleanup} -All added URLs reside in the EMMS cache after being played. I don't want them to stay there for a long time, so here is a handy function to clean it. +All the added URLs reside in the EMMS cache after being played. I don't want them to stay there for a long time, so here is a handy function to clean it. ```emacs-lisp (defun my/emms-cleanup-urls () @@ -6059,7 +6177,7 @@ References: (shell-command-to-string (format "curl -L %s --output %s" tldr-source-zip-url tldr-saved-zip-path)) (when (file-exists-p "/tmp/tldr") (delete-directory "/tmp/tldr" t)) - (shell-command-to-string (format "unzip -d /tmp/tldr/ %s" tldr-saved-zip-path) nil nil) + (shell-command-to-string (format "unzip -d /tmp/tldr/ %s" tldr-saved-zip-path)) (when (file-exists-p tldr-directory-path) (delete-directory tldr-directory-path 'recursive 'no-trash)) (shell-command-to-string (format "mv %s %s" "/tmp/tldr/tldr-main" tldr-directory-path)))) @@ -6110,6 +6228,8 @@ Finally, there is also an Emacs plugin for [devdocs.io](https://devdocs.io). I use [pass](https://www.passwordstore.org/) as my password manager. Expectedly, there is Emacs frontend for it. +Although I use [this rofi frontend](https://github.com/carnager/rofi-pass) for actually inserting passwords. + ```emacs-lisp (use-package pass :straight t @@ -6249,6 +6369,7 @@ Tecosaur's plugin to make beautiful code screenshots. ```emacs-lisp (use-package screenshot :straight (:repo "tecosaur/screenshot" :host github :files ("screenshot.el")) + :if (display-graphic-p) :commands (screenshot) :init (my-leader-def "S" 'screenshot)) @@ -6340,14 +6461,14 @@ In order for this to work in Guix, a service is necessary - [Discord rich presen :if (and (or (string= (system-name) "indigo") (string= (system-name) "eminence")) - (not my/slow-ssh)) + (not my/slow-ssh) + (not my/remote-server)) :config (elcord-mode) (add-to-list 'elcord-boring-buffers-regexp-list (rx bos (+ num) "-" (+ num) "-" (+ num) ".org" eos)) (add-to-list 'elcord-boring-buffers-regexp-list - (rx bos (= 14 num) "-" (* not-newline) ".org" eos)) - ) + (rx bos (= 14 num) "-" (* not-newline) ".org" eos))) ``` diff --git a/content/configs/Emacs.md~ b/content/configs/Emacs.md~ index cb90cf5..62ce64a 100644 --- a/content/configs/Emacs.md~ +++ b/content/configs/Emacs.md~ @@ -124,6 +124,12 @@ As with other files in the repo, parts prefixed with (OFF) are not used but kept - [Productivity & Knowledge management](#productivity-and-knowledge-management) - [Capture templates & various settings](#capture-templates-and-various-settings) - [Custom agendas](#custom-agendas) + - [org-ql](#org-ql) + - [Review workflow](#review-workflow) + - [Data from git & org-roam](#data-from-git-and-org-roam) + - [Data from org-journal](#data-from-org-journal) + - [Data from org-agenda via org-ql](#data-from-org-agenda-via-org-ql) + - [Capture template](#capture-template) - [Org Journal](#org-journal) - [Org Roam](#org-roam) - [org-roam-ui](#org-roam-ui) @@ -234,7 +240,7 @@ As with other files in the repo, parts prefixed with (OFF) are not used but kept - [Notmuch](#notmuch) - [Elfeed](#elfeed) - [Some additions](#some-additions) - - [YouTube](#youtube) + - [YouTube & EMMS](#youtube-and-emms) - [EMMS](#emms) - [MPD](#mpd) - [MPV](#mpv) @@ -2966,6 +2972,262 @@ Log DONE time ``` +#### org-ql {#org-ql} + +[org-ql](https://github.com/alphapapa/org-ql) is a package to query the org files. I'm using it in my review workflow, perhaps later I'll find another usecases. + +```emacs-lisp +(use-package org-ql + :straight (:fetcher github + :repo "alphapapa/org-ql" + :files (:defaults (:exclude "helm-org-ql.el")))) +``` + + +#### Review workflow {#review-workflow} + +My take on a review workflow. As a baseline, I want to have a template that lists the important changes since the last review and other basic information. I'm doing reviews regularly, but the time intervals still may vary, hence this flexibility. + + +##### Data from git & org-roam {#data-from-git-and-org-roam} + +First, as I have [autocommit]({{< relref "Console" >}}) set up in my org directory, here is a handy function to get an alist of changed files of a form `(status . path)`. In principle, the `rev` parameter can be a commit, tag, etc but here I'm interested in a form like `@{2021-08-30}`. + +```emacs-lisp +(setq my/git-diff-status + '(("A" . added) + ("C" . copied) + ("D" . deleted) + ("M" . modified) + ("R" . renamed) + ("T" . type-changed) + ("U" . unmerged))) + +(defun my/get-files-status (rev) + (let ((files (shell-command-to-string (concat "git diff --name-status " rev)))) + (mapcar + (lambda (file) + (let ((elems (split-string file "\t"))) + (cons + (cdr (assoc (car elems) my/git-diff-status)) + (nth 1 elems)))) + (split-string files "\n" t)))) +``` + +I'll use it to get a list of added and changed Roam files since the last review. Date should have be in a format `YYYY-MM-DD`. + +```emacs-lisp +(defun my/org-changed-files-since-date (date) + (let ((default-directory org-directory)) + (my/get-files-status (format "@{%s}" date)))) +``` + +Now we are ready to format this list to insert it into the capture template. + +```emacs-lisp +(defun my/org-review-format-roam (rev) + (let* ((changes (my/org-changed-files-since-date rev)) + (new-roam + (seq-filter + (lambda (elem) + (and (eq (car elem) 'added) + (string-match-p (rx bos "roam") (cdr elem)))) + changes)) + (changed-roam + (seq-filter + (lambda (elem) + (and (eq (car elem) 'modified) + (string-match-p (rx bos "roam") (cdr elem)))) + changes))) + (concat + (unless (seq-empty-p new-roam) + (concat "** New Roam entries \n" + (mapconcat + (lambda (entry) + (format "- [[file:%s][%s]]" (cdr entry) (cdr entry))) + new-roam + "\n") + "\n")) + (unless (seq-empty-p changed-roam) + (concat "** Changed Roam entries \n" + (mapconcat + (lambda (entry) + (format "- [[file:%s][%s]]" (cdr entry) (cdr entry))) + changed-roam + "\n")))))) +``` + + +##### Data from org-journal {#data-from-org-journal} + +Second, I want to have a list of new jounal entries since the last review. + +```emacs-lisp +(defun my/org-journal-entries-since-date (rev-date) + (mapcar + (lambda (date) + (let ((time (encode-time (parse-time-string date)))) + `((file . ,(org-journal--get-entry-path time)) + (header . ,(format-time-string org-journal-date-format time))))) + (seq-filter + (lambda (date) (string-lessp rev-date date)) + (mapcar + (lambda (date) + (format "%04d-%02d-%02dT00:00:00+0300" (nth 2 date) (nth 0 date) (nth 1 date))) + (org-journal--list-dates))))) +``` + +Format the results: + +```emacs-lisp +(defun my/org-review-format-journal (rev-date) + (mapconcat + (lambda (item) + (format "- [[file:%s::*%s][%s]]" + (cdr (assoc 'file item)) + (cdr (assoc 'header item)) + (cdr (assoc 'header item)))) + (my/org-journal-entries-since-date rev-date) + "\n")) +``` + + +##### Data from org-agenda via org-ql {#data-from-org-agenda-via-org-ql} + +Third, I want to list some changes in my agenda. This section will change depending on what I'm currently working on. + +So, here is a list of queries results of which I want to see in the review template. The format is `(name date-field order-by-field query)`. + +```emacs-lisp +(setq my/org-ql-review-queries + `(("Waitlist" scheduled scheduled + (and + (done) + (tags-inherited "waitlist"))) + ("Personal tasks done" closed ,nil + (and + (tags-inherited "personal") + (todo "DONE"))) + ("Attended meetings" closed scheduled + (and + (tags "meeting") + (todo "PASSED"))) + ("Done project tasks" closed deadline + (and + (todo "DONE") + (ancestors + (heading "Tasks")))))) +``` + +The query will be executed like this: `(and (date-field :from rev-date) query)` + +```emacs-lisp +(defun my/org-review-exec-ql (saved rev-date) + (let ((query `(and + (,(nth 1 saved) :from ,rev-date) + ,(nth 3 saved)))) + (org-ql-query + :select #'element + :from (org-agenda-files) + :where query + :order-by (nth 2 saved)))) +``` + +Format one element of query result. + +```emacs-lisp +(defun my/org-review-format-element (elem) + (concat + (string-pad + (plist-get (cadr elem) :raw-value) + 40) + (when-let (scheduled (plist-get (cadr elem) :scheduled)) + (concat " [SCHEDULED: " (plist-get (cadr scheduled) :raw-value) "]")) + (when-let (deadline (plist-get (cadr elem) :deadline)) + (concat " [DEADLINE: " (plist-get (cadr deadline) :raw-value) "]")))) +``` + +Execute all the saved queries and format an Org list for the capture template. + +```emacs-lisp +(defun my/org-review-format-queries (rev-date) + (mapconcat + (lambda (results) + (concat "** " (car results) "\n" + (string-join + (mapcar (lambda (r) (concat "- " r)) (cdr results)) + "\n") + "\n")) + (seq-filter + (lambda (result) + (not (seq-empty-p (cdr result)))) + (mapcar + (lambda (saved) + (cons + (car saved) + (mapcar + #'my/org-review-format-element + (my/org-review-exec-ql saved rev-date)))) + my/org-ql-review-queries)) + "\n")) +``` + + +##### Capture template {#capture-template} + +Now, we have to put all this together and define a capture template for the review. + +I'll use a separate directory for the review files, just like for org-journal and org-roam. The filename will have a format `YYYY-MM-DD.org`, which will also free me from the effort of storing the last review date somewhere. + +If somehow there are no files in the folder, fallback to the current date minus one week. + +```emacs-lisp +(setq my/org-review-directory "review") + +(defun my/org-review-get-filename () + (concat my/org-review-directory "/" (format-time-string "%Y-%m-%d.org" (current-time)))) + +(defun my/get-last-review-date () + (substring + (or + (-max-by + 'string-greaterp + (-filter + (lambda (f) (not (or (string-equal f ".") (string-equal f "..")))) + (directory-files (f-join org-directory my/org-review-directory)))) + (format-time-string + "%Y-%m-%d" + (time-subtract + (current-time) + (seconds-to-time (* 60 60 24 7))))) + 0 10)) +``` + +A template looks like this: + +```emacs-lisp +(setq my/org-review-capture-template + `("r" "Review" plain (file ,(my/org-review-get-filename)) + ,(string-join + '("#+TITLE: Review %t" + "" + "Last review date: %(org-timestamp-translate (org-timestamp-from-string (format \"<%s>\" (my/get-last-review-date))))" + "" + "* Roam" + "%(my/org-review-format-roam (my/get-last-review-date))" + "* Journal" + "New journal entries:" + "%(my/org-review-format-journal (my/get-last-review-date))" + "* Agenda" + "%(my/org-review-format-queries (my/get-last-review-date))" + "* Thoughts :crypt:" + "%?") + "\n"))) + +(add-to-list 'org-capture-templates my/org-review-capture-template t) +``` + + #### Org Journal {#org-journal} [org-journal](https://github.com/bastibe/org-journal) is a plugin for maintaining a journal in org mode. I want to have its entries separate from my knowledge base. @@ -4101,8 +4363,7 @@ Trying this one out instead of vue-mode and svelte-mode, because this one seems :config (add-hook 'web-mode-hook 'smartparens-mode) (add-hook 'web-mode-hook 'hs-minor-mode) - (my/set-smartparens-indent 'web-mode) - (add-hook 'web-mode-hook )) + (my/set-smartparens-indent 'web-mode)) ``` Hooking this up with lsp. @@ -5338,7 +5599,7 @@ Open a URL with eww. ``` -##### YouTube {#youtube} +##### YouTube & EMMS {#youtube-and-emms} Previously this block was opening MPV with `start-process`, but now I've managed to hook up MPV with EMMS. So there is the EMMS+elfeed "integration". @@ -5364,12 +5625,13 @@ Now, a function to add YouTube link with metadata from elfeed to EMMS. (let ((track (emms-track 'url (my/get-youtube-url (elfeed-entry-link entry))))) (emms-track-set track 'info-title (elfeed-entry-title entry)) - (setq my/test track) (emms-playlist-insert-track track)))) (defun my/elfeed-add-emms-youtube () (interactive) - (emms-add-elfeed elfeed-show-entry)) + (emms-add-elfeed elfeed-show-entry) + (elfeed-tag elfeed-show-entry 'watched) + (elfeed-show-refresh)) (with-eval-after-load 'elfeed (general-define-key diff --git a/content/configs/Guix.md b/content/configs/Guix.md index 69a2b7a..0a72480 100644 --- a/content/configs/Guix.md +++ b/content/configs/Guix.md @@ -598,6 +598,7 @@ Don't forget to install `JetBrainsMono Nerd Font`. |----------|-----------------------------| | system | openvpn | | system | openvpn-update-resolve-conf | +| system | vpnc | I'm not sure how to properly spin up VPN on Guix, so here is what I'm doing now, after some trial and error. @@ -715,6 +716,8 @@ mkdir -p ~/.conda/envs conda create -p ~/.conda/envs/test ``` +Fourth, you may need to unset `$PYTHONPATH` if you have any global packages installed, otherwise Python from anaconda will try to import them instead of the conda versions. + Finally, I also want to have an ability to use global npm. Some settings for that are located in [Console.org](Console). Here we want to unset `NPM_CONFIG_USERCONFIG` if there is npm available in the environment. So here is a script to set up conda hooks: diff --git a/content/configs/README.md b/content/configs/README.md index dd4f10e..89a402e 100644 --- a/content/configs/README.md +++ b/content/configs/README.md @@ -13,7 +13,7 @@ The majority of the software is configured with [literate configuration](https:/ The files themselves are managed and deployed via [yadm](https://yadm.io/), but I mostly use Org Mode rich noweb whenever I can instead of what yadm offers. -My current GNU/Linux distribution is [GNU Guix](https://guix.gnu.org/). In the context of this repo, Guix allows me to list all the used programs in manifests, which means I have the same set of programs across multiple machines. Look for the tables with "Guix dependency" in the header. +My current GNU/Linux distribution is [GNU Guix](https://guix.gnu.org/). In the context of this repo, Guix allows me to list all the used programs in manifests, which means I have the same set of programs across multiple machines. Look for tables with "Guix dependency" in the header. Literate configuration files: diff --git a/public/configs/console/index.html b/public/configs/console/index.html index 69739f4..6b8637a 100644 --- a/public/configs/console/index.html +++ b/public/configs/console/index.html @@ -66,7 +66,6 @@ # export BROWSER=/usr/bin/firefox export QT_QPA_PLATFORMTHEME="qt5ct" export QT_AUTO_SCREEN_SCALE_FACTOR=0 -export TZ="Asia/Yekaterinburg" # export GTK2_RC_FILES="$HOME/.gtkrc-2.0"

My paths

My script folders

diff --git a/public/configs/desktop/index.html b/public/configs/desktop/index.html index 0431dac..4206d87 100644 --- a/public/configs/desktop/index.html +++ b/public/configs/desktop/index.html @@ -149,6 +149,7 @@ @@ -638,7 +639,7 @@ pid=$(xdot bindsym $mod+Shift+g mode "outer gaps"

Move & resize windows

A more or less standard set of keybindings to move & resize floating windows.

-

Just be careful to always make a way to return from these new modes, otherwise, you’d end up in a rather precarious position.

+

Just be careful to always make a way to return from these new modes, otherwise you’d end up in a rather precarious situation.

# resize window (you can also use the mouse for that)
 mode "resize" {
     # These bindings trigger as soon as you enter the resize mode
@@ -712,6 +713,7 @@ pid=$(xdot
 

Keybindings to launch rofi. For more detail, look the Rofi section.

bindsym $mod+d exec "rofi -modi 'drun,run' -show drun"
 bindsym $mod+b exec --no-startup-id rofi-buku-mine
+bindsym $mod+minus exec rofi-pass; mode default
 
 bindsym $mod+apostrophe mode "rofi"
 
@@ -719,7 +721,7 @@ pid=$(xdot
     bindsym d exec "rofi -modi 'drun,run' -show drun"
     bindsym m exec rofi-man; mode default
     bindsym b exec rofi-buku-mine; mode default
-    bindsym k exec rofi-keepassxc -d ~/MEGAsync/Passwords.kdbx; mode default
+    bindsym k exec rofi-pass; mode default
     bindsym Escape mode "default"
 }
 

Launching apps & misc keybindings

@@ -933,7 +935,7 @@ declare -A BLOCKS=( ) # Geolocation for some modules -export LOC="TMN" +export LOC="SPB" export IPSTACK_API_KEY=$(pass show My_Online/APIs/ipstack | head -n 1) @@ -1594,6 +1596,27 @@ $BUKU -f 4 -p | awk -Fif [[ ! -z $SELECTED ]]; then man -Tpdf $SELECTED | zathura - fi +

pass

+ + + + + + + + + + + + + + +
Guix dependency
rofi-pass
xset
+

A nice pass frontend for Rofi, which is even packaged for Guix.

+
USERNAME_field='username'
+EDITOR=vim
+default_autotype='username :tab pass'
+clip=both
 

Flameshot

@@ -1710,7 +1733,7 @@ $BUKU -f 4 -p | awk -F # Showhowmanymessagesarecurrentlyhidden (becauseofgeometry). indicate_hidden = yes - # Shrinkwindowifit'ssmallerthanthewidth. Willbeignoredif + # Shrinkwindowifitssmallerthanthewidth. Willbeignoredif # widthis0. shrink = no @@ -2304,6 +2327,22 @@ $BUKU -f 4 -p | awk -FManifests @@ -2683,6 +2722,14 @@ aw-watcher-afk + + + + + + + +
anydesk Remote desktop software
gnome-disk-utilityManage disks
gpartedManage partitions

diff --git a/public/configs/emacs/index.html b/public/configs/emacs/index.html index 96858b3..4203e0c 100644 --- a/public/configs/emacs/index.html +++ b/public/configs/emacs/index.html @@ -73,18 +73,19 @@
  • Measure startup speed
  • straight.el
  • use-package
  • +
  • config variants & environment
  • Performance
  • -
  • Anaconda & environment
  • +
  • Anaconda
  • Custom file location
  • Private config
  • No littering
  • +
  • Prevent Emacs from closing
  • Global editing configuration @@ -288,7 +289,12 @@
  • Presentations
  • +
  • Tools + +
  • System configuration
  • -
  • CHECK (OFF) Format-all
  • +
  • Reformatter
  • General additional config
  • @@ -411,7 +417,9 @@
  • fish
  • sh
  • Haskell
  • +
  • Lua
  • JSON
  • +
  • SQL
  • YAML
  • .env
  • CSV
  • @@ -531,6 +539,26 @@
    (straight-use-package 'use-package)
     (eval-when-compile (require 'use-package))
      ;; (setq use-package-verbose t)
    +

    config variants & environment

    +

    The following variable is true when my machine is not powerful enough for some resource-heavy packages.

    +
    (setq my/lowpower (string= (system-name) "azure"))
    +

    The following is true if Emacs is meant to be used with TRAMP over slow ssh.

    +
    (setq my/slow-ssh
    +      (or
    +       (string= (getenv "IS_TRAMP") "true")
    +       (string= (system-name) "dev-digital")))
    +

    The following is true is Emacs is ran on a remote server where I don’t need stuff like my org workflow

    +
    (setq my/remote-server
    +      (or (string= (getenv "IS_REMOTE") "true")
    +	  (string= (system-name) "dev-digital")))
    +

    And the following is true if Emacs is run from termux on Android.

    +
    (setq my/is-termux (string-match-p (rx (* nonl) "com.termux" (* nonl)) (getenv "HOME")))
    +

    Also, I sometimes need to know if a program is running inside Emacs (say, inside a terminal emulator). To do that, I set the following environment variable:

    +
    (setenv "IS_EMACS" "true")
    +

    Finally, I want to have a minimal Emacs config for debugging purposes. This has just straight.el, use-packages and evil.

    +
    <<minimal>>
    +

    To launch Emacs with this config, run

    +
    emacs -q -l ~/.emacs.d/init-minimal.el
     

    Performance

    Garbage collection

    Just setting gc-cons-treshold to a larger value.

    @@ -547,18 +575,11 @@ (unless (frame-focus-state) (garbage-collect)))) (add-hook 'after-focus-change-function 'garbage-collect)))) -

    Misc

    -

    The following variable is true when my machine is not powerful enough for some resource-heavy packages.

    -
    (setq my/lowpower (string= (system-name) "azure"))
    -

    The following is true if Emacs is meant to be used with TRAMP over slow ssh.

    -
    (setq my/slow-ssh (string= (getenv "IS_TRAMP") "true"))
    -

    And the following is true if Emacs is run from termux on Android.

    -
    (setq my/is-termux (string-match-p (rx (* nonl) "com.termux" (* nonl)) (getenv "HOME")))
     

    Native compilation

    Set number of jobs to 1 on low-power machines

    (when my/lowpower
       (setq comp-async-jobs-number 1))
    -

    Anaconda & environment

    +

    Anaconda

    Anaconda is a free package and environment manager. I currently use it to manage multiple versions of Python and Node.js

    The following code uses the conda package to activate the base environment on startup if Emacs is launched outside the environment.

    Also, some strange things are happening if vterm is launched with conda activated from Emacs, so I advise conda-env-activate to set an auxililary environment variable.

    @@ -580,8 +601,6 @@ (lambda (&rest _) (setenv "EMACS_CONDA_ENV" conda-env-current-name))) (unless (getenv "CONDA_DEFAULT_ENV") (conda-env-activate "general"))) -

    Also, I sometimes need to know if a program is running inside Emacs (say, inside a terminal emulator). To do that, I set the following environment variable:

    -
    (setenv "IS_EMACS" "true")
     

    Custom file location

    By default, custom writes stuff to init.el, which is somewhat annoying. The following makes a separate file custom.el

    (setq custom-file (concat user-emacs-directory "custom.el"))
    @@ -595,6 +614,9 @@
     

    By default emacs and its packages create a lot files in .emacs.d and in other places. no-littering is a collective effort to redirect all of this to two folders in user-emacs-directory.

    (use-package no-littering
       :straight t)
    +

    Prevent Emacs from closing

    +

    This adds a confirmation to avoid accidental Emacs closing.

    +
    (setq confirm-kill-emacs 'y-or-n-p)
     

    Global editing configuration

    General keybindings stuff

    general.el

    @@ -1284,7 +1306,7 @@

    A company frontend with nice icons.

    (use-package company-box
       :straight t
    -  :if (not my/lowpower)
    +  :if (and (display-graphic-p) (not my/lowpower))
       :after (company)
       :hook (company-mode . company-box-mode))
     

    Git & Magit

    @@ -1371,7 +1393,7 @@
    (use-package wakatime-mode
       :straight (:host github :repo "SqrtMinusOne/wakatime-mode")
    -  :if (not my/is-termux)
    +  :if (not (or my/is-termux my/remote-server))
       :config
       (setq wakatime-ignore-exit-codes '(0 1 102))
       (advice-add 'wakatime-init :after (lambda () (setq wakatime-cli-path "/home/pavel/bin/wakatime-cli")))
    @@ -1383,7 +1405,7 @@
     
     (use-package activity-watch-mode
       :straight t
    -  :if (not my/is-termux)
    +  :if (not (or my/is-termux my/remote-server))
       :config
       (global-activity-watch-mode))
     

    UI

    @@ -1444,7 +1466,9 @@ :config (setq doom-themes-enable-bold t doom-themes-enable-italic t) - (load-theme 'doom-palenight t) + (if my/remote-server + (load-theme 'doom-gruvbox t) + (load-theme 'doom-palenight t)) (doom-themes-visual-bell-config) (setq doom-themes-treemacs-theme "doom-colors") (doom-themes-treemacs-config)) @@ -1640,13 +1664,13 @@
    (use-package emojify
       :straight t
    -  :if (not (or my/lowpower my/is-termux))
    +  :if (and (display-graphic-p) (not (or my/lowpower my/is-termux)))
       :hook (after-init . global-emojify-mode))
     

    Ligatures

    Ligature setup for the JetBrainsMono font.

    (use-package ligature
       :straight (:host github :repo "mickeynp/ligature.el")
    -  :if (not my/is-termux)
    +  :if (display-graphic-p)
       :config
       (ligature-set-ligatures
        '(
    @@ -1662,7 +1686,8 @@
          clojure-mode
          go-mode
          sh-mode
    -     haskell-mode)
    +     haskell-mode
    +     web-mode)
        '("--" "---" "==" "===" "!=" "!==" "=!=" "=:=" "=/=" "<="
          ">=" "&&" "&&&" "&=" "++" "+++" "***" ";;" "!!" "??"
          "?:" "?." "?=" "<:" ":<" ":>" ">:" "<>" "<<<" ">>>"
    @@ -1680,6 +1705,7 @@
       (global-ligature-mode t))
     

    Icons

    (use-package all-the-icons
    +  :if (display-graphic-p)
       :straight t)
     

    Highlight todo

    (use-package hl-todo
    @@ -1689,7 +1715,7 @@
     

    Highlight indent guides.

    (use-package highlight-indent-guides
       :straight t
    -  :if (not my/lowpower)
    +  :if (not (or my/lowpower my/remote-server))
       :hook (
     	 (prog-mode . highlight-indent-guides-mode)
     	 (vue-mode . highlight-indent-guides-mode)
    @@ -1781,7 +1807,7 @@
     
     
    (use-package all-the-icons-dired
       :straight t
    -  :if (not (or my/lowpower my/slow-ssh))
    +  :if (not (or my/lowpower my/slow-ssh (not (display-graphic-p))))
       :hook (dired-mode . (lambda ()
     			(unless (string-match-p "/gnu/store" default-directory)
     			  (all-the-icons-dired-mode))))
    @@ -1891,6 +1917,9 @@
           (format "\\(%s\\)\\|\\(%s\\)"
     	      vc-ignore-dir-regexp
     	      tramp-file-name-regexp))
    +

    Set the default shell to bin/bash for TRAMP or on a remote server.

    +
    (when (or my/remote-server my/slow-ssh)
    +  (setq explicit-shell-file-name "/bin/bash"))
     

    Also, here is a hack to make TRAMP find ls on Guix:

    (with-eval-after-load 'tramp
       (setq tramp-remote-path
    @@ -2002,6 +2031,7 @@
     	    (kill-buffer (current-buffer))
     	  (select-window vterm-window))
           (vterm-other-window "vterm-subterminal"))))
    +
     (unless my/slow-ssh
       (general-nmap "`" 'my/toggle-vterm-subteminal)
       (general-nmap "~" 'vterm))
    @@ -2091,6 +2121,7 @@
     

    Use the built-in org mode.

    (use-package org
       :straight t
    +  :if (not my/remote-server)
       :defer t
       :config
       (setq org-startup-indented t)
    @@ -2349,7 +2380,7 @@
     
     

    Used files

    (setq org-directory (expand-file-name "~/Documents/org-mode"))
    -(setq org-agenda-files '("inbox.org" "projects.org" "work.org"))
    +(setq org-agenda-files '("inbox.org" "projects.org" "work.org" "sem-11.org" "life.org"))
     ;; (setq org-default-notes-file (concat org-directory "/notes.org"))
     

    Hotkeys

    (my-leader-def
    @@ -2360,7 +2391,9 @@
     

    Refile targets

    (setq org-refile-targets
           '(("projects.org" :maxlevel . 2)
    -	("work.org" :maxlevel . 2)))
    +	("work.org" :maxlevel . 2)
    +	("sem-11.org" :maxlevel . 3)
    +	("life.org" :maxlevel . 2)))
     (setq org-refile-use-outline-path 'file)
     (setq org-outline-path-complete-in-steps nil)
     

    Capture templates & various settings

    @@ -2603,6 +2636,7 @@

    org-journal is a plugin for maintaining a journal in org mode. I want to have its entries separate from my knowledge base.

    (use-package org-journal
       :straight t
    +  :if (not my/remote-server)
       :after org
       :config
       (setq org-journal-dir (concat org-directory "/journal"))
    @@ -2671,7 +2705,8 @@
     
     (use-package org-roam
       :straight (:host github :repo "org-roam/org-roam"
    -	     :files (:defaults "extensions/*.el"))
    +		   :files (:defaults "extensions/*.el"))
    +  :if (not my/remote-server)
       :after org
       :init
       (setq org-roam-directory (concat org-directory "/roam"))
    @@ -2744,6 +2779,7 @@ MimeType=x-scheme-handler/org-protocol
     

    As of now, this package loads Helm on start. To avoid this, I have to exclude Helm from the Package-requires in the org-ref.el file. I haven’t found a way to do this without modifying the package source yet.

    (use-package org-ref
       :straight (:files (:defaults (:exclude "*helm*")))
    +  :if (not my/remote-server)
       :init
       (setq org-ref-completion-library 'org-ref-ivy-cite)
       (setq bibtex-dialect 'biblatex)
    @@ -2964,6 +3000,7 @@ MimeType=x-scheme-handler/org-protocol
     
     (use-package org-present
       :straight (:host github :repo "rlister/org-present")
    +  :if (not my/remote-server)
       :commands (org-present)
       :config
       (general-define-key
    @@ -2982,8 +3019,7 @@ MimeType=x-scheme-handler/org-protocol
     	      (setq-local org-format-latex-options
     			  (plist-put org-format-latex-options
     				     :scale (* org-present-text-scale my/org-latex-scale 0.5)))
    -	      (org-latex-preview '(16))
    -	      (tab-bar-mode 0)))
    +	      (org-latex-preview '(16))))
       (add-hook 'org-present-mode-quit-hook
     	    (lambda ()
     	      (blink-cursor-mode 1)
    @@ -2994,9 +3030,10 @@ MimeType=x-scheme-handler/org-protocol
     	      (display-line-numbers-mode 1)
     	      (hide-mode-line-mode 0)
     	      (setq-local org-format-latex-options (plist-put org-format-latex-options :scale my/org-latex-scale))
    -	      (org-latex-preview '(64))
    -	      (tab-bar-mode 1))))
    -

    TOC

    + (org-latex-preview '(64))))) +

    Tools

    +

    Various small packages.

    +

    TOC

    Make a TOC inside the org file.

    References:

      @@ -3005,12 +3042,18 @@ MimeType=x-scheme-handler/org-protocol
      (use-package org-make-toc
         :after (org)
      +  :if (not my/remote-server)
         :commands
         (org-make-toc
          org-make-toc-insert
          org-make-toc-set
          org-make-toc-at-point)
         :straight t)
      +

      Screenshots

      +

      A nice package to make screenshots and insert them to the Org document.

      +
      (use-package org-attach-screenshot
      +  :commands (org-attach-screenshot)
      +  :straight t)
       

      System configuration

      Functions used across my literate config files.

      Tables for Guix Dependencies

      @@ -3149,7 +3192,7 @@ MimeType=x-scheme-handler/org-protocol
      Setup
      (use-package lsp-mode
         :straight t
      -  :if (not (or my/slow-ssh my/is-termux))
      +  :if (not (or my/slow-ssh my/is-termux my/remote-server))
         :hook (
       	 (typescript-mode . lsp)
       	 (vue-mode . lsp)
      @@ -3195,6 +3238,7 @@ MimeType=x-scheme-handler/org-protocol
       ;;   (add-hook 'lsp-after-open-hook #'lsp-origami-try-enable))
       
       (use-package lsp-treemacs
      +  :after (lsp)
         :straight t
         :commands lsp-treemacs-errors-list)
       
      Keybindings
      @@ -3250,6 +3294,7 @@ MimeType=x-scheme-handler/org-protocol (use-package tree-sitter :straight t + :if (not my/remote-server) :hook ((typescript-mode . my/tree-sitter-if-not-mmm) (js-mode . my/tree-sitter-if-not-mmm) (python-mode . tree-sitter-mode) @@ -3346,8 +3391,9 @@ MimeType=x-scheme-handler/org-protocol :files ("code-compass.el") :branch "main" )) -

    CHECK (OFF) Format-all

    -
    (use-package format-all
    +

    Reformatter

    +

    A general-purpose package to run formattters on files. While the most popular formatters are already packaged for Emacs, those that aren’t can be invoked with this package.

    +
    (use-package reformatter
       :straight t)
     

    General additional config

    Make smartparens behave the way I like for C-like languages.

    @@ -3894,14 +3940,13 @@ MimeType=x-scheme-handler/org-protocol
    (use-package langtool
       :straight t
       :commands (langtool-check)
       :config
    -  (setq langtool-language-tool-server-jar "/home/pavel/Programs/LanguageTool-5.1/languagetool-server.jar")
    +  (setq langtool-language-tool-server-jar "/home/pavel/bin/LanguageTool-5.4/languagetool-server.jar")
       (setq langtool-mother-tongue "ru")
       (setq langtool-default-language "en-US"))
     
    @@ -4251,6 +4296,13 @@ MimeType=x-scheme-handler/org-protocol
     (use-package lsp-haskell
       :straight t
       :after (lsp haskell-mode))
    +

    Lua

    +
    (use-package lua-mode
    +  :straight t
    +  :mode "\\.lua\\'"
    +  :hook (lua-mode . smartparens-mode))
    +
    +(my/set-smartparens-indent 'lua-mode)
     

    JSON

    (use-package json-mode
       :straight t
    @@ -4259,6 +4311,28 @@ MimeType=x-scheme-handler/org-protocol
       (add-hook 'json-mode #'smartparens-mode)
       (add-hook 'json-mode #'hs-minor-mode)
       (my/set-smartparens-indent 'json-mode))
    +

    SQL

    +

    sql-formatter is a nice JavaScript package for pretty-printing SQL queries. It is not packaged for Emacs, so the easiest way to use it seems to be to define a custom formatter via reformatter.

    +

    Also, I’ve a simple function to switch dialects because I often alternate between them.

    +

    So far I didn’t find a nice SQL client for Emacs, but I occasionally run SQL queries in Org Mode, so this qute package is handy.

    +
    (setq my/sqlformatter-dialect-choice
    +      '("db2" "mariadb" "mysql" "n1ql" "plsql" "postgresql" "redshift" "spark" "sql" "tsql"))
    +
    +(setq my/sqlformatter-dialect "postgresql")
    +
    +(defun my/sqlformatter-set-dialect ()
    +  "Set dialect for sql-formatter"
    +  (interactive)
    +  (setq my/sqlformatter-dialect
    +	(completing-read "Dialect: " my/sqlformatter-dialect-choice)))
    +
    +(reformatter-define sqlformat
    +  :program (executable-find "sql-formatter")
    +  :args `("-l" ,my/sqlformatter-dialect))
    +
    +(my-leader-def
    +  :keymaps '(sql-mode-map)
    +  "rr" #'sqlformat-buffer)
     

    YAML

    (use-package yaml-mode
       :straight t
    @@ -4350,7 +4424,7 @@ MimeType=x-scheme-handler/org-protocol
     

    Internet & Multimedia

    Notmuch

    My notmuch config now resides in Mail.org.

    -
    (unless my/is-termux
    +
    (unless (or my/is-termux my/remote-server)
       (load-file (expand-file-name "mail.el" user-emacs-directory)))
     

    Elfeed

    elfeed is an Emacs RSS client.

    @@ -4358,12 +4432,13 @@ MimeType=x-scheme-handler/org-protocol

    Using my own fork until the modifications are merged into master.

    (use-package elfeed
       :straight (:repo "SqrtMinusOne/elfeed" :host github)
    +  :if (not my/remote-server)
       :commands (elfeed)
       :init
       (my-leader-def "ae" 'elfeed)
       :config
       (setq elfeed-db-directory "~/.elfeed")
    -  (setq elfeed-enclosure-default-dir (expand-file-name "~"))
    +  (setq elfeed-enclosure-default-dir (expand-file-name "~/Downloads"))
       (advice-add #'elfeed-insert-html
     	      :around
     	      (lambda (fun &rest r)
    @@ -4449,6 +4524,7 @@ MimeType=x-scheme-handler/org-protocol
     
     
    (use-package emms
       :straight t
    +  :if (not my/remote-server)
       :commands (emms-smart-browse
     	     emms-browser
     	     emms-add-url
    @@ -4477,11 +4553,11 @@ MimeType=x-scheme-handler/org-protocol
       ;; MPV setup
       <<emms-mpv-setup>>
       ;; evil-lion and evil-commentary shadow some gX bindings
    -  (add-hook 'emms-browser-mode-hook
    -	    (lambda ()
    -	      (evil-lion-mode -1)
    -	      ;; (evil-commentary-mode -1)
    -	      ))
    +  ;; (add-hook 'emms-browser-mode-hook
    +  ;; (lambda ()
    +  ;; (evil-lion-mode -1)
    +  ;; (evil-commentary-mode -1)
    +  ;; ))
       ;; I have everything I need in polybar
       (emms-mode-line-mode -1)
       (emms-playing-time-display-mode -1)
    @@ -4521,7 +4597,7 @@ MimeType=x-scheme-handler/org-protocol
     
     
     

    mpv is a decent media player, which has found a place in this configuration because it integrates with youtube-dl.

    -
    (add-to-list 'emms-player-list 'emms-player-mpv)
    +
    (add-to-list 'emms-player-list 'emms-player-mpv t)
     

    Also a custom regex. My demands for MPV include running youtube-dl, so there is a regex that matches youtube.com or some of the video formats.

    (emms-player-set emms-player-mpv
     		 'regex
    @@ -4549,7 +4625,7 @@ MimeType=x-scheme-handler/org-protocol
     (my/set-emms-mpd-youtube-quality (car my/youtube-dl-quality-list))
     

    Now emms-add-url should work on YouTube URLs just fine. Just keep in mind that it will only add the URL to the playlist, not play it right away.

    Cache cleanup
    -

    All added URLs reside in the EMMS cache after being played. I don’t want them to stay there for a long time, so here is a handy function to clean it.

    +

    All the added URLs reside in the EMMS cache after being played. I don’t want them to stay there for a long time, so here is a handy function to clean it.

    (defun my/emms-cleanup-urls ()
       (interactive)
       (let ((keys-to-delete '()))
    @@ -4751,7 +4827,7 @@ tag2: value2'
         (shell-command-to-string (format "curl -L %s --output %s" tldr-source-zip-url tldr-saved-zip-path))
         (when (file-exists-p "/tmp/tldr")
           (delete-directory "/tmp/tldr" t))
    -    (shell-command-to-string (format "unzip -d /tmp/tldr/ %s" tldr-saved-zip-path) nil nil)
    +    (shell-command-to-string (format "unzip -d /tmp/tldr/ %s" tldr-saved-zip-path))
         (when (file-exists-p tldr-directory-path)
           (delete-directory tldr-directory-path 'recursive 'no-trash))
         (shell-command-to-string (format "mv %s %s" "/tmp/tldr/tldr-main" tldr-directory-path))))
    @@ -4783,6 +4859,7 @@ tag2: value2'
     

    Utilities

    pass

    I use pass as my password manager. Expectedly, there is Emacs frontend for it.

    +

    Although I use this rofi frontend for actually inserting passwords.

    (use-package pass
       :straight t
       :commands (pass)
    @@ -4892,6 +4969,7 @@ tag2: value2'
     
     
    (use-package screenshot
       :straight (:repo "tecosaur/screenshot" :host github :files ("screenshot.el"))
    +  :if (display-graphic-p)
       :commands (screenshot)
       :init
       (my-leader-def "S" 'screenshot))
    @@ -4948,14 +5026,14 @@ tag2: value2'
       :if (and (or
     	    (string= (system-name) "indigo")
     	    (string= (system-name) "eminence"))
    -	   (not my/slow-ssh))
    +	   (not my/slow-ssh)
    +	   (not my/remote-server))
       :config
       (elcord-mode)
       (add-to-list 'elcord-boring-buffers-regexp-list
     	       (rx bos (+ num) "-" (+ num) "-" (+ num) ".org" eos))
       (add-to-list 'elcord-boring-buffers-regexp-list
    -	       (rx bos (= 14 num) "-" (* not-newline) ".org" eos))
    -  )
    +	       (rx bos (= 14 num) "-" (* not-newline) ".org" eos)))
     

    Snow

    (use-package snow
       :straight (:repo "alphapapa/snow.el" :host github)
    diff --git a/public/configs/guix/index.html b/public/configs/guix/index.html
    index 7193423..b56a3c0 100644
    --- a/public/configs/guix/index.html
    +++ b/public/configs/guix/index.html
    @@ -578,6 +578,10 @@ guix clone https://github.com/SqrtMinusOne/dotfiles.git
     system
     openvpn-update-resolve-conf
     
    +
    +system
    +vpnc
    +
     
     
     

    I’m not sure how to properly spin up VPN on Guix, so here is what I’m doing now, after some trial and error.

    @@ -657,7 +661,8 @@ nmcli connection up "$CONN
    mkdir -p ~/.conda/envs
     conda create -p ~/.conda/envs/test
    -

    Finally, I also want to have an ability to use global npm. Some settings for that are located in Console.org. Here we want to unset NPM_CONFIG_USERCONFIG if there is npm available in the environment.

    +

    Fourth, you may need to unset $PYTHONPATH if you have any global packages installed, otherwise Python from anaconda will try to import them instead of the conda versions.

    +

    Finally, I also want to have an ability to use global npm. Some settings for that are located in Console.org. Here we want to unset NPM_CONFIG_USERCONFIG if there is npm available in the environment.

    So here is a script to set up conda hooks:

    # Get writable conda envs with npm & without
     readarray -t CONDA_ENVS_ALL <<< $(conda env list --json | jq '.envs[]')
    diff --git a/public/configs/index.xml b/public/configs/index.xml
    index daba7c6..48fafe1 100644
    --- a/public/configs/index.xml
    +++ b/public/configs/index.xml
    @@ -13,7 +13,7 @@
           
           https://sqrtminusone.xyz/configs/console/
           #+TOC headlines 6
    -.profile Environment # export EDITOR=/usr/bin/vim # export BROWSER=/usr/bin/firefox export QT_QPA_PLATFORMTHEME=&#34;qt5ct&#34; export QT_AUTO_SCREEN_SCALE_FACTOR=0 export TZ=&#34;Asia/Yekaterinburg&#34; # export GTK2_RC_FILES=&#34;$HOME/.gtkrc-2.0&#34; My paths My script folders
    +.profile Environment # export EDITOR=/usr/bin/vim # export BROWSER=/usr/bin/firefox export QT_QPA_PLATFORMTHEME=&#34;qt5ct&#34; export QT_AUTO_SCREEN_SCALE_FACTOR=0 # export GTK2_RC_FILES=&#34;$HOME/.gtkrc-2.0&#34; My paths My script folders
     if [ -d &#34;$HOME/bin&#34; ] ; then export PATH=&#34;$HOME/bin:$PATH&#34; export PATH=&#34;$HOME/bin/scripts:$PATH&#34; fi Guix settings Enable extra profiles
     if [ -z &#34;$IS_ANDROID&#34; ]; then GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles for i in $GUIX_EXTRA_PROFILES/*; do profile=$i/$(basename &#34;$i&#34;) if [ -f &#34;$profile&#34;/etc/profile ]; then GUIX_PROFILE=&#34;$profile&#34; . &#34;$GUIX_PROFILE&#34;/etc/profile fi export XDG_DATA_DIRS=&#34;$XDG_DATA_DIRS:$profile/share&#34; unset profile done fi Set Jupyter config PATH.
         
    @@ -26,7 +26,7 @@ if [ -z &#34;$IS_ANDROID&#34; ]; then GUIX_EXTRA_PROFILES=$HOME/.guix-ex
           https://sqrtminusone.xyz/configs/desktop/
           My general desktop environment configuration.
     Parts prefixed with (OFF) are not used, but kept for historic purposes. For some reason GitHub&rsquo;s org renderer ignores TODO status, hence such a prefix. Round brackets instead of square ones to prevent GitHub&rsquo;s org renderer from screwing up.
    - Table of Contents  Global customization  Colors Xresources  Colors in Xresources Fonts   Themes Device-specific settings   i3wm  General settings Managing windows Workspaces Rules Scratchpad  Launch script i3 config   Gaps &amp; borders  Keybindings   Move &amp; resize windows OFF (OFF) Intergration with dmenu Integration with rofi Launching apps &amp; misc keybindings  Apps Media controls &amp; brightness Screenshots   Colors OFF (OFF) i3blocks Keyboard Layout Autostart   Polybar  Launching General settings  Colors Bar config   Modules  ipstack-vpn weather aw-afk sun SEP TSEP i3 xkeyboard mpd pulseaudio cpu ram-memory swap-memory network date battery     Rofi  Theme Scripts  Buku bookmarks Man pages     Flameshot dunst keynav  Config Using with picom   Picom  Shadows Fading Opacity General settings   Zathura Various software  Browsers Office LaTeX Dev Manifests Flatpak Nix   Services  Music GNU Mcron ActivityWatch PulseEffects xsettingsd Discord rich presence Polkit Authentication agent Xmodmap VPN Davmail Shepherd config Sync   Guix settings    Global customization Colors Most of the colors are from the Palenight theme.
    + Table of Contents  Global customization  Colors Xresources  Colors in Xresources Fonts   Themes Device-specific settings   i3wm  General settings Managing windows Workspaces Rules Scratchpad  Launch script i3 config   Gaps &amp; borders  Keybindings   Move &amp; resize windows OFF (OFF) Intergration with dmenu Integration with rofi Launching apps &amp; misc keybindings  Apps Media controls &amp; brightness Screenshots   Colors OFF (OFF) i3blocks Keyboard Layout Autostart   Polybar  Launching General settings  Colors Bar config   Modules  ipstack-vpn weather aw-afk sun SEP TSEP i3 xkeyboard mpd pulseaudio cpu ram-memory swap-memory network date battery     Rofi  Theme Scripts  Buku bookmarks Man pages pass     Flameshot dunst keynav  Config Using with picom   Picom  Shadows Fading Opacity General settings   Zathura Various software  Browsers Office LaTeX Dev Manifests Flatpak Nix   Services  Music GNU Mcron ActivityWatch PulseEffects xsettingsd Discord rich presence Polkit Authentication agent Xmodmap VPN Davmail Shepherd config Sync   Guix settings    Global customization Colors Most of the colors are from the Palenight theme.
         
         
         
    @@ -38,7 +38,7 @@ Parts prefixed with (OFF) are not used, but kept for historic purposes. For some
           One day we won&rsquo;t hate one another, no young boy will march to war and I will clean up my Emacs config. But that day isn&rsquo;t today.
      My Emacs configuration.
     As with other files in the repo, parts prefixed with (OFF) are not used but kept for historic purposes.
    - Table of Contents  Primary setup  Measure startup speed straight.el use-package Performance  Garbage collection Run garbage collection when Emacs is unfocused Misc Native compilation   Anaconda &amp; environment Custom file location Private config No littering   Global editing configuration  General keybindings stuff  general.
    + Table of Contents  Primary setup  Measure startup speed straight.el use-package config variants &amp; environment Performance  Garbage collection Run garbage collection when Emacs is unfocused Native compilation   Anaconda Custom file location Private config No littering Prevent Emacs from closing   Global editing configuration  General keybindings stuff  general.
         
         
         
    diff --git a/public/configs/readme/index.html b/public/configs/readme/index.html
    index 67a96d9..73dd8fb 100644
    --- a/public/configs/readme/index.html
    +++ b/public/configs/readme/index.html
    @@ -65,7 +65,7 @@
     

    A set of my GNU/Linux configuration files. View at GitHub.

    The majority of the software is configured with literate configuration strategy via Emacs' Org Mode. This way has its advantages and disadvantages, but overall it’s pretty nice to keep the configs interweaved with comments in a handful of files.

    The files themselves are managed and deployed via yadm, but I mostly use Org Mode rich noweb whenever I can instead of what yadm offers.

    -

    My current GNU/Linux distribution is GNU Guix. In the context of this repo, Guix allows me to list all the used programs in manifests, which means I have the same set of programs across multiple machines. Look for the tables with “Guix dependency” in the header.

    +

    My current GNU/Linux distribution is GNU Guix. In the context of this repo, Guix allows me to list all the used programs in manifests, which means I have the same set of programs across multiple machines. Look for tables with “Guix dependency” in the header.

    Literate configuration files: