aquamacs 2.0 elisp fun
While waiting for the white smoke to emerge on Textmate 2.0, I decidedto revisit an old friend. It turns out the emacsen have been busysince I've been using TextMate. Aquamacs 2.0 is a great Cocoa port ofEmacs 23. Not sure whether I should call it a port since emacsofficially supports the OS X operating system.The first thing I did was check out some of the old modes I used touse. AucTeX, GNUs are both packaged with emacs now. The SQL mode that comes withis great and "just works" with mysql and postgresql. There is goodsupport for Python and of course HTML. Two minor gliches in thoseareas that I wish I could fix:
- I cannot get MMM (multi-major-mode) to work properly. I wouldreally like to have both HTML and Javascript colorized properly whenI'm working on my Django projects. If anyone has any advice ongetting MMM to work right in emacs 23 I would really appreciate apointer.
- Completion in iPython does not work right. Instead of completingin the ipython shell it just indents more.
(defun muse-bold-word ()
(interactive)
(muse-wrap-with-string "**" 2)
)
(defun muse-ital-word ()
(interactive)
(muse-wrap-with-string "*" 1)
)
(defun muse-tt-word ()
(interactive)
(muse-wrap-with-string "=" 1)
)
(defun muse-wrap-with-string (str len)
(if mark-active
(progn
(kill-region (point) (mark))
(let ((myword (car kill-ring)))
(insert (concat str myword str) )))
(let ((myStr (thing-at-point 'word)))
(if myStr
(let ((myBounds (bounds-of-thing-at-point 'word)))
(kill-region (car myBounds) (cdr myBounds))
(insert (concat str myStr str)))
(progn
(insert (concat str str))
(goto-char (- (point) len)) ) ) ))
)
(define-key muse-mode-map `[(,osxkeys-command-key b)] 'muse-bold-word)
(define-key muse-mode-map `[(,osxkeys-command-key i)] 'muse-ital-word)
(define-key muse-mode-map `[(,osxkeys-command-key k)] 'muse-tt-word)