Code for inserting student code

(defvar sacha/project-base-path nil "*The path to the project files, excluding the ending /")
(defun sacha/insert-student-files (id)
  (interactive "MID: ")
  (if (file-directory-p (concat sacha/project-base-path "/" id))
      (progn
        (cd (concat sacha/project-base-path "/" id))
        (mapcar (lambda (item)
                  (print item)
                  (insert "--------------------------------------------------------------------\n")
                  (insert "Your code: " item "\n")
                  (insert "--------------------------------------------------------------------\n")
                  (let ((retval (cadr (insert-file-contents item))))
                    (goto-char (+ (point) retval))
                    (insert "\n")))
                (file-expand-wildcards "*")))
     (insert "***********************************************************\n"
             "You have not yet submitted any files.\n"
             "***********************************************************\n")))

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>