[net.emacs] 1 bug fix and 1 new feature for emacs #264

matt@oddjob.UChicago.UUCP (Matt Crawford) (06/19/84)

I found that if I visited a file, then did an insert-file, then saved the
file back again, I often got the "file-so-and-so has been modified ..."
message.  This turned out to be due to the readfile() subroutine always
updating the buffer's idea of the file st_mtime.  The fix to fileio.c shown
below causes emacs not to use the st_mtime of a file being inserted.

The second change is to emacs.c to support a line number argument
preceding a filename.  This was necessitated by the debugger's format for
invoking the editor.  The format supported by this change is:

	emacs [ +lineno1 ] file1 [ [ +lineno2 ] file2 ] ...

(I have editted the diff -c output for added clarity.  diff is not clever
about two near but non-contiguous changes.)

*** fileio.c.OLD	Mon Jun  6 02:52:39 1983
--- fileio.c	Tue Jun  5 22:57:53 1984
***************
*** 388,393
  	}
  	bf_cur -> b_fname = savestr (fn);
  	bf_cur -> b_kind = FileBuffer;
      }
-     bf_cur -> b_readtime = st.st_mtime;
      return i >= 0;

--- 388,394 -----
  	}
  	bf_cur -> b_fname = savestr (fn);
  	bf_cur -> b_kind = FileBuffer;
+ 	bf_cur -> b_readtime = st.st_mtime;
      }
      return i >= 0;
  }
  
*** emacs.c.OLD	Thu Dec  1 20:10:56 1983
--- emacs.c	Fri Dec  2 11:36:44 1983
***************
*** 343,350
  	if (!TouchedCommandArgs) {
  	    int     DoneAnyVisiting = 0;
  	    int     Lerr = err;
  	    for (i = 1; i < argc; i++)
! 		if (argv[i][0] != '-') {
  		    VisitFile (argv[i], 1, 1);
  		    DoneAnyVisiting++;
  		}

--- 343,363 -----
  	if (!TouchedCommandArgs) {
  	    int     DoneAnyVisiting = 0;
  	    int     Lerr = err;
+  	    int     linenum;
  	    for (i = 1; i < argc; i++)
! 		if (argv[i][0] == '-')
+ 		    continue;
+ 		else if (argv[i][0] == '+')
+ 		    linenum = atoi(&argv[i][1]);
+ 		else {
  		    VisitFile (argv[i], 1, 1);
  		    DoneAnyVisiting++;
+ 		    if (linenum>1) {
+ 		            arg = linenum - 1;
+ 			    ArgState = PreparedArg;
+ 			    ExecuteBound(MacBodies[FindMac("next-line")]);
+ 		    }
+ 		    linenum = 0;
  		}
  	    if (!DoneAnyVisiting &&
  		    (args = fopen (sprintf (combuf, ".emacs_%d", getuid ()), "r")) != 0)

___________________________________________________________
Matt		University	ARPA: crawford@anl-mcs.arpa
Crawford	of Chicago	UUCP: ihnp4!oddjob!matt