WP-Syntax Download Extension

Moving from tDiary, I’m kind of new to WordPress. I chose it because it was easy enough to run it on my server and had a lot of nifty, nice-looking plugins that would do me with everything that I needed.  As you may imagine, while using those plugins is fine and cool, looking into the code is hell. Through my journey of fixing problems I encountered and submitting a couple of patches to the plugin authors, I’ve seen full of code duplicates, unoptimized funtion call repetition, lack of look-up table pre-generation or even a simple memoization, parsing and substituting HTML with messy, awkward, terribly composed regexps, etc. etc. .  OK, life is short, let’s just turn a blind eye to them as long as the code works.
Well,  so much for digressions.  I just wanted to write a code blog like this.  In order to do that, there is no doubt you need a good code highlighting engine with download/view buttons.  I searched around for the best, but no combination of plugins appealed to my taste.  I decided to write a plugin to add what is lacking for me  to WP-Syntax and here it is.  WP-Syntax Download Extension renders a nice caption on each WP-Syntax highlighted code snippet as below.

(defun goto-next-window (&optional arg)
  (interactive "P")
  (cond ((one-window-p)
         (select-window (split-window-horizontally)))
        (arg (other-window -1))
        (t (other-window 1))))
(global-set-key "\C-o" 'goto-next-window)
(global-set-key "\M-\C-o" 'open-line)

I’ll probably add “print” and “copy to clipboard” buttons in the future. Try it out and feel free to leave a comment.

Leave a Reply

Your email address will not be published.