Aquamacs and Mozex

Note: Before messing around with emacsclient, as described below, see the comments for an easier solution.

I could not get Mozex to
launch Aquamacs. Mozex doesn’t seem to deal
well with editor program path names with spaces and quoting doesn’t work. I also
tried to symlink/copy /Applications/Aquamacs Emacs.app
to /Applications/Aquamacs.app and that seems to please Mozex but
then Aquamacs launches and hangs.

What does work however is the Aquamacs
emacsclient.

After doing the above mentioned symlink, I set Mozex’s textarea handler to
/Applications/Aquamacs.app/Contents/MacOS/bin/emacsclient
%t
.

And I made sure that my .emacs file had:

(server-start)

Next annoyance is that Mozex has no idea that you’re editing HTML and the temp
file name is a .txt file so consequently Aquamacs opens the file in
text mode. My solution to this is to add the following to the top of your post
(which I did in the WordPress textarea before triggering Mozex):


Adding this to every post is kind of a pain, of course, so if I really get into
the habit of using Aquamacs for my blog (which looks like a distinct
possibility), then I might make it automatic by hacking WordPress, or even
better, writing a WordPress plugin if the API supports this kind of thing.

The next annoyance was that Emacs doesn’t seem to be setup to
do auto-fill-mode (a.k.a.: “word wrap” for the rest of the human
race) automatically for HTML files. This was easy to remedy
in .emacs. So now we have:

(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook
      '(lambda nil
	 (setq fill-column 72)
	 (auto-fill-mode 1)))
(add-hook 'html-mode-hook 'turn-on-auto-fill)

;; Allow connections from emacsclient
(server-start)

It would also be nice to come up with some kind of Automator/AppleScript
doohickey that allows me to launch the Mozex textarea edit from the
keyboard… Maybe one of these days, I’ll try to hack one up.

6 thoughts on “Aquamacs and Mozex

  1. Just a quick follow-up question for Ed and Marc: Why is add-hook better than setq for this setting?

    Thanks.

  2. add-hook is better because it will add a hook to the already existing list of hooks, whereas setq will replace the list of hooks with the one you specify.

Leave a Reply

Your email address will not be published. Required fields are marked *