diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-04-09 11:42:31 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-04-09 11:42:31 -0700 |
commit | 762f8d96719ba3e8a0e79d8bb99fe8e119fafb3a (patch) | |
tree | 7b2fe40a89bf327ea8b9ad8265a6b6f27cacd2a7 /lisp/vc/log-edit.el | |
parent | eb3f1cc8dfe6a96505f1c5f9174b2712998cb52f (diff) | |
parent | 8546720e6f25eb988e8215de6678798053031440 (diff) | |
download | emacs-762f8d96719ba3e8a0e79d8bb99fe8e119fafb3a.tar.gz emacs-762f8d96719ba3e8a0e79d8bb99fe8e119fafb3a.tar.bz2 emacs-762f8d96719ba3e8a0e79d8bb99fe8e119fafb3a.zip |
Merge from mainline.
Diffstat (limited to 'lisp/vc/log-edit.el')
-rw-r--r-- | lisp/vc/log-edit.el | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index 54a2cb4f196..b3f5cfb78f7 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -531,13 +531,25 @@ If you want to abort the commit, simply delete the buffer." (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 @@ This contacts the repository to get the rcstemplate file and 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")))) |