Skip to content

Latest commit

 

History

36 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learn the AWK programming language in a fun and interactive way with help of Emacs Org
mode and Org-drill.

[[./learn-awk.gif]]

* Workflow

  1. Open 2 Emacs sessions
  2. Open awk.org in one session
  3. Open note-book.org in the other
  4. Start org-drill in the awk.org session
  5. Write your answers in the note-book.org session

  note-book.org contains org mode awk source blocks for each of the files in =text-files=.
  When questions refers to files, use that specific source block when writing the answer.
  You can then use =C-c C-c= to interactively execute the code and get instant feedback.

* Emacs setup

  This is the needed Emacs config. All of the =org-babel-do-load-languages= is not needed,
  just =awk=.

  To make new questions I use Org capture templates. They are easy to access via =C-c c
  a=. But as the questions are just plain text they can easily be written by hand. Just
  follow the pattern.

  #+BEGIN_SRC shell :results output code :exports results
    awk 'NR==245,NR==256;NR==285,NR==286' ~/.emacs.d/packages.el
  #+END_SRC

  #+RESULTS:
  #+begin_src shell
  (setq org-confirm-babel-evaluate nil)
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((emacs-lisp . t)
     (shell . t)
     (scheme . t)
     (python . t)
     (awk . t)
     (sed . t)
     (ledger . t)
     (clojure . t)))

  (use-package org-drill
    :pin melpa)
  #+end_src

  #+BEGIN_SRC shell :results output code :exports results
    awk 'NR==36,NR==40' ~/.emacs.d/org.el
  #+END_SRC

  #+RESULTS:
  #+begin_src shell
  (setq org-capture-templates
        '(("a" "awk drill question"
           entry (file+headline "~/git/learn-awk/awk.org" "Drills")
           "\n\n** %^{Question title}                           :awk:drill:\n\n   %^{Question body} \n\n*** Answer \n\n    #+BEGIN_SRC awk :results output code :in-file ./text-files/%^{text file}\n      %^{awk program}\n    #+END_SRC")))
  #+end_src

* Remove personal Org-drill data from awk.org

  If you are using org-drill in awk.org. Org-drill adds some data to each of the
  headlines. This is your personal data and should not be version controlled. Run this to
  remove the personal org-drill data.

  #+BEGIN_SRC shell :results none
    mv awk.org{,.bak}&&cat *.bak|awk '$1~/^SCHEDULED/,$1~/^:END/{next};$1~/^:PROPERTIES/,$1~/^:END/{next};{print}'>awk.org&&rm -f *.bak
  #+END_SRC

About

Learn the AWK programming language with Emacs Org-drill

Resources

Stars

15 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors