Skip to content

Latest commit

 

History

History
96 lines (93 loc) · 3.9 KB

File metadata and controls

96 lines (93 loc) · 3.9 KB

Journal

1 2018

1.1 2018-02 March

1.1.1 2018-02-12 Monday

1.1.1.1 Demonstrating emacs org-mode shortcuts

First webinar on reproducible research: litterate programming

1.1.1.1.1 Emacs shortcuts

Here are a few convenient emacs shortcuts for those that have never used emacs. In all of the emacs shortcuts, C=Ctrl, M=Alt/Esc and S=Shift. Note that you may want to use two hours to follow the emacs tutorial (C-h t). In the configuration file CUA keys have been activated and allow you to use classical copy/paste (C-c/C-v) shortcuts. This can be changed from the Options menu.

  • C-x C-c exit
  • C-x C-s save buffer
  • C-g panic mode ;) type this whenever you want to exit an awful series of shortcuts
  • C-Space start selection marker although selection with shift and arrows should work as well
  • C-l reposition the screen
  • C-_ (or C-z if CUA keys have been activated)
  • C-s search
  • M-% replace
  • C-x C-h get the list of emacs shortcuts
  • C-c C-h get the list of emacs shortcuts considering the mode you are currently using (e.g., C, Lisp, org, …)

There are a bunch of cheatsheets also available out there (e.g., this one for emacs and this one for org-mode or this graphical one).

1.1.1.1.2 Org-mode

Many emacs shortcuts start by C-x. Org-mode’s shortcuts generaly start with C-c.

  • Tab fold/unfold
  • C-c c capture (finish capturing with C-c C-c, this is explained on the top of the buffer that just opened)
  • C-c C-c do something useful here (tag, execute, …)
  • C-c C-o open link
  • C-c C-t switch todo
  • C-c C-e export
  • M-Enter new item/section
  • C-c a agenda (try the L option)
  • C-c C-a attach files
  • C-c C-d set a deadl1ine (use S-arrows to navigate in the dates)
  • A-arrows move subtree (add shift for the whole subtree)
1.1.1.1.3 Org-mode Babel (for literate programming)
  • <s + tab template for source bloc. You can easily adapt it to get this:
    ls
        

    Now if you C-c C-c, it will execute the block.

    #+RESULTS:
    | #journal.org# |
    | journal.html  |
    | journal.org   |
    | journal.org~  |
        
  • Source blocks have many options (formatting, arguments, names, sessions,…), which is why I have my own shortcuts <b + tab bash block (or B for sessions).
    ls /tmp/*201*.pdf
    
    #+RESULTS:
    : /tmp/2015_02_bordeaux_otl_tutorial.pdf
    : /tmp/2015-ASPLOS.pdf
    : /tmp/2015-Europar-Threadmap.pdf
    : /tmp/europar2016-1.pdf
    : /tmp/europar2016.pdf
    : /tmp/M2-PDES-planning-examens-janvier2016.pdf
        
  • I have defined many such templates in my configuration. You can give a try to <r, <R, <RR, <g, <p, <P, <m
  • Some of these templates are not specific to babel: e.g., <h, <l, <L, <c, <e, …

****