No title

Anonymous Coward 2015-02-10 07:56:08.984941 UTC

(defun s9g-haskell-yesod-handler-name ()
  (interactive)
  (let* ((p1 (line-beginning-position))
         (p2 (line-end-position))
         (lval (buffer-substring-no-properties p1 p2))
         (w (cdr (split-string lval)))  ; split to words and drop routes
         (rname (car w))
         (methods (cdr w)))
    (if (> (length methods) 0)
        (progn
          (kill-whole-line)
          (previous-line)
          (loop for m in methods do
                (let* ((name (concat (downcase m) rname))
                       (l1 (concat name " :: Handler TypedContent"))
                       (l2 (concat name " = error \"" name " not implemented\"")))
                  (end-of-line)
                  (newline)
                  (insert l1) (newline)
                  (insert l2) (newline)))))))