| emacs

The following code snippet makes it easier for me to import segments
from my dictionary files. It uses ../emacs/flashcard.el.

(defun flashcard-import-from-kill (deck)
  "Import cards for DECK from the clipboard, which should be colon-separated.

Question : Answer"
  (interactive (list flashcard-deck))
  (unless (eq major-mode 'flashcard-mode)
    (error "You're not in a deckfile."))
    (goto-char (point-min))
    (while (re-search-forward "^ *\\(.*\\) +: +\\(.*\\)$" nil t)
      (flashcard-add-card deck
                          (flashcard-make-card (match-string 1)
                                               (match-string 2)))))
  (when (and (interactive-p)
             (not flashcard-card))


You can comment with Disqus or you can e-mail me at sacha@sachachua.com.