[comp.sources.bugs] jove 4.14 spell-buffer bugfix

wietse@wzv.win.tue.nl (Wietse Venema) (01/01/91)

Problem:
	The Jove 4.14 `spell-buffer' command produces weird results when
	the current buffer is not associated with a file.

Repeat-by:

	Do a `C-X ! some-shell-command', then invoke the spell command
	on the resulting buffer. 

Analysis:

	If the current buffer has no file name, SpelBuffer() passes the
	command `spell (null)' to the shell. 

Workaround:

	Apply the patch below. If the current buffer has no file name,
	SpelBuffer now forces put_bufs() to ask for a file name and to
	write the current buffer to file (even if it was not modified).  

		Wietse Venema
		Eindhoven University of Technology
		The Netherlands

*** proc.c-	Fri Jul 28 05:41:14 1989
--- proc.c	Mon Dec 31 17:41:32 1990
***************
*** 401,407 ****
--- 401,413 ----
  		com[100];
  	Window	*savewp = curwind;
  
+ 	if (curbuf->b_fname == 0) {
+ 		curbuf->b_type = B_FILE;	/* buffer needs file name */
+ 		curbuf->b_modified = YES;	/* buffer needs to be saved */
+ 	}
  	put_bufs(0);
+ 	if (curbuf->b_fname == 0)
+ 		return;
  	swritef(com, "spell %s", curbuf->b_fname);
  	(void) UnixToBuf(Spell, YES, EWSize, YES, Shell, ShFlags, com, (char *) 0);
  	message("[Delete the irrelevant words and then type C-X C-C]");