Files
emacs/README.org

9.2 KiB

Emacs Configuration

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

Installation

Run one of the following install script commands.

curl sh -c "$(curl -fsSL http://gogs.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"
wget sh -c "$(wget -O- http://gogs.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"
fetch sh -c "$(fetch -o - http://gogs.weseng.de/daniel/emacs/raw/master/scripts/install.sh)"

Installation path is ~/.config/emacs. See details and other installed linux packages as requirements inside sripts/install.sh.

Packages

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
C-r query-replace-regexp replace text. (former isearch-backward)
C-x C-b ibuffer list buffers (former list-buffers)
C-x | 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
General key bindings and functions

Org

C-c | org-table-create-or-convert-from-region convert seperator 1. TAB, 2. comma, 3. space
C-u C-c | org-table-create-or-convert-from-region convert using comma (CSV) seperator
C-u C-u C-c | org-table-create-or-convert-from-region convert using TAB
C-u N C-c | org-table-create-or-convert-from-region convert using N spaces
C-u REGEX C-c | 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
Org export
f5 in org export to html
f6 in org export to LaTeX
Org key bindings and functions

Important

  • For Gnuplot source blocks: Do not use % inside Gnuplot source block but \% or in format command \%%

    • % starts a comment in LaTeX and therefore stops further interpretations like a closing bracket } etc.

      • Gnuplot graphics are imported as .tex (text, axis, legend) and .eps (figure) files.
    • \% \%% can also be used for HTML SVG export

Links

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
Multiple cursors key bindings and functions

Other 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 Interlocking in the 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.
  • 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

      • <policy domain="delegate" rights="none" pattern="gs" />

TODOs

  • Org / global configuration

    • Page formatting

      • Modify HTML styling

        • Printed page layout, white styled figures
    • Custom export function for HTML and \(\LaTeX\), with;

      • Shift - <f5>, Shift - <f6> with open file
    • delete temp. generated export files
  • Figures

    • Gnuplot

      • plot transposed files/tables
      • preamble in function and call this function for every gnuplot block either manually or automatically with a hook?!
  • 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:

      • Preamle: #+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]

        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\"]
        });
        });