Merge branch 'master' of github.com:phundrak/dotfiles

This commit is contained in:
Lucien Cartier-Tilet 2020-02-25 15:03:31 +01:00
commit 4aa81d67da
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
7 changed files with 600 additions and 356 deletions

View File

@ -72,8 +72,6 @@
#### ####
u = reset -- u = reset --
unstage = reset -- unstage = reset --
####
webui = !/home/phundrak/.git-webui/release/libexec/git-core/git-webui
[magithub] [magithub]
online = true online = true
[magithub "status"] [magithub "status"]
@ -82,8 +80,6 @@
includeIssuesSection = true includeIssuesSection = true
[gpg] [gpg]
program = gpg2 program = gpg2
[webui]
autoupdate = true
[mergetool.ediff] [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\\\"))\" 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] [merge]

View File

@ -5,7 +5,6 @@ This function is called at the very beginning of Spacemacs startup,
before layer configuration. before layer configuration.
It should only modify the values of Spacemacs settings." It should only modify the values of Spacemacs settings."
(setq phundrak//dotspacemacs-src-dir (concat (getenv "HOME") "/.config/emacs/private/") (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-src (concat (getenv "HOME") "/org/config/spacemacs.org")
phundrak//dotspacemacs-si (concat phundrak//dotspacemacs-src-dir "spacemacs-init.el") phundrak//dotspacemacs-si (concat phundrak//dotspacemacs-src-dir "spacemacs-init.el")
phundrak//dotspacemacs-sl (concat phundrak//dotspacemacs-src-dir "spacemacs-layers.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) (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-sl)
(file-newer-than-file-p phundrak//dotspacemacs-src phundrak//dotspacemacs-ui) (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-uc))
(file-newer-than-file-p phundrak//dotspacemacs-src phundrak//dotspacemacs-gc))
(princ "Exporting new Emacs configuration from spacemacs.org through org-babel...") (princ "Exporting new Emacs configuration from spacemacs.org through org-babel...")
(call-process (call-process
(concat invocation-directory invocation-name) (concat invocation-directory invocation-name)

View File

@ -22,6 +22,7 @@
- [[#dmenu][Dmenu]] - [[#dmenu][Dmenu]]
- [[#emoji-picker][Emoji picker]] - [[#emoji-picker][Emoji picker]]
- [[#lsl][Lsl]] - [[#lsl][Lsl]]
- [[#mp42webm][mp42webm]]
- [[#polybar-launch][Polybar-launch]] - [[#polybar-launch][Polybar-launch]]
- [[#rofi-mount][Rofi-mount]] - [[#rofi-mount][Rofi-mount]]
- [[#get-the-mountable-elements][Get the mountable elements]] - [[#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 Please do not forget to run the following before tangling files from this file
to make sure the tangled files will be executables. 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 () (defun phundrak/make-tangled-files-executable ()
(set-file-modes (buffer-file-name) #o755)) (set-file-modes (buffer-file-name) #o755))
(add-hook 'org-babel-post-tangle-hook 'phundrak/make-tangled-files-executable) (add-hook 'org-babel-post-tangle-hook 'phundrak/make-tangled-files-executable)
#+end_src #+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 * 4chandl
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-39e14885-9da7-4cba-b24e-c3b181ef5f6b :CUSTOM_ID: h-39e14885-9da7-4cba-b24e-c3b181ef5f6b
@ -354,6 +361,16 @@
ls -ahlX --group-directories-first $argv | bat ls -ahlX --group-directories-first $argv | bat
#+END_SRC #+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 * Polybar-launch
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-68587918-879b-42db-b304-901d01233f95 :CUSTOM_ID: h-68587918-879b-42db-b304-901d01233f95

View File

@ -5,7 +5,7 @@
#+HTML_HEAD_EXTRA: <meta name="description" content="Phundrak's fish config" /> #+HTML_HEAD_EXTRA: <meta name="description" content="Phundrak's fish config" />
#+HTML_HEAD_EXTRA: <meta property="og:title" content="Phundrak's fish config" /> #+HTML_HEAD_EXTRA: <meta property="og:title" content="Phundrak's fish config" />
#+HTML_HEAD_EXTRA: <meta property="og:description" content="Description of the fish config file of Phundrak" /> #+HTML_HEAD_EXTRA: <meta property="og:description" content="Description of the fish config file of Phundrak" />
#+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 #+PROPERTY: header-args :exports code :tangle no
* Table of Contents :TOC:noexport: * Table of Contents :TOC:noexport:
@ -21,7 +21,7 @@
- [[#abbreviations][Abbreviations]] - [[#abbreviations][Abbreviations]]
- [[#system-monitoring][System monitoring]] - [[#system-monitoring][System monitoring]]
- [[#system-management-packages-and-services][System management (packages and services)]] - [[#system-management-packages-and-services][System management (packages and services)]]
- [[#package-mangaement][Package mangaement]] - [[#package-management][Package management]]
- [[#service-management][Service management]] - [[#service-management][Service management]]
- [[#development][Development]] - [[#development][Development]]
- [[#cmake][CMake]] - [[#cmake][CMake]]
@ -44,6 +44,7 @@
- [[#compression][Compression]] - [[#compression][Compression]]
- [[#feh][Feh]] - [[#feh][Feh]]
- [[#network-management][Network Management]] - [[#network-management][Network Management]]
- [[#nordvpn][NordVPN]]
- [[#wget][Wget]] - [[#wget][Wget]]
* Presentation * Presentation
@ -210,48 +211,44 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-740bd904-3e32-4c09-b0a4-bde16ae2e116 :CUSTOM_ID: h-740bd904-3e32-4c09-b0a4-bde16ae2e116
:END: :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])
return result.replace("\\vert{}", "|").replace("\\vert", "|")
#+END_SRC
** System monitoring ** System monitoring
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-ec910a8c-9154-48a4-b4cd-df28cb4e54d9 :CUSTOM_ID: h-ec910a8c-9154-48a4-b4cd-df28cb4e54d9
:END: :END:
Here I have some abbreviations which are quite useful when performing some Here I have some abbreviations which are quite useful when performing some
system monitoring. With =df=, we can get an overview of our filesystem system monitoring. With =df=, we can get an overview of our filesystem usage,
usage, while with =diskspace= we get some more precise information. while with =diskspace= we get some more precise information. =meminfo= is a
#+BEGIN_SRC fish call to =free= with sane defaults, and similar to =meminfo=, we also have
abbr df 'df -H' =gpumeminfo= so we can get a quick look at the memory-related logs of our X
abbr diskspace 'sudo df -h | grep -E "sd|lv|Size"' session. I also declared =cpuinfo= an alias of =lscpu= in order to keep
#+END_SRC 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
#+BEGIN_SRC fish <<generate-abbr(table=mgmt-abbr)>>
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'
#+END_SRC #+END_SRC
** System management (packages and services) ** System management (packages and services)
@ -261,38 +258,26 @@
I added some of these abbreviations due to how often I have to write the I added some of these abbreviations due to how often I have to write the
whole thing. whole thing.
*** Package mangaement *** Package management
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-281a59aa-4ea0-47ab-a4cc-33fff8d38165 :CUSTOM_ID: h-281a59aa-4ea0-47ab-a4cc-33fff8d38165
:END: :END:
The first command is =remove= which removes a package from my system, as The first command is =remove= which removes a package from my system, as
well as its dependencies no longer needed. well as its dependencies no longer needed. =p=. =pacman='s or =yay='s. This
#+BEGIN_SRC fish is why I simply type =purge=. And if I want to simply seach among the
abbr remove 'sudo pacman -Rscnd' =pacman= repos, I can type =search=. Otherwise, if I want to include AUR
#+END_SRC results, Ill use =yay=.
But if I just want to run =pacman= as sudo, then I could always just type #+NAME: pm-abbr
=p=. | abbreviation | command |
#+BEGIN_SRC fish |--------------+--------------------|
abbr p 'sudo -A pacman' | remove | sudo pacman -Rscnd |
#+END_SRC | p | sudo pacman |
| purge | yay -Sc |
| search | yay -Ss |
Sometimes, I just want to purge my package managers cache, be it
=pacman='s or =yay='s. This is why I simply type =purge=.
#+BEGIN_SRC fish #+BEGIN_SRC fish
abbr purge 'yay -Sc' <<generate-abbr(table=pm-abbr)>>
#+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, Ill use =yay=.
#+BEGIN_SRC fish
abbr search 'pacman -Ss'
#+END_SRC
To update everything from the official repos, Ill sometimes type =update=
instead of the full command.
#+BEGIN_SRC fish
abbr update 'sudo pacman -Syu'
#+END_SRC #+END_SRC
*** Service management *** Service management
@ -301,14 +286,16 @@
:END: :END:
I dont have the muscle memory of =systemctl=. So instead, I simply type I dont have the muscle memory of =systemctl=. So instead, I simply type
=c= when I want to do something user service related. =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 And if I want to manipulate system services, I can instead type a simple
capital =S=. capital =S=.
#+NAME: service-abbr
| abbreviation | command |
|--------------+------------------|
| s | systemctl --user |
| S | sudo systemctl |
#+BEGIN_SRC fish #+BEGIN_SRC fish
abbr S 'sudo systemctl' <<generate-abbr(table=service-abbr)>>
#+END_SRC #+END_SRC
** Development ** Development
@ -324,9 +311,15 @@
:END: :END:
I have the following abbreviations so I can quickly run CMake and create a I have the following abbreviations so I can quickly run CMake and create a
configuration for debug or release profiles. 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 #+BEGIN_SRC fish
abbr cdebug 'cmake -DCMAKE_BUILD_TYPE=Debug' <<generate-abbr(table=abbr-cmake)>>
abbr crelease 'cmake -DCMAKE_BUILD_TYPE=Release'
#+END_SRC #+END_SRC
*** Compilation *** Compilation
@ -335,11 +328,17 @@
:END: :END:
By default, I set =clang=, =clang++=, =gcc= and =g++= to the latest By default, I set =clang=, =clang++=, =gcc= and =g++= to the latest
standard and with the =-Wall= flag activated. 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 #+BEGIN_SRC fish :tangle
abbr clang 'clang -Wall' <<generate-abbr(table=abbr-comp)>>
abbr clang++ 'clang++ -Wall'
abbr g++ 'g++ -Wall -std=c++17'
abbr gcc 'gcc -Wall -std=c18'
#+END_SRC #+END_SRC
*** Docker *** Docker
@ -348,12 +347,18 @@
:END: :END:
And of course, when it comes to Docker Compose, I dont have time to write And of course, when it comes to Docker Compose, I dont have time to write
the full command, so I use these instead. 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 #+BEGIN_SRC fish
abbr dc docker-compose <<generate-abbr(table=abbr-docker)>>
abbr dcd 'docker-compose down'
abbr dcr 'docker-compose run --rm'
abbr dcu 'docker-compose up'
abbr dcub 'docker-compose up --build'
#+END_SRC #+END_SRC
*** Git *** Git
@ -363,8 +368,14 @@
And lets face it: we all at one point just wanted to commit our code And lets face it: we all at one point just wanted to commit our code
without thinking about the message, to just get over with it. Dont worry, without thinking about the message, to just get over with it. Dont worry,
I got you covered. 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 #+BEGIN_SRC fish :tangle
abbr randcommit 'git commit -m (curl -s whatthecommit.com/index.txt)' <<generate-abbr(table=abbr-git)>>
#+END_SRC #+END_SRC
*** Prolog *** Prolog
@ -373,31 +384,41 @@
:END: :END:
When I launch =swipl=, I prefer to have my terminal cleaned before and When I launch =swipl=, I prefer to have my terminal cleaned before and
after it runs, I find it more clean. 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 #+BEGIN_SRC fish
abbr swipl 'clear && swipl -q && clear' <<generate-abbr(table=abbr-prolog)>>
#+END_SRC #+END_SRC
*** Text editors *** Text editors
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-51155e06-872d-4a12-9bf7-ae5eabc256ad :CUSTOM_ID: h-51155e06-872d-4a12-9bf7-ae5eabc256ad
:END: :END:
I greatly prefer to use Emacsclient as my main text editor; Emacs has I greatly prefer to use Emacsclient as my main text editor; Emacs has
basically all I need. So, its only normal I have an abbreviation to launch basically all I need. So, its only normal I have an abbreviation to launch
a new instance of it. a new instance of it. However, in a graphical environment, this will launch
#+BEGIN_SRC fish a new graphical window of Emacs. To launch a terminal instance, Ill use
abbr e 'emacsclient -c' =enw= (=nw= stands for the option “nowindow” =-nw= of Emacs). I also wish to
#+END_SRC completely stop using other text editors, such as =vi=, =vim=, =nano= and
However, in a graphical environment, this will launch a new graphical =ed=, so lets all add their command as an abbreviation for Emacs.
window of Emacs. To launch a terminal instance, Ill use =enw= (=nw= stands
for the option “nowindow” =-nw= of Emacs).
#+BEGIN_SRC fish
abbr enw 'emacsclient -c -nw'
#+END_SRC
I also have the abbreviation =vi= which refers to =vim=. I really should #+NAME: abbr-text-ed
learn =vi=, but I also really dont feel like it. | abbreviation | command |
#+BEGIN_SRC fish |--------------+--------------------|
abbr vi vim | 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
<<generate-abbr(table=abbr-text-ed)>>
#+END_SRC #+END_SRC
** LaTeX ** LaTeX
@ -408,68 +429,71 @@
when it comes to PDF exports of my org files. Hence why I use the LaTeX 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=, 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 but I can never remember the command, and the latter is faster to type, so
time for an abbreviation. time for an abbreviation. Same goes for =texhash= which must be run as sudo.
#+BEGIN_SRC fish #+NAME: latex-abbr
abbr tlmgr tllocalmgr | abbreviation | command |
#+END_SRC |--------------+--------------|
| tlmgr | tllocalmgr |
| texhash | sudo texhash |
Here is the corresponding fish configuration:
#+BEGIN_SRC fish #+BEGIN_SRC fish
abbr texhash 'sudo texhash' <<generate-abbr(table=latex-abbr)>>
#+END_SRC #+END_SRC
** Some security measures ** Some security measures
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-dd97ea71-c43f-4b79-8bb7-1f857284b1b4 :CUSTOM_ID: h-dd97ea71-c43f-4b79-8bb7-1f857284b1b4
:END: :END:
Some commands can be quite dangerous when not used properly, which is why I 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 added default flags and options so I can get warnings before things get ugly.
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 #+BEGIN_SRC fish
abbr cp 'cp -i' <<generate-abbr(table=sec-abbr)>>
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 #+END_SRC
** Typos ** Typos
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-4c5a03cd-20a8-437e-87b7-af990780084e :CUSTOM_ID: h-4c5a03cd-20a8-437e-87b7-af990780084e
:END: :END:
Lets admit it, we all make typos from time to time in the shell, and some Lets 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 are recurrent enough we make abbreviations or aliases of the correct command.
command. Well, I have some of my abbreviations which were make exactly Well, I have some of my abbreviations which were make exactly because of
because of this. this. Sometimes for some reasons, my brain makes me write =clean= instead of
=clear=. So, lets just replace the former by the latter. Im 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 Here is the corresponding fish configuration:
=clear=. So, lets just replace the former by the latter.
#+BEGIN_SRC fish #+BEGIN_SRC fish
abbr clean clear <<generate-abbr(table=typo-abbr)>>
#+END_SRC
Im 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 #+END_SRC
** Misc ** Misc
@ -557,9 +581,14 @@
one day hopefully, after seeing the abbreviations expansion over and over one day hopefully, after seeing the abbreviations expansion over and over
Ill remember the command like I did for the abbreviation of =remove= (see Ill remember the command like I did for the abbreviation of =remove= (see
[[#h-281a59aa-4ea0-47ab-a4cc-33fff8d38165][Package management]]). [[#h-281a59aa-4ea0-47ab-a4cc-33fff8d38165][Package management]]).
#+NAME: tar-abbr
| abbreviation | command |
|--------------+-----------|
| compress | tar -czf |
| untar | tar -xvzf |
#+BEGIN_SRC fish #+BEGIN_SRC fish
abbr compress 'tar -czf' <<generate-abbr(table=tar-abbr)>>
abbr untar 'tar -xvzf'
#+END_SRC #+END_SRC
*** Feh *** Feh
@ -583,22 +612,28 @@
abbr nmcli 'nmcli -p -c auto' abbr nmcli 'nmcli -p -c auto'
#+END_SRC #+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 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 abbreviation to =nordvpn=. The second one is a shortcut to connect to a
server, and to disconnect from the current server. server, and to disconnect from the current server. I also have a couple of
#+BEGIN_SRC fish shortcuts to quickly connect to some preselected countries, mainly France,
abbr n 'nordvpn' Germany, Japan and the US.
abbr nc 'nordvpn c' #+NAME: nordvpn-abbr
abbr nd 'nordvpn d' | abbreviation | command |
#+END_SRC |--------------+-------------------------|
| 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 #+BEGIN_SRC fish
abbr ncf 'nordvpn c France' <<generate-abbr(table=nordvpn-abbr)>>
abbr ncg 'nordvpn c Germany'
abbr ncj 'nordvpn c Japan'
abbr ncu 'nordvpn c United_States'
#+END_SRC #+END_SRC
*** Wget *** Wget

View File

@ -92,15 +92,15 @@
will just have to change the name of the executable here. will just have to change the name of the executable here.
#+NAME: variable-table #+NAME: variable-table
| variable | value | | variable | value |
|-------------+--------------------------------------------------------------------------| |----------+-------|
| $mod | Mod4 | | $mod | Mod4 |
| $alt | Mod1 | | $alt | Mod1 |
| $up | Up | | $up | Up |
| $down | Down | | $down | Down |
| $left | Left | | $left | Left |
| $right | Right | | $right | Right |
| $term | st | | $term | st |
#+NAME: variable-sh #+NAME: variable-sh
| variable | value | | variable | value |
@ -125,7 +125,7 @@
return result return result
#+END_SRC #+END_SRC
#+RESULTS[58c517fe29b63f631ff0ba754d5d9ec4ea673388]: generate-variables #+RESULTS[187d9be7907abf05492d27a454685b424b933b7d]: generate-variables
: set $mod Mod4 : set $mod Mod4
: set $alt Mod1 : set $alt Mod1
: set $up Up : set $up Up

View File

@ -110,8 +110,7 @@
https://phundrak.com (Français) https://phundrak.com (Français)
https://en.phundrak.com (English) https://en.phundrak.com (English)
Pensez à notre planète, avez-vous vraiment besoin dimprimer ce courriel ? Sent from a Free and Open-Source Linux operating system with GNU/Emacs
Please mind our planet, do you really need to print this email?
#+END_SRC #+END_SRC
** Fish configuration with useful abbreviations ** Fish configuration with useful abbreviations

View File

@ -5,6 +5,7 @@
#+HTML_HEAD_EXTRA: <meta name="description" content="Phundraks Spacemacs Configuration" /> #+HTML_HEAD_EXTRA: <meta name="description" content="Phundraks Spacemacs Configuration" />
#+HTML_HEAD_EXTRA: <meta property="og:title" content="Phundraks Spacemacs Configuration" /> #+HTML_HEAD_EXTRA: <meta property="og:title" content="Phundraks Spacemacs Configuration" />
#+HTML_HEAD_EXTRA: <meta property="og:description" content="Description of the Spacemacs configuration of Phundrak" /> #+HTML_HEAD_EXTRA: <meta property="og:description" content="Description of the Spacemacs configuration of Phundrak" />
#+PROPERTY: header-args: :mkdirp yes
* Table of Contents :TOC:noexport: * Table of Contents :TOC:noexport:
:PROPERTIES: :PROPERTIES:
@ -74,17 +75,12 @@
- [[#visual-commands][Visual commands]] - [[#visual-commands][Visual commands]]
- [[#eshell-theme][Eshell theme]] - [[#eshell-theme][Eshell theme]]
- [[#file-extensions][File extensions]] - [[#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]] - [[#lsp][LSP]]
- [[#mu4e][Mu4e]]
- [[#miscellaneous-1][Miscellaneous]] - [[#miscellaneous-1][Miscellaneous]]
- [[#evil][Evil]] - [[#evil][Evil]]
- [[#default-modes][Default modes]] - [[#default-modes][Default modes]]
- [[#hooks-1][Hooks]] - [[#hooks][Hooks]]
- [[#pinentry][Pinentry]] - [[#pinentry][Pinentry]]
- [[#prettified-symbols][Prettified symbols]] - [[#prettified-symbols][Prettified symbols]]
- [[#twittering-mode][Twittering mode]] - [[#twittering-mode][Twittering mode]]
@ -103,13 +99,19 @@
- [[#org-files-exports][Org files exports]] - [[#org-files-exports][Org files exports]]
- [[#custom-latex-formats][Custom LaTeX formats]] - [[#custom-latex-formats][Custom LaTeX formats]]
- [[#org-agenda][Org agenda]] - [[#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]] - [[#org-projects][Org projects]]
- [[#configuration-website][Configuration website]] - [[#configuration-website][Configuration website]]
- [[#linguistics-website][Linguistics website]] - [[#linguistics-website][Linguistics website]]
- [[#rust][Rust]] - [[#rust][Rust]]
- [[#scheme][Scheme]] - [[#scheme][Scheme]]
- [[#shortcuts-1][Shortcuts]] - [[#shortcuts][Shortcuts]]
- [[#applications][Applications]] - [[#applications][Applications]]
- [[#comments][Comments]] - [[#comments][Comments]]
- [[#files][Files]] - [[#files][Files]]
@ -135,7 +137,7 @@
* Spacemacs layers and packages * Spacemacs layers and packages
:PROPERTIES: :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 :CUSTOM_ID: h-9d9869e0-4672-419c-bf37-3d3ae1b7c0aa
:END: :END:
Here will be our layer configuration set. Everything here is set with a Here will be our layer configuration set. Everything here is set with a
@ -204,23 +206,22 @@
Dependencies should be explicitly included as they wont be resolved Dependencies should be explicitly included as they wont be resolved
automatically. Here is a table of all the extra packages I use: automatically. Here is a table of all the extra packages I use:
#+NAME: extra-packages #+NAME: extra-packages
| name of the package | why is it installed | | name of the package | why is it installed |
|------------------------+------------------------------------------------------| |---------------------+------------------------------------------------------|
| dired-du | alternative to ~ncdu~ with Dired | | dired-du | alternative to ~ncdu~ with Dired |
| doom-themes | some cool themes | | doom-themes | some cool themes |
| edit-indirect | edit region in separate buffer | | edit-indirect | edit region in separate buffer |
| elcord | rich integration of Emacs in Discord | | elcord | rich integration of Emacs in Discord |
| eshell-git-prompt | pimp my Eshell | | kaolin-themes | some cool themes |
| kaolin-themes | some cool themes | | magit-gitflow | integrate gitflow in Magit |
| magit-gitflow | integrate gitflow in Magit | | meson-mode | major mode for Meson build files |
| meson-mode | major mode for Meson build files | | multiple-cursors | I dont like the layer, I prefer this package alone |
| multiple-cursors | I dont like the layer, I prefer this package alone | | org-sidebar | display on the side the outline of an Org buffer |
| org-sidebar | display on the side the outline of an Org buffer | | outorg | edit comments as Org-mode buffers |
| outorg | edit comments as Org-mode buffers | | pinentry | enter a GPG password from Emacs |
| pinentry | enter a GPG password from Emacs | | visual-fill-column | allow the use of ~fill-column~ in ~visual-line-mode~ |
| visual-fill-column | allow the use of ~fill-column~ in ~visual-line-mode~ | | wttrin | weather in Emacs |
| wttrin | weather in Emacs | | yasnippet-snippets | snippets for YaSnippet |
| yasnippet-snippets | snippets for YaSnippet |
#+NAME: make-extra-packages #+NAME: make-extra-packages
#+BEGIN_SRC emacs-lisp :tangle no :var packages=extra-packages[,0] :exports none #+BEGIN_SRC emacs-lisp :tangle no :var packages=extra-packages[,0] :exports none
@ -321,10 +322,15 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-0db2333c-86bf-4b41-8226-da66885fce36 :CUSTOM_ID: h-0db2333c-86bf-4b41-8226-da66885fce36
:END: :END:
As described below, I use Gnus as my main email client. Therefore, I have I use as my daily Email client ~mu4e~, so lets enable it and tell Emacs
the gnus layer enabled: 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 #+BEGIN_SRC emacs-lisp
gnus (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 #+END_SRC
*** Emacs *** Emacs
@ -359,7 +365,6 @@
org-enable-github-support t org-enable-github-support t
org-enable-reveal-js-support t org-enable-reveal-js-support t
org-enable-sticky-header t org-enable-sticky-header t
org-enable-org-journal-support t
spaceline-org-clock-p t spaceline-org-clock-p t
org-projectile-file "TODOs.org" org-projectile-file "TODOs.org"
org-download-image-dir "~/Pictures/org/" org-download-image-dir "~/Pictures/org/"
@ -646,7 +651,7 @@
* Init * Init
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-3f3c8a0b-56cd-4be6-b019-3ba6f1e24f96 :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: :END:
The ~dotspacemacs/init~ function is the one called at the very begining of the The ~dotspacemacs/init~ function is the one called at the very begining of the
Spacemacs startup, before any kind of configuration, including the layer Spacemacs startup, before any kind of configuration, including the layer
@ -908,7 +913,7 @@
variable sets in seconds the time Spacemacs should wait between a key press variable sets in seconds the time Spacemacs should wait between a key press
and the moment =which-key= should be shown. and the moment =which-key= should be shown.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-which-key-delay 0.4) (setq-default dotspacemacs-which-key-delay 3)
#+END_SRC #+END_SRC
This variable sets =which-key='s frame position. Possible values are: This variable sets =which-key='s frame position. Possible values are:
@ -1263,7 +1268,7 @@
* User Initialization * User Initialization
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-e297b9be-9b0d-4c2d-bb6e-402f0d00be0d :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: :END:
While Emacs and especially Spacemacs loads, I want it to initialize some 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 elements and load some packages. First of all, I want it to load my private
@ -1275,6 +1280,7 @@
Then, I want a couple of requires: Then, I want a couple of requires:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(require 'org-id) (require 'org-id)
(require 'org-protocol)
(require 'package) (require 'package)
(require 'ox-latex) (require 'ox-latex)
(require 'ox-publish) (require 'ox-publish)
@ -1308,7 +1314,7 @@
* User Configuration * User Configuration
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-7a36d3a0-8bb6-4d9d-9402-eadbc49fef32 :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: :END:
** ASM configuration ** ASM configuration
:PROPERTIES: :PROPERTIES:
@ -1783,11 +1789,6 @@
eshell-prompt-function 'eshell/my-prompt) eshell-prompt-function 'eshell/my-prompt)
#+END_SRC #+END_SRC
Finally, lets declare the theme of our shell:
#+BEGIN_SRC emacs-lisp
(eshell-git-prompt-use-theme 'powerline)
#+END_SRC
** File extensions ** File extensions
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-beb67a88-d7d3-4d58-bbc7-7a7be67f64aa :CUSTOM_ID: h-beb67a88-d7d3-4d58-bbc7-7a7be67f64aa
@ -1824,129 +1825,6 @@
auto-mode-alist)) auto-mode-alist))
#+END_SRC #+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
"ogo" 'my-gnus-group-list-subscribed-groups
"ogr" 'gnus-summary-insert-new-articles
"ogs" 'message-send-and-exit)
#+END_SRC
*** 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
Lets 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, lets fix that:
#+BEGIN_SRC emacs-lisp
(gnus-add-configuration
'(article (horizontal 1.0 (summary .4 point) (article 1.0))))
#+END_SRC
** LSP ** LSP
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-4d0272c3-df5e-4f6b-a6e6-f769add4e603 :CUSTOM_ID: h-4d0272c3-df5e-4f6b-a6e6-f769add4e603
@ -1973,6 +1851,145 @@
(tooltip-mode 1) (tooltip-mode 1)
#+END_SRC #+END_SRC
** Mu4e
: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 ArchLinuxCNs 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)
#+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
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 dont 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)
("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
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
mu4e-alert-email-notification-types '(count))
(with-eval-after-load 'mu4e-alert
(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 dont 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
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 thats 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 Im 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 <lucien@phundrak.com>\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 ** Miscellaneous
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-cee08965-745a-4a6f-b04e-bf1638342698 :CUSTOM_ID: h-cee08965-745a-4a6f-b04e-bf1638342698
@ -2488,7 +2505,7 @@
One awesome feature of Org mode is the agenda. By default, my agendas are One awesome feature of Org mode is the agenda. By default, my agendas are
stored in =~/org/agenda=. stored in =~/org/agenda=.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq org-agenda-files (list "~/org/agenda")) (setq org-agenda-files (list "~/org/agenda" "~/org/notes.org"))
#+END_SRC #+END_SRC
I also have a custom command in Org agenda to mark some tasks as daily I also have a custom command in Org agenda to mark some tasks as daily
@ -2515,25 +2532,198 @@
(org-projectile-todo-files))) (org-projectile-todo-files)))
#+END_SRC #+END_SRC
*** Org journal *** Org capture
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-d679ae6c-3096-4933-8e06-9848ad35adb0 :CUSTOM_ID: h-9a070bbb-5b57-4abd-9d61-51f2070eb47b
:END: :END:
I also occasionally use Org journal. All my files are stored in Org-capture is an amazing feature of Org-mode which allows me to quickly
=~/org/journal=, as set below: 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 #+BEGIN_SRC emacs-lisp
(setq org-journal-dir "~/org/journal/") (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 "~/org/capture/emails.orgcaptmpl"))
("j" "Journal" entry
(file+datetree "~/org/journal.org")
(file "~/org/capture/journal.orgcaptmpl"))
("l" "Links")
("ly" "YouTube" entry
(file+headline org-default-notes-file "YouTube")
(file "~/org/capture/youtube.orgcaptmpl"))
("L" "Protocol Link" entry
(file+headline org-default-notes-file "Link")
(file "~/org/capture/protocol-link.orgcaptmpl"))
("n" "Note"
entry (file+headline org-default-notes-file "Note")
(file "~/org/capture/notes.orgcaptmpl"))
("p" "Protocol" entry
(file+headline org-default-notes-file "Link")
(file "~/org/capture/protocol.orgcaptmpl"))
("r" "Resources")
("rc" "Conlanging" entry
(file+headline org-default-notes-file "Conlanging")
(file "~/org/capture/resource.orgcaptmpl"))
("re" "Emacs" entry
(file+headline org-default-notes-file "Emacs")
(file "~/org/capture/resource.orgcaptmpl"))
("ri" "Informatique général" entry
(file+headline org-default-notes-file "Informatique")
(file "~/org/capture/resource.orgcaptmpl"))
("rl" "Linguistics" entry
(file+headline org-default-notes-file "Linguistics")
(file "~/org/capture/resource.orgcaptmpl"))
("rw" "Worldbuilding" entry
(file+headline org-default-notes-file "Worldbuilding")
(file "~/org/capture/resource.orgcaptmpl"))))
#+END_SRC #+END_SRC
The default prefix for org journals is the following: You may notice a capture entry for my journal, and this is due to the fact I
#+BEGIN_SRC emacs-lisp do not use ~org-journal~ anymore: it was too overpowered for me, and I
(setq org-journal-date-prefix "#+TITLE: ") prefer to keep it simple with a single file. And as you can see, and unlike
#+END_SRC 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: **** Emails
#+BEGIN_SRC emacs-lisp :PROPERTIES:
(setq org-journal-file-format "%Y-%m-%d") :CUSTOM_ID: h-9012599e-c143-4df0-b63c-7c60ddb4a081
#+END_SRC :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 <lucien@phundrak.com>
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 Ive 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: %:description
:END:
,#+begin_quote
%i
,#+end_quote
%?
#+END_SRC
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: %: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 *** Org projects
:PROPERTIES: :PROPERTIES:
@ -2689,7 +2879,7 @@
The Scheme configuration will be very short, I just need to tell Emacs the 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: name of the interpreter since it is not the default one:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq geiser-chicken-binary "chicken-csi") (setq geiser-chicken-binary "chicken-csi")
#+END_SRC #+END_SRC
** Shortcuts ** Shortcuts
@ -2820,6 +3010,15 @@
"ofr" (lambda () (interactive) (find-file "~/README.org"))) "ofr" (lambda () (interactive) (find-file "~/README.org")))
#+END_SRC #+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 *** Multiple cursors
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: h-de40bea1-4301-4ad3-b3f1-c4c8ed029feb :CUSTOM_ID: h-de40bea1-4301-4ad3-b3f1-c4c8ed029feb