diff lisp/pcvs.el @ 73207:7e220566994b

(cvs-update-header): Fix handling of extra newlines so that they don't keep accumulating.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 02 Oct 2006 00:21:07 +0000
parents 2ce9bf47e864
children 82fde7e4c23b bb0e318b7c53
line wrap: on
line diff
--- a/lisp/pcvs.el	Sun Oct 01 22:58:44 2006 +0000
+++ b/lisp/pcvs.el	Mon Oct 02 00:21:07 2006 +0000
@@ -618,7 +618,6 @@
 	 (str (car hf))
 	 (done "")
 	 (tin (ewoc-nth cvs-cookies 0)))
-    (if (eq (length str) 2) (setq str ""))
     ;; look for the first *real* fileinfo (to determine emptyness)
     (while
 	(and tin
@@ -626,14 +625,17 @@
 		   '(MESSAGE DIRCHANGE)))
       (setq tin (ewoc-next cvs-cookies tin)))
     (if add
-	(setq str (concat "-- Running " cmd " ...\n" str))
+        (progn
+          ;; Remove the default empty line, if applicable.
+          (if (not (string-match "." str)) (setq str "\n"))
+          (setq str (concat "-- Running " cmd " ...\n" str)))
       (if (not (string-match
 		(concat "^-- Running " (regexp-quote cmd) " \\.\\.\\.\n") str))
 	  (error "Internal PCL-CVS error while removing message")
 	(setq str (replace-match "" t t str))
-	(if (zerop (length str)) (setq str "\n"))
-	(setq done (concat "-- last cmd: " cmd " --"))))
-    (setq str (concat str "\n") done (concat done "\n"))
+        ;; Re-add the default empty line, if applicable.
+        (if (not (string-match "." str)) (setq str "\n\n"))
+	(setq done (concat "-- last cmd: " cmd " --\n"))))
     ;; set the new header and footer
     (ewoc-set-hf cvs-cookies
 		 str (concat "\n--------------------- "