[gnu.emacs.bug] problem in handling of spell-filter in 18.52

hrp@snoid.cray.com (Hal Peterson) (12/04/88)

This is Emacs version 18.52, running on a Sun-3/50.

Spell-filter is a buffer local variable (or at least it should be; a
while ago I sent in a fix to make it so) and its value is nil by
default.  When spell-region is called on a buffer with a non-nil
spell-filter, it switches to a scratch buffer to run the filter, and
discovers that filter is now nil.  The following patch shows
spell-region how to remember the value of spell-filter across the
set-buffer call.

--
Hal Peterson / Cray Research / 1440 Northland Dr. / Mendota Hts, MN  55120
hrp@cray.com			bungia!cray!hrp		    (612) 681-3145

============================================================
*** spell.el-dist	Sat Dec  3 16:38:30 1988
--- spell.el	Sat Dec  3 16:41:00 1988
***************
*** 56,68 ****
  DESCRIPTION is an optional string naming the unit being checked:
  for example, \"word\"."
    (interactive "r")
!   (let ((buf (get-buffer-create " *temp*")))
      (save-excursion
       (set-buffer buf)
       (widen)
       (erase-buffer))
      (message "Checking spelling of %s..." (or description "region"))
!     (if (and (null spell-filter) (= ?\n (char-after (1- end))))
  	(if (string= "spell" spell-command)
  	    (call-process-region start end "spell" nil buf)
  	  (call-process-region start end shell-file-name
--- 56,68 ----
  DESCRIPTION is an optional string naming the unit being checked:
  for example, \"word\"."
    (interactive "r")
!   (let ((buf (get-buffer-create " *temp*")) (filter spell-filter))
      (save-excursion
       (set-buffer buf)
       (widen)
       (erase-buffer))
      (message "Checking spelling of %s..." (or description "region"))
!     (if (and (null filter) (= ?\n (char-after (1- end))))
  	(if (string= "spell" spell-command)
  	    (call-process-region start end "spell" nil buf)
  	  (call-process-region start end shell-file-name
***************
*** 72,78 ****
  	 (set-buffer buf)
  	 (insert-buffer-substring oldbuf start end)
  	 (or (bolp) (insert ?\n))
! 	 (if spell-filter (funcall spell-filter))
  	 (if (string= "spell" spell-command)
  	     (call-process-region (point-min) (point-max) "spell" t buf)
  	   (call-process-region (point-min) (point-max) shell-file-name
--- 72,78 ----
  	 (set-buffer buf)
  	 (insert-buffer-substring oldbuf start end)
  	 (or (bolp) (insert ?\n))
! 	 (if filter (funcall filter))
  	 (if (string= "spell" spell-command)
  	     (call-process-region (point-min) (point-max) "spell" t buf)
  	   (call-process-region (point-min) (point-max) shell-file-name