#+TITLE: Emacs Configuration
#+HTML_DOCTYPE: xhtml
# xhtml for gogs needed, bug showing table in the footer, bc/ html5 creates
instead of
This is an ongoing evolution of Emacs configuration files, inspired by
a bunch of online resources.
* Installation
:PROPERTIES:
:CUSTOM_ID: installation
:END:
Different ways to install:
- arch-linux :: If ~emacs-conf~ is available in a ~custom~ ~pacman~ repository
#+begin_src sh
pacman -S emacs-conf
ln /opt/emacs-conf/init ~/.config/emacs/
ln /opt/emacs-conf/early-init.el ~/.config/emacs/
#+end_src
- debian :: If ~emacs-conf~ is available in a ~custom~ ~apt~ repository
#+begin_src sh
apt install emacs-conf
ln /opt/emacs-conf/init ~/.config/emacs/
ln /opt/emacs-conf/early-init.el ~/.config/emacs/
#+end_src
- manual :: Download or clone git repo and point the emacs =init= and
=early-init.el= file to this configuration.
- old :: Run one of the following install script commands (using curl,
wget or fetch).
#+begin_src sh
sh -c "$(curl -fsSL http://gitea.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"
sh -c "$(wget -O- http://gitea.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"
sh -c "$(fetch -o - http://gitea.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"
#+end_src
Installation path is =~/.config/emacs=. See details and other
installed linux packages as requirements inside =sripts/install.sh=.
* External programs
:PROPERTIES:
:CUSTOM_ID: programs
:END:
- =ripgrep= (optional) used by =counsel-rg= (package =counsel=)
- =texlive-luatex= for =luainputenc.sty= used by org latex export
- =texlive-xetex= for =realscripts.sty= for =KpRoman= used by org latex export
* Usage
:PROPERTIES:
:CUSTOM_ID: usage
:END:
See the emacs command =my-help= for some key-bindings and further
commands and information.
- Org Templates
- Article: =?article[TAB]= / YASnippet - org-mode - Article
Templates - Article
- Letter: =?letter[TAB]= / YASnippet - org-mode - Letter Templates -
Letter
- Org Export
- To Article HTML (extended version)
- =my-org-article-html-export-to-html= / My - Org Export - Article HTML
- =my-org-article-html-export-to-html-notify-async= (=F5=) / My - Org Export - Article HTML async
- To Article PDF (LaTeX, extended version)
- =my-org-article-latex-export-to-pdf= / My - Org Export - Article PDF
- =my-org-article-latex-export-to-pdf-notify-async= (=F6=) / My - Org Export - Article PDF async
- To Letter (LaTeX)
- =my-org-letter-latex-export-to-pdf= (=C-c C-e l t=)
* Packages
:PROPERTIES:
:CUSTOM_ID: packages
:END:
General key bindings and functions
- =C-r= (=query-replace-regexp=) replace text
- =C-x RET f= (=set-buffer-file-coding-system=) e.g. set to =utf-8
- (=decode-coding-region=) e.g. decode to =utf-8= (e.g. 晴天)
- (=diff-buffer-with-file=) show a diff between buffer (current state) and file (saved state)
#+begin_src sh :exports results
dir=$(pwd)/lisp
verinfo() {
# $dir: directory of packages
# $1: package name (basenaem and w/o extension)
if test -f $dir/$1.el; then
ver=$(grep -i package-version: $dir/$1.el | cut -d":" -f2 | xargs)
if test -z $ver; then
ver=$(grep -i version: $dir/$1.el | cut -d":" -f2 | xargs)
fi
echo $ver
elif test -d $dir/$1; then
emacs --batch --eval "(princ (nth 2 (read (with-temp-buffer (insert-file-contents \"$dir/$1/$1-pkg.el\") (buffer-string)))))"
echo ''
fi
}
map_pkg_ver() {
# $1: list of package names, either full path (can include a version) or just the package name
# $2: repo name
# 1st: get package name: strips list element to basename and removes version and extension
# 2nd: get package version (from the installed directory)
# 3rd: print info
for i in $1; do
pkg=$(sed 's/-[0-9].*//' <(basename $i))
ver=$(verinfo $pkg)
echo $pkg $ver $2
done
}
pkg_custom_list=$(echo awesome-tray dialog)
pkg_elpagnu_list=$(ls -F ~/repos/my-elpa-gnu/archive/*.tar | grep -v @)
pkg_elpanongnu_list=$(ls -F ~/repos/my-elpa-nongnu/archive/*.tar | grep -v @)
pkg_melpa_list=$(sort <(ls ~/repos/my-melpa/packages/*.tar | xargs -n1) <(ls ~/repos/my-melpa/packages/*.el | xargs -n1))
pkg_custom=$(map_pkg_ver "$pkg_custom_list" custom)
pkg_elpagnu=$(map_pkg_ver "$pkg_elpagnu_list" elpa-gnu)
pkg_elpanongnu=$(map_pkg_ver "$pkg_elpanongnu_list" elpa-nongnu)
pkg_melpa=$(map_pkg_ver "$pkg_melpa_list" melpa)
echo -e "$pkg_custom\n$pkg_elpagnu\n$pkg_elpanongnu\n$pkg_melpa" | \
sort | \
column -t -N PACKAGE_____________________,VERSION______,REPO_______
#+end_src
#+RESULTS:
| PACKAGE_____________________ | VERSION______ | REPO_______ |
| ace-window | 20220911.358 | melpa |
| adaptive-wrap | 0.8 | elpa-gnu |
| all-the-icons | 20220929.2303 | melpa |
| all-the-icons-ivy-rich | 20221202.1336 | melpa |
| amx | 20210305.118 | melpa |
| anaconda-mode | 20220922.741 | melpa |
| async | 20221217.649 | melpa |
| avy | 20220910.1936 | melpa |
| awesome-tray | 4.2 | custom |
| biblio | 20210418.406 | melpa |
| biblio-core | 20210418.406 | melpa |
| bibtex-completion | 20221024.857 | melpa |
| bind-key | 20221209.2013 | melpa |
| cfrs | 20220129.1149 | melpa |
| citeproc | 20221216.1238 | melpa |
| cl-libify | 20181130.23 | melpa |
| company | 20221206.2122 | melpa |
| company-anaconda | 20200404.1859 | melpa |
| company-ledger | 20210910.25 | melpa |
| company-quickhelp | 20221212.534 | melpa |
| company-statistics | 20170210.1933 | melpa |
| company-web | 20220115.2146 | melpa |
| compat | 28.1.2.2 | elpa-gnu |
| counsel | 20221015.936 | melpa |
| crdt | 0.3.5 | elpa-gnu |
| ctable | 20210128.629 | melpa |
| dash | 20221013.836 | melpa |
| dashboard | 20221206.1228 | melpa |
| deft | 20210707.1633 | melpa |
| delight | 1.7 | elpa-gnu |
| dialog | 0.2 | custom |
| diff-hl | 20221007.2147 | melpa |
| dim | 20160818.949 | melpa |
| elisp-refs | 20220704.2141 | melpa |
| emacsql | 20221127.2146 | melpa |
| emacsql-sqlite | 20221127.2146 | melpa |
| emacsql-sqlite-builtin | 20221127.2146 | melpa |
| emojify | 20210108.1111 | melpa |
| ess | 20221204.1348 | melpa |
| ess-R-data-view | 20130509.1158 | melpa |
| f | 20220911.711 | melpa |
| flycheck | 20221213.107 | melpa |
| flycheck-ledger | 20200304.2204 | melpa |
| flycheck-pos-tip | 20200516.16 | melpa |
| flyspell-correct | 20220520.63 | melpa |
| flyspell-correct-ivy | 20220520.63 | melpa |
| focus | 20221016.1846 | melpa |
| git-commit | 20221127.2227 | melpa |
| git-messenger | 20201202.1637 | melpa |
| gnuplot | 20221112.2049 | melpa |
| helpful | 20221209.1743 | melpa |
| ht | 20221031.705 | melpa |
| htmlize | 20210825.215 | melpa |
| hydra | 20220910.1206 | melpa |
| indent-guide | 20210115.4 | melpa |
| iscroll | 20220612.31 | melpa |
| ivy | 20220926.125 | melpa |
| ivy-bibtex | 20210927.1205 | melpa |
| ivy-rich | 20210409.931 | melpa |
| js2-mode | 20221028.1819 | melpa |
| key-chord | 20201222.203 | melpa |
| langtool | 20200529.23 | melpa |
| ledger-mode | 20220623.1125 | melpa |
| lv | 20200507.1518 | melpa |
| magit | 20221208.1848 | melpa |
| magit-section | 20221127.2227 | melpa |
| markdown-mode | 20221210.348 | melpa |
| memoize | 20200103.2036 | melpa |
| mu4e-maildirs-extension | 20220517.1852 | melpa |
| multiple-cursors | 20221126.743 | melpa |
| notmuch | 20221115.1134 | melpa |
| ob-async | 20210428.2052 | melpa |
| olivetti | 20220330.635 | melpa |
| ol-notmuch | 20220428.1337 | melpa |
| org | 9.6 | elpa-gnu |
| org-appear | 20220617.2355 | melpa |
| org-brain | 20210706.1519 | melpa |
| org-cliplink | 20201126.102 | melpa |
| org-contrib | 0.4.1 | elpa-nongnu |
| org-drill | 20210427.2003 | melpa |
| org-fancy-priorities | 20210830.1657 | melpa |
| org-fragtog | 20220714.2146 | melpa |
| orgit | 20221127.2228 | melpa |
| org-ref | 20221129.1925 | melpa |
| org-roam | 20221205.355 | melpa |
| org-roam-bibtex | 20221104.2139 | melpa |
| org-roam-timestamps | 20221104.1544 | melpa |
| org-roam-ui | 20221105.104 | melpa |
| org-sticky-header | 20201223.143 | melpa |
| org-superstar | 20210915.1934 | melpa |
| org-table-sticky-header | 20190924.506 | melpa |
| ov | 20200326.1042 | melpa |
| ox-pandoc | 20220705.1036 | melpa |
| ox-reveal | 20221127.814 | melpa |
| ox-tufte | 20160926.1607 | melpa |
| page-break-lines | 20210104.2224 | melpa |
| parsebib | 20221007.1402 | melpa |
| pdf-tools | 20221202.1104 | melpa |
| persist | 0.5 | elpa-gnu |
| pfuture | 20220913.1401 | melpa |
| php-mode | 20221112.1616 | melpa |
| pkg-info | 20150517.1143 | melpa |
| plantuml-mode | 20191102.2056 | melpa |
| polymode | 20220820.163 | melpa |
| popup | 20220927.161 | melpa |
| popwin | 20210215.1849 | melpa |
| posframe | 20221220.544 | melpa |
| pos-tip | 20220715.102 | melpa |
| powershell | 20220805.1712 | melpa |
| pythonic | 20220723.1741 | melpa |
| queue | 0.2 | elpa-gnu |
| rainbow-mode | 1.0.6 | elpa-gnu |
| restart-emacs | 20201127.1425 | melpa |
| s | 20220902.1511 | melpa |
| seq | 2.23 | elpa-gnu |
| simple-httpd | 20191103.1446 | melpa |
| spacemacs-theme | 20221103.1406 | melpa |
| sphinx-doc | 20210213.125 | melpa |
| sql-indent | 1.6 | elpa-gnu |
| srefactor | 20180703.181 | melpa |
| stickyfunc-enhance | 20150429.1814 | melpa |
| string-inflection | 20220910.1306 | melpa |
| swiper | 20220430.2247 | melpa |
| systemd | 20210209.2052 | melpa |
| tablist | 20200427.2205 | melpa |
| transient | 20221202.1727 | melpa |
| treemacs | 20221221.1301 | melpa |
| treemacs-magit | 20220917.1026 | melpa |
| use-package | 20221209.2013 | melpa |
| virtual-auto-fill | 20200906.2038 | melpa |
| visual-fill-column | 20220519.1959 | melpa |
| vterm | 20221118.1354 | melpa |
| web-completion-data | 20160318.848 | melpa |
| web-mode | 20221012.8 | melpa |
| websocket | 20221218.115 | melpa |
| which-key | 20220811.1616 | melpa |
| with-editor | 20221127.2243 | melpa |
| yasnippet | 20200604.246 | melpa |
| yasnippet-snippets | 20220713.1234 | melpa |
* Information
:PROPERTIES:
:CUSTOM_ID: information
:END:
Interlock symlinks and auto-save files.
Be aware that symbolic links of the form “.#*” are not auto-save files
but interlocks to prevent the simultaneous editing of the same
file. See [[https://www.emacswiki.org/info-ref?find=Interlocking][Interlocking]] in the [[https://www.emacswiki.org/emacs/EmacsManual][EmacsManual]] for details.
* Errors
:PROPERTIES:
:CUSTOM_ID: errors
:END:
- failed execution of bibtex2html
- see bib2htmlxxxxxx.blg for errors, e.g.
- I couldn't open style file acmu.bst
- copy/merge the texmf directory into your home directory.
- when using this in an Org mode buffer:
=#+HEADER: :fit yes :imagemagick yes :iminoptions -density 300=
- can leads to:
- =convert: attempt to perform an operation not allowed by the security policy `gs' @ error/delegate.c/ExternalDelegateCommand/378.=
- =convert: no images defined `DESY_logo_tikz.png' @ error/convert.c/ConvertImageCommand/3282.=
- edit =/etc/ImageMagick-7/policy.xml= and comment out
- ~~
* TODOs
:PROPERTIES:
:CUSTOM_ID: todos
:END:
- Org / global configuration
- Page formatting
- Modify HTML styling
- Printed page layout, white styled figures
- Figures
- Gnuplot
- plot transposed files/tables
- Tables
- Wrap Table in div element. For smartphone scrolling.
- Table of contents
- \(\LaTeX\); currently headers with no-number property means not included in TOC
- HTML; currently generated list, like lot and lol, are not included in toc
but own headers without numbers are.
- Equation cancel/strike out with color line
- hcancel[color]{}
- Example: ~\(\hcancel[red]{f_{X_2}(x_2)}}\)~
- Definition:
- Preamble: ~#+LATEX_HEADER: \usepackage{cancel}~ \\
~#+LATEX_HEADER: \newcommand\hcancel[2][black]{\setbox0=\hbox{$#2$}%~ \\
~#+LATEX_HEADER: \rlap{\raisebox{.45\ht0}{\textcolor{#1}{\rule{\wd0}{1pt}}}}#2}~ \\
- ~hcancel: [\"{\\\\setbox0=\\\\hbox{$#2$}\\\\rlap{\\\\raisebox{.45\\\\ht0}{\\\\textcolor{#1}{\\\\rule{\\\\wd0}{1pt}}}}#2}\",2]~
#+Begin_example
MathJax.Ajax.config.path[\"Contrib\"] = \"https://cdn.mathjax.org/mathjax/contrib\";
MathJax.Hub.Register.StartupHook(\"TeX Jax Ready\",function () {
MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{
cancel: [\"Extension\",\"cancel\"],
bcancel: [\"Extension\",\"cancel\"],
xcancel: [\"Extension\",\"cancel\"],
cancelto: [\"Extension\",\"cancel\"]
});
});
#+End_example