From 14ee2e65169b1bfa28cfd7debffcaeb77006c780 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Mon, 24 Feb 2020 19:52:13 +0100 Subject: [PATCH 01/13] Better literate programming for fish config Most abbreviations for my fish configuration are now presented as tables that are then used by some python code to generate fish code. --- org/config/fish.org | 351 ++++++++++++++++++++++++-------------------- org/config/i3.org | 20 +-- 2 files changed, 203 insertions(+), 168 deletions(-) diff --git a/org/config/fish.org b/org/config/fish.org index 7d5a27d..bf2fc41 100644 --- a/org/config/fish.org +++ b/org/config/fish.org @@ -5,7 +5,7 @@ #+HTML_HEAD_EXTRA: #+HTML_HEAD_EXTRA: #+HTML_HEAD_EXTRA: -#+PROPERTY: header-args:fish :tangle ~/.config/fish/config.fish :exports code +#+PROPERTY: header-args:fish :tangle ~/.config/fish/config.fish :exports code :noweb yes #+PROPERTY: header-args :exports code :tangle no * Table of Contents :TOC:noexport: @@ -21,7 +21,7 @@ - [[#abbreviations][Abbreviations]] - [[#system-monitoring][System monitoring]] - [[#system-management-packages-and-services][System management (packages and services)]] - - [[#package-mangaement][Package mangaement]] + - [[#package-management][Package management]] - [[#service-management][Service management]] - [[#development][Development]] - [[#cmake][CMake]] @@ -44,6 +44,7 @@ - [[#compression][Compression]] - [[#feh][Feh]] - [[#network-management][Network Management]] + - [[#nordvpn][NordVPN]] - [[#wget][Wget]] * Presentation @@ -210,48 +211,44 @@ :PROPERTIES: :CUSTOM_ID: h-740bd904-3e32-4c09-b0a4-bde16ae2e116 :END: + #+NAME: generate-abbr + #+BEGIN_SRC python :var table=[] :exports none + result = '' + for abbr in table: + result += "abbr {0} '{1}'\n".format(abbr[0], abbr[1].replace("\\vert{}", "|").replace("\\vert", "|")) + return result + #+END_SRC + ** System monitoring :PROPERTIES: :CUSTOM_ID: h-ec910a8c-9154-48a4-b4cd-df28cb4e54d9 :END: - Here I have some abbreviations which are quite useful when performing some - system monitoring. With =df=, we can get an overview of our filesystem - usage, while with =diskspace= we get some more precise information. - #+BEGIN_SRC fish - abbr df 'df -H' - abbr diskspace 'sudo df -h | grep -E "sd|lv|Size"' - #+END_SRC + Here I have some abbreviations which are quite useful when performing some + system monitoring. With =df=, we can get an overview of our filesystem usage, + while with =diskspace= we get some more precise information. =meminfo= is a + call to =free= with sane defaults, and similar to =meminfo=, we also have + =gpumeminfo= so we can get a quick look at the memory-related logs of our X + session. I also declared =cpuinfo= an alias of =lscpu= in order to keep + consistent with =meminfo=. =pscpu= gives us information on what the CPU is + running right now, and =pscpu10= limits that to the top 10 threads. + Similarly, =psmem= gives us information on the memory usage of the current + threads, and =psmem10= only the ten most important threads in terms of memory + usage. + #+NAME: mgmt-abbr + | abbreviation | command | + |--------------+---------------------------------------------------| + | df | df -H | + | diskspace | sudo df -h \vert grep -E "sd\vert{}lv\vert{}Size" | + | meminfo | free -m -l -t | + | gpumeminfo | grep -i --color memory /var/log/Xorg.0.log | + | cpuinfo | lscpu | + | pscpu | ps auxf \vert sort -nr -k 3 | + | pscpu10 | ps auxf \vert sort -nr -k 3 \vert head -10 | + | psmem | ps auxf \vert sort -nr -k 4 | + | psmem10 | ps auxf \vert sort -nr -k 4 \vert head -10 | - =meminfo= is a call to =free= with sane defaults. - #+BEGIN_SRC fish - abbr meminfo 'free -m -l -t' - #+END_SRC - - Similar to =meminfo=, we also have =gpumeminfo= so we can get a quick look - at the memory-related logs of our X session. - #+BEGIN_SRC fish - abbr gpumeminfo 'grep -i --color memory /var/log/Xorg.0.log' - #+END_SRC - - I also declared =cpuinfo= an alias of =lscpu= in order to keep consistent - with =meminfo=. - #+BEGIN_SRC fish - abbr cpuinfo lscpu - #+END_SRC - - =pscpu= gives us information on what the CPU is running right now, and - =pscpu10= limits that to the top 10 threads. - #+BEGIN_SRC fish - abbr pscpu 'ps auxf | sort -nr -k 3' - abbr pscpu10 'ps auxf | sort -nr -k 3 | head -10' - #+END_SRC - - Similarly, =psmem= gives us information on the memory usage of the current - threads, and =psmem10= only the ten most important threads in terms of - memory usage. - #+BEGIN_SRC fish - abbr psmem 'ps auxf | sort -nr -k 4' - abbr psmem10 'ps auxf | sort -nr -k 4 | head -10' + #+begin_SRC fish + <> #+END_SRC ** System management (packages and services) @@ -261,38 +258,26 @@ I added some of these abbreviations due to how often I have to write the whole thing. -*** Package mangaement +*** Package management :PROPERTIES: :CUSTOM_ID: h-281a59aa-4ea0-47ab-a4cc-33fff8d38165 :END: - The first command is =remove= which removes a package from my system, as - well as its dependencies no longer needed. - #+BEGIN_SRC fish - abbr remove 'sudo pacman -Rscnd' - #+END_SRC + The first command is =remove= which removes a package from my system, as + well as its dependencies no longer needed. =p=. =pacman='s or =yay='s. This + is why I simply type =purge=. And if I want to simply seach among the + =pacman= repos, I can type =search=. Otherwise, if I want to include AUR + results, I’ll use =yay=. - But if I just want to run =pacman= as sudo, then I could always just type - =p=. - #+BEGIN_SRC fish - abbr p 'sudo -A pacman' - #+END_SRC + #+NAME: pm-abbr + | abbreviation | command | + |--------------+--------------------| + | remove | sudo pacman -Rscnd | + | p | sudo pacman | + | purge | yay -Sc | + | search | yay -Ss | - Sometimes, I just want to purge my package manager’s cache, be it - =pacman='s or =yay='s. This is why I simply type =purge=. #+BEGIN_SRC fish - abbr purge 'yay -Sc' - #+END_SRC - - And if I want to simply seach among the =pacman= repos, I can type - =search=. Otherwise, if I want to include AUR results, I’ll use =yay=. - #+BEGIN_SRC fish - abbr search 'pacman -Ss' - #+END_SRC - - To update everything from the official repos, I’ll sometimes type =update= - instead of the full command. - #+BEGIN_SRC fish - abbr update 'sudo pacman -Syu' + <> #+END_SRC *** Service management @@ -301,14 +286,16 @@ :END: I don’t have the muscle memory of =systemctl=. So instead, I simply type =c= when I want to do something user service related. - #+BEGIN_SRC fish - abbr s 'systemctl --user' - #+END_SRC - And if I want to manipulate system services, I can instead type a simple capital =S=. + #+NAME: service-abbr + | abbreviation | command | + |--------------+------------------| + | s | systemctl --user | + | S | sudo systemctl | + #+BEGIN_SRC fish - abbr S 'sudo systemctl' + <> #+END_SRC ** Development @@ -324,9 +311,15 @@ :END: I have the following abbreviations so I can quickly run CMake and create a configuration for debug or release profiles. + #+NAME: abbr-cmake + | abbreviation | command | + |--------------+----------------------------------| + | cdebug | cmake -DCMAKE_BUILD_TYPE=Debug | + | crelease | cmake -DCMAKE_BUILD_TYPE=Release | + + Here is the corresponding fish configuration: #+BEGIN_SRC fish - abbr cdebug 'cmake -DCMAKE_BUILD_TYPE=Debug' - abbr crelease 'cmake -DCMAKE_BUILD_TYPE=Release' + <> #+END_SRC *** Compilation @@ -335,11 +328,17 @@ :END: By default, I set =clang=, =clang++=, =gcc= and =g++= to the latest standard and with the =-Wall= flag activated. + #+NAME: abbr-comp + | abbreviation | command | + |--------------+----------------------| + | clang | clang -Wall | + | clang++ | clang++ -Wall | + | g++ | g++ -Wall -std=c++17 | + | gcc | gcc -Wall -std=c18 | + + Here is the corresponding fish configuration: #+BEGIN_SRC fish :tangle - abbr clang 'clang -Wall' - abbr clang++ 'clang++ -Wall' - abbr g++ 'g++ -Wall -std=c++17' - abbr gcc 'gcc -Wall -std=c18' + <> #+END_SRC *** Docker @@ -348,12 +347,18 @@ :END: And of course, when it comes to Docker Compose, I don’t have time to write the full command, so I use these instead. + #+NAME: abbr-docker + | abbreviation | command | + |--------------+---------------------------| + | dc | docker-compose | + | dcd | docker-compose down | + | dcr | docker-compose run --rm | + | dcu | docker-compose up | + | dcub | docker-compose up --build | + + Here is the corresponding fish configuration: #+BEGIN_SRC fish - abbr dc docker-compose - abbr dcd 'docker-compose down' - abbr dcr 'docker-compose run --rm' - abbr dcu 'docker-compose up' - abbr dcub 'docker-compose up --build' + <> #+END_SRC *** Git @@ -363,8 +368,14 @@ And let’s face it: we all at one point just wanted to commit our code without thinking about the message, to just get over with it. Don’t worry, I got you covered. + #+NAME: abbr-git + | abbreviation | command | + |--------------+-----------------------------------------------------| + | randcommit | git commit -m (curl -s whatthecommit.com/index.txt) | + + Here is the corresponding fish configuration: #+BEGIN_SRC fish :tangle - abbr randcommit 'git commit -m (curl -s whatthecommit.com/index.txt)' + <> #+END_SRC *** Prolog @@ -373,31 +384,41 @@ :END: When I launch =swipl=, I prefer to have my terminal cleaned before and after it runs, I find it more clean. + #+NAME: abbr-prolog + | abbreviation | command | + |--------------+----------------------------| + | swipl | clear && swipl -q && clear | + + Here is the corresponding fish configuration: #+BEGIN_SRC fish - abbr swipl 'clear && swipl -q && clear' + <> #+END_SRC *** Text editors :PROPERTIES: :CUSTOM_ID: h-51155e06-872d-4a12-9bf7-ae5eabc256ad :END: - I greatly prefer to use Emacsclient as my main text editor; Emacs has - basically all I need. So, it’s only normal I have an abbreviation to launch - a new instance of it. - #+BEGIN_SRC fish - abbr e 'emacsclient -c' - #+END_SRC - However, in a graphical environment, this will launch a new graphical - window of Emacs. To launch a terminal instance, I’ll use =enw= (=nw= stands - for the option “nowindow” =-nw= of Emacs). - #+BEGIN_SRC fish - abbr enw 'emacsclient -c -nw' - #+END_SRC + I greatly prefer to use Emacsclient as my main text editor; Emacs has + basically all I need. So, it’s only normal I have an abbreviation to launch + a new instance of it. However, in a graphical environment, this will launch + a new graphical window of Emacs. To launch a terminal instance, I’ll use + =enw= (=nw= stands for the option “nowindow” =-nw= of Emacs). I also wish to + completely stop using other text editors, such as =vi=, =vim=, =nano= and + =ed=, so let’s all add their command as an abbreviation for Emacs. - I also have the abbreviation =vi= which refers to =vim=. I really should - learn =vi=, but I also really don’t feel like it. - #+BEGIN_SRC fish - abbr vi vim + #+NAME: abbr-text-ed + | abbreviation | command | + |--------------+--------------------| + | e | emacsclient -c | + | enw | emacsclient -c -nw | + | vi | emacsclient -c | + | vim | emacsclient -c | + | nano | emacsclient -c | + | ed | emacsclient -c | + + Here is the corresponding fish configuration: + #+BEGIN_SRC fish :noweb yes + <> #+END_SRC ** LaTeX @@ -408,68 +429,71 @@ when it comes to PDF exports of my org files. Hence why I use the LaTeX package manager. It is recommended to use =tllocalmgr= instead of =tlmgr=, but I can never remember the command, and the latter is faster to type, so - time for an abbreviation. - #+BEGIN_SRC fish - abbr tlmgr tllocalmgr - #+END_SRC + time for an abbreviation. Same goes for =texhash= which must be run as sudo. + #+NAME: latex-abbr + | abbreviation | command | + |--------------+--------------| + | tlmgr | tllocalmgr | + | texhash | sudo texhash | + Here is the corresponding fish configuration: #+BEGIN_SRC fish - abbr texhash 'sudo texhash' + <> #+END_SRC ** Some security measures :PROPERTIES: :CUSTOM_ID: h-dd97ea71-c43f-4b79-8bb7-1f857284b1b4 :END: - Some commands can be quite dangerous when not used properly, which is why I - added default flags and options so I can get warnings before things get - ugly. + Some commands can be quite dangerous when not used properly, which is why I + added default flags and options so I can get warnings before things get ugly. + The =-i= and =-I= add prompts in case we might not want to do what we asked + the shell to do. Notice =lns= which creates symlinks, =rmd= which removes + directories, =rmf= which forces deletion, and =rmdf= which forces the + delition of a directory. Notice also the =--preserve-root= which will prevent + me from accidentally removing the root folder. I added the same option to + =chgrp=, =chmod=, and =chown=. + #+NAME: sec-abbr + | abbreviation | command | + |--------------+--------------------------| + | cp | cp -i | + | ln | ln -i | + | lns | ln -si | + | mv | mv -i | + | rm | rm -Iv | + | rmd | rm --preserve-root -Irv | + | rmdf | rm --preserve-root -Irfv | + | rmf | rm --preserve-root -Ifv | + | chgrp | chgrp --preserve-root -v | + | chmod | chmod --preserve-root -v | + | chown | chown --preserve-root -v | + + Here is the corresponding fish configuration: #+BEGIN_SRC fish - abbr cp 'cp -i' - abbr ln 'ln -i' - abbr lns 'ln -si' - abbr mv 'mv -i' - abbr rm 'rm -Iv' - abbr rmd 'rm --preserve-root -Irv' - abbr rmdf 'rm --preserve-root -Irfv' - abbr rmf 'rm --preserve-root -Ifv' - #+END_SRC - The =-i= and =-I= add prompts in case we might not want to do what we asked - the shell to do. Notice =lns= which creates symlinks, =rmd= which removes - directories, =rmf= which forces deletion, and =rmdf= which forces the - delition of a directory. Notice also the =--preserve-root= which will - prevent me from accidentally removing the root folder. I added the same - option to =chgrp=, =chmod=, and =chown=. - #+BEGIN_SRC fish - abbr chgrp 'chgrp --preserve-root -v' - abbr chmod 'chmod --preserve-root -v' - abbr chown 'chown --preserve-root -v' + <> #+END_SRC ** Typos :PROPERTIES: :CUSTOM_ID: h-4c5a03cd-20a8-437e-87b7-af990780084e :END: - Let’s admit it, we all make typos from time to time in the shell, and some - are recurrent enough we make abbreviations or aliases of the correct - command. Well, I have some of my abbreviations which were make exactly - because of this. + Let’s admit it, we all make typos from time to time in the shell, and some + are recurrent enough we make abbreviations or aliases of the correct command. + Well, I have some of my abbreviations which were make exactly because of + this. Sometimes for some reasons, my brain makes me write =clean= instead of + =clear=. So, let’s just replace the former by the latter. I’m also very bad + at typing =exit=. And sometimes I suck at typing =htop=. + #+NAME: typo-abbr + | abbreviation | command | + |--------------+---------| + | clean | clear | + | exi | exit | + | exti | exit | + | hotp | htop | - Sometimes for some reasons, my brain makes me write =clean= instead of - =clear=. So, let’s just replace the former by the latter. + Here is the corresponding fish configuration: #+BEGIN_SRC fish - abbr clean clear - #+END_SRC - - I’m also very bad at typing =exit=. - #+BEGIN_SRC fish - abbr exi exit - abbr exti exit - #+END_SRC - - And sometimes I suck at typing =htop=. - #+BEGIN_SRC fish - abbr hotp htop + <> #+END_SRC ** Misc @@ -557,9 +581,14 @@ one day hopefully, after seeing the abbreviations’ expansion over and over I’ll remember the command like I did for the abbreviation of =remove= (see [[#h-281a59aa-4ea0-47ab-a4cc-33fff8d38165][Package management]]). + #+NAME: tar-abbr + | abbreviation | command | + |--------------+-----------| + | compress | tar -czf | + | untar | tar -xvzf | + #+BEGIN_SRC fish - abbr compress 'tar -czf' - abbr untar 'tar -xvzf' + <> #+END_SRC *** Feh @@ -583,22 +612,28 @@ abbr nmcli 'nmcli -p -c auto' #+END_SRC +*** NordVPN + :PROPERTIES: + :CUSTOM_ID: h-f35e00a2-ec5b-416d-821f-56040ad1d6b4 + :END: Next, we have some NordVPN-related shortcuts. The first one is a simple abbreviation to =nordvpn=. The second one is a shortcut to connect to a - server, and to disconnect from the current server. - #+BEGIN_SRC fish - abbr n 'nordvpn' - abbr nc 'nordvpn c' - abbr nd 'nordvpn d' - #+END_SRC + server, and to disconnect from the current server. I also have a couple of + shortcuts to quickly connect to some preselected countries, mainly France, + Germany, Japan and the US. + #+NAME: nordvpn-abbr + | abbreviation | command | + |--------------+-------------------------| + | n | nordvpn | + | nc | nordvpn c | + | nd | nordvpn d | + | ncf | nordvpn c France | + | ncg | nordvpn c Germany | + | ncj | nordvpn c Japan | + | ncu | nordvpn c United_States | - I also have a couple of shortcuts to quickly connect to some preselected - countries, mainly France, Germany, Japan and the US. #+BEGIN_SRC fish - abbr ncf 'nordvpn c France' - abbr ncg 'nordvpn c Germany' - abbr ncj 'nordvpn c Japan' - abbr ncu 'nordvpn c United_States' + <> #+END_SRC *** Wget diff --git a/org/config/i3.org b/org/config/i3.org index f6cbed2..92deecc 100644 --- a/org/config/i3.org +++ b/org/config/i3.org @@ -92,15 +92,15 @@ will just have to change the name of the executable here. #+NAME: variable-table - | variable | value | - |-------------+--------------------------------------------------------------------------| - | $mod | Mod4 | - | $alt | Mod1 | - | $up | Up | - | $down | Down | - | $left | Left | - | $right | Right | - | $term | st | + | variable | value | + |----------+-------| + | $mod | Mod4 | + | $alt | Mod1 | + | $up | Up | + | $down | Down | + | $left | Left | + | $right | Right | + | $term | st | #+NAME: variable-sh | variable | value | @@ -125,7 +125,7 @@ return result #+END_SRC - #+RESULTS[58c517fe29b63f631ff0ba754d5d9ec4ea673388]: generate-variables + #+RESULTS[187d9be7907abf05492d27a454685b424b933b7d]: generate-variables : set $mod Mod4 : set $alt Mod1 : set $up Up From 775b43697739239413c8691b39e14fc710cfbb95 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Mon, 24 Feb 2020 21:02:54 +0100 Subject: [PATCH 02/13] Added templates for org-capture However, some stopped working while others do, I have to work on that --- org/config/spacemacs.org | 239 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 224 insertions(+), 15 deletions(-) diff --git a/org/config/spacemacs.org b/org/config/spacemacs.org index 8c1b88b..9188fcc 100644 --- a/org/config/spacemacs.org +++ b/org/config/spacemacs.org @@ -5,6 +5,7 @@ #+HTML_HEAD_EXTRA: #+HTML_HEAD_EXTRA: #+HTML_HEAD_EXTRA: +#+PROPERTY: header-args: :mkdirp yes * Table of Contents :TOC:noexport: :PROPERTIES: @@ -103,7 +104,13 @@ - [[#org-files-exports][Org files exports]] - [[#custom-latex-formats][Custom LaTeX formats]] - [[#org-agenda][Org agenda]] - - [[#org-journal][Org journal]] + - [[#org-capture][Org capture]] + - [[#emails][Emails]] + - [[#journal][Journal]] + - [[#notes][Notes]] + - [[#protocol][Protocol]] + - [[#resources][Resources]] + - [[#youtube][YouTube]] - [[#org-projects][Org projects]] - [[#configuration-website][Configuration website]] - [[#linguistics-website][Linguistics website]] @@ -359,7 +366,6 @@ org-enable-github-support t org-enable-reveal-js-support t org-enable-sticky-header t - org-enable-org-journal-support t spaceline-org-clock-p t org-projectile-file "TODOs.org" org-download-image-dir "~/Pictures/org/" @@ -1275,6 +1281,7 @@ Then, I want a couple of requires: #+BEGIN_SRC emacs-lisp (require 'org-id) + (require 'org-protocol) (require 'package) (require 'ox-latex) (require 'ox-publish) @@ -2515,25 +2522,218 @@ (org-projectile-todo-files))) #+END_SRC -*** Org journal +*** Org capture :PROPERTIES: - :CUSTOM_ID: h-d679ae6c-3096-4933-8e06-9848ad35adb0 + :CUSTOM_ID: h-9a070bbb-5b57-4abd-9d61-51f2070eb47b :END: - I also occasionally use Org journal. All my files are stored in - =~/org/journal=, as set below: + Org-capture is an amazing feature of Org-mode which allows me to quickly + save links, resources, reminders and notes in a neatly organized org file. + With Spacemacs, an Org capture can be invoked with the shortcut ~SPC a o c~. + It will then ask which template I wish to use. Said templates are described + below: #+BEGIN_SRC emacs-lisp - (setq org-journal-dir "~/org/journal/") + (defvar org-capture-templates-location "~/org/capture/" + "Directory in which org-capture templates are stored.") + (setq + org-default-notes-file "~/org/notes.org" + org-capture-templates + '(("e" "Emails") + ("ew" "Write Email" entry + (file+headline org-default-notes-file "Emails") + (file ,(concat org-capture-templates-location "emails.orgcaptmpl"))) + ("j" "Journal" entry + (file+datetree "~/org/journal.org") + (file ,(concat org-capture-templates-location "journal.orgcaptmpl"))) + ("l" "Links") + ("ly" "YouTube" entry + (file+headline org-default-notes-file "YouTube") + (file ,(concat org-capture-templates-location "youtube.orgcaptmpl"))) + ;; ("L" "Protocol Link" entry + ;; (file+headline org-default-notes-file "Link") + ;; (file ,(concat org-capture-templates-location "protocol-link.orgcaptmpl"))) + ("L" "Protocol Link" entry + (file+headline org-default-notes-file "Link") + "* %^{Title}\n:PROPERTIES:\n:CAPTURED: %U\n:LINK: %:link\n:END:\n%?\n") + ("n" "Note" + entry (file+headline org-default-notes-file "Note") + (file ,(concat org-capture-templates-location "notes.orgcaptmpl"))) + ;; ("p" "Protocol" entry + ;; (file+headline org-default-notes-file "Link") + ;; (file ,(concat org-capture-templates-location "protocol.orgcaptmpl"))) + ("p" "Protocol" entry + (file+headline org-default-notes-file "Link") + "* %^{Title}\n:PROPERTIES:\n:CAPTURED: %U\n:LINK: %:link\n:END:\n#+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n%?\n") + ("r" "Resources") + ("rc" "Conlanging" entry + (file+headline org-default-notes-file "Conlanging") + (file ,(concat org-capture-templates-location "resource.orgcaptmpl"))) + ("re" "Emacs" entry + (file+headline org-default-notes-file "Emacs") + (file ,(concat org-capture-templates-location "resource.orgcaptmpl"))) + ("ri" "Informatique général" entry + (file+headline org-default-notes-file "Informatique") + (file ,(concat org-capture-templates-location "resource.orgcaptmpl"))) + ("rl" "Linguistics" entry + (file+headline org-default-notes-file "Linguistics") + (file ,(concat org-capture-templates-location "resource.orgcaptmpl"))) + ("rw" "Worldbuilding" entry + (file+headline org-default-notes-file "Worldbuilding") + (file ,(concat org-capture-templates-location "resource.orgcaptmpl"))))) #+END_SRC - The default prefix for org journals is the following: - #+BEGIN_SRC emacs-lisp - (setq org-journal-date-prefix "#+TITLE: ") - #+END_SRC + You may notice a capture entry for my journal, and this is due to the fact I + do not use ~org-journal~ anymore: it was too overpowered for me, and I + prefer to keep it simple with a single file. And as you can see, and unlike + a lot of other Emacs configurations, the content of the template is not set + in the variable, but in external files which can be modified freely as + actual Org buffers instead of trying to get a proper one with loads of ~\n~ + characters and such. All these templates are declared below. - The timestamp will be set following the ISO 8601 format: - #+BEGIN_SRC emacs-lisp - (setq org-journal-file-format "%Y-%m-%d") - #+END_SRC +**** Emails + :PROPERTIES: + :CUSTOM_ID: h-9012599e-c143-4df0-b63c-7c60ddb4a081 + :END: + This is my template for a new Email: + #+BEGIN_SRC org :tangle ~/org/capture/email.orgcaptmpl + ,** TODO [#A] Write Email + :PROPERTIES: + :CAPTURED: %U + :END: + From: Lucien Cartier-Tilet + To: %^{Recipient} + Subject: %^{Object} + --text follows this line-- + %? + -- + Lucien “Phundrak” Cartier-Tilet + https://phundrak.com (Français) + https://en.phundrak.com (English) + + Sent from a Free and Open-Source Linux operating system with GNU/Emacs + #+END_SRC + + I use it in case my computer is not yet connected to the internet and I + need to already write the email so I can send it later. All I will need to + to afterwards will be to copy and paste my capture in a new message buffer + and send it once I am back online. This is exported to + =~/org/capture/email.orgcaptmpl=. + +**** Journal + :PROPERTIES: + :CUSTOM_ID: h-ab1b21af-e887-41a7-be7a-c08825d16339 + :END: + This template is quite simple: it creates a new entry with the current + timestamp as its title, a brief title of my choosing, and then I can write + whatever I wish to write. This is exported to + =~/org/capture/journal.orgcaptmpl=. + #+BEGIN_SRC org :tangle ~/org/capture/journal.orgcaptmpl + ,* %U %^{Title} + %? + #+END_SRC + +**** Notes + :PROPERTIES: + :CUSTOM_ID: h-2b5e7efc-4a9d-4a92-b75f-4ec75e2fb48d + :END: + This template is used for taking note about various subjects that can go + from conlanging to development. I wrote it so I can know from where this + capture was made and when, and it even supports text that was highlighted + in Emacs that will be inserted in a quote block. This is exported to + =~/org/capture/notes.orgcaptmpl=. + #+BEGIN_SRC org :tangle ~/org/capture/notes.orgcaptmpl + ,* Note + :PROPERTIES: + :CAPTURED: %U + :FROM: %f + :END: + Possible inspiration: + ,#+begin_quote + %i + ,#+end_quote + + %? + #+END_SRC + +**** Protocol + :PROPERTIES: + :CUSTOM_ID: h-6fa10246-26bf-4ab3-a3b0-1f58bc79350e + :END: + This capture is used when received through org-protocol, with the + Org-protocol Extension for Firefox. It allows me to save in a quote block + what I’ve highlighted, as well as the link of the webpage on which my saved + content was highlighted. This file is exported to + =~/org/capture/protocol.orgcaptmpl=. + #+BEGIN_SRC org :tangle ~/org/capture/protocol.orgcaptmpl + ,* TODO [#C] %^{Title} + :PROPERTIES: + :CAPTURED: %U + :LINK: %:link + :TITLE: %:(transform-square-brackets-to-round-ones \"%:description\") + :END: + ,#+begin_quote + %i + ,#+end_quote + + %? + #+END_SRC + + For the next + #+BEGIN_SRC emacs-lisp + (defun transform-square-brackets-to-round-ones (string-to-transform) + "Transforms [ into ( and ] into ), other chars left unchanged." + (concat + (mapcar #'(lambda (c) + (if (equal c ?[) + ?\( + (if (equal c ?]) + ?\) + c))) + string-to-transform))) + #+END_SRC + + #+BEGIN_SRC org :tangle ~/org/capture/protocol-link.orgcaptmpl + ,* TODO [#C] Link: %^{Title} + :PROPERTIES: + :CAPTURED: %U + :LINK: %:link + :TITLE: %(transform-square-brackets-to-round-ones \"%:description\") + :END: + %? + #+END_SRC + +**** Resources + :PROPERTIES: + :CUSTOM_ID: h-001eb681-1725-442d-91ef-b6a46c1784dc + :END: + This is the default template for resources, which generally are located on + the Internet. By default, I give them the lowest priority, because although + this is something for me to remember later, it is not by default important. + You can see in the properties I record when the capture happened, and what + the link is. The title of the capture is a summary of what this is, while + the body of the capture is a more detailed explanation of what I capture, + why, and how it could be useful to me. + #+BEGIN_SRC org :tangle ~/org/capture/resource.orgcaptmpl + ,* TODO [#C] %^{Title} + :PROPERTIES: + :CAPTURED: %U + :LINK: %^{Link} + :END: + %? + #+END_SRC + +**** YouTube + :PROPERTIES: + :CUSTOM_ID: h-4b962a95-47d9-4410-8365-7d09e19530eb + :END: + #+BEGIN_SRC org :tangle ~/org/capture/youtube.orgcaptmpl + ,* TODO [#C] %^{Title} + :PROPERTIES: + :CAPTURED: %U + :AUTHOR: %^{Author} + :LINK: %^{Link} + :END: + %? + #+END_SRC *** Org projects :PROPERTIES: @@ -2820,6 +3020,15 @@ "ofr" (lambda () (interactive) (find-file "~/README.org"))) #+END_SRC + I also want a quick access to my notes and my journal. + #+BEGIN_SRC emacs-lisp + (spacemacs/declare-prefix "ofj" "journal.org") + (spacemacs/declare-prefix "ofn" "notes.org") + (spacemacs/set-leader-keys + "ofj" (lambda () (interactive) (find-file "~/org/journal.org")) + "ofn" (lambda () (interactive) (find-file "~/org/notes.org"))) + #+END_SRC + *** Multiple cursors :PROPERTIES: :CUSTOM_ID: h-de40bea1-4301-4ad3-b3f1-c4c8ed029feb From c93eb33f016d3bb3adc791a01cfd9d08761d02d2 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Mon, 24 Feb 2020 21:40:04 +0100 Subject: [PATCH 03/13] Added mp4 to webm utitily --- org/config/bin.org | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/org/config/bin.org b/org/config/bin.org index 05e3111..0103b68 100644 --- a/org/config/bin.org +++ b/org/config/bin.org @@ -22,6 +22,7 @@ - [[#dmenu][Dmenu]] - [[#emoji-picker][Emoji picker]] - [[#lsl][Lsl]] +- [[#mp42webm][mp42webm]] - [[#polybar-launch][Polybar-launch]] - [[#rofi-mount][Rofi-mount]] - [[#get-the-mountable-elements][Get the mountable elements]] @@ -59,12 +60,18 @@ Please do not forget to run the following before tangling files from this file to make sure the tangled files will be executables. - #+begin_src emacs-lisp :results silent + #+begin_src emacs-lisp :results silent (defun phundrak/make-tangled-files-executable () (set-file-modes (buffer-file-name) #o755)) (add-hook 'org-babel-post-tangle-hook 'phundrak/make-tangled-files-executable) #+end_src + #+begin_src emacs-lisp :results silent + (defun phundrak/make-tangled-files-not-executable () + (set-file-modes (buffer-file-name) #o644)) + (add-hook 'org-babel-post-tangle-hook 'phundrak/make-tangled-files-not-executable) + #+end_src + * 4chandl :PROPERTIES: :CUSTOM_ID: h-39e14885-9da7-4cba-b24e-c3b181ef5f6b @@ -354,6 +361,16 @@ ls -ahlX --group-directories-first $argv | bat #+END_SRC +* mp42webm + :PROPERTIES: + :HEADER-ARGS: :tangle ~/.local/bin/mp42webm + :CUSTOM_ID: h-29b8a01c-7499-4a35-be25-f5a593bf40ea + :END: + #+BEGIN_SRC fish + #!/usr/bin/fish + ffmpeg -i $argv[1] -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis $argv[1].webm + #+END_SRC + * Polybar-launch :PROPERTIES: :CUSTOM_ID: h-68587918-879b-42db-b304-901d01233f95 From 6202168e05b25acb2edcac8e848be1699acc41be Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Mon, 24 Feb 2020 21:42:45 +0100 Subject: [PATCH 04/13] Fixed issue with commit #775b436 Now org-capture templates actually work and are no longer contained in strings but external files. --- org/config/spacemacs.org | 50 +++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/org/config/spacemacs.org b/org/config/spacemacs.org index 9188fcc..589ce84 100644 --- a/org/config/spacemacs.org +++ b/org/config/spacemacs.org @@ -2532,53 +2532,45 @@ It will then ask which template I wish to use. Said templates are described below: #+BEGIN_SRC emacs-lisp - (defvar org-capture-templates-location "~/org/capture/" - "Directory in which org-capture templates are stored.") (setq org-default-notes-file "~/org/notes.org" org-capture-templates '(("e" "Emails") ("ew" "Write Email" entry (file+headline org-default-notes-file "Emails") - (file ,(concat org-capture-templates-location "emails.orgcaptmpl"))) + (file "~/org/capture/emails.orgcaptmpl")) ("j" "Journal" entry (file+datetree "~/org/journal.org") - (file ,(concat org-capture-templates-location "journal.orgcaptmpl"))) + (file "~/org/capture/journal.orgcaptmpl")) ("l" "Links") ("ly" "YouTube" entry (file+headline org-default-notes-file "YouTube") - (file ,(concat org-capture-templates-location "youtube.orgcaptmpl"))) - ;; ("L" "Protocol Link" entry - ;; (file+headline org-default-notes-file "Link") - ;; (file ,(concat org-capture-templates-location "protocol-link.orgcaptmpl"))) + (file "~/org/capture/youtube.orgcaptmpl")) ("L" "Protocol Link" entry (file+headline org-default-notes-file "Link") - "* %^{Title}\n:PROPERTIES:\n:CAPTURED: %U\n:LINK: %:link\n:END:\n%?\n") + (file "~/org/capture/protocol-link.orgcaptmpl")) ("n" "Note" entry (file+headline org-default-notes-file "Note") - (file ,(concat org-capture-templates-location "notes.orgcaptmpl"))) - ;; ("p" "Protocol" entry - ;; (file+headline org-default-notes-file "Link") - ;; (file ,(concat org-capture-templates-location "protocol.orgcaptmpl"))) + (file "~/org/capture/notes.orgcaptmpl")) ("p" "Protocol" entry (file+headline org-default-notes-file "Link") - "* %^{Title}\n:PROPERTIES:\n:CAPTURED: %U\n:LINK: %:link\n:END:\n#+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n%?\n") + (file "~/org/capture/protocol.orgcaptmpl")) ("r" "Resources") ("rc" "Conlanging" entry (file+headline org-default-notes-file "Conlanging") - (file ,(concat org-capture-templates-location "resource.orgcaptmpl"))) + (file "~/org/capture/resource.orgcaptmpl")) ("re" "Emacs" entry (file+headline org-default-notes-file "Emacs") - (file ,(concat org-capture-templates-location "resource.orgcaptmpl"))) + (file "~/org/capture/resource.orgcaptmpl")) ("ri" "Informatique général" entry (file+headline org-default-notes-file "Informatique") - (file ,(concat org-capture-templates-location "resource.orgcaptmpl"))) + (file "~/org/capture/resource.orgcaptmpl")) ("rl" "Linguistics" entry (file+headline org-default-notes-file "Linguistics") - (file ,(concat org-capture-templates-location "resource.orgcaptmpl"))) + (file "~/org/capture/resource.orgcaptmpl")) ("rw" "Worldbuilding" entry (file+headline org-default-notes-file "Worldbuilding") - (file ,(concat org-capture-templates-location "resource.orgcaptmpl"))))) + (file "~/org/capture/resource.orgcaptmpl")))) #+END_SRC You may notice a capture entry for my journal, and this is due to the fact I @@ -2678,6 +2670,16 @@ #+END_SRC For the next + #+BEGIN_SRC org :tangle ~/org/capture/protocol-link.orgcaptmpl + ,* TODO [#C] Link: %^{Title} + :PROPERTIES: + :CAPTURED: %U + :LINK: %:link + :TITLE: %(transform-square-brackets-to-round-ones \"%:description\") + :END: + %? + #+END_SRC + #+BEGIN_SRC emacs-lisp (defun transform-square-brackets-to-round-ones (string-to-transform) "Transforms [ into ( and ] into ), other chars left unchanged." @@ -2691,16 +2693,6 @@ string-to-transform))) #+END_SRC - #+BEGIN_SRC org :tangle ~/org/capture/protocol-link.orgcaptmpl - ,* TODO [#C] Link: %^{Title} - :PROPERTIES: - :CAPTURED: %U - :LINK: %:link - :TITLE: %(transform-square-brackets-to-round-ones \"%:description\") - :END: - %? - #+END_SRC - **** Resources :PROPERTIES: :CUSTOM_ID: h-001eb681-1725-442d-91ef-b6a46c1784dc From 56e655f0c88bbadcf7c63166175bb9a2760d7deb Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Mon, 24 Feb 2020 21:44:24 +0100 Subject: [PATCH 05/13] Updated email signature --- org/config/index.org | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/org/config/index.org b/org/config/index.org index f75d17e..759e6f5 100644 --- a/org/config/index.org +++ b/org/config/index.org @@ -110,8 +110,7 @@ https://phundrak.com (Français) https://en.phundrak.com (English) - Pensez à notre planète, avez-vous vraiment besoin d’imprimer ce courriel ? - Please mind our planet, do you really need to print this email? + Sent from a Free and Open-Source Linux operating system with GNU/Emacs #+END_SRC ** Fish configuration with useful abbreviations From 8e9d55d7decc032c53850dd36c8bcf61e5f33563 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Mon, 24 Feb 2020 21:44:38 +0100 Subject: [PATCH 06/13] Optimized fish literate programming --- org/config/fish.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org/config/fish.org b/org/config/fish.org index bf2fc41..dec2970 100644 --- a/org/config/fish.org +++ b/org/config/fish.org @@ -215,8 +215,8 @@ #+BEGIN_SRC python :var table=[] :exports none result = '' for abbr in table: - result += "abbr {0} '{1}'\n".format(abbr[0], abbr[1].replace("\\vert{}", "|").replace("\\vert", "|")) - return result + result += "abbr {0} '{1}'\n".format(abbr[0], abbr[1]) + return result.replace("\\vert{}", "|").replace("\\vert", "|") #+END_SRC ** System monitoring From b4a9471af3e6c6164e65bbc3e0bb77ff786c0865 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Mon, 24 Feb 2020 21:45:32 +0100 Subject: [PATCH 07/13] Added mu4e configuration I might do a full switch from Gnus to mu4e honestly --- org/config/spacemacs.org | 66 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/org/config/spacemacs.org b/org/config/spacemacs.org index 589ce84..9c32e2a 100644 --- a/org/config/spacemacs.org +++ b/org/config/spacemacs.org @@ -82,6 +82,7 @@ - [[#general-options][General options]] - [[#visual-configuration-1][Visual configuration]] - [[#lsp][LSP]] + - [[#mu4e][Mu4e]] - [[#miscellaneous-1][Miscellaneous]] - [[#evil][Evil]] - [[#default-modes][Default modes]] @@ -331,7 +332,18 @@ As described below, I use Gnus as my main email client. Therefore, I have the gnus layer enabled: #+BEGIN_SRC emacs-lisp - gnus + gnus + #+END_SRC + + I am also currently testing ~mu4e~, so let’s enable it and tell Emacs where + mu4e is installed. I also tell mu4e to use maildirs extensions, use async + operations, where to keep attachments, and enable the mu4e modeline. + #+BEGIN_SRC emacs-lisp + (mu4e :variables + mu4e-installation-path "/usr/share/emacs/site-lisp" + mu4e-use-maildirs-extension t + mu4e-enable-mode-line t + mu4e-attachment-dir "~/Documents") #+END_SRC *** Emacs @@ -1854,11 +1866,14 @@ "ogD" 'turn-on-gnus-dired-mode "ogd" 'gnus-summary-delete-article "ogf" 'gnus-summary-mail-forward + "ogm" 'gnus-group-mail "ogo" 'my-gnus-group-list-subscribed-groups "ogr" 'gnus-summary-insert-new-articles "ogs" 'message-send-and-exit) #+END_SRC + #+RESULTS: + *** Hooks :PROPERTIES: :CUSTOM_ID: h-5208e53f-d2e7-4dc1-a081-964ac1c90d4b @@ -1980,6 +1995,55 @@ (tooltip-mode 1) #+END_SRC +** Mu4e + :PROPERTIES: + :CUSTOM_ID: h-ba4a69ff-38a6-498a-b076-a514bbf0701f + :END: + + #+BEGIN_SRC emacs-lisp + (setq mu4e-maildir "~/.mail" + mu4e-trash-folder "/Trash" + mu4e-refile-folder "/Archive" + mu4e-sent-folder "/Sent" + mu4e-get-mail-command "mbsync -a" + mu4e-update-interval 60 + mu4e-compose-signature-auto-include t + mu4e-view-show-images t + mu4e-view-show-addresses t) + #+END_SRC + + Bookmarks + #+BEGIN_SRC emacs-lisp + (setq mu4e-bookmarks + `(("flag:unread AND NOT flag:trashed" "Unread messages" ?u) + ("date:today..now" "Today's messages" ?t) + ("date:7d..now" "Last 7 days" ?w) + ("mime:image/*" "Messages with images" ?p) + (,(mapconcat 'identity + (mapcar + (lambda (maildir) + (concat "maildir:" (car maildir))) + mu4e-maildir-shortcuts) " OR ") + "All inboxes" ?i))) + #+END_SRC + + Enable OS notifications. + #+BEGIN_SRC emacs-lisp + (setq mu4e-enable-notifications t) + (with-eval-after-load 'mu4e-alert + (mu4e-alert-set-default-style 'notifications)) + #+END_SRC + + #+BEGIN_SRC emacs-lisp + (add-hook 'mu4e-view-mode-hook 'visual-fill-column-mode) + #+END_SRC + + Vertical split + #+BEGIN_SRC emacs-lisp + (setq mu4e-split-view 'vertical + mu4e-headers-visible-columns 80) + #+END_SRC + ** Miscellaneous :PROPERTIES: :CUSTOM_ID: h-cee08965-745a-4a6f-b04e-bf1638342698 From d91932bf0e504c86cc5d8b637945f8b1d1356bd0 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Tue, 25 Feb 2020 12:33:38 +0100 Subject: [PATCH 08/13] Replaced Gnus with Mu4e Removed all Gnus configuration, replaced them with mu4e. --- .spacemacs | 4 +- org/config/spacemacs.org | 252 ++++++++++++++++----------------------- 2 files changed, 103 insertions(+), 153 deletions(-) diff --git a/.spacemacs b/.spacemacs index b25ce68..83ddfdf 100644 --- a/.spacemacs +++ b/.spacemacs @@ -5,7 +5,6 @@ This function is called at the very beginning of Spacemacs startup, before layer configuration. It should only modify the values of Spacemacs settings." (setq phundrak//dotspacemacs-src-dir (concat (getenv "HOME") "/.config/emacs/private/") - phundrak//dotspacemacs-gc (concat (getenv "HOME") "/.gnus.el") phundrak//dotspacemacs-src (concat (getenv "HOME") "/org/config/spacemacs.org") phundrak//dotspacemacs-si (concat phundrak//dotspacemacs-src-dir "spacemacs-init.el") phundrak//dotspacemacs-sl (concat phundrak//dotspacemacs-src-dir "spacemacs-layers.el") @@ -14,8 +13,7 @@ It should only modify the values of Spacemacs settings." (when (or (file-newer-than-file-p phundrak//dotspacemacs-src phundrak//dotspacemacs-si) (file-newer-than-file-p phundrak//dotspacemacs-src phundrak//dotspacemacs-sl) (file-newer-than-file-p phundrak//dotspacemacs-src phundrak//dotspacemacs-ui) - (file-newer-than-file-p phundrak//dotspacemacs-src phundrak//dotspacemacs-uc) - (file-newer-than-file-p phundrak//dotspacemacs-src phundrak//dotspacemacs-gc)) + (file-newer-than-file-p phundrak//dotspacemacs-src phundrak//dotspacemacs-uc)) (princ "Exporting new Emacs configuration from spacemacs.org through org-babel...") (call-process (concat invocation-directory invocation-name) diff --git a/org/config/spacemacs.org b/org/config/spacemacs.org index 9c32e2a..4c545f6 100644 --- a/org/config/spacemacs.org +++ b/org/config/spacemacs.org @@ -75,18 +75,12 @@ - [[#visual-commands][Visual commands]] - [[#eshell-theme][Eshell theme]] - [[#file-extensions][File extensions]] - - [[#gnus][Gnus]] - - [[#shortcuts][Shortcuts]] - - [[#hooks][Hooks]] - - [[#mail-account-configuration][Mail account configuration]] - - [[#general-options][General options]] - - [[#visual-configuration-1][Visual configuration]] - [[#lsp][LSP]] - [[#mu4e][Mu4e]] - [[#miscellaneous-1][Miscellaneous]] - [[#evil][Evil]] - [[#default-modes][Default modes]] - - [[#hooks-1][Hooks]] + - [[#hooks][Hooks]] - [[#pinentry][Pinentry]] - [[#prettified-symbols][Prettified symbols]] - [[#twittering-mode][Twittering mode]] @@ -117,7 +111,7 @@ - [[#linguistics-website][Linguistics website]] - [[#rust][Rust]] - [[#scheme][Scheme]] - - [[#shortcuts-1][Shortcuts]] + - [[#shortcuts][Shortcuts]] - [[#applications][Applications]] - [[#comments][Comments]] - [[#files][Files]] @@ -329,15 +323,9 @@ :PROPERTIES: :CUSTOM_ID: h-0db2333c-86bf-4b41-8226-da66885fce36 :END: - As described below, I use Gnus as my main email client. Therefore, I have - the gnus layer enabled: - #+BEGIN_SRC emacs-lisp - gnus - #+END_SRC - - I am also currently testing ~mu4e~, so let’s enable it and tell Emacs where - mu4e is installed. I also tell mu4e to use maildirs extensions, use async - operations, where to keep attachments, and enable the mu4e modeline. + I use as my daily Email client ~mu4e~, so let’s enable it and tell Emacs + where mu4e is installed. I also tell mu4e to use maildirs extensions, use + async operations, where to keep attachments, and enable the mu4e modeline. #+BEGIN_SRC emacs-lisp (mu4e :variables mu4e-installation-path "/usr/share/emacs/site-lisp" @@ -1843,132 +1831,6 @@ auto-mode-alist)) #+END_SRC -** Gnus - :PROPERTIES: - :CUSTOM_ID: h-fb05a405-110f-4e7e-a21d-b768615754cc - :END: - Here comes my Gnus configuration. Gnus is an email client I use daily to - read, manage, answer to and forward messages I receive by email. - -*** Shortcuts - :PROPERTIES: - :CUSTOM_ID: h-4715e44d-b95b-40d4-b79a-c7873d972b39 - :END: - Some shortcuts needed to be redefined in order for Evil to work well with - Gnus. Here is first the declaration of a prefix: - #+BEGIN_SRC emacs-lisp - (spacemacs/declare-prefix "og" "gnus") - #+END_SRC - And here are said shortcuts. As described above in the [[#h-f193126f-abc1-4287-aa70-4f2080d2ef8f][shortcuts]] chapter, - these Spacemacs shortcuts are invoked with the ~SPC~ leader key. - #+BEGIN_SRC emacs-lisp - (spacemacs/set-leader-keys - "ogD" 'turn-on-gnus-dired-mode - "ogd" 'gnus-summary-delete-article - "ogf" 'gnus-summary-mail-forward - "ogm" 'gnus-group-mail - "ogo" 'my-gnus-group-list-subscribed-groups - "ogr" 'gnus-summary-insert-new-articles - "ogs" 'message-send-and-exit) - #+END_SRC - - #+RESULTS: - -*** Hooks - :PROPERTIES: - :CUSTOM_ID: h-5208e53f-d2e7-4dc1-a081-964ac1c90d4b - :END: - To sort by topics my different mailboxes and folders, I use the - ~gnus-topic-mode~ minor mode. To get it active by default, I use the - following hook to activate it: - #+BEGIN_SRC emacs-lisp - (add-hook 'gnus-group-mode-hook 'gnus-topic-mode) - #+END_SRC - -*** Mail account configuration - :PROPERTIES: - :CUSTOM_ID: h-eb1a12b5-38ef-4c81-9d6c-01c1e066feaa - :header-args:emacs-lisp: :comments link :tangle ~/.gnus.el - :END: - This section will be tangled in =~/.gnus.el=. - - I only use one email account with Gnus: ~lucien@phundrak.com~. Here is how I - configured it: - #+BEGIN_SRC emacs-lisp - (setq gnus-secondary-select-methods '((nnimap "lucien@phundrak.com" - (nnimap-address "mail.phundrak.com") - (nnimap-server-port 143) - (nnimap-stream starttls))) - message-send-mail-function 'smtpmail-send-it - smtpmail-smtp-server "mail.phundrak.com" - smtpmail-stream-type 'starttls - smtpmail-smtp-service 587 - gnus-message-archive-method '(nnimap "mail.phundrak.com") - gnus-message-archive-group "Sent" - nnml-directory "~/Mails" - message-directory "~/Mails" - gnus-fetch-old-headers 'some - mm-discouraged-alternatives '("text/html" "text/richtext")) - #+END_SRC - -*** General options - :PROPERTIES: - :CUSTOM_ID: h-336a2c1c-ed8d-4a90-b4a3-6422a0199ba0 - :header-args:emacs-lisp: :comments link :tangle ~/.gnus.el - :END: - This section will be tangled in =~/.gnus.el=. - - I want to use at one point the [[https://www.emacswiki.org/emacs/EmacsApplicationFramework][Emacs Application Framework]] which is set to - be able one day to render Gnus emails, but for now I am using w3m to render - HTML emails I receive. - #+BEGIN_SRC emacs-lisp - (setq mm-text-html-renderer 'w3m) - #+END_SRC - - I also want Gnus to use the cache in case I need to navigate my emails - offline: - #+BEGIN_SRC emacs-lisp - (setq gnus-use-cache t) - #+END_SRC - - The following allows the user to read in a group all the messages in this - group, whether they are read or unread. - #+BEGIN_SRC emacs-lisp - (setq gnus-fetch-old-headers t) - (setq gnus-parameters '(("nnimap.*" - (display . all)))) - #+END_SRC - - Let’s set a quick organization of the Gnus folders, the format in which sent - messages should be saved, and the typology of Gnus’ topics: - #+BEGIN_SRC emacs-lisp - (eval-after-load 'gnus-topic - '(progn - (setq gnus-message-archive-group '((format-time-string "sent.%Y"))) - (setq gnus-topic-topology '(("Gnus" visible) - (("lucien@phundrak.com" visible nil nil)))) - (setq gnus-topic-alist '(("lucien@phundrak.com" ; the key of the topic - "nnimap+lucien@phundrak.com:INBOX" - "nnimap+lucien@phundrak.com:Sent" - "nnimap+lucien@phundrak.com:Drafts") - ("Gnus"))))) - #+END_SRC - -*** Visual configuration - :PROPERTIES: - :CUSTOM_ID: h-8ccda149-c755-4c80-8643-7a9b99ee85b2 - :header-args:emacs-lisp: :comments link :tangle ~/.gnus.el - :END: - This section will be tangled in =~/.gnus.el=. - - I get it that it used to be a good option with 4/3 screens, but frankly - opening an email at the bottom of the frame instead of the side of the frame - does not look good anymore. So, let’s fix that: - #+BEGIN_SRC emacs-lisp - (gnus-add-configuration - '(article (horizontal 1.0 (summary .4 point) (article 1.0)))) - #+END_SRC - ** LSP :PROPERTIES: :CUSTOM_ID: h-4d0272c3-df5e-4f6b-a6e6-f769add4e603 @@ -1999,20 +1861,57 @@ :PROPERTIES: :CUSTOM_ID: h-ba4a69ff-38a6-498a-b076-a514bbf0701f :END: + Mu4e is a frontend for mu, an email analyzer which sits on top of a Maildir + which gets updated with ~isync~. It has a lot of neat features, but I guess + my favorite ones are: + 1. the search query feature + 2. being able to send an HTML email either to the browser or + 3. to compile it to a PDF for a better output + This last feature can only be enabled manually with Arch Linux. We need + ~webkitgtk~ installed, and unfortunately, it is by default only available + through the AUR and has to be compiled. Thing is, ~webkitgtk~ is a *BIG* + piece of software, and compiling it can be very time consuming. So, I decided + to add ArchLinuxCN’s servers to my pacman config (instructions on how to do + so [[https://github.com/archlinuxcn/repo][here]]) so I could install a compiled version from their repos. Next, when I + installed ~mu~ from the AUR, I modified the PKGBUILD like so: + #+BEGIN_SRC diff :tangle no + < ./configure --prefix=/usr --disable-webkit --disable-gtk --enable-mu4e --enable-guile + --- + > ./configure --prefix=/usr --enable-mu4e --enable-guile + #+END_SRC + This enables the installation of ~msg2pdf~, which in turn enables the email + compilation to PDF with the shortcut ~a v~ when an email is opened, and this + opens the PDF in a new Emacs buffer. + + Due to mu sitting on top of a Maildir, I need to tell mu4e where said maildir + is, and point it the trash, archive, and sent folders as well as the refresh + command and how frequently I want my emails to be refreshed. #+BEGIN_SRC emacs-lisp (setq mu4e-maildir "~/.mail" mu4e-trash-folder "/Trash" mu4e-refile-folder "/Archive" mu4e-sent-folder "/Sent" mu4e-get-mail-command "mbsync -a" - mu4e-update-interval 60 - mu4e-compose-signature-auto-include t + mu4e-update-interval 60) + #+END_SRC + + The following also allows me to automatically include my signature in my + Emails, to view images in my Emacs buffers and to show me the address of my + contacts and not just their names. + #+BEGIN_SRC emacs-lisp + (setq mu4e-compose-signature-auto-include t mu4e-view-show-images t mu4e-view-show-addresses t) #+END_SRC - Bookmarks + This source block is an example of the search queries in mu4e, and part of + the reason why I very much like mu4e: these bookmarks are actually defined by + search queries, but act as if they were just yet another type of custom inbox + you get with modern Email client (and often you don’t even get them). All + these bookmarks can be accessed through a shortcut on the main mu4e buffer, + prefixed by ~b~. So, for instance, my unread messages are accessed through + ~bu~. #+BEGIN_SRC emacs-lisp (setq mu4e-bookmarks `(("flag:unread AND NOT flag:trashed" "Unread messages" ?u) @@ -2027,23 +1926,76 @@ "All inboxes" ?i))) #+END_SRC - Enable OS notifications. + On new email arrival, Emacs can send the system a notification which will be + handled as any other notification received by the system and will display the + number of unread emails to the user; in my case, notifications are handled by + [[https://dunst-project.org/][dunst]]. #+BEGIN_SRC emacs-lisp - (setq mu4e-enable-notifications t) + (setq mu4e-enable-notifications t + mu4e-alert-email-notification-types '(count)) (with-eval-after-load 'mu4e-alert - (mu4e-alert-set-default-style 'notifications)) + (mu4e-alert-set-default-style 'libnotify)) #+END_SRC + Now this hook is added so I can get a maximal width for the text of my + emails, I really don’t like it when lines are kilometers long. I would like + instead to hook ~visual-line-mode~ and ~auto-fill-mode~, but for some reasons + Emacs throws an error when I add them, So I go with ~visual-fill-column-mode~ + instead. #+BEGIN_SRC emacs-lisp (add-hook 'mu4e-view-mode-hook 'visual-fill-column-mode) #+END_SRC - Vertical split + On modern-day computers, with wide screens almost everywhere, there is no + reason for the email buffer to open below the email directory and not on its + right, which is why I set the split view to be vertical instead of + horizontal. I also set the width the email directory should keep to 80 + characters (and I could go to 120, but that’s only good for my + ultra-widescreen), because 30 characters is way too f-ing low. #+BEGIN_SRC emacs-lisp (setq mu4e-split-view 'vertical mu4e-headers-visible-columns 80) #+END_SRC + I want to add myself as a hidden recipient to all of my messages so I can get + them in the email thread in my inbox and not just get a thread of messages + not sent by me –the thread could kinda lack some context if the other people + do not insert my email in their answer. But unfortunately, for some obscure + reason, mu4e does not use the following variable for its email templates, so + I am keeping this as a reminder I should find how to fix that. It does work + when I’m exporting an org file to and HTML buffer to be sent by email through + ~, e m~. + #+BEGIN_SRC emacs-lisp + (setq message-default-headers "Bcc: Lucien Cartier-Tilet \n") + #+END_SRC + + Finally but very importantly, this is the setup I have for my SMTP mail + server: I point Emacs’ SMTP services to my private mail server on its SMTP + port, which should be used with a STARTTLS stream. And I tell Emacs this is + the default way to send an email. + #+BEGIN_SRC emacs-lisp + (setq smtpmail-smtp-server "mail.phundrak.com" + smtpmail-smtp-service 587 + smtpmail-stream-type 'starttls + message-send-mail-function 'smtpmail-send-it) + #+END_SRC + + I am unsure yet if this has any effect on mu4e, but this variable should + discourage mu4e from reading rich text emails and instead open them as plain + text. However, I do not wish to discourage opening HTML emails since I can + compile them to PDF or open them in the browser. + #+BEGIN_SRC emacs-lisp + (setq mm-discouraged-alternatives '("text/richtext")) + #+END_SRC + + I am still unsure about this variable and if it has an effect on mu4e, but I + wish to set a default web viewer for my HTML emails: w3m. This is not as + effective as sending the email in the browser or rendering it as a PDF file, + but it can be effective enough for some emails. + #+BEGIN_SRC emacs-lisp + (setq mm-text-html-renderer 'w3m) + #+END_SRC + ** Miscellaneous :PROPERTIES: :CUSTOM_ID: h-cee08965-745a-4a6f-b04e-bf1638342698 From 1fa563b74add99517adae5d8a44e2b6845259c3e Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Tue, 25 Feb 2020 12:34:30 +0100 Subject: [PATCH 09/13] Silent results for Emacs-lisp code I can now evaluate in-place my Elisp code without it generating some results I then have to delete. --- org/config/spacemacs.org | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/org/config/spacemacs.org b/org/config/spacemacs.org index 4c545f6..faa781a 100644 --- a/org/config/spacemacs.org +++ b/org/config/spacemacs.org @@ -137,7 +137,7 @@ * Spacemacs layers and packages :PROPERTIES: - :header-args:emacs-lisp: :comments link :tangle ~/.config/emacs/private/spacemacs-layers.el :exports code + :header-args:emacs-lisp: :comments link :tangle ~/.config/emacs/private/spacemacs-layers.el :exports code :results silent :CUSTOM_ID: h-9d9869e0-4672-419c-bf37-3d3ae1b7c0aa :END: Here will be our layer configuration set. Everything here is set with a @@ -652,7 +652,7 @@ * Init :PROPERTIES: :CUSTOM_ID: h-3f3c8a0b-56cd-4be6-b019-3ba6f1e24f96 - :header-args:emacs-lisp: :comments link :tangle ~/.config/emacs/private/spacemacs-init.el :exports code + :header-args:emacs-lisp: :comments link :tangle ~/.config/emacs/private/spacemacs-init.el :exports code :results silent :END: The ~dotspacemacs/init~ function is the one called at the very begining of the Spacemacs startup, before any kind of configuration, including the layer @@ -1269,7 +1269,7 @@ * User Initialization :PROPERTIES: :CUSTOM_ID: h-e297b9be-9b0d-4c2d-bb6e-402f0d00be0d - :header-args:emacs-lisp: :comments link :tangle ~/.config/emacs/private/user-init.el :exports code + :header-args:emacs-lisp: :comments link :tangle ~/.config/emacs/private/user-init.el :exports code :results silent :END: While Emacs and especially Spacemacs loads, I want it to initialize some elements and load some packages. First of all, I want it to load my private @@ -1315,7 +1315,7 @@ * User Configuration :PROPERTIES: :CUSTOM_ID: h-7a36d3a0-8bb6-4d9d-9402-eadbc49fef32 - :header-args:emacs-lisp: :comments link :tangle ~/.config/emacs/private/user-config.el :exports code + :header-args:emacs-lisp: :comments link :tangle ~/.config/emacs/private/user-config.el :exports code :results silent :END: ** ASM configuration :PROPERTIES: From 11517d9c0bfb663ff88d2cb200c3a1bb776e007a Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Tue, 25 Feb 2020 12:35:16 +0100 Subject: [PATCH 10/13] Added my notes to my agenda, updated capture templates I also completed my comment about the protocol templates, and I removed a piece of Elisp code not used anymore --- org/config/spacemacs.org | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/org/config/spacemacs.org b/org/config/spacemacs.org index faa781a..93f829c 100644 --- a/org/config/spacemacs.org +++ b/org/config/spacemacs.org @@ -2511,7 +2511,7 @@ One awesome feature of Org mode is the agenda. By default, my agendas are stored in =~/org/agenda=. #+BEGIN_SRC emacs-lisp - (setq org-agenda-files (list "~/org/agenda")) + (setq org-agenda-files (list "~/org/agenda" "~/org/notes.org")) #+END_SRC I also have a custom command in Org agenda to mark some tasks as daily @@ -2676,7 +2676,7 @@ :PROPERTIES: :CAPTURED: %U :LINK: %:link - :TITLE: %:(transform-square-brackets-to-round-ones \"%:description\") + :TITLE: %:description :END: ,#+begin_quote %i @@ -2685,30 +2685,18 @@ %? #+END_SRC - For the next + This next capture template is used only when a link is sent to Emacs and no + content was highlighted. #+BEGIN_SRC org :tangle ~/org/capture/protocol-link.orgcaptmpl ,* TODO [#C] Link: %^{Title} :PROPERTIES: :CAPTURED: %U :LINK: %:link - :TITLE: %(transform-square-brackets-to-round-ones \"%:description\") + :TITLE: %:description :END: %? #+END_SRC - #+BEGIN_SRC emacs-lisp - (defun transform-square-brackets-to-round-ones (string-to-transform) - "Transforms [ into ( and ] into ), other chars left unchanged." - (concat - (mapcar #'(lambda (c) - (if (equal c ?[) - ?\( - (if (equal c ?]) - ?\) - c))) - string-to-transform))) - #+END_SRC - **** Resources :PROPERTIES: :CUSTOM_ID: h-001eb681-1725-442d-91ef-b6a46c1784dc From 35d285b07abe081735dee3e7389b5ec14d95b14b Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Tue, 25 Feb 2020 12:37:43 +0100 Subject: [PATCH 11/13] Greater delay for Helm popup This will allow Emacs to be less laggy. Also fixed indentation on a code block --- org/config/spacemacs.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org/config/spacemacs.org b/org/config/spacemacs.org index 93f829c..d55fbb1 100644 --- a/org/config/spacemacs.org +++ b/org/config/spacemacs.org @@ -914,7 +914,7 @@ variable sets in seconds the time Spacemacs should wait between a key press and the moment =which-key= should be shown. #+BEGIN_SRC emacs-lisp - (setq-default dotspacemacs-which-key-delay 0.4) + (setq-default dotspacemacs-which-key-delay 3) #+END_SRC This variable sets =which-key='s frame position. Possible values are: @@ -2885,7 +2885,7 @@ The Scheme configuration will be very short, I just need to tell Emacs the name of the interpreter since it is not the default one: #+BEGIN_SRC emacs-lisp - (setq geiser-chicken-binary "chicken-csi") + (setq geiser-chicken-binary "chicken-csi") #+END_SRC ** Shortcuts From 125b48a599d0f1557809d40540b7704229741929 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Tue, 25 Feb 2020 14:38:03 +0100 Subject: [PATCH 12/13] Removed git webui lines --- .gitconfig | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitconfig b/.gitconfig index b889ad0..b2b7d5d 100644 --- a/.gitconfig +++ b/.gitconfig @@ -72,8 +72,6 @@ #### u = reset -- unstage = reset -- - #### - webui = !/home/phundrak/.git-webui/release/libexec/git-core/git-webui [magithub] online = true [magithub "status"] @@ -82,8 +80,6 @@ includeIssuesSection = true [gpg] program = gpg2 -[webui] - autoupdate = true [mergetool.ediff] cmd = emacs --eval \" (progn (defun ediff-write-merge-buffer () (let ((file ediff-merge-store-file)) (set-buffer ediff-buffer-C) (write-region (point-min) (point-max) file) (message \\\"Merge buffer saved in: %s\\\" file) (set-buffer-modified-p nil) (sit-for 1))) (setq ediff-quit-hook 'kill-emacs ediff-quit-merge-hook 'ediff-write-merge-buffer) (ediff-merge-files-with-ancestor \\\"$LOCAL\\\" \\\"$REMOTE\\\" \\\"$BASE\\\" nil \\\"$MERGED\\\"))\" [merge] From d9015c267b2dd1134c00ffc577ca3e6ebed6c3c2 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Tue, 25 Feb 2020 15:02:24 +0100 Subject: [PATCH 13/13] Removed git powerline prompt for Eshell --- org/config/spacemacs.org | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/org/config/spacemacs.org b/org/config/spacemacs.org index d55fbb1..af1396d 100644 --- a/org/config/spacemacs.org +++ b/org/config/spacemacs.org @@ -206,23 +206,22 @@ Dependencies should be explicitly included as they won’t be resolved automatically. Here is a table of all the extra packages I use: #+NAME: extra-packages - | name of the package | why is it installed | - |------------------------+------------------------------------------------------| - | dired-du | alternative to ~ncdu~ with Dired | - | doom-themes | some cool themes | - | edit-indirect | edit region in separate buffer | - | elcord | rich integration of Emacs in Discord | - | eshell-git-prompt | pimp my Eshell | - | kaolin-themes | some cool themes | - | magit-gitflow | integrate gitflow in Magit | - | meson-mode | major mode for Meson build files | - | multiple-cursors | I don’t like the layer, I prefer this package alone | - | org-sidebar | display on the side the outline of an Org buffer | - | outorg | edit comments as Org-mode buffers | - | pinentry | enter a GPG password from Emacs | - | visual-fill-column | allow the use of ~fill-column~ in ~visual-line-mode~ | - | wttrin | weather in Emacs | - | yasnippet-snippets | snippets for YaSnippet | + | name of the package | why is it installed | + |---------------------+------------------------------------------------------| + | dired-du | alternative to ~ncdu~ with Dired | + | doom-themes | some cool themes | + | edit-indirect | edit region in separate buffer | + | elcord | rich integration of Emacs in Discord | + | kaolin-themes | some cool themes | + | magit-gitflow | integrate gitflow in Magit | + | meson-mode | major mode for Meson build files | + | multiple-cursors | I don’t like the layer, I prefer this package alone | + | org-sidebar | display on the side the outline of an Org buffer | + | outorg | edit comments as Org-mode buffers | + | pinentry | enter a GPG password from Emacs | + | visual-fill-column | allow the use of ~fill-column~ in ~visual-line-mode~ | + | wttrin | weather in Emacs | + | yasnippet-snippets | snippets for YaSnippet | #+NAME: make-extra-packages #+BEGIN_SRC emacs-lisp :tangle no :var packages=extra-packages[,0] :exports none @@ -1790,11 +1789,6 @@ eshell-prompt-function 'eshell/my-prompt) #+END_SRC - Finally, let’s declare the theme of our shell: - #+BEGIN_SRC emacs-lisp - (eshell-git-prompt-use-theme 'powerline) - #+END_SRC - ** File extensions :PROPERTIES: :CUSTOM_ID: h-beb67a88-d7d3-4d58-bbc7-7a7be67f64aa