]> code.delx.au - gnu-emacs/commitdiff
Fix error in add-change-log-entry when the entry has no newline
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 24 Feb 2016 02:08:48 +0000 (13:08 +1100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 24 Feb 2016 02:08:48 +0000 (13:08 +1100)
* lisp/vc/add-log.el (add-change-log-entry): The entry in the
ChangeLog may end without a new line starting with blanks.

lisp/vc/add-log.el

index 112bc7bd9a139930ee6acbb9c7efcdf20cac463b..d6c1fc203db9874276d1767ace6e9c3f63f12ddf 100644 (file)
@@ -911,8 +911,10 @@ non-nil, otherwise in local time."
                              "\\(\\s \\|[(),:]\\)")
                      bound t)))
              ;; Add to the existing item for the same file.
-             (re-search-forward "^\\s *$\\|^\\s \\*")
-             (goto-char (match-beginning 0))
+             (if (re-search-forward "^\\s *$\\|^\\s \\*" nil t)
+                 (goto-char (match-beginning 0))
+               (goto-char (point-max))
+               (insert "\n"))
              ;; Delete excess empty lines; make just 2.
              (while (and (not (eobp)) (looking-at "^\\s *$"))
                (delete-region (point) (line-beginning-position 2)))