Skip to content

Learn the AWK programming language with Emacs Org-drill

Notifications You must be signed in to change notification settings

jherrlin/learn-awk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

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.

(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)
(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")))

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.

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

About

Learn the AWK programming language with Emacs Org-drill

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published