Editing textareas with emacs-w3m
The default mode for editing textareas with emacs-w3m is pretty cheesy. No auto-fill, no spell checking, ...
Enabling the use of text-mode was a little bit more complex than I imagined, but only a little. The strangeness was caused by the use of local variables to maintain state in the textarea editing buffer. As all major-modes should, text-mode kills all local variables. This meant that the emacs-w3m state was lost and attempting to submit the modified text failed. Marking the relevant variables as permanent-local did the trick.
Here's the code:
(eval-after-load "w3m-form"
'(progn
(define-minor-mode dme:w3m-textarea-mode
"Minor mode used when editing w3m textareas."
nil " dme:w3m-textarea" w3m-form-input-textarea-keymap)
(defun dme:w3m-textarea-hook ()
;; protect the form local variables from being killed by `text-mode'
(mapcar (lambda (v)
(if (string-match "^w3m-form-input-textarea.*"
(symbol-name (car v)))
(put (car v) 'permanent-local t)))
(buffer-local-variables))
(text-mode) (dme:w3m-textarea-mode))
(add-hook 'w3m-form-input-textarea-mode-hook 'dme:w3m-textarea-hook)))
Updates will probably happen on the relevant Emacs Wikipage.
Listening to: DJ Tiesto: In My Memory - Dallas 4PM