Emacs notes, jmn (@nrlnd) 2013-2017

1 Document Metadata

I use Emacs for editing text under version control. Sometimes I also use it for communication such as IRC and e-mail. This is my archive of notes for the editor. This is a complement to my literate Emacs configuration.

For information about how I maintain and publish this file, see section 9.1 .- jmn, December 2014.

Standing on the shoulders of giants: Thanks to Mark Pilgrim, Sacha Chua, Aaron Swartz, Phil Hagelberg (tk: continue) and the Emacs community, #Emacs on Freenode IRC and EmacsWiki. jwz, rms, esr and so forth, bastien stguerry, carsten dominik.

Table of Contents

2 Configure

Emacs provides a system called M-x customize which enables configuration using menus. It can be useful for easily finding which options are available. To get a more sustainable configuration which can be used on multiple systems it is generally better to use other means of configuration.

See jmn.html to see how I use the org-mode format to maintain my Emacs configuration.

2.1 Changing variables on the fly

Hit M-: to run "eval-expression". To for example change the tab-width of the buffer, enter: (setq tab-width 8) and hit RET.

2.2 Running Emacs as a daemon

It is possible to run Emacs as a daemon and connect to it with clients.

To do this I use two shell scripts called ec and emacs-exit ~/bin/ec:

exec emacsclient --alternate-editor="" -c "[email protected]"

The second command might be helpful when you want to close a running emacs daemon. ~/bin/emacs-exit:

emacsclient --eval "(progn (kill-emacs))"

3 Appearance

3.1 My current configuration

  • I currently use a serif font as my default emacs "face". I use Times New Roman. For colors I use the dark "tango-dark" theme. <2014-12-06 Sat>
  • When I feel like using less colour I use the theme "monochrome".

3.2 Fonts and faces (Typography)

3.2.1 The default font

It is possible to use M-x customize-face, default Personally I like to use the Consolas font on Windows. It is possible to set the font in buffer-face-mode using S-Leftclick, "Change buffer font". To find out more about the face, use M-x what-cursors-position, or Cu C-x =.

 '(default ((t (:family "Consolas" :foundry "outline" :slant normal :weight normal :height 108 :width normal))))
 '(variable-pitch ((t (:slant normal :weight light :foundry "outline" :family "Gotham HTF Light")))))

3.2.2 Buffer-face-mode / variable-pitch-mode

For reading longer texts in Emacs it might be nice to, temporarily, use a different font, for this use buffer-face-mode. M-x buffer-face-mode

(setq buffer-face-mode-face '(:family "DejaVu Sans" :height 100 :width semi-condensed))
(setq buffer-face-mode-face '(:family "Gotham HTF Light" :foundry "outline" :slant normal :weight light :height 113 :width normal))
(set-face-attribute 'variable-pitch nil :family "Gotham HTF Light" :foundry "outline" :slant "normal" :weight "light" :height 113 :width "normal")

You might want to configure certain modes to automatically start in variable-pitch-mode using a mode-hook, e.g:

(add-hook 'markdown-mode-hook (lambda () (variable-pitch-mode t))
  1. Using variable-pitch in org-mode

    You might want tables in org-mode to still use a monospaced font (fixed-pitch):

    (set-face-attribute 'org-table nil :inherit 'fixed-pitch)

    For code-blocks:

    (set-face-attribute 'org-code nil :inherit 'fixed-pitch)
    (set-face-attribute 'org-block nil :inherit 'fixed-pitch)
    (set-face-attribute 'org-block-background nil :inherit 'fixed-pitch)

3.2.3 Figuring out font names

One option is to use the menu bar, Options/set default font, Options/Save options and look at the result in ~/.emacs. Another is to use M-x what-cursors-position, or =C-u C-x =

3.3 Fullscreen mode on Windows

Starting with version (M-x version) 24.4 Emacs supports fullscreen mode on MS Windows, use M-x toggle-frame-fullscreen to toggle fullsceren mode, it's bound to the key F11.

3.4 Line numbers in the margin

M-x linum-mode There is a problem with using linum-mode together with visual-line-mode in Emacs, described here.

3.5 Long lines

  • Visual line mode wraps lines that are longer than the current window without creating linebreakes in the text file.
  • Visual fill column mode does the same but creates "virtual" linebreaks at fill column. Both of these modes have global modes.

For breaking text use, M-q (or fill-paragraph).

3.6 Create your own colour theme

I usually start off with a basic theme that I like and then do: M-x customize-create-theme to create my own version of the theme. Generally I do this to reduce the amount of colours used. See http://batsov.com/articles/2012/02/19/color-theming-in-emacs-reloaded/ for more info.

Preview and find color themes: http://emacsthemes.caisah.info/

4 Operations

4.1 Moving lines around

transpose-lines C-x C-t

"Exchange current line and previous line, leaving point after both. With argument ARG, takes previous line and moves it past ARG lines. With argument 0, interchanges line point is in with line mark is in."

See also transpose-chars and transpose-words and transpose-sexp For more information see http://stackoverflow.com/questions/2423834/move-line-region-up-and-down-in-emacs

4.2 Operations on words (transformations)

Uppercase word: M-c Lowercase word: M-l

4.3 the help system

C-h b show all keybindings
C-h m Show major mode key bindings
C-h f explain a function
C-h i open Info

4.3.1 finding the name of an elisp function used in a menu

C-h c (then use a menu)

4.4 Navigating

4.4.1 Marking and Jumping

`C-c %' Push the current position onto the mark ring, to be able to return easily. Commands following an internal link do this automatically.

`C-c &' Jump back to a recorded position. A position is recorded by the commands following internal links, and by `C-c %'. Using this command several times in direct succession moves through a ring of previously recorded positions. M-z <character>, M-x zap-to-char kills text forward up to and including the given character. Useful i.e. in expressions. See http://superuser.com/questions/124246/emacs-equivalent-to-vim-ci C-M-k kill balanced expression.

4.4.2 Handling files

dired-mode C-x d File explorer
dired-jump C-x C-j Open dired with cursor on the file displayed in buffer
find-alternate-file C-x C-v Displays the filename so you can yank it.
revert-buffer   asd

4.4.3 Opening files via HTTP, SSH

To open a file via HTTP(S) in Emacs, use M-x browse-url-emacs

Emacs can edit files over SSH using the package "tramp".

4.4.4 Searching

  1. Searching and replacing within files
  2. Tricks, Quoted-insert et c.

    By pressing C-q C-m RET You can search for "Carriage return" (C-q is "quoted-insert).

    (Carriage return is displayed in Emacs as ^M "Hello" and can show up when you are switching between various character encodings (dos,unix,utf-8…) line endings.)

    See more here: http://ergoemacs.org/emacs/emacs_line_ending_char.html

  3. Searching across files
  4. TODO file contents (grep) across many files

    commands: rgrep, grep-find, grep BUG?: Searching in "Lokala inställningar crashes" with: local characters no such directory found via cdpath rgrep

    TODO: find code for mouse-appearance-menu to bind keys for "increase buffer text size" and "decrease…" to C-Plus, C-Minus)

    TODO: find the emacsclient extension in the chrome data dir. lokala../appdata et c.

  5. replacing across files. Press Q in dired-mode. Enter regex.
  6. C-x C-q in dired is extremely powerful when combined with macros (imagine changing names of some files in a large directory, but instead of having to code some script, just use the macro magic!).
  7. More dired-mode stuff

4.4.5 Accessibility

goto-adress-mode makes written hyperlinks clickable. see here.

Try adding:

(add-hook 'find-file-hook 'goto-address-mode)

To your dot-emacs.


Emacs Bookmarks - EmacsWiki

Shortcut key M-x command Description
C-x r m   set a bookmark at the current location (e.g. in a file)
C-x r b   jump to a bookmark
C-x r l   list your bookmarks
  bookmark-delete delete a bookmark by name

4.5 Undoing, et c

C-x u (or just "u" in viper) to undo. M-x undo-only to "undo only" (not redo). Tip: undo-tree (package) can be very useful.

4.6 Common editing tasks

4.6.1 Counting

M-x count-words-region counts lines, words and characters in the region.

4.6.2 Handling whitespace

  1. Deleting leading whitespace from lines

    C-x TAB with a huge prefix argument is one method of removing leading whitespace from lines

    e.g. C-- C-u C-u C-u C-x TAB

4.7 Inserting special characters

This can be done in various ways

  • Using a compose key
  • using M-x ucs-insert (C-x 8 RET)

C-x 8 can also be used to insert various characters, e.g:

C-x 8 c ¢
… m µ
… o °
… u µ
S §
  • using abbrevs
  • using agda


4.8 Spelling

Note: There are various spelling engines. aspell and hunspell are two. Hunspell is said to be more advanced, handles utf-8 and complex grammar structures (?) used in i.e. swedish.

M-x ispell M-x ispell-change-dictionary

4.8.1 Questions

Mixed language content? i.e. Swedish/English.

4.9 Troubleshooting, profiling & debugging

Use M-x toggle-debug-on-error to enable debugging for errors.

GNU Emacs 24 and later has got profile.el

(require 'profiler)
M-x profiler-start
M-x profiler-report

4.10 Version control

4.10.1 Magit

See package magit for a great git/emacs tool.

4.10.2 Conflict resolution

M-x vc-resolve-conflicts - opens three buffer windows, A (your file), B (the conflicting file from the repository) and C (the combined file) See "?" for commands, but use keys a/b/ to pick either of the versions and then press space to visit the next merge conflict.

4.10.3 File history

M-x vc-annotate - Creates a log of who did what when.

4.10.4 View Difference at various stages in history.

M-x vc-ediff - Highlight and navigate between difference between the file at it's current stage and previous commits (for example).

4.11 E-mail using gnus

4.11.1 On Windows with GMail

4.12 IRC

See M-x erc

5 Extensions and modes

5.1 Shell

Enter by typing M-x shell

To clear the shell buffer, you can use M-x erase-buffer

6 Extending Emacs (Emacs Lisp)

6.1 Learn Emacs lisp


  • Use ‘C-x ESC ESC’ to repeat commands you execute, and look at the Emacs-Lisp code that executes them, before hitting ‘RET’ (Return) – see RepeatLastCommand.
  • Use ‘C-h f’ (‘describe-function’) and ‘C-h v’ (‘describe-variable’) to understand commands and variables you use. In the help description, click the function or variable name (link) to go directly to the source code that defines it. Try to read the source code. When you want to know what some function you see used does, use ‘C-h f’ on it… Got it?
  • Use ‘C-h k’ to see which commands you are executing when you use keys. Then follow the previous bullet: click the name (link) of the command to see its source code…
  • Read the Emacs Lisp Introduction: EmacsLispIntro. Use ‘C-h i’, then choose `Emacs Lisp Intro’. You can also read this manual on the Web.

-Read the Emacs Lisp Reference manual: EmacsLispReference. Use ‘C-h i’, then choose ‘Elisp’ (Emacs Lisp is sometimes called “Elisp”). You can also read this manual on the Web. SteveYegge’s intro to the language. (FIXME: Link)

6.1.1 Basics

Comparisons: note the difference between "eq" and "equal". While "eq" tests if x and y are the same object, "equal" tests if they have equal contents.

6.1.3 Useful e-lisp basics

(message "hi") outputs a message to the Message buffer, this can be useful for debugging.

6.2 Evaluating lisp code

C-x C-e evaluates last expression (Position the cursor after the expression)

6.2.1 ielm

M-x ielm will run a REPL, similar to a Python "interpreter" but for Elisp. (For other REPLs see SLIME, nrepl)

6.3 Pretty printing

See pp.el. For example, use M-x pp-macroexpand-last-sexp to prettify a sexp.

6.4 Debugging

First try M-x toggle-debug-on-error RET before running your code.

(bisect) – If "emacs –debug-init" doesn't help, comment out half of ~/.emacs and try to reproduce the issue. Recurse as necessary. See also <-q> and <ielm>.

Another type of "bisect" method is putting (message "DEBUG ONE"), (message "DEBUG TWO") in various locations in the code to find where it fails.

6.5 using 'package

There's a repository called "marmalade" that contains an assortment of extensions

6.6 Keybindings

Mastering keybindings in Emacs

M-x describe-bindings or C-h b displays all keybindings

6.7 Colortheme extension

use M-x color-theme-print to save your own colortheme

6.8 Macros

F3, F4 (or C-x (, C-x ) ) to begin and end recording of a macro. M-x name-last-kbd-macro

6.9 Parentheses

6.9.1 Paredit

paredit-mode C-q, force insert of parentheses. M-( Wrap parens around something M-s Remove parens from something M-S-s Split sexpr into two M-S-j join sexprs C-u DEL force delete paren or bracket.

Further info: http://p.hagelb.org/paredit-screencast.html

6.9.2 Test

(defun foo ()
"foo is cool"
(message "hi")

6.9.3 Jump to matching parentheses

Balancing your parentheses - emacs fu

(defun paren-match ()
"Tries to jump to the matching parenthesis to the one currently
under the point. Useful if the matching paren is out of sight. "
(cond ((looking-at "[{\[\(]") (forward-sexp 1) (backward-char))
((looking-at "[]})]") (forward-char) (backward-sexp 1))
(t (message "Point not at a parenthesis."))))

6.10 Modifying an existing function


   <yenda> s/month/monthes
  <jmnoz`> so if I modify a function in a package… what's a sane way to
    maintain my change across package updates?
<arthurnn> andres: positive, thats what i thought, thanks
   <yenda> jmnoz`: modify it in your config file ? [17:30]
<arthurnn> question, if I wanna play on building my own distribution of
    emacs, where should I start? any good article about it, or any
    resource? thanks [17:32]
       * yenda ([email protected]) has quit: Remote host closed the
    connection [17:33]
  <jmnoz`> yenda: yeah. I guess I can put it in the use-package (or
    req-package) :config section for clarity and ensuring load
    order or something
     <dtw> jmnoz`, (with-eval-after-load 'some-package
    your-own-modifications-here) [17:34]
     <dtw> Where some-package is actually some-feature. [17:35]
  <sachac> jmnoz`: I like using advice if I can (although I think there's
    a newer way of doing this now). If I have to override the
    function, I make my own with a my/ prefix, and then I fset the
    old one to the new one.
  <sachac> jmnoz`: (That way, it's easier for me to remember what I've
    changed.) [17:36]

7 Gnus - News and E-mail

The news and e-mail client is invoked by typing M-x gnus.

7.1 Using gnus for e-mail and news

To read weblogs and such using feeds it's possible to use the service "gwene.org" which makes rss and atom feed enabled sites accessible through NNTP (the news protocol)

To use gwene you can add to your ~/.gnus:

(add-to-list 'gnus-secondary-select-methods
             '(nntp "news.gwene.org"))

From gnus you can then hit the key ^ to see a list of services, if you hit RET on gwene a list of all available blogs will be displayed. To subscribe to a source hit u.

7.2 Reading feeds with gnus

Recent versions of gnus support reading feeds directly. To add a feed, press G R in the group buffer. You can also follow feeds via NNTP using the service gwene.org.

7.3 Keys

\^ Display the server buffer
u subscribe/unsubscribe to a group
l/L Toggle display of groups with no new items.
g Get news. (Update)
q Quit the current buffer.
c Catch up: Mark all as read on current group.
s Save

7.4 Topics - Uncluttering the groups buffer

If you have more then a few groups in your group buffer, you might want to consider looking at creating topics. https://www.gnu.org/software/emacs/manual/html_node/gnus/Topic-Commands.html#Topic-Commands Enable it with M-x gnus-topic-mode

Topic keys

T n Prompt for a new topic name and create it (gnus-topic-create-topic).

See my config (tk: link) for further details.

7.5 Display name

Gnus doesn't have a concept of a "display name" but you can use a "comment" on a group and show that in the group line specification. See (info "(gnus) Group Line Specification")

You can use a "comment" in the group parameters to be displayed instead of the group name by putting %C in the gnus-group-line-format (see manual). To add a comment to a group, press G p or G c (see manual).

%C will display the group name if there is no comment.

(setq gnus-group-line-format "%M%S%5y/%-5t: %C\n")

7.6 Performance - How to make things faster

See emacswiki: GnusSpeed

If you have a slow machine, or are just really impatient, there are a few things you can do to make Gnus run faster.

Set gnus-check-new-newsgroups and gnus-check-bogus-newsgroups to nil to make startup faster.

Set gnus-show-threads, gnus-use-cross-reference and gnus-nov-is-evil to nil to make entering and exiting the summary buffer faster. (source)

7.6.1 For IMAP

Using IMAP can be slow, consider using offlineimap to cache locally.

Several Gnus users run a local IMAP server, such as dovecot, which they synchronize using offlineimap and access from Gnus via nnimap. (source)

8 Personal notes

8.1 System/platform specific

8.1.1 My current emacs notes for Win8

~/.emacs is in

  • c:/Users/jmn/Appdata/Roaming/.emacs

8.2 For me to check out

  • Sauron (by djcb) https://github.com/djcb/sauron

    Sauron is an emacs mode for keeping track of events happening in the (emacs) world around you. Events are things like ‘appointment in 5 minutes’, ‘bob pinged you on IRC’, ‘torrent download is complete’ etc. Sauron shows those events like a list – basically like a log. You can ‘activate’ an event by either pressing RET when point is on it, or clicking it with the middle mouse button (<mouse-2>).

8.3 Wouldn't it be great if… / Wishlist

Better bookmarks: If the bookmarks could show the title of each document.

9 Meta

9.1 About this file

This file is written using Emacs org-mode, exported to HTML and published onto Github pages using git (magit). View the org source file here.

I keep this file in a directory ~/git/notes/emacs.org and apply the following configuration to my Emacs for publishing:

(setq org-publish-project-alist
         :base-directory "~/git/notes/"
         :base-extension "org"
         :publishing-directory "~/git/jmn.github.io"
         :recursive nil
         :publishing-function org-html-publish-to-html
         :include ("emacs.org")
         :exclude "\\.org$"
         :base-directory "~/git/notes/"
         :base-extension "org"
         :publishing-directory "~/git/jmn.github.io/org"
         :recursive nil
         :publishing-function org-org-publish-to-org
         :include ("emacs.org")
         :exclude "\\.org$"

To publish the file, I then use M-x org-export-dispatch (binding C-c C-e) and select publish this file. I then use M-x magit-status (C-u C-c m) to stage (s), commit (c) and push (P) the exported HTML file onto Github pages.

9.2 TODO Export both org and HTML

Choosing "publish this file" in the org export dispatcher currently only exports one of the projects. How can I have this export to both org-mode (from org-mode) and to HTML?

10 Edit Example Task, Convert data into org-mode table:

Say you want to save a list of your installed packages in Emacs, one way could be to open M-x package-list-packages-no-fetch, and save the buffer Then I wanted to place the list of my installed packages into an existing org-mode file so I opened the file and did: M-x insert-file. I then wanted to convert the list into an org-mode table. To do this I first need to clean up some whitespace:

  • To clean up the leading whitespace I marked the region (C-space ) and hit C-x TAB (M-x indent-rigidly) and hit <Left> twice to remove the two leading whitespaces.

I then want to replace the arbitrary number of whitespace separating the columns with a single tab. To do this, mark the selection and use M-x replace-regexp. As selection press spacebar twice followed by a plus sign (+) then press RET (Enter). For replace with type C-q TAB followed by RET. This will create a regular expression to replace any two or more spaces with TAB. Hint: If you find that your "selection" gets unselected (i.e. the region), hit C-x C-x to reactivate it (M-x exchange-point-and-mark).

With the now tab-separated data selected hit C-c | (M-x org-table-create-org-convert-region) to turn it into an org-mode table.

Note: I first tried converting all the lines in one fell swoop, but seeing that some lines did not get converted correctly I converted a manageable number of lines at the time instead.

Hint: M-x whitespace-mode can be helpful to show tabs and spaces. Hint: Replace multiple recurring tabs using the same method as above with replace-regexp, just enter C-q TAB two times followed by plus in the matching regexp and replace with a single tab.

To sort the table: Mark the table and place the cursor in the column you wish to sort from, then invoke M-x org-table-sort-lines by pressing C-c ^

11 Org-mode - the organizer

Org mode good for things like managing todo information, capturing notes, keeping a journal, clocking in time and more.

11.0.1 Running the latest version

See http://orgmode.org/worg/org-faq.html#keeping-current-with-Org-mode-development

Org-mode is under active development, here are instructions to running the latest version from Git. Basic steps: clone the repo, make autoloads, load files properly.

  1. Generating autoloads and Compiling Org without make (e.g. under win32)

    Compilation is optional, but you must update the autoloads file each time you update org, even when you run org uncompiled!

    Starting with Org 7.9 you'll find functions for creating the autoload files and do byte-compilation in mk/org-fixup.el. When you execute the commands below, your current directory must be where org has been unpacked into, in other words the file README should be found in your current directory and the directories lisp and etc should be subdirectories of it. The command emacs should be found in your PATH and start the Emacs version you are using.

    To make just the autoloads file do:

    emacs -batch -Q -L lisp -l ../mk/org-fixup -f org-make-autoloads

    To make the autoloads file and byte-compile org:

    emacs -batch -Q -L lisp -l ../mk/org-fixup -f org-make-autoloads-compile

    To make the autoloads file and byte-compile all of org again:

    emacs -batch -Q -L lisp -l ../mk/org-fixup -f org-make-autoloads-compile-force

    If you are not using Git, you'll have to make fake version strings first if org-version.el is not already available (if it is, you could also edit the version strings there).

    emacs -batch -Q -L lisp -l ../mk/org-fixup \
    --eval '(let ((org-fake-release "7.9.1")(org-fake-git-version "7.9.1-fake"))\

    The above assumes a POSIX shell for its quoting. Windows CMD.exe has quite different quoting rules and this won't work, so your other option is to start Emacs like this

    emacs -Q -L lisp -l ../mk/org-fixup

    then paste the following into the *scratch* buffer

    (let ((org-fake-release     "7.9.1")
          (org-fake-git-version "7.9.1-fake"))

    position the cursor after the closing paren and press C-j or C-x C-e to evaluate the form. Of course you can replace org-make-autoloads with org-make-autoloads-compile or even org-make-autoloads-compile-force if you wish with both variants.

  2. Reload Org

    As of Org version 6.23b (released Sunday Feb 22, 2009) there is a new function to reload org files.

    Normally you want to use the compiled files since they are faster. If you update your org files you can easily reload them with

    M-x org-reload

    If you run into a bug and want to generate a useful backtrace you can reload the source files instead of the compiled files with

    C-u M-x org-reload

    and turn on the "Enter Debugger On Error" option. Redo the action that generates the error and cut and paste the resulting backtrace. To switch back to the compiled version just reload again with

    M-x org-reload

11.0.2 Mark-up


code strikethrough bold italic underlined verbatim

=code= +strikethrough+ *bold* /italic/ _underlined_ ~verbatim~

Subscripti Subscripti (equivalent) Superscript~x Superscript~{x} (equivalent)

Subscript_i Subscript_{i} (equivalent) Superscript^x Superscript^{x} (equivalent)
  1. Conundrum

    What is up with org-mode created superscripts i.e: "^Hello" exports to "<sup>Hello</sup>" (Even when contained within equal signs. Bug?)

    ="^Hello"= exports to ="<sup>Hello</sup>"= (Even when contained within equal signs. Bug?)

    Further more, HTML in a SRC code block will not be escaped properly.



11.0.3 Code in org files

To input code insert "<s" on a line and press tab. See Easy Templates

11.0.4 Inserting dates and times

key M-x description
C-c .   insert timestamp

11.0.5 Personal keybindings

C-c c capture new item
C-c a org-agenda
C-c , set priority

11.0.6 Capture

To change the header message of the capture buffer

(org-set-local 'header-line-format "")

11.0.7 Various

Link format \[[http…]\[foo]] (without slashes) Example: localhost Use C-c C-l with the cursor above the link to modify it. Or, backspace after the description to remove the final bracket and unhide the URL. See Documentation on links

11.0.8 Scheduling time

To schedule a task, use C-c C-s.

C-c C-x ; Start a countdown timer (just ";" in agenda views).
  1. Repeated tasks (recurring tasks)

    To schedule a recurring task (or "repeated task", see info org-mode 8.3.2):

    Note the "+1m", that means to repeat every month.

    You can use yearly, monthly, weekly, daily and hourly repeat cookies by using the `y/w/m/d/h' letters.

    If you need both a repeater and a special warning period in a deadline entry, the repeater should come first and the warning period last: `DEADLINE: <2005-10-01 Sat +1m -3d>'.

11.0.9 Agenda

Schedule on date C-c C-s
Change status (started, done, etc) C-c C-t
Deadline C-c C-d
kill item C-k

11.0.10 Agenda view

The default key for opening agenda mode (M-x org-agenda) is C-c C-a followed by a command key. Pressing "a" will open the agenda for day or week (depending on the value of the variable org-agenda-span).

One simple way of effectively using org agenda is this:

  • Capture TODO items using org capture
  • When planning the work ahead of you, open the list of stored TODO items.
  • Use C-c C-s to schedule the item. Just hit RET to schedule it for today.
  • Open org-agenda-goto-today by pressing C-c a a

11.0.11 Importing ICS icalendar files

Emacs can import icalendar files to the diary using M-x icalendar-… Org can then be set to read the diary files using:

(setq org-agenda-include-diary t)

11.0.12 Capture

C-c C-l insert link  
C-c C-a insert attachment  
  open last stored capture org-capture-goto-last-stored

11.0.13 Archiving

C-c C-x C-a org-archive-subtree-default archives the item

11.0.14 Searching and filtering in org

C-c / Use org-sparse-tree to filter out only matching headings. i.e: "C-c / m blog" to show only headings containing the tag "blog"

11.0.15 Literate programming using org-babel

Insert code blocks:


Useful org-babel keybindings:

key action description
C-c C-v t org-tangle  
C-c C-c   Evalute code block
C-c '   Edit code block in separate buffer
  org-src-fontify-block Applies syntax highlighting (font lock) to code block
  org-src-fontify-buffer (As above) to all code blocks in the buffer.

To easily create new code blocks, insert "<s" and hit "Tab" and a code block will be created.

11.0.16 Publishing and export

C-c C-e opens the export menu (or "dispatcher").

More export configuration options can be found under: M-x customize-group org-export

  1. Stylesheets

    There are some high quality template stylesheets available for use with org-mode exports.

  2. Export with Table of contents configuration

    Table of contents can be created with a configured to include all levels of heading or just to a specified level.

    M-x customize-variable org-export-with-toc

  3. Export with heading numbering

    M-x customize-variable org-export-with-section-numbers

  4. TODO Room for improvement

    In my opinion, there is room to improve the Org export dispatch menu to allow for:

    • Configration of ToC (Table of contents) (whether it should be created or not, level of detail et c.)
    • Whether or not headings should be rendered with numbers alongside them.

11.0.17 Editing math and special characters

First install packages auctex and cdlatex

Enable M-x org-cdlatex-mode

11.0.18 Further study

[[http://orgmode.org/worg/doc.html][All hooks, commands and options of Org 8.0]

11.1 Miscellaneous (git, magit, org-mode, gnus, diff …)

11.1.1 Acceptable visual configurations

Dark: color-theme-dark-blue2, fringe-mode, Font: Consolas 10, Dejavu Sans Mono 10 C-x C-+, C-x C– - increase, decrease text size

11.1.2 Text zoom, default is C-x C-+, C-x C– to resize text.

11.1.3 Magit for git version control

Magit manual

magit-status will show the state of the repository

  1. Useful magit-status keys and commands:
    S-Tab toggle showing diff in place
    d Show a diff
    e show ediff
    c commit
    s stage (and add files)
    v discard change
    g refresh
    C-u s stage all untracked files
    C-c C-c commit (from change message buffer)
    l show history
  2. the log

    pressing l opens the log . - mark = - compare the marked commit and the current (under cursor )commit C-w - copy sha1 of commit into the kill ring

  3. C-u commands:

    C-u i, ask for filename to ignore (useful for directories)

  4. mx-commands:


11.1.4 Reading feeds with gnus

press G R to add a new feed.

11.1.5 Comparing files with diff, merging them with ediff

Ediff manual

Ediff opens up three frames, frame A and B and a small frame that controls the diffing using hotkeys key ? shows help, "n" or space jumps to next diff, keys a/b copies region to A (upper frame)/B (lower) key r followed by b restores the buffer in B Q: How to undo the last action?

11.1.6 Visibility

Tab cycles visibility

C-c C-x b org-tree-to-indirect-buffer Shows the current subtree in a new buffer ("indirect buffer")

Author: jmn

Created: 2016-12-07 Wed 04:50