Emacs and org-mode notes
From Notes_Wiki
Keyboard shortcuts
Shortcut | Description |
C-x C-s | Save file |
C-x d | List directory contents so that we can choose which file to edit from directory listing |
Editing shortcuts
Shortcut | Description |
C-u <number> <command> | Repeat command that follows given number of times. |
C-g | Cancel previous command. Note that we cannot use Esc and we should use C-g to cancel previous command. |
C-x u C-_ C-/ |
Undo |
C-k | Kill from cursor position to end of line |
C-@ or C-<space> | Start selecting text from cursor position |
C-w | Cut selected text |
C-y | Paste text from clipboard to current location |
M-y | This has to be used just after using C-y. This would change the pasted text to older text that was cut or killed. Emacs remembers all the different killed texts and we can paste older text by using M-y repeatedly after we have used C-y once to restore latest killed text. |
C-x C++ | To increase font-size |
C-x C+- | To decrease font-size |
M-q | To wrap paragraph properly as per set fill-width value |
Org-mode shortcuts
Shortcut | Description |
<pipe><hypen> followed by tab | To create a table in org mode. The same shortcut also completes a table row |
M-ret | To split long text within table so that it spans multiple lines. |
C-c C-q | Apply tag to given section, sub-section etc. Note that tags cannot be applied to bullets started with - |
Tab (at heading) | Change detail of display of sub-headings of current heading |
Shift-tab (at first heading) | Change detail of display of all sub-headings in file |
C-c . | Insert active date using calendar. Calendar accepts options such as . (today), +1 (tomorrow), -1 (yesterday), etc. One can also use Shift+<arrow_keys> to change selected date in displayed calendar |
C-c ! | Insert inactive date |
C-c . <choose_date> C-c . | Insert active date range |
Shortcut | Description |
C-x 1 | Expand current buffer to fullscreen and hide all other buffers |
C-c C-o | Visit link |
C-x 0 | Delete current window |
C-x k | kill buffer |
C-x b | switch buffer (Press tab for auto-complete and suggestions) |
C-x C-b | List all buffers |
C-x o | Switch to other visible buffers |
Shortcut | Description |
C-h k <key> | Gives help about key in a split window |
C-h m | Mode help |
C-h a PATTERN | Help on commands that match given pattern |
C-h d PATTERN | Help on functions and variables that match given pattern |
C-h b | List of current key bindings |
C-h c | Displays command run by given key sequence |
Commands
Generic commands
Command | Description |
buffer-menu | Shows list of all buffers to choose from |
ispell-buffer | Check text in current buffer for spelling errors |
Org-mode commands
Command | Description |
org-table-delete-column | To delete column from org mode table |
org-mode | To change to org mode. In case extension of file being edited is not .org, we may need to shift to org mode manually. |
org-export-as- [pdf or html or ...] | Export current org file to given format. Many different formats including LaTeX are supported. |
org-insert-export-options-template | Inserts options like Title, Date, etc. at top of file which help in exporting org files to other formats |
Configuration
General configuration
Configuration option | Description |
(setq make-backup-files nil) | Prevents emacs from creating backup files while saving |
(global-visual-line-mode 1) | Enables visual-line-mode in all buffers by default |
(set-fill-column 60) | To ensure lines wrap at 60 in text-modes. After this also change mode using auto-fill-mode command. |
(setq-default fill-column 60) (add-hook 'text-mode-hook 'turn-on-auto-fill) |
Use these two enable automated form-fill for 60 columns when emacs starts |
(set-face-attribute 'default nil :height 160) | Unit is 1/10pt, so for 10pt font 100 should be used |
(setq x-select-enable-clipboard t) | Make emacs copy-paste M-w, C-y work with system copy-paste |
(setq auto-save-default nil) | Preventing emacs from creating auto-save files |
Tips / Techniques
To do list using org mode
We can build todo lists using org-mode. For that we should create bullted list using - below a heading or a sub-heading. The hypen should be followed by [ ] empty square braces. We should also put [1/1] in front of sub-heading / heading under which we have built bulleted list. Then we can use C-c C-c shortcut to mark / unmark any item and the count gets reflected at top of list.
If we use single left click while keeping control key pressed on any buffer then we get popup buffer menu for switching buffers which can be very useful to switch buffers when working on multiple files.