#+TITLE: Emacs Configuration
#+HTML_DOCTYPE: xhtml
# xhtml for gogs needed, bug showing table in the footer, bc/ html5 creates <col> instead of <col />

This is an ongoing evolution of Emacs configuration files, inspired by
a bunch of online resources.

* Requirements
  external packages:
  #+begin_src shell
    # flyspell-buffer
    yay -S aspell hunspell
    # org-mode latex-mode
    yay -S biber bibtex2html
    # ledger-mode
    yay -S ledger
    # langtool
    yay -S languagetool
    # python-mode
    yay -S python-pylint
    # emacs-application-famework EAF
    yay -S --needed git nodejs aria2 libreoffice wmctrl xdotool jre-openjdk \
    python-pyqt5 python-pyqt5-sip python-pyqtwebengine python-qrcode \
    python-feedparser python-dbus python-pyinotify python-markdown \
    python-grip filebrowser-bin python-epc
  #+end_src
  Optional package for EAF see in Installation.
  
* Installation
  Install into =~/.config/emacs= (must be empty)
  #+begin_src sh
    git clone http://gogs.weseng.de/daniel/emacs.git ~/.config/emacs
  #+end_src

  #+RESULTS:

  or copy all files of this directory into your ~/.config/emacs directory
  - for Emacs version < 27 create symbolic link to the init file
  - =ln -s ~/.config/emacs/init ~/.emacs= (or =~/.emacs.el=,
    =~/.emacs.d/init.el=)

  copy/merge the texmf directory into your home directory

  optional for EAF
  #+begin_src shell
    yay --editmenu -S mupdf python-pymupdf
  #+end_src

  edit =PGKBUILD= file for =python-pymupdf= to:
  #+begin_example
  prepare() {
    cd "${_name}-${pkgver}"
    patch --forward --strip=1 --input="${HOME}/.config/emacs/scripts/fix-pymupdf-library-linking-for-arcolinux.patch"
  }
  #+end_example
    
* Key bindings and functions
#+caption: General
| M->       | end-of-buffer                 |                                          |
| M-<       | beginning-of-buffer           |                                          |
| C-x h     | mark-whole-buffer             | mark the whole buffer                    |
| C-x TAB   | indent-rigidly                | indent selected region                   |
| C-x RET f | set-buffer-file-coding-system | e. g. set to utf-8                       |
|           | decode-coding-region          | e. g. decode to utf-8 (郭富城Aaron Kwok) |
|           | diff-buffer-with-file         | show a diff between buffer and file      |
| C-h v     | counsel-describe-variable     | help text of variable                    |
| C-h f     | counsel-describe-funtion      | help text of function                    |

#+caption: Org
| C-c \vert           | org-table-create-or-convert-from-region | convert seperator 1. TAB, 2. comma, 3. space                                 |
| C-u C-c \vert       | org-table-create-or-convert-from-region | convert using comma (CSV) seperator                                          |
| C-u C-u C-c \vert   | org-table-create-or-convert-from-region | convert using TAB                                                            |
| C-u N C-c \vert     | org-table-create-or-convert-from-region | convert using N spaces                                                       |
| C-u REGEX C-c \vert | org-table-create-or-convert-from-region | convert using regex to match seperator                                       |
| C-c C-x \           | org-toggle-pretty-entries               | e. g. displays =\pm= as ±                                                    |
|                     |                                         |                                                                              |
| Org table           |                                         |                                                                              |
| S-right             | org-shiftright                          | move a single cell right                                                     |
| S-left              | org-shiftleft                           | move a single cell left                                                      |
| C-c SPC             | org-table-blank-field                   | clear cell                                                                   |
|                     |                                         |                                                                              |
| Org src block       |                                         |                                                                              |
| C-c C-v t           | org-babel-tangle                        | create a file with the content of the block, use in header: :tangle filename |

#+caption: Custom and changed keys
| C-r       | query-replace-regexp | replace text. (former isearch-backward)   |
| C-x C-b   | ibuffer              | list buffers (former list-buffers)        |
| C-x \vert | toggle-window-split  | toggle horizontal/vertical 2 window split |
| M-up      | move-line-up         | move current line up                      |
| M-down    | move-line-down       | move current line down                    |
| mouse-6   |                      | scroll right                              |
| mouse-7   |                      | scroll left                               |
| mouse-8   | previous-buffer      |                                           |
| mouse-9   | next-buffer          |                                           |
| f5        |                      | in org export to html                     |
| f6        |                      | in org export to LaTeX                    |

#+caption: Multiple cursors
| M-m s m a | mc/mark-all-dwim | try to mark all at point           |
| C-v       |                  | jump to next cursor                |
| M-v       |                  | jump to previous cursor            |
| C-'       |                  | hide/unhide lines without a cursor |

* Packages
- rainbow-mode.el :: https://elpa.gnu.org/packages/rainbow-mode.html
  rainbow-mode is a minor mode for Emacs which displays strings representing
  colors with the color they represent as background.

* Information
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
** 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.
