diff options
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/vc/log-edit.el | 17 |
2 files changed, 19 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ae36e174b96..6e13e1e836d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2011-04-08 Glenn Morris <rgm@gnu.org> | 1 | 2011-04-08 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * vc/log-edit.el (log-edit-empty-buffer-p): New function. | ||
| 4 | (log-edit-insert-cvs-template, log-edit-insert-cvs-rcstemplate): | ||
| 5 | Use log-edit-empty-buffer-p. (Bug#7598) | ||
| 6 | |||
| 3 | * net/rlogin.el (rlogin-process-connection-type): Simplify. | 7 | * net/rlogin.el (rlogin-process-connection-type): Simplify. |
| 4 | (rlogin-mode-map): Initialize in the defvar. | 8 | (rlogin-mode-map): Initialize in the defvar. |
| 5 | (rlogin): Use ignore-errors. | 9 | (rlogin): Use ignore-errors. |
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." | |||
| 531 | (shrink-window-if-larger-than-buffer) | 531 | (shrink-window-if-larger-than-buffer) |
| 532 | (selected-window))))) | 532 | (selected-window))))) |
| 533 | 533 | ||
| 534 | (defun log-edit-empty-buffer-p () | ||
| 535 | "Return non-nil if the buffer is \"empty\"." | ||
| 536 | (or (= (point-min) (point-max)) | ||
| 537 | (save-excursion | ||
| 538 | (goto-char (point-min)) | ||
| 539 | (while (and (looking-at "^\\(Summary: \\)?$") | ||
| 540 | (zerop (forward-line 1)))) | ||
| 541 | (eobp)))) | ||
| 542 | |||
| 534 | (defun log-edit-insert-cvs-template () | 543 | (defun log-edit-insert-cvs-template () |
| 535 | "Insert the template specified by the CVS administrator, if any. | 544 | "Insert the template specified by the CVS administrator, if any. |
| 536 | This simply uses the local CVS/Template file." | 545 | This simply uses the local CVS/Template file." |
| 537 | (interactive) | 546 | (interactive) |
| 538 | (when (or (called-interactively-p 'interactive) | 547 | (when (or (called-interactively-p 'interactive) |
| 539 | (= (point-min) (point-max))) | 548 | (log-edit-empty-buffer-p)) |
| 549 | ;; Should the template take precedence over an empty Summary:, | ||
| 550 | ;; ie should we first erase the buffer? | ||
| 540 | (when (file-readable-p "CVS/Template") | 551 | (when (file-readable-p "CVS/Template") |
| 552 | (goto-char (point-max)) | ||
| 541 | (insert-file-contents "CVS/Template")))) | 553 | (insert-file-contents "CVS/Template")))) |
| 542 | 554 | ||
| 543 | (defun log-edit-insert-cvs-rcstemplate () | 555 | (defun log-edit-insert-cvs-rcstemplate () |
| @@ -546,8 +558,9 @@ This contacts the repository to get the rcstemplate file and | |||
| 546 | can thus take some time." | 558 | can thus take some time." |
| 547 | (interactive) | 559 | (interactive) |
| 548 | (when (or (called-interactively-p 'interactive) | 560 | (when (or (called-interactively-p 'interactive) |
| 549 | (= (point-min) (point-max))) | 561 | (log-edit-empty-buffer-p)) |
| 550 | (when (file-readable-p "CVS/Root") | 562 | (when (file-readable-p "CVS/Root") |
| 563 | (goto-char (point-max)) | ||
| 551 | ;; Ignore the stderr stuff, even if it's an error. | 564 | ;; Ignore the stderr stuff, even if it's an error. |
| 552 | (call-process "cvs" nil '(t nil) nil | 565 | (call-process "cvs" nil '(t nil) nil |
| 553 | "checkout" "-p" "CVSROOT/rcstemplate")))) | 566 | "checkout" "-p" "CVSROOT/rcstemplate")))) |