Posts Tagged ‘wordpress’
One benefit of being an emacs user is that people “respect” your typing habit. By that I mean nearly everything comes with an “emacs keybinding”: all CLI programs using readline, GUI programs built on gtk and qt, and maybe some java UI programs. As a matter of fact, I have in my ~/.gtkrc.mine file a line like
gtk-key-theme-name = "Emacs"
so I can use emacs bindings in all my gtk based programs, including Firefox.
Speaking of which, I used to use ScribeFire to do quick postings from within Firefox. The good thing about it is you get to manage all your blogs in one place, but it’s on the buggy side for a plugin, and it’s also quite annoying that there are always some minor clashes between gtk’s emacs keybindings and Firefox/ScribeFire hotkeys (e.g., c-k defaults to the search engine, c-a selects the whole text, etc.). I’m no frequent blogger, so I chose to frown but live with it.
A couple of weeks ago, I found this firefox plugin: It’s All Text!. It allows you to use your favorite editor (reads: emacs :D) for any text entry box. I’ve been using it quite often, editing gmails and stuff. So today after repeatedly experiencing some weird ScribeFire bugs, I started entertaining the idea of using emacs to edit wp’s html text.
Bad news is, wp treats newlines serious even for html code, and I’m just too accustomed to using m-q every once in a while (for those uninitiated, pressing alt-q in emacs will autowrap the current paragraph with hard newlines). But it’s EMACS we are talking about! It has a solution for just everything!–I was merely digging into its info manual looking for something like unfill-buffer, and instead stumbled into this longlines-mode goodie. Basically in this mode, when you save your text file, it discards all newline characters used for autowrapping. Neat!
Now one thing you’d like having is to only apply this longlines-mode for wordpress posts — I do like wrapping my outgoing gmails! Just put this snippet into your ~/.emacs (too bad the flag doesn’t support lisp):
;;;; for wordpress.com post editing (defun my-wp-mode() (html-mode) (set-variable 'longlines-show-hard-newlines t) (longlines-mode)) (add-to-list 'auto-mode-alist '("wordpress\\.com\\." . my-wp-mode))
Well, now that I’m not using ScribeFire, I have to add new post in wp and click that tiny little blue button to conjure my emacsclient. I’m sure there’s some emacs mode out there for managing wp (and blog engines in general), but that’s for another day.