[gnu.emacs.bug] Old/prior bug-fix posting

jbw%bucsf.BU.EDU@BU-IT.BU.EDU (Joe Wells) (12/05/88)

Several months ago, I posted a bug fix for several problems in
lisp/c-mode.el, and RMS later told me that he had installed my
patches.  I am now convinced that one of the bugs I was fixing had
already been fixed in a better way than mine.  I originally fixed the
bug in 18.47, but the patch I posted was a diff against 18.49.

The particular bug in question was an obscure interaction between
c-auto-newline and auto-fill-mode.  It occured when a semicolon was
typed at the end of a long line (that was due for auto-filling).  The
line would be broken, and the semicolon would be inserted at a wierd
place in the middle of the line, overwriting the character there.  It
actually doesn't matter until inserting a newline is fixed to do
auto-filling, which is broken in 18.52.

Here is the part of my patch that I think wasn't needed, so that it
can be reversed.  It actually works, but the other way of fixing it is
more efficient, since it doesn't use a marker.  My fix also forgot to
set the marker to nil, so that it wouldn't slow down editing before it
was garbage-collected.

--
Joe Wells
INTERNET: jbw%bucsf.bu.edu@bu-it.bu.edu
UUCP: ...!harvard!bu-cs!bucsf!jbw

*** c-mode.el.old	Sun Dec  4 16:00:30 1988
--- c-mode.el.new	Sun Dec  4 16:01:29 1988
***************
*** 234,241 ****
  	  (and c-auto-newline
  	       (not (c-inside-parens-p))
  	       (progn
  		 (newline)
- 		 (setq insertpos (- (point) 2))
  		 (c-indent-line)))
  	  (save-excursion
  	    (if insertpos (goto-char (1+ insertpos)))
--- 234,245 ----
  	  (and c-auto-newline
  	       (not (c-inside-parens-p))
  	       (progn
+  		 ;; the new marker object, used to be just an integer
+  		 (setq insertpos (make-marker))
+  		 ;; changed setq to set-marker
+  		 (set-marker insertpos (1- (point)))
+  		 ;; do this before the newline, since in auto fill can break
  		 (newline)
  		 (c-indent-line)))
  	  (save-excursion
  	    (if insertpos (goto-char (1+ insertpos)))