After purchasing a physical copy of the popular Naruto manga's volume 3, I set out to read the rest of the chapters until the end. I've obtained an archive of CBZs (basically a zip file of images representing comic book pages).

Somehow, on trying to open them in Calibre, it tries to convert the CBZs to... CBZ? This seems to lead to an infinite loop so you can't really read them directly. Resigned to my fate, I loaded them 10 at a time to calibre and converted them to PDFs. This is really manual and sort of boring, so I set out to discover something better.

Do it in Emacs!

I already read PDFs and EPUBs in emacs (epubs via nov.el, which is a really good name), so I figured why not just try and find a package to read comics in it as well.

Turns out the built-in doc-view mode natively supports CBRs by opening each as an archive and allowing the reader to go the the next or previous image via n or p.

Since it's basically images nested deep in a few directories, going to the next chapter is not the greatest UX, so I just automated it in a function since the chapters are numbered predictably (000-500, left padded with 0s).

Emacs Lisp!

You could say I am rather fond of writing emacs-lisp, so this was a joy, writing something for my specific needs only. This only works while you're already reading a chapter!

(defun next-comic ()
  (interactive)
  (let* 
    ((curr-img
      (buffer-file-name))
     (curr-cbz
      (car (split-string curr-img ":"))) ;; buffer has the name file:001.png for instance
     (curr-volume
      (string-to-number (file-name-base (file-name-sans-extension curr-cbz))))
     (volumes-dir
      (file-name-directory curr-img))
     (next-file
      (expand-file-name 
        (format "%03d.cbz" (+ 1 curr-volume)) ;; pad to 3 digits
         volumes-dir)))
    (kill-buffer)
    (find-file next-file)))

(bind-key (kbd "C-c n") 'next-comic 'image-mode-map) ;; nifty binding