6091 comments
2357 subscribers
6240 on Twitter
Subscribe! Feed reader E-mail

More hacks for mangling Japanese CSV

This is for use with kdrill.

(defun sacha/kanji/get-ordered-kanji-list ()
  (let (kanji-list)
    (while (not (eobp))
      (let ((c (char-after (point))))
        (cond
         ((= c ?\"))
         ((= c ?\n))
         ((= c ?:) (forward-line 1) (forward-char -1))
         (t (add-to-list 'kanji-list c))))
      (forward-char 1))
    kanji-list))

(defun sacha/kanji/ordered-usefile-to-kill ()
  (interactive)
  ;; Look up kanji in kanjidic
  (let ((list (sacha/kanji/get-ordered-kanji-list)))
    (kill-new
     (with-current-buffer (find-file-noselect "/usr/share/edict/kanjidic")
       (mapconcat
        (lambda (kanji)
          (goto-char (point-min))
          (when (search-forward (char-to-string kanji) nil t)
            (skip-syntax-forward " ")
            (buffer-substring-no-properties (point) (and (skip-syntax-forward "^ ") (point)))))
        list
        "\n")))))

On Technorati: ,

Short URL: http://sachachua.com/blog/p/2554

On This Day...

  • 2013: Reading old letters and relearning how to write — a snippet from my 2006 annual letter I’m tremendously lucky to have family and friends who humour me by writing letters. [...]
  • 2012: Tip: Use visibility to motivate new habits — The urge to check things off can be a great way to start a new habit. On our recent trip [...]
  • 2011: Wrapping up projects and preparing for the next one — We’re in the final phases of our two Drupal projects. We’re writing test scripts, fixing bugs, and loading production data. [...]
  • 2010: Information gardening tasks — A large part of my work involves capturing and organizing information. It takes a surprising lot of time and thought. [...]
  • 2010: La-Z-Boy cinemas, massages, and seafood — It’s not like a trip home to the Philippines means stocking up on cheap export overruns or taking advantage [...]
  • 2009: Finally figured out how to set up a shared Git repository — After a few hours of struggling with it, I gave up on trying to get Git working over WebDAV. I [...]
  • 2007: Aha! — I’ve been thinking about picking up tennis. I’m not in shape for it yet, but I think it will be a [...]
  • 2007: I should meet more people in Canada — Hanging out with my friends here made me realize that I really do need to go and meet more people in [...]
  • 2007: Can’t work on map-enabled prototype — Slow Internet connectivity means that prototyping with Google Maps will be a royal pain. What else can I focus on? Maybe [...]
  • 2005: Testing testing testing — Hmm. This shouldn’t pass by a plan page at all.
  • 2005: Proof of concept: Deleting private tasks — It’s easy to tweak Planner. For example, the following two lines of code delete all lines that contain {{private}} before publishing. [...]
  • 2005: planner-multi-read-name — I read through crm.el on the train. Now that I have an idea as to how completing reads work, I think [...]
  • 2005: Cat — 55 words — “Your cat’s vicious.” “Neko?” I stroked the cat sleeping on my lap. She yawned, stretched, and curled up around my hand. “Absolutely antisocial.” [...]
  • 2005: Japanese flashcards — This extracts all kanji in the buffer and converts them to the format expected by flashcard.el. (defun sacha/kanji/get-ordered-kanji-list () "Return a [...]
  • 2004: Kernel configuration — http://sacha.free.net.ph/notebook/personal/lifebook.config
  • 2004: Backlog of expenses — 2004.01.10 +120.00 money:expenses/entertainment LOTR 2004.01.10 -120.00 money:assets/cash LOTR 2004.01.10 +200.00 money:expenses/entertainment Timezone card 2004.01.10 -200.00 money:assets/cash Timezone card 2004.01.10 +75.00 money:expenses/dining Baked potato bacon and cheese (approximately) 2004.01.10 -200.00 money:assets/cash Baked potato bacon and cheese (approximately)
  • 2004: Reflections from the other day — How ashen my father was under the harsh fluorescent lights, I thought, as I pulled a chair up and offered to [...]

Get the highlights as a PDF!

Stories from my Twenties: Highlights from a Decade of Blogging

Free sample!