diff --git a/configuration.org b/configuration.org index f26788e881fc3c54ffeb03d5b59d8b0a6cce631e..67f88fcb610bd00ca8ffe06e5f04ae2bd19fa035 100644 --- a/configuration.org +++ b/configuration.org @@ -2,6 +2,7 @@ #+author: Michaƫl Hauspie #+email: michael.hauspie@univ-lille.fr #+language: en +#+options: header-args :results none Some of my configuration entries where borrowed from other people, see [[*Acknowledgment][Acknowledgment]] section for a list. @@ -51,17 +52,17 @@ Sets who I am I use [[https://elpa.gnu.org][Elpa]], [[https://melpa.org][Melpa]] and [[http://orgmode.org][Org mode]] packages repository, thus I need to add them to the =package-archives= list - For older emacs version, fix some gnutls algorithm priority +For older emacs version, fix some gnutls algorithm priority - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") - #+END_SRC +#+END_SRC - #+RESULTS: - : NORMAL:-VERS-TLS1.3 +#+RESULTS: +: NORMAL:-VERS-TLS1.3 - #+BEGIN_SRC emacs-lisp +#+BEGIN_SRC emacs-lisp (require 'package) (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) @@ -69,7 +70,7 @@ I use [[https://elpa.gnu.org][Elpa]], [[https://melpa.org][Melpa]] and [[http:// (package-initialize) #+END_SRC - #+RESULTS: +#+RESULTS: Then, to ensure that packages are installed and that I can launch @@ -127,26 +128,26 @@ Add a folder for .el files that are not available as packages I use [[https://github.com/technomancy/better-defaults][better-defaults]] to tweak some annoying Emacs default behaviors. The two most important beeing: - - use =ido= almost everywhere - - put temporary files in a specific folder rather as =~= files everywhere +- use =ido= almost everywhere +- put temporary files in a specific folder rather as =~= files everywhere - there is more to =better-defaults=, be sure to have a look at its list - of changed behaviors. In particular, it switches the menu bar off and - I quite like have it around sometimes, so I re-enable it. + there is more to =better-defaults=, be sure to have a look at its list + of changed behaviors. In particular, it switches the menu bar off and + I quite like have it around sometimes, so I re-enable it. - #+BEGIN_SRC emacs-lisp + #+BEGIN_SRC emacs-lisp (use-package better-defaults) ;; I want menu bar (menu-bar-mode t) - #+END_SRC + #+END_SRC - Ido is not set everywhere by =better-defaults= and I really want it everywhere + Ido is not set everywhere by =better-defaults= and I really want it everywhere - #+begin_src emacs-lisp + #+begin_src emacs-lisp (setq ido-enable-flex-matching t) (setq ido-everywhere t) - #+end_src + #+end_src As I often use Emacs on MacOS, I need the right option (alt) key to @@ -254,6 +255,13 @@ Define a shortcut to re-indent all buffer. This saves the current point, marks w #+RESULTS: : mh/indent-buffer +Set the line width for fill command + +#+begin_src emacs-lisp +(setq-default fill-column 100) +#+end_src + + ** Undo on steroids Manage undo as a tree so that we can undo/redo more. Bound by default on =C-x u= @@ -311,11 +319,11 @@ Use Fira Code but do not use ligature everywhere #+begin_src emacs-lisp (use-package fira-code-mode :config - ;(global-fira-code-mode) + ;(global-fira-code-mode) (setq fira-code-mode-enable-hex-literal nil) ) - (add-to-list 'default-frame-alist '(font . "Fira Code-12" )) - (set-face-attribute 'default t :font "Fira Code-12" ) +(add-to-list 'default-frame-alist '(font . "Fira Code-12" )) +(set-face-attribute 'default t :font "Fira Code-12" ) #+end_src #+RESULTS: @@ -367,38 +375,38 @@ and loaded. *** TRAMP configuration for remote editing - Tramp is a mode that allows emacs to edit file remotely (over ssh) or - even as =sudo= (even combining both, effectively editing a file on a - remote machine as root while connecting to the remote machine using - ssh as an unpriviledged user) +Tramp is a mode that allows emacs to edit file remotely (over ssh) or +even as =sudo= (even combining both, effectively editing a file on a +remote machine as root while connecting to the remote machine using +ssh as an unpriviledged user) - To open a file located on a remote machine, simply open the file - =/ssh:user@host:path/to/the/file= +To open a file located on a remote machine, simply open the file +=/ssh:user@host:path/to/the/file= - To =sudo= open a local file : =/sudo::/path/to/the/file=. +To =sudo= open a local file : =/sudo::/path/to/the/file=. - Combining both : =/ssh:user@host|sudo::/path/to/the/file=. +Combining both : =/ssh:user@host|sudo::/path/to/the/file=. - There is no real configuration need for my tramp usage, however, I - would like to display on the mode line on which host I am editing (one - of the many reason is that I find myself editing the same file on - different servers on many occasions). By default, a =@= symbol is - displayed on the mode line when editing remote, but not the server - hostname. It requires mousing hover the =@= which is... impractical at - the very best. +There is no real configuration need for my tramp usage, however, I +would like to display on the mode line on which host I am editing (one +of the many reason is that I find myself editing the same file on +different servers on many occasions). By default, a =@= symbol is +displayed on the mode line when editing remote, but not the server +hostname. It requires mousing hover the =@= which is... impractical at +the very best. - For this, I use the =tramp-theme= package that does what I want. +For this, I use the =tramp-theme= package that does what I want. - #+begin_src emacs-lisp +#+begin_src emacs-lisp (use-package tramp-theme :ensure t :config (load-theme 'tramp t) -) - #+end_src + ) +#+end_src - #+RESULTS: - : t +#+RESULTS: +: t @@ -493,10 +501,11 @@ Add shortcuts to quickly add code blocks using =C-,= Use =latexmk= to export to Latex #+begin_src emacs-lisp :exports code -(setq org-latex-pdf-process (list "latexmk -pdflatex='pdflatex -shell-escape -interaction nonstopmode' -pdf %f")) +(setq org-latex-pdf-process (list "latexmk -pdflatex='pdflatex -shell-escape -interaction nonstopmode' -output-directory=%o -pdf %f")) #+end_src + Use =org-ref= for citation #+begin_src emacs-lisp @@ -514,6 +523,21 @@ And use the same shortcut for =org-reftex-citation= than for =reftex-citation= #+RESULTS: : org-reftex-citation +Define a document class that do not use parts and start with chapters + +#+begin_src emacs-lisp +(add-to-list 'org-latex-classes + '("book-noparts" + "\\documentclass{book}" + ("\\chapter{%s}" . "\\chapter*{%s}") + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) +#+end_src + + ** Visuals Use bullets instead of asterisks @@ -685,19 +709,14 @@ using bootstrap template. #+RESULTS: -So that code highlighting can be done using [[https://www.ctan.org/pkg/minted][minted]] (which uses -[[https://pygments.org/][Pygments]] as an external tool), we need to change latex export commands. +Configure code highlighting using [[https://www.ctan.org/pkg/minted][minted]] (which uses +[[https://pygments.org/][Pygments]] as an external tool) for latex export #+begin_src emacs-lisp ;; Configure ox-latex to export source block using minted ;; Setting minted cache to false as cache seems to fail when changing the output-directory (add-to-list 'org-latex-packages-alist '("cache=false" "minted")) (setq org-latex-listings 'minted) - -(setq org-latex-pdf-process - '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" - "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" - "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) #+end_src For HTML source code highlight, use =htmlize= @@ -1041,7 +1060,7 @@ For dockerfiles and docker-compose files, install some docker packages (use-package dockerfile-mode) (use-package docker-compose-mode) (use-package docker) -;(use-package docker-tramp) + ;(use-package docker-tramp) (use-package docker-api) (use-package docker-cli) #+end_src @@ -1143,12 +1162,12 @@ cargo install slint-lsp [[https://magit.vc/][Magit]] is git porcelain inside emacs. - + Bind =C-x g= to pop up the magit status buffer - + configure magit to automatically revert buffers that are opened - if they are modified by a magit action (such as changing branch, - merging...) - + Save buffers that visit a file that belongs to a repository if - needed ++ Bind =C-x g= to pop up the magit status buffer ++ configure magit to automatically revert buffers that are opened + if they are modified by a magit action (such as changing branch, + merging...) ++ Save buffers that visit a file that belongs to a repository if + needed #+begin_src emacs-lisp (use-package magit