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.
Or you can ignore 99% of what I said above and just use the script at http://www.emacswiki.org/cgi-bin/wiki/CustomizeAquamacs#toc4
Heck, you don’t need emacsclient at all. The above will automatically reuse an existing, running Aquamacs.
🙂
Please don’t
setq
hooks, useadd-hook
instead.Ed – Thanks for the
add-hook
tip. I blindly copied from http://web.mit.edu/answers/emacs/emacs_autofill.html. Your solution is much better.Just a quick follow-up question for Ed and Marc: Why is add-hook better than setq for this setting?
Thanks.
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.
open -a /Applications/Development/Emacs.app %t