[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fixed highlighting in draft mode
At Wed, 20 Jan 2010 04:46:06 -0500, David Abrahams wrote:
> Mystery solved. The variable after-change-functions needs to be made
> buffer-local; then none of that other hackery is needed.
>
> (defun my-highlight-hook (beg end len)
> (let ((begining (save-excursion
> (goto-char beg)
> (re-search-backward "^" nil t)))
> (ending (save-excursion
> (goto-char end)
> (re-search-forward "$" nil t))))
> (put-text-property begining ending 'face nil)
> (wl-highlight-message begining ending t nil)
> (wl-highlight-message begining ending t t)))
>
> (add-hook 'wl-draft-mode-hook (lambda ()
> (make-local-variable ; HERE
> 'after-change-functions) ; HERE
> (add-hook 'after-change-functions
> 'my-highlight-hook)))
Cool! Thanks!
--
wbr, Vitaly