]> code.delx.au - gnu-emacs/blobdiff - lisp/log-edit.el
(remove, remq): New functions.
[gnu-emacs] / lisp / log-edit.el
index 37fe7068f9ac76d01550f6c1764b25eb8bcb9667..0f8dd68d214ec34943e944316406bb7bef2265d8 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Stefan Monnier <monnier@cs.yale.edu>
 ;; Keywords: pcl-cvs cvs commit log
 ;; Version: $Name:  $
-;; Revision: $Id: log-edit.el,v 1.3 2000/03/26 23:05:12 monnier Exp $
+;; Revision: $Id: log-edit.el,v 1.6 2000/06/02 02:28:39 monnier Exp $
 
 ;; This file is part of GNU Emacs.
 
 
 ;; Todo:
 
-;; - Remove a single leading `* <file>' in log-edit-insert-changelog
 ;; - Move in VC's code
 ;; - Add compatibility for VC's hook variables
-;; - add compatibility with cvs-edit.el
 
 ;;; Code:
 
@@ -177,7 +175,8 @@ Several other handy support commands are provided of course and
 the package from which this is used might also provide additional
 commands (under C-x v for VC, for example).
 
-\\{log-edit-mode-map}")
+\\{log-edit-mode-map}"
+  (make-local-variable 'vc-comment-ring-index))
 
 (defun log-edit-hide-buf (&optional buf where)
   (when (setq buf (get-buffer (or buf log-edit-files-buf)))
@@ -189,6 +188,12 @@ commands (under C-x v for VC, for example).
   "Finish editing the log message and commit the files.
 If you want to abort the commit, simply delete the buffer."
   (interactive)
+  ;; Get rid of trailing empty lines
+  (goto-char (point-max))
+  (skip-syntax-backward " ")
+  (when (equal (char-after) ?\n) (forward-char 1))
+  (delete-region (point) (point-max))
+  ;; Check for final newline
   (if (and (> (point-max) 1)
           (/= (char-after (1- (point-max))) ?\n)
           (or (eq log-edit-require-final-newline t)
@@ -199,7 +204,12 @@ If you want to abort the commit, simply delete the buffer."
       (save-excursion
        (goto-char (point-max))
        (insert ?\n)))
-  (if (boundp 'vc-comment-ring) (ring-insert vc-comment-ring (buffer-string)))
+  (let ((comment (buffer-string)))
+    (when (and (boundp 'vc-comment-ring)
+              (ring-p vc-comment-ring)
+              (not (ring-empty-p vc-comment-ring))
+              (not (equal comment (ring-ref vc-comment-ring 0))))
+      (ring-insert vc-comment-ring comment)))
   (let ((win (get-buffer-window log-edit-files-buf)))
     (if (and log-edit-confirm
             (not (and (eq log-edit-confirm 'changed)
@@ -242,6 +252,7 @@ To select default log text, we:
     (when (not (re-search-forward "^\\*\\s-+" nil t))
       (goto-char (point-min))
       (skip-chars-forward "^():")
+      (skip-chars-forward ": ")
       (delete-region (point-min) (point)))))
 
 (defun log-edit-mode-help ()