[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fixed highlighting in draft mode



At Tue, 19 Jan 2010 21:27:32 -0500,
David Abrahams wrote:
> 
> Hi Vitaly,
> 
> Test report and a few questions.
> 
> With just your hack, I can reliably hang emacs as follows:
> 
> 1. enter a Summary buffer
> 2. on a message, hit RET
> 3. `w' to start writing a new message
> 4. Fill out the To: and Subject: fields
> 5. `C-c C-c'
> 6. Back in the Summary buffer, hit `D'
> 
> The reasons are completely mysterious to me.  

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)))

-- 
Dave Abrahams           Meet me at BoostCon: http://www.boostcon.com
BoostPro Computing
http://www.boostpro.com