emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103864: log-edit.el fix for bug#7598


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103864: log-edit.el fix for bug#7598.
Date: Thu, 07 Apr 2011 20:21:30 -0700
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103864
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Thu 2011-04-07 20:21:30 -0700
message:
  log-edit.el fix for bug#7598.
  
  * lisp/vc/log-edit.el (log-edit-empty-buffer-p): New function.
  (log-edit-insert-cvs-template, log-edit-insert-cvs-rcstemplate):
  Use log-edit-empty-buffer-p.
modified:
  lisp/ChangeLog
  lisp/vc/log-edit.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-04-08 03:11:31 +0000
+++ b/lisp/ChangeLog    2011-04-08 03:21:30 +0000
@@ -1,5 +1,9 @@
 2011-04-08  Glenn Morris  <address@hidden>
 
+       * vc/log-edit.el (log-edit-empty-buffer-p): New function.
+       (log-edit-insert-cvs-template, log-edit-insert-cvs-rcstemplate):
+       Use log-edit-empty-buffer-p.  (Bug#7598)
+
        * net/rlogin.el (rlogin-process-connection-type): Simplify.
        (rlogin-mode-map): Initialize in the defvar.
        (rlogin): Use ignore-errors.

=== modified file 'lisp/vc/log-edit.el'
--- a/lisp/vc/log-edit.el       2011-03-11 20:04:22 +0000
+++ b/lisp/vc/log-edit.el       2011-04-08 03:21:30 +0000
@@ -531,13 +531,25 @@
        (shrink-window-if-larger-than-buffer)
        (selected-window)))))
 
+(defun log-edit-empty-buffer-p ()
+  "Return non-nil if the buffer is \"empty\"."
+  (or (= (point-min) (point-max))
+      (save-excursion
+        (goto-char (point-min))
+        (while (and (looking-at "^\\(Summary: \\)?$")
+                    (zerop (forward-line 1))))
+        (eobp))))
+
 (defun log-edit-insert-cvs-template ()
   "Insert the template specified by the CVS administrator, if any.
 This simply uses the local CVS/Template file."
   (interactive)
   (when (or (called-interactively-p 'interactive)
-           (= (point-min) (point-max)))
+            (log-edit-empty-buffer-p))
+    ;; Should the template take precedence over an empty Summary:,
+    ;; ie should we first erase the buffer?
     (when (file-readable-p "CVS/Template")
+      (goto-char (point-max))
       (insert-file-contents "CVS/Template"))))
 
 (defun log-edit-insert-cvs-rcstemplate ()
@@ -546,8 +558,9 @@
 can thus take some time."
   (interactive)
   (when (or (called-interactively-p 'interactive)
-           (= (point-min) (point-max)))
+            (log-edit-empty-buffer-p))
     (when (file-readable-p "CVS/Root")
+      (goto-char (point-max))
       ;; Ignore the stderr stuff, even if it's an error.
       (call-process "cvs" nil '(t nil) nil
                     "checkout" "-p" "CVSROOT/rcstemplate"))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]