Org Wiki
Main Programming Platforms Projects Emacs Russian Quotes Old Lisa wiki
Table of Contents
Emacs Notes
2 Handy keys
2.1 Windows and buffers
C-x b <filename> | Select buffer by filename; with autocompletion |
C-x C-f | 'Find file' - open a file |
C-x C-s | Save buffer |
C-x s | Save all buffers; prompts per changed buffer |
C-x s ! | Save all buffers; no prompting |
C-x C-v <RET> | Reload current buffer; useful for resetting R/W |
C-x k <enter> | Kill current buffer without closing window |
C-x o | Go to next window |
C-x 0 | Close current window without killing buffer |
C-x 2 | Split current window vertical |
C-x 3 | Split current window horizontal |
2.2 Other essential keys
Keys | Action | Comment |
---|---|---|
C-s | Search forward | |
C-s M-c | Search case sensitive | M-c is a toggle |
C-r | Search back | Use after C-s |
C-s (C-w)* | Select (expanding) word under cursor | Use after C-s |
C-M-s | Search by regex | NB: \{ \} |
C-x C-e | run elisp function | Place cursor at end brace |
C-h f | get elisp function doc | Set cursor on name |
TAB | Outline: cycle visibility | i.e. open/close outlines |
<shift>-<insert> | Paste | |
C-<shift>-<backspace> | Delete line | |
M-1 M-! shell-cmd | run shell command | |
C-h v var-name | Show variable | |
C-c C-l | Create/edit external link | |
C-c C-o | Open link under cursor in new window | |
C-x 8 C-h | Help page for accented char's | |
C-x 8 ' e | Accents; given combination: é | Should work for all emacs modes |
C-c C-f | Toggle folding of block | For modes that support it |
C-x 8 RET #x20AC RET | Euro sign € | |
M-x sort-lines | sort lines in current selection | |
M-x *-mode <tab> | List all interactive commands ending in '-mode' | Prefix: just hit Tab, no * |
<shift>-left click | Adjust font size menu | Click in text area |
2.3 Useful commands
Prefix these with M-x. Notably, major modes can be set here.
load-file <RET> <RET> | reload current file - handy for .emacs |
customize-option <name> | use emacs option screen for changing settings |
set-variable RET tab-width RET 4 RET | Change tab width for local buffer |
Lisp functions: use C-x C-e at end to run (eg in scratch buffer)
(dired "/wim@quinte:~") | Show dir listing on remote machine |
- Leaving out user works | |
- Refresh with single key 'g' | |
- '/' required |
Byte-compile everything in .emacs.d/elpa
To avoid warnings when uploading wiki
> C-u 0 M-x byte-recompile-directory > Directory: ~/.emacs.d/elpa
2.4 Major/minor modes
Major modes. Others work analogously; useful for eg. syntax highlighting.
c++-mode
markdown-mode
ruby-mode
Useful minor modes
hs-minor-mode |
enable folding in current buffer |
2.5 Vim rehash
Following useful vim-keys also work in evil-mode:
NOTES
- emacs folding binded to C-c s, C-c h in .emacs.
- In vim, lower case does action on current level, upper case on all lower levels as well. Evil mode does not implement this well.
- Works better if cursor is on a brace, or within (c++)
za | toggle current fold current level |
zR, zM | open, close all folds |
zo, zc | open, close current fold |
2.6 Evil mode
C-z | Toggle evil mode - conflicts with undo! |
2.7 Make source block runnable inline
E.g. for shell:
(org-babel-do-load-languages 'org-babel-load-languages '((sh . t)))
3 Org mode
NOTE: Stuff here works only in org-mode files
3.1 Issue "Wrong type argument: org-export-backend…"
Following occurs during export to html:
Wrong type argument: org-export-backend, [cl-struct-org-export-backend nil html ((footnote-reference . ignore) (link lambda (object c i) c) (radio-target lambda (object c i) c) (target . ignore)) nil nil nil nil]
Solution: delete all .elc
files in org package.
Date postfix will differ
cd ~/.emacs.d/elpa/org- cd org-20181008/ cd org-ac-20170401.1307/ cd org-ref-20181010.2343/ rm -r *.elc
3.2 Essential keys
Keys | Action | Comment |
---|---|---|
C-c C-c | Export commands | |
C-c C-e | Publish org file | |
" " h h | Publish to html | |
C-c C-c p | markdown preview | bare display in browser |
\\ | extra line break | at end of line |
3.3 Essential commands (images)
M-x org-display-inline-images | show linked images |
M-x org-remove-inline-images | hide linked images |
3.4 font modifiers
- # Comment (start of line, one space)
- bold
- `*backticks override*`
- italic
- underlined
verbatim
code
strike-through- super^script
- sub_script
- Text with a new-style footnote 1
Source: see link under 'links'
Note: ': ' prefix must me at start of line, space after
* This Is A Heading ** This Is A Sub-Heading *** And A Sub-Sub-Heading horizontal rule (at least 5 dashes) ----- Paragraphs are separated by at least one empty line. *bold* /italic/ _underlined_ +strikethrough+ =monospaced= [[http://Karl-Voit.at][Link description]] http://Karl-Voit.at → link without description : Simple pre-formatted text such as for source code. : This also respects the line breaks. *bold* is not bold here. - list item - another item - sub-item 1. also enumerated 2. if you like - [ ] yet to be done - [X] item which is done
3.5 links
3.6 Outline/todo keys
C-c C-t | Cycle state todo->done->nothing | |
M-<right/left> | Lower/raise current outline item | Select first! |
M-S-<right/left> | Lower/raise outline item + children | First attempt usually fails, just redo |
C-c C-e | Export, opens help screen | |
C-c C-x C-v | Toggle inline images |
3.7 Disable warnings when running src blocks on export
(setq org-confirm-babel-evaluate nil)
4 Blog
4.1 Jekyll server mode
For local network:
> cd ~/project/blog/jekyll-simple > jekyll serve --host 192.168.1.16
In serve mode, changes in posts get picked up automatically.
4.2 Publish from org to jekyll
> C-c C-e P x wim
5 Daemon mode
- Start in running emacs: `M-x server-start`
- Login from other machine: `ssh -XYC olivia`
- Start in graphics mode: `emacsclient -c` # -t for text mode
NOTE: When server started this way, main emacs (in server mode) hangs from time to time.
6 Install new package
Following assumes you're installing package 'evil'
M-x list-packages C-s evil to find evil i - select for install x - execute install
7 Notes
7.1 The difference between BEGIN_HTML
and BEGIN_EXPORT html
BEGIN_HTML
uses the html raw in the page:
BEGIN_EXPORT html
formats the html so that the tags are visible:
<b>Welcome back to the 90's</b>
7.2 Using src blocks to generate html
This is the first attempt that actually worked:
WTF
Welcome back to the 90's!poepkat, is this really going to work??
WTF
Welcome back to the 90's!Little piggy, is this really going to work??
7.3 Set encoding in file to utf-8
on first line:
-*- coding: utf-8 -*-
… limited success with org-mode export
7.4 Specify org-mode within file
Tutorial said to put this at the top of an org-mode file:
MY PROJECT -*- mode: org -*-
However, emacs picks up org-mode up from the extension. Also, given line is interpreted as the document title on export to HTML.
8 Task Log
27-06-2016 Did David O'Toole org tutorial. 27-09-2016 Upgraded org mode using this HOWTO.
8.1 01-10-2016 Installed package 'capt-of'
> sudo zypper in texlive-capt-of
Due to error during pdf generation
9 emacs as IDE
- GUD Grand Unified debugger
- GLOBAL - gtags. Tutorial, blog
- To override keys
undo-tree
: Global key binding overriden by undo-tree, How to override major mode bindings:w
- To override keys
10 Try
10.1 Test: run shell commands within org-mode document
uname -a
10.2 Try spreadsheet
Source - skipped using lisp functions
- C-c ? for references
- C-c } for inline ref's
- C-c C-c on formula for recalc
- C-u C-c * on table for full recalc
- C-c = in cell; edit column formula in minibuffer
- C-u C-c = in cell; edit column formula in minibuffer
- functions used come from Calc. Doc, Function index.
- := for field formula, = for column formula
Formula's
- 'this row' is default
Student | Maths | Physics | Mean |
---|---|---|---|
Bertrand | 13 | 19 | 16 |
Henri | 15 | 14 | 14.5 |
Arnold | 17 | 13 | 15 |
Means | 15 | 15.333333 | 15.166667 |
Footnotes:
New-style requires the fn:
-prefix within the brackets.
For this one, double empty line is required, otherwise following text is
added to footnote as well.