Skip to content

Instantly share code, notes, and snippets.

@andersjohansson
Last active April 12, 2016 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andersjohansson/c8189fc4a5435e59223c3b959486a9ee to your computer and use it in GitHub Desktop.
Save andersjohansson/c8189fc4a5435e59223c3b959486a9ee to your computer and use it in GitHub Desktop.
Some functions for grading student papers in Emacs with org-mode

Grading table

NamePointsGradewcid
Smith, Joan10ASmith_Joan
Smith, John7BSmith_Johan

Evaluations

My grading

Σ10A
Criterium 1 (2)2
Criterium 2 (2)2
Criterium 3 (4)4
Criterium 4 (2)2

Some notes

Comments

Hi Joan,
Comments to student

My grading

Σ7B
Criterium 1 (2)2
Criterium 2 (2)2
Criterium 3 (4)2
Criterium 4 (2)1

Some notes

Comments

Hi John,
Comments to student

Functions

Generate wordcounts (from file-table generated below)

(let (val)
  (dolist (file tab (reverse val))
    (let ((fn (car file)))
      (push
       (list
        fn
        (string-to-number (shell-command-to-string (format "pdftotext \"%s\" - | wc -w" fn)))
        (if (string-match "^[^/]+/\\([^\\.]+\\)" fn)
            (match-string 1 fn)
          "FEL")) val))))

Table of files

ls  -1 ./*.pdf

Link function

(org-id-goto id)
(org-map-entries
 (lambda ()
   (when (= (org-current-level) 2)
     (forward-char 3)
     (let* ((namn (buffer-substring-no-properties
                   (point)
                   (line-end-position)))
            (fornamn (cadr (split-string namn ", ")))
            (fn (car (pop files)))
            (fnrens (if (string-match "^[^/]+/\\([^\\.]+\\)" fn)
                        (match-string 1 fn)
                      "FEL")))
       (insert (org-make-link-string
                (concat "file:" fn) namn))
       (delete-region (point) (line-end-position))
       ;; (kill-line)
       (forward-line)
       (insert (format evf "*" fnrens "*" fornamn)))))
 t 'tree 'comment)

Evaluation format

%s** My evaluation
#+NAME: %s
| *Σ*               | 0 |   |
|-----------------+---+---|
| Criterium 1 (2) |   |   |
| Criterium 2 (2) |   |   |
| Criterium 3 (4) |   |   |
| Criterium 4 (2) |   |   |
#+TBLFM: @1$2=vsum(@2..@5)

%s** Comments
Hi %s,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment