Martin Foot's Emacs Configuration
Table of Contents
-
<<<<<<< HEAD
- 1. Installation instructions
- 2. Package repositories
- 3. Startup time benchmarking
- 4. Load path
- 5. User information
- 6. Parentheses
- 7. Fill columns and line highlighting
- 8. Indentation guides
- 9. Shortcut help
- 10. Line numbering and cursor position
- 11. Yes or no prompts
- 12. Symbolic links
- 13. OS Clipboard integration
- 14. Temporary backup files
- 15. Font size
- 16. Startup message
- 17. Terminal bells
- 18. Menu bar
- 19. Whitespace
- 20. Region selection
- 21. Org Mode
- 22. Blog
- 23. Window navigation and scrolling
- 24. Reloading files
- 25. Programming language support
- 26. Linting prose
- 27. Autocompletion
- 28. Code folding
- 29. Git
- 30. TODO Base editor configuration
- 31. TODO Package installation
- 32. Remote shells
- 33. Themes and visual config
- 34. Editor augmentation
- 35. Syntax highlighting and static analysis
- 36. Spell checking
- 37. Presenting
- 38. TODO Code snippet handling
- 39. TODO Other configuration =======
- 1. Installation instructions
- 2. Package repositories
- 3. Startup time benchmarking
- 4. Load path
- 5. User information
- 6. Parentheses
- 7. Fill columns and line highlighting
- 8. Indentation guides
- 9. Shortcut help
- 10. Line numbering and cursor position
- 11. Yes or no prompts
- 12. Multiple cursors
- 13. Symbolic links
- 14. OS Clipboard integration
- 15. Temporary backup files
- 16. Font size
- 17. Startup message
- 18. Terminal bells
- 19. Menu bar
- 20. Whitespace
- 21. Region selection
- 22. Org Mode
- 22.1. Key bindings
- 22.2. Task tracking
- 22.3. Agenda
- 22.4. Switching buffers
- 22.5. LaTeX entities
- 22.6. Emphasis and italics
- 22.7. Syntax highlighting for code blocks
- 22.8. Displaying images referenced in org files
- 22.9. Export org's checkboxes as HTML checkboxes on HTML export
- 22.10. Ditaa (generating images from textual block diagrams)
- 22.11. To Do list and agenda
- 22.12. Emoji
- 22.13. Improved bullet point styles
- 22.14. Screenshot attachment
- 22.15. Presentations
- 23. Blog
- 24. Window navigation and scrolling
- 25. Reloading files
- 26. Programming language support
- 27. Autocompletion
- 28. Code folding
- 29. Git
- 30. TODO Base editor configuration
- 31. TODO Package installation
- 32. Remote shells
- 33. Themes and visual config
- 34. Editor augmentation
- 35. Syntax highlighting and static analysis
- 36. Spell checking
- 37. Presenting
- 38. TODO Code snippet handling
- 39. TODO Other configuration >>>>>>> org-jekyll
This file stores my emacs configuration. The latest version can be found on GitHub. It is written using org-mode which
is an excellent way to organise notes and, as it turns out, an excellent way to organise my configuration file. It is
intended to be used with org-babel-load-file
which parses this file, generates a config.el
file, then executes that
during emacs startup. In this way my Emacs configuration serves as both the configuration settings and a high level
documentation of those settings. It provides an incredibly convenient way to organise configuration the full benefit of
org mode's functionality available within the configuration file itself. More information can be found in the
<<<<<<< HEAD
Installation instructions section.
=======
Installation instructions section.
>>>>>>> org-jekyll
I am not a long term emacs user yet, having started in October 2015 after using vim for around 7 years. As such I use
evil-mode all the time. This file is a work in progress that I try to keep organised. Like many people experiencing a
new editor rather than spending an extended period of time reading emacs' extensive documentation, the configuration
here has been a mix of searching and reading other people's .emacs
files. I would recommend taking small parts of it and
asking the inbuilt help system what each command does. I've tried to keep each section documented. You can do this with
C-h a
.
Organising my configuration in this way came about after a general interest in literate programming and after seeing these:
I already make notes on all my work and a lot of personal tasks throughout the day. This way I know I can confirm exactly what queries I executed or steps I took on a support request, or the methods I took at resolving a certain issue. Since I've been using org to do this, having org's power inside my editor configuration was a huge plus.
This file makes a lot of use of the use-package
function. This is a really nice way to keep the installation of a
package, it's keybindings, configuration, packaged together in the config file. There's a good description on how it
works here and you can see the project page here.
Note: Parts of this file are marked TODO
. These are sections that require more work. They may not be properly
documented, may be badly organised (maybe they should be part of other sections), or could be part of my old emacs
configuration from before I used org-mode
that I still haven't converted.
1 Installation instructions
~/.emacs.d/config.org
.
=======
1 Installation instructions
Copy the <a href="config.org">raw version of this file</a> to <code>~/.emacs.d/config.org</code>.
Then add (org-babel-load-file (concat user-emacs-directory "config.org"))
to ~/.emacs
.
Here is the contents of my ~/.emacs
file:
;; Martin's .emacs file ;; ;; Author: Martin Foot <martin@mfoot.com> ;; Load the config (require 'org) (org-babel-load-file (concat user-emacs-directory "config.org")) =======;; Martin's .emacs file ;; ;; Author: Martin Foot <martin@mfoot.com> ; Limit garbage collection to speed up startup (TODO revert this after the config is loaded) (setq gc-cons-threshold 100000000) ;; Load the config (org-babel-load-file (concat user-emacs-directory "config.org")) (setq gc-cons-threshold 800000) >>>>>>> org-jekyll
That's it.
The reason that this works is that some parts of this file are carefully organised. org-babel-load-file
pulls out and
<<<<<<< HEAD
executes emacs-lisp
code blocks in the order they're in the file. This means that it's very important that my Package
repositories section comes before any of the other non-standard config.
2 Package repositories
I use Melpa and Marmalade for repositories.
(require 'package) (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t) (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) (package-initialize) ======= executesemacs-lisp
code blocks in the order they're in the file. This means that it's very important that my Package repositories section comes before any of the other non-standard config.Small note for readers of the source file: The example above uses the org babel source language of
lisp
rather thanemacs-lisp
, meaning that it won't be executed byorg-babel-load-file
on startup. Initially I had atangle
block here so~/.emacs.d/.emacs
would be written conveniently by org, but it adds to the startup time of every emacs load. Removing thetangle
block meant a recursive load, so my workaround is to change the source language.org-babel-load-file
will only evaluateemacs-lisp
blocks.
2 Package repositories
I use Melpa and Marmalade for repositories as well as Org's official repository.
(require 'package) (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t) (add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/") t) (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) (package-initialize) >>>>>>> org-jekyll
Then, since I use use-package
for every package from the repositories, initialise this first.
(unless (package-installed-p 'use-package) (package-refresh-contents) (package-install 'use-package)) (eval-when-compile (setq use-package-always-ensure t) (require 'use-package) ) =======Note this is currently commented, it exists in
.emacs
.;(unless (package-installed-p 'use-package) ; (package-refresh-contents) ; (package-install 'use-package)) ; ;(eval-when-compile ; (setq use-package-always-ensure t) ; (setq use-package-verbose t) ; Put slow loading packages / config warnings in the *Messages* buffer ; (require 'use-package) ;) >>>>>>> org-jekyll
use-package
has support for removing minor modes from the bottom. This requires thediminish
package.<<<<<<< HEAD(use-package diminish) =======(use-package diminish :defer t ) >>>>>>> org-jekyll
3 Startup time benchmarking
=======3 Startup time benchmarking
>>>>>>> org-jekyll
It's possible to benchmark startup time in emacs. This is useful if evaluating this gets too slow. I keep these lines
commented as it's not something I do generally. It also isn't safe to run on every machine since the benchmark-init-el
package needs to be downloaded manually.
;(add-to-list 'load-path "/home/martinfoot/repositories/benchmark-init-el/") ;(require 'benchmark-init-loaddefs) ;(benchmark-init/activate)
4 Load path
=======4 Load path
>>>>>>> org-jekyllTODO: Fix this!
(add-to-list 'load-path "~/org-mode/lisp/") =======;;(add-to-list 'load-path "~/org-mode/lisp/") >>>>>>> org-jekyll
5 User information
;(setq user-full-name "Martin Foot" ; user-mail-address "martin@mfoot.com") (setq user-full-name "" user-mail-address "") =======<<<<<<< HEAD5 User information
(setq user-full-name "Martin Foot" user-mail-address "martin@mfoot.com") >>>>>>> org-jekyll6 Parentheses
=======<<<<<<< HEAD6 Parentheses
>>>>>>> org-jekyllUse
electric-pair-mode
to automatically close inserted parentheses and braces. I don't have this enabled in text modes because when usingorg-mode
it makes inserting links annoying.<<<<<<< HEAD(add-hook 'prog-mode-hook (lambda () (electric-pair-mode))) =======(add-hook 'prog-mode-hook (lambda () (electric-pair-mode))) >>>>>>> org-jekyll
show-paren-mode
makes emacs highlight closing parentheses, braces, and curly braces.<<<<<<< HEAD(show-paren-mode) ; Automatically highlight parenthesis pairs (setq show-paren-delay 0) ; show the paren match immediately =======(show-paren-mode) ; Automatically highlight parenthesis pairs (setq show-paren-delay 0) ; show the paren match immediately >>>>>>> org-jekyllThen I use
[[https://github.com/Fanael/rainbow-delimiters][rainbow-delimiters]]
to highlight nested parentheses in different colours.<<<<<<< HEAD(use-package rainbow-delimiters :config (add-hook 'prog-mode-hook 'rainbow-delimiters-mode) ) =======(use-package rainbow-delimiters :diminish :defer t :config (add-hook 'prog-mode-hook 'rainbow-delimiters-mode) ) >>>>>>> org-jekyll7 Fill columns and line highlighting
=======<<<<<<< HEAD7 Fill columns and line highlighting
>>>>>>> org-jekyllI find a 120 character line length is best for modern screens. Individual languages/major modes can override this.
In text-based modes (non-programming modes) I enable automatic line wrapping also.
<<<<<<< HEAD(setq-default fill-column 120) (add-hook 'text-mode-hook 'auto-fill-mode) =======(setq-default fill-column 120) (add-hook 'text-mode-hook 'auto-fill-mode) >>>>>>> org-jekyllI also like a highlight on the screen to show the current cursor line.
<<<<<<< HEAD(global-hl-line-mode) =======(global-hl-line-mode) >>>>>>> org-jekyllI also like to highlight git changes in buffers in a git repository:
<<<<<<< HEAD(use-package git-gutter+ :config (global-git-gutter+-mode) ) =======(use-package git-gutter+ :diminish :defer t :config (global-git-gutter+-mode) ) >>>>>>> org-jekyll8 Indentation guides
=======<<<<<<< HEAD8 Indentation guides
>>>>>>> org-jekyllWhen working with structured code it's nice to have an indentation guide.
<<<<<<< HEAD(use-package indent-guide :config (add-hook 'prog-mode-hook (lambda () (indent-guide-mode))) ) =======(use-package indent-guide :defer t :diminish :config (add-hook 'prog-mode-hook (lambda () (indent-guide-mode))) ) >>>>>>> org-jekyll9 Shortcut help
=======<<<<<<< HEAD9 Shortcut help
>>>>>>> org-jekyllIt's very difficult to remember all the shortcuts available in emacs. The
guide-key
plugin pops up a list of available suggestions after a little while.
:diminish guide-key-mode
configures the mode to not show up in the list of minor modes.I've configured it to wait 0.5 seconds before popping up the suggestions list.
C-c
- Active mode specific commands
C-x
- Emacs commands
<<<<<<< HEAD(use-package which-key :diminish which-key-mode :init (setq which-key-idle-delay 0.5) (which-key-mode) ) =======(use-package which-key :diminish which-key-mode :defer t :init (setq which-key-idle-delay 0.5) (which-key-mode) ) >>>>>>> org-jekyll10 Line numbering and cursor position
=======<<<<<<< HEAD10 Line numbering and cursor position
>>>>>>> org-jekyllI've had a slight change of heart. Typically I would show line numbers everywhere, but now, instead, I leave them turned off to save space. If I need to jump to a specific line, I'm using Avy mode to enable
g l
for go to line. This is just <<<<<<< HEAD as fast. See my Window navigation and scrolling section. ======= as fast. See my Window navigation and scrolling section. >>>>>>> org-jekyllI also show the current cursor position column number in the bottom left of the screen:
<<<<<<< HEAD(column-number-mode) =======(column-number-mode) >>>>>>> org-jekyll11 Yes or no prompts
=======<<<<<<< HEAD11 Yes or no prompts
>>>>>>> org-jekyllUse 'y' or 'n' instead of 'yes' and 'no' in interactive prompts. This saves typing.
<<<<<<< HEAD(defalias 'yes-or-no-p 'y-or-n-p) =======(defalias 'yes-or-no-p 'y-or-n-p) >>>>>>> org-jekyllI also configure emacs to ask me if I really want to quit when hitting
C-x C-c
because I find this way too easy to do.<<<<<<< HEAD(setq confirm-kill-emacs 'y-or-n-p) =======(setq confirm-kill-emacs 'y-or-n-p) >>>>>>> org-jekyll12 Symbolic links
By default emacs doesn't follow symlinks
(setq vc-follow-symlinks t) =======<<<<<<< HEAD12 Multiple cursors
Multiple cursors is cool.
(use-package multiple-cursors :diminish multiple-cursors-mode :defer t :init (global-set-key (kbd "C->") 'mc/mark-next-like-this) (global-set-key (kbd "C-<") 'mc/mark-previous-like-this) (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this) ) >>>>>>> org-jekyll13 OS Clipboard integration
=======
13 Symbolic links
By default emacs doesn't follow symlinks
(setq vc-follow-symlinks t)<<<<<<< HEAD14 OS Clipboard integration
>>>>>>> org-jekyll Add proper support for the OS clipboard integrations. Only tested under X.
First we enable the emacs copy buffer to be linked to the OS clipboard. Lines copied from the OS can be pasted into emacs and lines copied from emacs can be pasted into other OS windows.
<<<<<<< HEAD(setq x-select-enable-clipboard t) =======(setq x-select-enable-clipboard t) >>>>>>> org-jekyllNow we enable 'primary selection'. The clipboard config above is for the operating system copy buffer with
C-c
andC-v
. Primary selection is the mouse select buffer that usually works as pasted with a middle click. Enabling this allows selected text in emacs to be copied there so I can select in the program and paste into somewhere else using X.<<<<<<< HEAD(setq x-select-enable-primary t) (setq mouse-drag-copy-region t) =======(setq x-select-enable-primary t) (setq mouse-drag-copy-region t) >>>>>>> org-jekyll14 Temporary backup files
=======<<<<<<< HEAD15 Temporary backup files
>>>>>>> org-jekyllAuto backup can be disabled in emacs with
(setq make-backup-files nil)
but rather than disabling them we can simply move the directory that they get placed in. This keeps them out of the way in case we need them.I've used
~/.emacs-backups
because my ~/.emacs.d is in git, I don't need to keep backups.<<<<<<< HEAD; From http://www.emacswiki.org/emacs/BackupDirectory ; and http://stackoverflow.com/questions/151945/how-do-i-control-how-emacs-makes-backup-files (setq backup-by-copying t ; Ensure backups are copied, not renamed. Important for symlinks backup-directory-alist '(("" . "~/.emacs-backups")) ; Keep backups in ~/.emacs-backups, not the same directory tree delete-old-versions t ; Delete old versions without prompting kept-new-versions 10 ; Keep multiple versioned backup files kept-old-versions 0 ; Don't keep any beyond that version-control t) ; Use versioned backups (setq vc-make-backup-files t) ; Backup even when it's a version controlled project =======; From http://www.emacswiki.org/emacs/BackupDirectory ; and http://stackoverflow.com/questions/151945/how-do-i-control-how-emacs-makes-backup-files (setq backup-by-copying t ; Ensure backups are copied, not renamed. Important for symlinks backup-directory-alist '(("" . "~/.emacs-backups")) ; Keep backups in ~/.emacs-backups, not the same directory tree delete-old-versions t ; Delete old versions without prompting kept-new-versions 10 ; Keep multiple versioned backup files kept-old-versions 0 ; Don't keep any beyond that version-control t) ; Use versioned backups (setq vc-make-backup-files t) ; Backup even when it's a version controlled project >>>>>>> org-jekyll15 Font size
=======<<<<<<< HEAD16 Font size
>>>>>>> org-jekyllAdd some keybindings to increase and decrease the font size
<<<<<<< HEAD(global-set-key (kbd "C-+") 'text-scale-increase) (global-set-key (kbd "C--") 'text-scale-decrease) =======(global-set-key (kbd "C-+") 'text-scale-increase) (global-set-key (kbd "C--") 'text-scale-decrease) >>>>>>> org-jekyll ;; C-x C-0 restores the default font size16 Startup message
=======<<<<<<< HEAD17 Startup message
>>>>>>> org-jekyllDon't show the default emacs startup message when it's opened
<<<<<<< HEAD(setq inhibit-startup-message t) =======(setq inhibit-startup-message t) >>>>>>> org-jekyllLet's also show a fortune message in the scratch buffer when we start emacs:
<<<<<<< HEAD(use-package fortune-cookie :config (setq fortune-cookie-cowsay-enable nil) ; Disable cowsay (fortune-cookie-mode) ; Enable fortune cookie mode ) =======(use-package fortune-cookie :defer t :diminish :config (setq fortune-cookie-cowsay-enable nil) ; Disable cowsay (fortune-cookie-mode) ; Enable fortune cookie mode ) >>>>>>> org-jekyll17 Terminal bells
=======<<<<<<< HEAD18 Terminal bells
>>>>>>> org-jekyllDisable the terminal bell. Use a visible bell instead. A non-nil value causes emacs to try and flash the frame to represent a bell.
<<<<<<< HEAD(setq visible-bell 1) =======(setq visible-bell 1) >>>>>>> org-jekyll18 Menu bar
=======<<<<<<< HEAD19 Menu bar
>>>>>>> org-jekyllDon't show emacs' menu bar - I remember enough shortcuts and understand how to use the inbuilt help system if I don't remember the shortcut for something. When we're using graphical emacs, also disable the tooltips for the mouse an the scroll bar.
<<<<<<< HEAD(when window-system (tooltip-mode -1) (tool-bar-mode -1) (scroll-bar-mode -1)) (menu-bar-mode -1) =======(when window-system (tooltip-mode -1) (tool-bar-mode -1) (scroll-bar-mode -1)) (menu-bar-mode -1) >>>>>>> org-jekyll
19 Whitespace
=======20 Whitespace
>>>>>>> org-jekyllWhitespace mode is enabled for all programming and text buffers.
<<<<<<< HEAD(add-hook 'prog-mode-hook (lambda () (whitespace-mode))) (add-hook 'text-mode-hook (lambda () (whitespace-mode)))19.1 Trailing whitespace
=======(add-hook 'prog-mode-hook (lambda () (whitespace-mode))) (add-hook 'text-mode-hook (lambda () (whitespace-mode)))<<<<<<< HEAD20.1 Trailing whitespace
>>>>>>> org-jekyllDelete trailing whitespace automatically on save. I used to configure editors to highlight trailing whitespace, but it's pointless if it can be auto-deleted on save.
<<<<<<< HEAD(add-hook 'before-save-hook 'delete-trailing-whitespace) =======(add-hook 'before-save-hook 'delete-trailing-whitespace) >>>>>>> org-jekyllI also don't like seeing tabs mixed with spaces. This section needs some work however so is currently commented out. I need to customise the faces that
whitespace-mode
uses.<<<<<<< HEAD(setq whitespace-line-column 118) ; Highlight lines over 118 characters in whitespace-mode =======(setq whitespace-line-column 118) ; Highlight lines over 118 characters in whitespace-mode >>>>>>> org-jekyll19.2 Default emacs backspace behaviour
=======<<<<<<< HEAD20.2 Default emacs backspace behaviour
>>>>>>> org-jekyllI despise emacs' default behaviour when hitting backspaces on tabs - it converts the tab into the tab-width number of spaces and inserts tab-width -1 spaces. This seems like an insane default.
<<<<<<< HEAD(setq backward-delete-char-untabify-method nil) =======(setq backward-delete-char-untabify-method nil) >>>>>>> org-jekyll19.3 Tabs
=======<<<<<<< HEAD20.3 Tabs
>>>>>>> org-jekyllDisplay tabs as four spaces:
<<<<<<< HEAD(setq-default tab-width 4) =======(setq-default tab-width 4) >>>>>>> org-jekyll ;(setq-default tab-always-indent 'complete)Set up the tab stop list. This is what emacs uses when it can't find an appropriate tab stop - i.e how much to try indenting when tab is hit.
<<<<<<< HEAD(setq-default tab-stop-list (number-sequence 4 200 4)) =======(setq-default tab-stop-list (number-sequence 4 200 4)) >>>>>>> org-jekyllInsert tabs by default when auto-formatting.
<<<<<<< HEAD(setq-default indent-tabs-mode t) =======(setq-default indent-tabs-mode t) >>>>>>> org-jekyll
electric-indent-mode
is used to automatically indent a new line when RET is typed.<<<<<<< HEAD(electric-indent-mode) =======(electric-indent-mode) >>>>>>> org-jekyll19.4 TODO Highlighting font faces
=======<<<<<<< HEAD20.4 TODO Highlighting font faces
>>>>>>> org-jekyllHighlighting colours for whitespace indicators:
<<<<<<< HEAD(custom-set-faces '(whitespace-hspace ((t (:foreground "black")))) '(whitespace-space ((t (:foreground "dark slate gray" :slant italic)))) '(whitespace-tab ((t (:foreground "black"))))) =======(custom-set-faces '(whitespace-hspace ((t (:foreground "black")))) '(whitespace-space ((t (:foreground "dark slate gray" :slant italic)))) '(whitespace-tab ((t (:foreground "black"))))) >>>>>>> org-jekyll19.5 Highlighting long lines
=======<<<<<<< HEAD20.5 Highlighting long lines
>>>>>>> org-jekyllI have whitespace mode configured to show lines longer than 120 characters.
<<<<<<< HEAD(setq whitespace-line-column 120) =======(setq whitespace-line-column 120) >>>>>>> org-jekyll19.6 Showing mixed tabs-spaces
=======<<<<<<< HEAD20.6 Showing mixed tabs-spaces
>>>>>>> org-jekyllI highlight mixed spaces and tabs, and have whitespace mode clean out blank lines at the beginning and end of files.
<<<<<<< HEAD(setq whitespace-style (quote (face space-before-tab empty space-after-tab))) =======(setq whitespace-style (quote (face space-before-tab empty space-after-tab))) >>>>>>> org-jekyll19.7 Highlighting colours
20 Region selection
=======20.7 Highlighting colours
<<<<<<< HEAD21 Region selection
>>>>>>> org-jekyll
expand-region
makes it really easy to quickly select regions of text getting larger.<<<<<<< HEAD(use-package expand-region :defer t :bind ("C-=" . er/expand-region) ) =======(use-package expand-region :diminish :defer t :bind ("C-=" . er/expand-region) ) >>>>>>> org-jekyll21 Org Mode
=======22 Org Mode
>>>>>>> org-jekyllWhen I originally wrote this file I had a few simple customisations here. As I discovered new features and customised more things it became larger and larger and I had to split it into subcategories.
<<<<<<< HEAD(require 'org)21.1 Key bindings
=======22.1 Key bindings
>>>>>>> org-jekyllThis table lists (and defines) the key bindings that I often use. Most are set to the defaults but it provides both an easy way to set variables and a handy reference. Check the source for how the table is used.
Note to future me: If the key is already bound and you're setting a default here, you can find out the name of the function with
C-h k <key combination>
.TODO: These are the header rows but they cause problems with org-babel evaluation. I would also like to use org's
monospace markup
but this is causing problems. I need to strip the "=" character out of the value in the table cells.<<<<<<< HEAD
Key binding Description Function =======
>>>>>>> org-jekyll
C-c a View agenda org-agenda C-c b Switch buffer between different org mode files org-switchb C-c C-t Assign or modify a TODO state for the current node org-todo C-c C-a View current task attachments / attach a file to current task org-attach C-c C-b Move to previous heading at the same level org-backwards-heading-same-level C-c C-d Set the deadline for a task org-deadline C-c C-e Launch the org export dialog org-export-dispatch C-c C-w Refile (move subtree elsewhere in document) org-refile C-c C-s Schedule current note/task org-schedule C-c C-t Toggle todo state to any allowed org-todo C-c C-o Open link at point org-open-at-point C-c $ Archive the subtree to the archive file (useful as large org files are slow) org-archive-subtree C-c ' Edit the current code block in buffer in the correct major mode org-edit-special C-c * Recalculate formulas on an org mode table org-ctrl-c-star C-c { Enable the debugger for table formulas org-table-toggle-formula-debugger <<<<<<< HEAD<<<<<<< HEAD(defun mfoot-define-key-bindings (input) (global-set-key (kbd (car input)) (last input))) ; Handle using org's monospace markup (=example=) ;(global-set-key (kbd (remove "=" (car input))) (remove "=" (last input)))) (mapcar #'mfoot-define-key-bindings org-key-bindings) =======(defun mfoot-define-key-bindings (input) (global-set-key (kbd (car input)) (last input))) ; Handle using org's monospace markup (=example=) ;(global-set-key (kbd (remove "=" (car input))) (remove "=" (last input)))) (mapcar #'mfoot-define-key-bindings org-key-bindings) >>>>>>> org-jekyll21.2 Task tracking
21.2.1 Task transition timing
=======22.2 Task tracking
<<<<<<< HEAD22.2.1 Task transition timing
>>>>>>> org-jekyllI like to see timestamps for task transitions but I don't want them filling up screen real estate. Logging these into drawers makes them easily expandable and collapsible.
<<<<<<< HEAD(setq org-log-into-drawer t) =======(setq org-log-into-drawer t) >>>>>>> org-jekyll21.2.2 TODO State transitions
Here states transitions are configured. This is largely based on this document but I use
IN_PROGRESS
instead ofNEXT
.<<<<<<< HEAD(setq org-todo-keywords (quote ((sequence "TODO(t!)" "IN_PROGRESS(i!)" "|" "DONE(d!)") (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)"))) ) =======22.2.2 TODO State transitions
State transitions are largely based on this document but I use
IN_PROGRESS
instead ofNEXT
.(setq org-todo-keywords (quote ((sequence "TODO(t!)" "IN_PROGRESS(i!)" "|" "DONE(d!)") (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)"))) ) >>>>>>> org-jekyllI have defined colours for each task state. TODO is red (bad), blocked is orange and magnta (somewhat bad), in progress is gold (OK) and complete is green.
<<<<<<< HEAD(setq org-todo-keyword-faces (quote (("TODO" :foreground "red" :weight bold) ("IN_PROGRESS" :foreground "gold" :weight bold) ("DONE" :foreground "forest green" :weight bold) ("WAITING" :foreground "orange" :weight bold) ("HOLD" :foreground "magenta" :weight bold) ("CANCELLED" :foreground "forest green" :weight bold) ) )) =======(setq org-todo-keyword-faces (quote (("TODO" :foreground "red" :weight bold) ("IN_PROGRESS" :foreground "gold" :weight bold) ("DONE" :foreground "forest green" :weight bold) ("WAITING" :foreground "orange" :weight bold) ("HOLD" :foreground "magenta" :weight bold) ("CANCELLED" :foreground "forest green" :weight bold) ) )) >>>>>>> org-jekyllSince I have more than two states, moving between them with the default
S-<left>
andS-<right>
is slow. This enablesC-c c t
as a shortcut for quickly choosing the state. some of the states below have an "@" symbol next to them. This lets me write a reason why a task is cancelled or blocked, or what it's waiting on. The buffer will appear when selecting such a state that lets me enter the reason.<<<<<<< HEAD(setq org-use-fast-todo-selection t) =======(setq org-use-fast-todo-selection t) >>>>>>> org-jekyll21.3 Agenda
=======22.3 Agenda
>>>>>>> org-jekyllTell org mode where my notes are usually kept. This allows the agenda view to index all my org notes for TODO items and scheduled items. Some of these directories won't exist on some machines so we filter the list at startup based on whether or not the file exists.
<<<<<<< HEAD(require 'cl) ; remove-if-not is inside the common-lisp package (setq org-agenda-files (remove-if-not 'file-exists-p '("~/Repositories/notes" "~/repositories/notes" "~/Dropbox/life" "~/repositories/life"))) =======(require 'cl) ; remove-if-not is inside the common-lisp package (setq org-agenda-files (remove-if-not 'file-exists-p '( "~/Repositories/notes" "~/repositories/notes" "~/repositories/life" "~/repositories/life/projects" "~/repositories/life/tasks"))) ;(setq org-agenda-files (remove-if-not 'file-exists-p '("~/Repositories/notes" "~/repositories/notes"))) >>>>>>> org-jekyllSet up a key binding for the org agenda
<<<<<<< HEAD=======(global-set-key (kbd "C-c a") 'org-agenda)(global-set-key (kbd "C-c a") 'org-agenda)
22.4 Switching buffers
>>>>>>> org-jekyll
org-iswitchb
is a quick way to switch org mode buffers.<<<<<<< HEAD=======(global-set-key (kbd "C-c b") 'org-iswitchb)(global-set-key (kbd "C-c b") 'org-iswitchb)
22.5 LaTeX entities
>>>>>>> org-jekyllEnable pretty entities - shows e.g. α β γ as UTF-8 characters.
<<<<<<< HEAD=======(setq org-pretty-entities t)(setq org-pretty-entities t)22.6 Emphasis and italics
>>>>>>> org-jekyllIn
org-mode
we can use several different emphasis types using different emphasis markup. When a block of text has some emphasis on it, get emacs to hide the markup characters:<<<<<<< HEAD=======(setq org-hide-emphasis-markers t)(setq org-hide-emphasis-markers t)22.7 Syntax highlighting for code blocks
>>>>>>> org-jekyllEnsure native syntax highlighting is used for inline source blocks in org files
<<<<<<< HEAD(setq org-src-fontify-natively t) =======(setq org-src-fontify-natively t) >>>>>>> org-jekyllWhen emacs source-formats a code block, don't add spaces before it (it messes with syntax highlighting in major modes).
<<<<<<< HEAD(setq org-edit-src-content-indentation 0) =======(setq org-edit-src-content-indentation 0) >>>>>>> org-jekyllConfigure the languages that Babel will automatically syntax highlight
<<<<<<< HEAD=======;; active Babel languages (org-babel-do-load-languages 'org-babel-load-languages '((sql . t) (sh . t) (ditaa . t) (dot . t) (calc . t) (java . t) (emacs-lisp . t) (ruby . t) (python . t) ) );; active Babel languages (org-babel-do-load-languages 'org-babel-load-languages '((sql . t) (shell . t) (ditaa . t) (dot . t) (calc . t) (java . t) (emacs-lisp . t) (ruby . t) (python . t) (gnuplot . t) (latex . t) ) )22.8 Displaying images referenced in org files
>>>>>>> org-jekyllWhen we're using a GUI emacs we can display embedded images on startup
<<<<<<< HEAD(add-hook 'org-babel-after-execute-hook 'org-display-inline-images) (add-hook 'org-mode-hook 'org-display-inline-images) (add-hook 'org-mode-hook 'org-babel-result-hide-all) =======(add-hook 'org-babel-after-execute-hook 'org-display-inline-images) (add-hook 'org-mode-hook 'org-display-inline-images) (add-hook 'org-mode-hook 'org-babel-result-hide-all) >>>>>>> org-jekyll<<<<<<< HEAD When exporting to HTML change check boxes into actual HTML check boxes.
(setq org-html-checkbox-type 'html)I use
ditaa
for block diagrams. This executes a java program and needs to know where to find the jar.(setq org-ditaa-jar-path "/home/martin/bin/ditaa0_9.jar")I use graphical emacs so that I can display inline images. Set them to have a maximum size so large images don't fill the screen.
======= I use graphical emacs so that I can display inline images. Set them to have a maximum size so large images don't fill the screen.(setq org-image-actual-width 800)(setq org-image-actual-width 800)22.9 Export org's checkboxes as HTML checkboxes on HTML export
When exporting to HTML change check boxes into actual HTML check boxes.
(setq org-html-checkbox-type 'html)22.10 Ditaa (generating images from textual block diagrams)
I use
ditaa
for block diagrams. This executes a java program and needs to know where to find the jar.(setq org-ditaa-jar-path "/home/martin/bin/ditaa0_9.jar")
<<<<<<< HEAD22.11 To Do list and agenda
>>>>>>> org-jekyllI've been using a single TODO list file and using org-capture to capture todo items to my org agenda from anywhere. This tends to happen at home rather than at work as my work org files contain appropriate TODOs arranged by date headers. At home and in my blog I can capture TODO items and put them in this directory.
<<<<<<< HEAD(if (file-exists-p "~/Dropbox/life/life.org") (setq org-default-notes-file "~/Dropbox/life/life.org") (setq org-default-notes-file "~/repositories/notes/notes.org") ) (define-key global-map "\C-cc" 'org-capture) =======(if (file-exists-p "~/Dropbox/life/life.org") (setq org-default-notes-file "~/Dropbox/life/life.org") (setq org-default-notes-file "~/repositories/notes/notes.org") ) (define-key global-map "\C-cc" 'org-capture) >>>>>>> org-jekyllCustomise the colours of TODO task priority indicators:
<<<<<<< HEAD(setq org-priority-faces '((?A :foreground "dark orange") (?B :foreground "tomato") (?C :foreground "firebrick"))) =======(setq org-priority-faces '((?A :foreground "dark orange") (?B :foreground "tomato") (?C :foreground "firebrick"))) >>>>>>> org-jekyllI would like a custom agenda view that shows me unscheduled TODO tasks:
<<<<<<< HEAD(setq org-agenda-custom-commands '(("c" . "My Custom Agendas") ("cu" "Unscheduled TODO" ((todo "" ((org-agenda-overriding-header "\nUnscheduled TODO") (org-agenda-skip-function '(org-agenda-skip-entry-if 'scheduled))))) nil nil))) =======(setq org-agenda-custom-commands '(("c" . "My Custom Agendas") ("cu" "Unscheduled TODO" ((todo "" ((org-agenda-overriding-header "\nUnscheduled TODO") (org-agenda-skip-function '(org-agenda-skip-entry-if 'scheduled))))) nil nil))) >>>>>>> org-jekyllWe'll also make the agenda view appear in the current window, not in a right split. It messes up existing splits.
<<<<<<< HEAD(setq org-agenda-window-setup 'current-window) =======(setq org-agenda-window-setup 'current-window) >>>>>>> org-jekyllTODO: Investigate org-capture, org-agenda etc. See http://pages.sachachua.com/.emacs.d/Sacha.html#orgheadline45. There is a HUGE wealth of information here.
21.4 Emoji
=======<<<<<<< HEAD22.12 Emoji
>>>>>>> org-jekyllI rarely use smiley faces in notes, but sometimes the occasion calls for it. Emojify displays these emojis in interactive buffers.
Example: :)
<<<<<<< HEAD(use-package emojify :init (add-hook 'org-mode-hook 'emojify-mode)) =======(use-package emojify :diminish :defer t ) >>>>>>> org-jekyll21.5 Improved bullet point styles
21.5.1 Section headers
=======22.13 Improved bullet point styles
<<<<<<< HEAD22.13.1 Section headers
>>>>>>> org-jekyllThe
org-bullets
package allows pretty unicode bullet points.These are taken from https://thraxys.wordpress.com/2016/01/14/pimp-up-your-org-agenda/.
<<<<<<< HEAD(use-package org-bullets :init (setq org-bullets-bullet-list '("◉" "◎" "⚫" "○" "►" "◇")) (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) ) =======(use-package org-bullets :defer t :diminish :init (setq org-bullets-bullet-list '("◉" "◎" "⚫" "○" "►" "◇")) (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) ) >>>>>>> org-jekyll21.5.2 Bullet point lists
=======<<<<<<< HEAD22.13.2 Bullet point lists
>>>>>>> org-jekyllFor bullet lists, I use a slightly modified (removed
*
chars) versino of Howard Abrams' Better bullets changes.<<<<<<< HEAD(font-lock-add-keywords 'org-mode '(("^ *\\(-\\) " (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) =======(font-lock-add-keywords 'org-mode '(("^ *\\(-\\) " (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) >>>>>>> org-jekyll21.6 Screenshot attachment
=======<<<<<<< HEAD22.14 Screenshot attachment
>>>>>>> org-jekyllI use a package called org-attach-screenshot which is awesome. Calling the function hides emacs and allows you to grab a section of the screen to insert, where it uses
org-attach
to save it, embeds it at the cursor position, and callsorg-redisplay-inline-images
. This is great for capturing issues at work.<<<<<<< HEAD(use-package org-attach-screenshot :bind (("C-c S" . org-attach-screenshot)) ) =======(use-package org-attach-screenshot :diminish :bind (("C-c S" . org-attach-screenshot)) ) >>>>>>> org-jekyll21.7 Presentations
=======<<<<<<< HEAD22.15 Presentations
>>>>>>> org-jekyllI use
org-reveal
for HTML/JS presentations.TODO: Get org-reveal installed.
<<<<<<< HEAD(add-to-list 'load-path "~/.emacs.d/org-reveal/") (setq org-reveal-root (expand-file-name (concat user-emacs-directory "reveal.js"))) (add-hook 'org-mode-hook (lambda () (load-library "ox-reveal"))) =======;(add-to-list 'load-path "~/.emacs.d/org-reveal/") ;(setq org-reveal-root (expand-file-name (concat user-emacs-directory "reveal.js"))) ;(add-hook 'org-mode-hook (lambda () (load-library "ox-reveal"))) ; >>>>>>> org-jekyll21.8 Additional URL schemes
21.8.1 TODO Man pages
The following code adds a new link type from org that can link to man pages. It's taken from the org mode manual.
I need to improve this to see if I can link directly to a heading inside the man page.
(require 'org) (org-add-link-type "man" 'org-man-open) (add-hook 'org-store-link-functions 'org-man-store-link) (defcustom org-man-command 'man "The Emacs command to be used to display a man page." :group 'org-link :type '(choice (const man) (const woman))) (defun org-man-open (path) "Visit the manpage on PATH. PATH should be a topic that can be thrown at the man command." (funcall org-man-command path)) (defun org-man-store-link () "Store a link to a manpage." (when (memq major-mode '(Man-mode woman-mode)) ;; This is a man page, we do make this link (let* ((page (org-man-get-page-name)) (link (concat "man:" page)) (description (format "Manpage for %s" page))) (org-store-link-props :type "man" :link link :description description)))) (defun org-man-get-page-name () "Extract the page name from the buffer name." ;; This works for both `Man-mode' and `woman-mode'. (if (string-match " \\(\\S-+\\)\\*" (buffer-name)) (match-string 1 (buffer-name)) (error "Cannot create link to this man page")))22 Blog
=======<<<<<<< HEAD23 Blog
>>>>>>> org-jekyllMy blog uses a static site generator called Jekyll. This parses YAML files and produces static HTML content which I then host on Amazon S3. I really like the power of
org-mode
in Emacs, so this configuration block enables me to write blog posts usingorg-mode
and then useorg-mode
's publishing system to publish these files in a format that Jekyll understands. I can then run Jekyll normally and it will take these org-published files and convert them into the static website. The configuration here is based on Using org to Blog with Jekyll, so reading through that is a good idea before trying to understand this. I've adapted it slightly to work with the latestorg-mode
(the publishing functions changed name). I've also added an third part of the project that handles exporting this org mode config file into a/static/emacs-config
directory. Whenever I runorg-publish-all
the latest version of the config file gets pulled in and so the config file hosted on my blog is always as up-to-date as the latest blog post.Here we define a list of projects for org mode. When using the export processor (
C-c C-e
) a projects option now appears at the bottom from any file. Two projects are defined; one for the blog posts that get processed with the HTML publishing function, and one for static content that gets copied verbatim. I can select a project and select either one of the two projects or the component project that wraps both of them. Org will maintain timestamps and caches of these files so that it doesn't regenerate what it doesn't have to.TODO: Describe folder structure. Link to GitHub?
Additionally I embed my Google Analytics tracking code in my org mode config for purely informational purposes. Everybody likes cool statistics. To do this I define a custom HTML export that derives from the default org HTML export. It includes a translation function that calls the default HTML template renderer then uses string manipulation to insert the Google Analytics code at the end of the
<body>
tag.<<<<<<< HEAD(defun mfoot-append-google-analytics-tag (template info) "Appends my Google Analytics script segment to the body" (let ((html-template (org-html-template template info))) (let ((pos (string-match (regexp-quote "</body>") html-template))) (concat (substring html-template 0 pos) =======(defun mfoot-append-google-analytics-tag (template info) "Appends my Google Analytics script segment to the body" (let ((html-template (org-html-template template info))) (let ((pos (string-match (regexp-quote "</body>") html-template))) (concat (substring html-template 0 pos) >>>>>>> org-jekyll "<script type=\"text/javascript\"> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-24568117-1', 'auto'); ga('send', 'pageview'); </script>" <<<<<<< HEAD (substring html-template pos))))) (eval-after-load "org" '(progn (require 'ox-html) (org-export-define-derived-backend 'mfoot-html-with-google-analytics 'html :translate-alist '( (template . mfoot-append-google-analytics-tag) ) ) ) ) (defun mfoot-export-emacs-config-to-file (plist filename pub-dir) "Export current buffer to an blog HTML file" (let* ((extension (concat "." org-html-extension)) (org-export-coding-system org-html-coding-system)) (org-publish-org-to 'mfoot-html-with-google-analytics filename extension plist pub-dir))) (setq org-publish-project-alist '( ("org-mfoot" ; Export my blog to the Jekyll format for ~jekyll build~ :base-directory "~/repositories/mfoot.com/jekyll/_posts" :base-extension "org" ;; Path to your Jekyll project. :publishing-directory "~/repositories/mfoot.com/jekyll/_posts" ======= (substring html-template pos))))) (eval-after-load "org" '(progn (require 'ox-html) (org-export-define-derived-backend 'mfoot-html-with-google-analytics 'html :translate-alist '( (template . mfoot-append-google-analytics-tag) ) ) ) ) (defun mfoot-export-emacs-config-to-file (plist filename pub-dir) "Export current buffer to an blog HTML file" (let* ((extension (concat "." org-html-extension)) (org-export-coding-system org-html-coding-system)) (org-publish-org-to 'mfoot-html-with-google-analytics filename extension plist pub-dir))) (setq org-publish-project-alist '( ("org-mfoot" ; Export my blog to the Jekyll format for ~jekyll build~ :base-directory "~/repositories/mfoot.com/org/" :base-extension "org" ;; Path to your Jekyll project. :publishing-directory "~/repositories/mfoot.com/jekyll/" >>>>>>> org-jekyll :recursive t :publishing-function org-html-publish-to-html :html-extension "html" :body-only t ;; Only export section between <body> </body> :section-numbers nil :with-toc nil :auto-index nil :auto-preamble nil :body-only t :auto-postamble nil <<<<<<< HEAD ) ;("org-static-mfoot" ; :base-directory "~/repositories/mfoot.com/org/" ; :base-extension "css\\|js\\|png\\|jpg\\|gif" ; :publishing-directory "~/repositories/mfoot.com/jekyll" ; :recursive t ; :publishing-function org-publish-attachment ;) ("emacs-dotfiles-mfoot.com" ; Publish an HTML version of this file to the static folder. ======= ) ("org-static-mfoot" :base-directory "~/repositories/mfoot.com/org/" :base-extension "css\\|js\\|png\\|jpg\\|gif" :publishing-directory "~/repositories/mfoot.com/jekyll" :recursive t :publishing-function org-publish-attachment ) ("emacs-dotfiles-mfoot.com" ; Publish an HTML version of this file to the static folder. >>>>>>> org-jekyll :base-directory "~/repositories/dotfiles/.emacs.d/" :base-extension "org" :publishing-directory "~/repositories/mfoot.com/jekyll/static/emacs-config" :exclude ".*" <<<<<<< HEAD :include ("config.org") :publishing-function mfoot-export-emacs-config-to-file :html-extension "html" ) ("emacs-config.org-mfoot.com" ; Publish the raw version of this file alongside the HTML ======= :include ("config.org") :publishing-function mfoot-export-emacs-config-to-file :html-extension "html" ) ("emacs-config.org-mfoot.com" ; Publish the raw version of this file alongside the HTML >>>>>>> org-jekyll :base-directory "~/repositories/dotfiles/.emacs.d/" :base-extension "org" :publishing-directory "~/repositories/mfoot.com/jekyll/static/emacs-config" :exclude ".*" <<<<<<< HEAD :include ("config.org") :publishing-function org-publish-attachment ) ("mfoot.com" :components ( "org-mfoot" ;"org-static-mfoot" "emacs-dotfiles-mfoot.com" "emacs-config.org-mfoot.com" ) ) )) ======= :include ("config.org") :publishing-function org-publish-attachment ) ("mfoot.com" :components ( "org-mfoot" "org-static-mfoot" "emacs-dotfiles-mfoot.com" "emacs-config.org-mfoot.com" ) ) )) >>>>>>> org-jekyllIn addition, I need to install the
htmlize
package to provide syntax highlighting when exporting HTML. See here for more information.<<<<<<< HEAD(use-package htmlize) =======(use-package htmlize :defer t ) >>>>>>> org-jekyllIn order to get images to work both inside emacs and inside the generated output I need to register a custom image format. Emacs currently will only generate
<a href />
tags for images it can actually resolve on the filesystem. Since my images on my blog are hosted under/images
, emacs will generatefile:///images
URLs which is not useful. The following allows me to useimg:../images/2015/11/photo.png
as an image reference and have both emacs and the html generator generate the correct paths. This is modified from this StackOverflow answer.<<<<<<< HEAD(defun org-custom-link-img-follow (path) (org-open-file-with-emacs (format "../images/%s" path))) (defun org-custom-link-img-export (path desc format) (cond ((eq format 'html) (format "<img src=\"/images/%s\" alt=\"%s\"/>" path desc)))) (org-add-link-type "img" 'org-custom-link-img-follow 'org-custom-link-img-export) =======(defun org-custom-link-img-follow (path) (org-open-file-with-emacs (format "../images/%s" path))) (defun org-custom-link-img-export (path desc format) (cond ((eq format 'html) (format "<img src=\"/images/%s\" alt=\"%s\"/>" path desc)))) (org-add-link-type "img" 'org-custom-link-img-follow 'org-custom-link-img-export) >>>>>>> org-jekyllTODO: Write some notes on how I publish this to S3 with s3-website. I always forget this and have to check my bash history.
23 Window navigation and scrolling
=======<<<<<<< HEAD24 Window navigation and scrolling
>>>>>>> org-jekyllScroll smoothly rather than by paging
<<<<<<< HEAD(setq scroll-step 1) =======(setq scroll-step 1) >>>>>>> org-jekyllWhen the cursor moves past the top or bottom of the window, scroll one line at a time rather than jumping. I don't like having to find my place in the file again.
<<<<<<< HEAD(setq scroll-conservatively 10000) =======(setq scroll-conservatively 10000) >>>>>>> org-jekyllAdd vim-like navigation between panes in a window using windmove.
<<<<<<< HEAD(windmove-default-keybindings) (global-set-key (kbd "C-c <left>") 'windmove-left) (global-set-key (kbd "C-c <right>") 'windmove-right) (global-set-key (kbd "C-c <up>") 'windmove-up) (global-set-key (kbd "C-c <down>") 'windmove-down) =======(windmove-default-keybindings) (global-set-key (kbd "C-c <left>") 'windmove-left) (global-set-key (kbd "C-c <right>") 'windmove-right) (global-set-key (kbd "C-c <up>") 'windmove-up) (global-set-key (kbd "C-c <down>") 'windmove-down) >>>>>>> org-jekyllI use avy-mode for fast buffer navigation. As I use
evil-mode
I've boundgc
to goto-char andgl
to goto-line. This makes for some really fast navigation of the visible buffer.<<<<<<< HEAD(use-package avy :init (progn (use-package evil) ) :config (define-key evil-normal-state-map (kbd "gc") 'avy-goto-char) (define-key evil-normal-state-map (kbd "gl") 'avy-goto-line) ) =======(use-package avy :defer t :diminish :init (progn (use-package evil :diminish :defer t ) ) :config (define-key evil-normal-state-map (kbd "gc") 'avy-goto-char) (define-key evil-normal-state-map (kbd "gl") 'avy-goto-line) ) >>>>>>> org-jekyll24 Reloading files
=======<<<<<<< HEAD25 Reloading files
>>>>>>> org-jekyllI swap branches a lot.
auto-reload-mode
will automatically reload opened buffers (prompting to save or not)<<<<<<< HEAD(global-auto-revert-mode t) =======(global-auto-revert-mode t) >>>>>>> org-jekyll25 Programming language support
=======26 Programming language support
>>>>>>> org-jekyll<<<<<<< HEADI use flycheck mode for syntax highlighting and linting when programming. See https://github.com/flycheck/flycheck
<<<<<<< HEAD(use-package flycheck :init (add-hook 'prog-mode-hook (lambda () (flycheck-mode))) ) =======(use-package flycheck :defer t :diminish :config (add-hook 'prog-mode-hook (lambda () (flycheck-mode))) ) >>>>>>> org-jekyll25.1 YAML
=======<<<<<<< HEAD26.1 YAML
>>>>>>> org-jekyllAdd a major mode for yaml highlighting
<<<<<<< HEAD(use-package yaml-mode) =======(use-package yaml-mode :defer t :diminish ) >>>>>>> org-jekyll25.2 C
=======<<<<<<< HEAD26.2 C
>>>>>>> org-jekyllAt work we use BSD-style C/C++. We also set the default indentation to four spaces.
<<<<<<< HEAD(setq-default c-basic-offset 4) (setq-default c-default-style "bsd") =======(setq-default c-basic-offset 4) (setq-default c-default-style "bsd") >>>>>>> org-jekyll
25.3 Go
=======<<<<<<< HEAD26.3 Go
>>>>>>> org-jekyllI've just started learning about Go so this is very basic. Enough to run through the tutorials.
<<<<<<< HEAD(use-package go-mode) (setenv "GOPATH" "~/go") (add-hook 'go-mode-hook (lambda () ( (add-hook 'before-save-hook 'gofmt-before-save) ))) =======(use-package go-mode :mode "\\.go" :init (setenv "GOPATH" "~/go") :config (add-hook 'go-mode-hook (lambda () ( (add-hook 'before-save-hook 'gofmt-before-save) ))) ) >>>>>>> org-jekyll25.4 SCSS
=======<<<<<<< HEAD26.4 SCSS
>>>>>>> org-jekyllWhen doing web development, SCSS is really useful. We use scss-mode for this. By default hitting tab will insert four spaces. We'll modify this to use two in the same format that Twitter's Bootstrap library uses.
<<<<<<< HEAD(use-package scss-mode :config (add-hook 'scss-mode-hook (lambda () ( (setq css-indent-offset 2) (setq tab-always-indent nil) ; electric-indent-mode will insert tabs otherwise to minimise whitespace characters (setq indent-tabs-mode nil) ; Always use spaces for scss ))) ) =======(use-package scss-mode :defer t :config (add-hook 'scss-mode-hook (lambda () ( (setq css-indent-offset 2) (setq tab-always-indent nil) ; electric-indent-mode will insert tabs otherwise to minimise whitespace characters (setq indent-tabs-mode nil) ; Always use spaces for scss ))) ) >>>>>>> org-jekyll26 Linting prose
I came across a cool blog post on linting prose in emacs with the proselint package for python wrapped as a flycheck checker.
(flycheck-define-checker proselint "A linter for prose." :command ("proselint" source-inplace) :error-patterns ((warning line-start (file-name) ":" line ":" column ": " (id (one-or-more (not (any " ")))) (message) line-end)) :modes (text-mode markdown-mode org-mode)) (add-to-list 'flycheck-checkers 'proselint)27 Autocompletion
=======<<<<<<< HEAD27 Autocompletion
>>>>>>> org-jekyllI use company-mode for autocompletion. It's bound to
C-<space>
in a similar way to eclipse. Since I useevil-mode
I don't use emacs' default mark combo.<<<<<<< HEAD(use-package company :init (use-package helm-company :config (define-key company-mode-map (kbd "C-SPC") 'helm-company) (define-key company-active-map (kbd "C-SPC") 'helm-company) ) :config (add-hook 'prog-mode-hook 'company-mode) (progn ;; Company mode interferes with yasnippets, so this fixes it and integrates them: ;; http://emacs.stackexchange.com/questions/10431/get-company-to-show-suggestions-for-yasnippet-names ;; Add yasnippet support for all company backends ;; https://github.com/syl20bnr/spacemacs/pull/179 (defvar company-mode/enable-yas t "Enable yasnippet for all backends.") (defun company-mode/backend-with-yas (backend) (if (or (not company-mode/enable-yas) (and (listp backend) (member 'company-yasnippet backend))) backend (append (if (consp backend) backend (list backend)) '(:with company-yasnippet)))) (setq company-backends (mapcar #'company-mode/backend-with-yas company-backends)) ) ) =======(use-package company :defer t :diminish :config (progn ;; Company mode interferes with yasnippets, so this fixes it and integrates them: ;; http://emacs.stackexchange.com/questions/10431/get-company-to-show-suggestions-for-yasnippet-names ;; Add yasnippet support for all company backends ;; https://github.com/syl20bnr/spacemacs/pull/179 (defvar company-mode/enable-yas t "Enable yasnippet for all backends.") (defun company-mode/backend-with-yas (backend) (if (or (not company-mode/enable-yas) (and (listp backend) (member 'company-yasnippet backend))) backend (append (if (consp backend) backend (list backend)) '(:with company-yasnippet)))) (setq company-backends (mapcar #'company-mode/backend-with-yas company-backends)) (global-company-mode) ) ) >>>>>>> org-jekyll28 Code folding
=======<<<<<<< HEAD28 Code folding
>>>>>>> org-jekyllI've discovered
yafolding-mode
for all my code folding needs.<<<<<<< HEAD(use-package yafolding :config (add-hook 'prog-mode-hook (lambda() (yafolding-mode))) ) =======(use-package yafolding :defer t :diminish :config (add-hook 'prog-mode-hook (lambda() (yafolding-mode))) ) >>>>>>> org-jekyll29 Git
=======<<<<<<< HEAD29 Git
>>>>>>> org-jekyllMagit is awesome. It's git integration with emacs and it's incredibly well made. Taking the time to learn it is highly advised.
<<<<<<< HEAD(use-package magit :config (global-set-key (kbd "C-x g") 'magit-status) ) =======(use-package magit :diminish :bind (("C-x g" . magit-status)) :config (setq magit-completing-read-function 'ivy-completing-read) ) >>>>>>> org-jekyll<<<<<<< HEAD30 TODO Base editor configuration
=======30 TODO Base editor configuration
>>>>>>> org-jekyllI came from Vim and some of the default emacs functionality felt weird to me.
<<<<<<< HEAD(set-face-attribute 'default nil :height 90) (tool-bar-mode -1) ;; TODO: Try and get projectile-ag to work. Is git grep better? ;; Human readable sizes in dired (setq dired-listing-switches "-alh")30.1 Mouse support for terminals
=======(set-face-attribute 'default nil :height 90) (tool-bar-mode -1) ;; TODO: Try and get projectile-ag to work. Is git grep better? ;; Human readable sizes in dired (setq dired-listing-switches "-alh")30.1 Mouse support for terminals
>>>>>>> org-jekyllEnable the mouse when running in a terminal.
<<<<<<< HEAD(when (not (window-system)) (xterm-mouse-mode +1)) =======(when (not (window-system)) (xterm-mouse-mode +1)) >>>>>>> org-jekyll
31 TODO Package installation
=======<<<<<<< HEAD31 TODO Package installation
>>>>>>> org-jekyllAll of the packages that I use get automatically installed. First we define
required-packages
and then a function that iterates over all of them, installing each one. My~/.emacs
configures Melpa and Marmalade before this gets executed.<<<<<<< HEAD(defvar required-packages '( =======(defvar required-packages '( >>>>>>> org-jekyll ;; https://github.com/benprew/flymake-puppet ;; ;; Puppet flymake support with puppet-lint flymake-puppet ;; https://github.com/purcell/whitespace-cleanup-mode ;; ;; whitespace-cleanup is a handy function, but putting it in ;; before-save-hook for every buffer is overkill, and causes messy ;; diffs when editing third-party code that did not initially have ;; clean whitespace. Additionally, whitespace preferences are ;; often project-specific, and it's inconvenient to set up ;; before-save-hook in a .dir-locals.el file. ;; whitespace-cleanup-mode is a minor mode which calls ;; whitespace-cleanup before saving the current buffer, but only ;; if the whitespace in the buffer was initially clean. It ;; determines this by quickly checking to see if ;; whitespace-cleanup would have any effect on the buffer whitespace-cleanup-mode ;; Provides git modification markers in the left hand side gutter~ ;; window that shows which lines have been locally modified ;; compared to the git index ;; ;; This is currently commented out because it does not work well ;; with linum-mode. ; git-gutter markdown-mode dockerfile-mode yaml-mode ;; https://github.com/genehack/smart-tab ;; ;; An intelligent tab completion function for Emacs ;; http://www.emacswiki.org/emacs/TabCompletion smart-tab indent-guide ;; https://github.com/lunaryorn/puppet-mode ;; ;; Puppet Mode lets you edit Puppet 3 manifests with GNU Emacs 24. puppet-mode <<<<<<< HEAD ) "a list of packages to ensure are installed at launch.") ;; method to check if all packages are installed ;(defun packages-installed-p () ; (loop for p in required-packages ; when (not (package-installed-p p)) do (return nil) ; finally (return t))) ; ;; if not all packages are installed, check one by one and install the missing ones. ;(unless (packages-installed-p) ; ; check for new packages (package versions) ; (message "%s" "Emacs is now refreshing its package database...") ; (package-refresh-contents) ; (message "%s" " done.") ; ; install the missing packages ; (dolist (p required-packages) ; (when (not (package-installed-p p)) ; (package-install p)))) ======= ) "a list of packages to ensure are installed at launch.") >>>>>>> org-jekyll32 Remote shells
=======<<<<<<< HEAD32 Remote shells
>>>>>>> org-jekyllI use
tramp
to edit files on remote machines. Locally I usezsh
but this might not be installed on the target machine. Usebash
when connecting to a remote host.TODO: This sets my local shell also. I don't really use
M-x shell
yet, but if I move further into the "everything inside emacs" way, something like this (with hostname-specificity removed) might be useful.<<<<<<< HEAD(setq shell-file-name "/bin/bash") =======(setq shell-file-name "/bin/bash") >>>>>>> org-jekyll
33 Themes and visual config
33.1 Custom-safe-themes
=======33 Themes and visual config
<<<<<<< HEAD33.1 Custom-safe-themes
>>>>>>> org-jekyllEmacs requires used themes to be whitelisted. This section contains all of the hash identifiers of themes I'm OK with loading.
<<<<<<< HEAD(custom-set-variables '(custom-safe-themes (quote ("a8245b7cc985a0610d71f9852e9f2767ad1b852c2bdea6f4aadc12cce9c4d6d0" "1297a022df4228b81bc0436230f211bad168a117282c20ddcba2db8c6a200743" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "d677ef584c6dfc0697901a44b885cc18e206f05114c8a3b7fde674fce6180879" "8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" default))) ) =======(custom-set-variables '(custom-safe-themes (quote ("a8245b7cc985a0610d71f9852e9f2767ad1b852c2bdea6f4aadc12cce9c4d6d0" "1297a022df4228b81bc0436230f211bad168a117282c20ddcba2db8c6a200743" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "d677ef584c6dfc0697901a44b885cc18e206f05114c8a3b7fde674fce6180879" "8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" default))) ) >>>>>>> org-jekyll33.2 Smart mode line
=======<<<<<<< HEAD33.2 Smart mode line
>>>>>>> org-jekyllSmart Mode Line is a mode-line for emacs.
Smart Mode Line is a sexy mode-line for Emacs. It aims to be easy to read from small to large monitors by using colors, a prefix feature, and smart truncation.
This is customised to use the
solarized
theme.<<<<<<< HEAD(use-package solarized-theme :init (load-theme 'solarized-dark) (use-package smart-mode-line :config (progn (setq sml/no-confirm-load-theme t) (sml/setup) ) ) ) =======(use-package solarized-theme :defer t :init (load-theme 'solarized-dark) :config (use-package smart-mode-line :defer t :diminish :config (progn (setq sml/no-confirm-load-theme t) (sml/setup) ) ) ) >>>>>>> org-jekyll<<<<<<< HEAD33.3 Displaying the time
=======33.3 Displaying the time
>>>>>>> org-jekyllDisplaying the time in the bottom right of the mode line is useful. This displays the time, system load over the last minute, and if I have new emails.
<<<<<<< HEAD(display-time-mode 1) =======(display-time-mode 1) >>>>>>> org-jekyll34 Editor augmentation
34.1 Vim customisations
=======34 Editor augmentation
<<<<<<< HEAD34.1 Vim customisations
>>>>>>> org-jekyllEvil mode provides vim-style keybindings for emacs. It makes it much more usable for a long-time vim user. Evil-surround is an emacs wrapper of Tim Pope's vim-surround plugin. Evil-tabs is an emacs mode that allows tabs with vim's tab keybindings.
<<<<<<< HEAD(use-package evil :config (evil-mode) ; Enable evil mode globally ) (use-package evil-surround :config (global-evil-surround-mode t) ) (use-package evil-tabs :config (global-evil-tabs-mode t) ) =======(use-package evil :diminish :config (evil-mode) ; Enable evil mode globally ) (use-package evil-surround :defer t :diminish :config (global-evil-surround-mode t) ) (use-package evil-tabs :defer t :diminish :config (global-evil-tabs-mode t) ) >>>>>>> org-jekyllBy default emacs doesn't tab indent to the current level when you hit return. Move to vim style.
Note: actually electric-indent-mode is used for this.
<<<<<<< HEAD(global-set-key (kbd "RET") 'newline-and-indent) =======(global-set-key (kbd "RET") 'newline-and-indent) >>>>>>> org-jekyll
34.2 Projectile
=======<<<<<<< HEAD34.2 Projectile
>>>>>>> org-jekyllProjectile is a project interaction library for Emacs. Its goal is to provide a nice set of features operating on a project level without introducing external dependencies(when feasible). For instance - finding project files has a portable implementation written in pure Emacs Lisp without the use of GNU find (but for performance sake an indexing mechanism backed by external commands exists as well).
<<<<<<< HEAD(use-package projectile :config (projectile-global-mode) ) =======(use-package projectile :diminish :config (projectile-global-mode) ) >>>>>>> org-jekyllI use
helm-projectile-ag
quite a lot which requires theag
package.<<<<<<< HEAD(use-package ag) =======(use-package ag :defer t :diminish ) >>>>>>> org-jekyll34.3 Recentf mode
=======<<<<<<< HEAD34.3 Recentf mode
>>>>>>> org-jekyllAs well as using Projectile for browsing projects, recentf shows recently opened files in the buffer list for fast switching to them.
<<<<<<< HEAD(use-package recentf :diminish :config (recentf-mode) :bind ("C-x C-r" . recentf-open-files) ) =======(use-package recentf :diminish :config (recentf-mode) :bind ("C-x C-r" . recentf-open-files) ) >>>>>>> org-jekyll34.4 Neotree
=======<<<<<<< HEAD34.4 Neotree
>>>>>>> org-jekyllSometimes I need to see the directory structure for the current file. The NeoTree plugin helps here with a togglable pane that will pop up and disappear with the
F8
key.<<<<<<< HEAD(use-package neotree :bind ([f8] . neotree-toggle) ) =======(use-package neotree :bind ([f8] . neotree-toggle) ) >>>>>>> org-jekyll34.5 TODO Helm mode
Helm is incremental completion and selection narrowing framework for Emacs. It will help steer you in the right direction when you're looking for stuff in Emacs (like buffers, files, etc). It's awesome when combined with helm-projectile for jumping around projects and finding files within them.
(use-package helm :init (progn (require 'helm-config) (use-package helm-projectile :commands helm-projectile ) (use-package helm-ag) (helm-mode 1) ) :bind ("M-x" . helm-M-x) ("C-x b" . helm-mini) :config (setq projectile-completion-system 'helm) )Use helm-git-grep for fast searches within the current git directory.
(use-package helm-git-grep :config (global-set-key (kbd "C-c g") 'helm-git-grep) )The TODO here is that helm is awesome. There are so many functions to learn. I need to find some easy-to-remember shortcuts for things like
helm-occur
. Spend some time reading http://pages.sachachua.com/.emacs.d/Sacha.html#orgheadline12.34.6 Anzu
=======34.5 Swiper
I've switched to Swiper from Helm.
(use-package counsel :ensure t ) (use-package swiper :ensure t :config (ivy-mode 1) (setq ivy-use-virtual-buffers t) (global-set-key "\C-s" 'swiper) (global-set-key (kbd "C-c C-r") 'ivy-resume) (global-set-key (kbd "<f6>") 'ivy-resume) (global-set-key (kbd "M-x") 'counsel-M-x) (global-set-key (kbd "C-x C-f") 'counsel-find-file) (global-set-key (kbd "<f2> u") 'counsel-unicode-char) (global-set-key (kbd "C-c j") 'counsel-git-grep) (global-set-key (kbd "C-c k") 'counsel-ag) (global-set-key (kbd "C-x l") 'counsel-locate) (define-key read-expression-map (kbd "C-r") 'counsel-expression-history) (setq projectile-completion-system 'ivy) )<<<<<<< HEAD34.6 Anzu
>>>>>>> org-jekyllAnzu shows how many strings match the regex you're replacing and show the effect of replacement as the substitution is typed. This is awesome. Using
%s/using/foo/
you'll see the change tofoo
in the buffer.http://pragmaticemacs.com/emacs/prettier-text-replacement-with-anzu/
<<<<<<< HEAD(use-package anzu :init (global-anzu-mode) :bind ( ("M-%" . anzu-query-replace) ("C-M-%" . anzu-query-replace-regexp) ) ) =======(use-package anzu :diminish :defer t :config (global-anzu-mode) :bind ( ("M-%" . anzu-query-replace) ("C-M-%" . anzu-query-replace-regexp) ) ) >>>>>>> org-jekyll34.7 Rainbow mode
=======<<<<<<< HEAD34.7 Rainbow mode
>>>>>>> org-jekyllHighlights CSS colours in their actual colour. For instance (probably won't be visible in the export):
<<<<<<< HEAD ======= >>>>>>> org-jekylldiv.example { background-color: #cc3; }This is enabled globally:
<<<<<<< HEAD(use-package rainbow-mode :config (rainbow-mode) (add-hook 'scss-mode-hook (lambda () (rainbow-mode))) ) =======(use-package rainbow-mode :config (rainbow-mode) :diminish :defer t ) >>>>>>> org-jekyll34.8 Coffee mode
=======<<<<<<< HEAD34.8 Coffee mode
>>>>>>> org-jekyllMajor mode for editing CoffeeScript files.
<<<<<<< HEAD(use-package coffee-mode :config (setq coffee-tab-width 2) ) (use-package flymake-coffee :init (add-hook 'coffee-mode-hook 'flymake-coffee-load) ) =======(use-package coffee-mode :mode "\\.coffee$" :config (setq coffee-tab-width 2) ) (use-package flymake-coffee :defer t :diminish :init (add-hook 'coffee-mode-hook 'flymake-coffee-load) ) >>>>>>> org-jekyll34.9 Docker
(use-package docker) (use-package dockerfile-mode) =======<<<<<<< HEAD34.9 Docker
(use-package docker :defer t :diminish ) (use-package dockerfile-mode :defer t ) >>>>>>> org-jekyll34.10 Ruby configuration
=======34.10 Ruby configuration
>>>>>>> org-jekyllProvide a
ruby-mode
for editing ruby files.<<<<<<< HEAD(use-package enh-ruby-mode :mode "\\.rb\\'" :config (setq enh-ruby-deep-indent-paren nil) ; Don't indent ruby function parameters at column index of function parentheses ) =======(use-package enh-ruby-mode :mode "\\.rb$" :config (setq enh-ruby-deep-indent-paren nil) ; Don't indent ruby function parameters at column index of function parentheses ) >>>>>>> org-jekyllI use rspec a lot, and rspec-mode is very useful.
<<<<<<< HEAD(use-package rspec-mode :config (setq rspec-use-rake-when-possible nil) (setq rspec-use-bundler-when-possible t) (setq rspec-use-rvm-when-possible t) (setenv "PATH" (concat (getenv "PATH") ":" "/usr/local/bin")) (eval-after-load "rspec-mode" '(progn (setenv "PAGER" (executable-find "cat")) (inf-ruby-switch-setup) (define-key global-map (kbd "M-T") 'rspec-toggle-spec-and-target) ) ) ) =======(use-package rspec-mode :mode "_spec.rb$" :config (setq rspec-use-rake-when-possible nil) (setq rspec-use-bundler-when-possible t) (setq rspec-use-rvm-when-possible t) (setenv "PATH" (concat (getenv "PATH") ":" "/usr/local/bin")) (eval-after-load "rspec-mode" '(progn (setenv "PAGER" (executable-find "cat")) (inf-ruby-switch-setup) (define-key global-map (kbd "M-T") 'rspec-toggle-spec-and-target) ) ) ) >>>>>>> org-jekyllruby-end inserts
end
blocks whenever I typedo
automatically.<<<<<<< HEAD(use-package ruby-end) =======(use-package ruby-end :defer t :diminish :init (add-hook 'ruby-mode-hook #'ruby-end-mode) ) >>>>>>> org-jekyllThe following allows using
binding.pry
inrspec-mode
.<<<<<<< HEAD(use-package inf-ruby :init (add-hook 'after-init-hook 'inf-ruby-switch-setup) :bind ("C-c r r" . inf-ruby) ) (use-package robe :init (add-hook 'enh-ruby-mode-hook 'robe-mode) :config (push 'company-robe company-backends) )34.11 CMake
(use-package cmake-mode) =======(use-package inf-ruby :init (add-hook 'after-init-hook 'inf-ruby-switch-setup) :bind ("C-c r r" . inf-ruby) ) (use-package robe :defer t :init (add-hook 'enh-ruby-mode-hook 'robe-mode) (with-eval-after-load 'company (add-to-list 'company-backends 'company-robe)) ) (defun mfoot/rdb () "Run rake db:rdb." (interactive) (let ((default-directory "~/repositories/cube/src/webapp")) (async-shell-command "bundle exec rake db:rdb" "*Bundle exec*"))) (defun mfoot/trdb () "Run rake db:trdb." (interactive) (let ((default-directory "~/repositories/cube/src/webapp")) (async-shell-command "bundle exec rake db:trdb" "*Bundle exec*"))) (add-hook 'enh-ruby-mode-hook (lambda () (local-set-key (kbd "C-x r t") 'mfoot/trdb)) (lambda () (local-set-key (kbd "C-x r d") 'mfoot/rdb)))projectile-rails provides quick jump-to-model and jump-to-helper support for rails projects.
(use-package projectile-rails :defer t :diminish :init (add-hook 'projectile-mode-hook 'projectile-rails-on) )<<<<<<< HEAD34.11 CMake
(use-package cmake-mode :diminish :mode ("CMakeLists.txt" . cmake-mode) ) >>>>>>> org-jekyll<<<<<<< HEAD34.12 MySQL
=======34.12 MySQL
>>>>>>> org-jekyllEmacs has a built-in MySQL client. When using it, I want to disable line wrapping. I can use standard text navigation features to see what I need (source).
<<<<<<< HEAD(add-hook 'sql-interactive-mode-hook (lambda () (toggle-truncate-lines t))) =======(add-hook 'sql-interactive-mode-hook (lambda () (toggle-truncate-lines t))) >>>>>>> org-jekyll
35 Syntax highlighting and static analysis
=======35 Syntax highlighting and static analysis
>>>>>>> org-jekyll<<<<<<< HEADI use flycheck as a framework for syntax checking and static analysis. E.g. it will provide language-specific syntax checking for known languages. Some languages also provide linting as well via flycheck.
<<<<<<< HEAD(add-hook 'prog-mode-hook (lambda () (flycheck-mode))) =======TODO: This section should be merged with my
use-package
declaration for flycheck.(add-hook 'prog-mode-hook (lambda () (flycheck-mode))) >>>>>>> org-jekyll
36 Spell checking
=======<<<<<<< HEAD36 Spell checking
>>>>>>> org-jekyllI have several modes that execute
flyspell-mode
. There's a problem with this with xemacs by default: middle clicking to save a correction also inadvertently pastes whatever was in the selection buffer. This can be fixed by swapping around the bindings (source).I don't flyspell
org-mode
buffers inside thePROPERTIES
,LOGBOOK
, orBEGIN_SRC..END_SRC
blocks.<<<<<<< HEAD(add-hook 'prog-mode-hook (lambda () (flyspell-prog-mode))) (add-hook 'text-mode-hook (lambda () (flyspell-mode))) (eval-after-load "flyspell" '(progn ; (define-key flyspell-mouse-map [down-mouse-2] nil) ; (define-key flyspell-mouse-map [mouse-2] #'flyspell-correct-word)) (add-to-list 'ispell-skip-region-alist '(":\\(PROPERTIES\\|LOGBOOK\\):" . ":END:")) (add-to-list 'ispell-skip-region-alist '("#\\+BEGIN_SRC" . "#\\+END_SRC")) ) ) =======(add-hook 'prog-mode-hook (lambda () (flyspell-prog-mode))) (add-hook 'text-mode-hook (lambda () (flyspell-mode))) (eval-after-load "flyspell" '(progn ; (define-key flyspell-mouse-map [down-mouse-2] nil) ; (define-key flyspell-mouse-map [mouse-2] #'flyspell-correct-word)) (add-to-list 'ispell-skip-region-alist '(":\\(PROPERTIES\\|LOGBOOK\\):" . ":END:")) (add-to-list 'ispell-skip-region-alist '("#\\+BEGIN_SRC" . "#\\+END_SRC")) ) ) >>>>>>> org-jekyll37 Presenting
=======37 Presenting
>>>>>>> org-jekyllI've been using org-reveal for presentations.
<<<<<<< HEAD##+BEGIN_SRC emacs-lisp :results none #(use-package ox-reveal
#) ##+END_SRC
38 TODO Code snippet handling
=======;; (use-package ox-reveal ;; :ensure t ;; :defer t ;; :config ;; (setq org-reveal-root (concat user-emacs-directory "reveal-js/reveal.js")) ;; (add-hook 'org-mode-hook (lambda () (load-library 'ox-reveal))) ;; )<<<<<<< HEAD38 TODO Code snippet handling
>>>>>>> org-jekyllI use yasnippet for code snippet handling. This is enabled globally.
<<<<<<< HEAD(use-package yasnippet :config (yas-global-mode 1) ) =======(use-package yasnippet :config (yas-global-mode 1) :diminish :defer t ) >>>>>>> org-jekyll<<<<<<< HEAD39 TODO Other configuration
=======39 TODO Other configuration
>>>>>>> org-jekyllThis section holds configuration from before I moved to using
org-babel
(i.e. it lived directly inside~/.emacs
). It is here just because I haven't had the time or the impetus to categorise and document it.<<<<<<< HEAD;(add-hook 'projectile-mode-hook 'projectile-custom-hook) ;(add-hook 'helm-projectile-mode-hook 'projectile-custom-hook) ;(global-unset-key (kbd "C-c p g")) ;(global-set-key (kbd "C-c p g") 'helm-projectile-grep) ;(define-key projectile-command-map (kbd "C-c p g") 'helm-projectile-grep) ;; If we're at the end of a word and hit TAB, run the expand command ;; for tab completion. If we're not at the end of a word, run the ;; normal tab command ;; http://emacsblog.org/2007/03/12/tab-completion-everywhere/ (defun indent-or-expand (arg) "Either indent according to mode, or expand the word preceding point." (interactive "*P") (if (and (or (bobp) (= ?w (char-syntax (char-before)))) (or (eobp) (not (= ?w (char-syntax (char-after)))))) (dabbrev-expand arg) (indent-according-to-mode))) (local-set-key (kbd "<tab>") 'indent-or-expand) (add-to-list 'auto-mode-alist '("\\.hamlc$" . haml-mode)) =======;; If we're at the end of a word and hit TAB, run the expand command ;; for tab completion. If we're not at the end of a word, run the ;; normal tab command ;; http://emacsblog.org/2007/03/12/tab-completion-everywhere/ (defun indent-or-expand (arg) "Either indent according to mode, or expand the word preceding point." (interactive "*P") (if (and (or (bobp) (= ?w (char-syntax (char-before)))) (or (eobp) (not (= ?w (char-syntax (char-after)))))) (dabbrev-expand arg) (indent-according-to-mode))) (local-set-key (kbd "<tab>") 'indent-or-expand) (add-to-list 'auto-mode-alist '("\\.hamlc$" . haml-mode)) >>>>>>> org-jekyll ;;; Things that are not in melpa ; NOTE: flymake-easy now is in melpa. What am I using that requires it? Is it one of the linters? Does it come in as a dependency? Check if this works without it. ;(add-to-list 'load-path "~/Dropbox/lisp/") ;(require 'flymake-easy) <<<<<<< HEAD (set-default 'tramp-default-proxies-alist (quote ((".*" "\\`root\\'" "/ssh:%h:")))) ======= (set-default 'tramp-default-proxies-alist (quote ((".*" "\\`root\\'" "/ssh:%h:")))) >>>>>>> org-jekyll