Mercurial > emacs
changeset 30809:3aa7c156087a
(change-log-merge): Doc fix.
(change-log-redate): New command.
author | Dave Love <fx@gnu.org> |
---|---|
date | Tue, 15 Aug 2000 13:26:16 +0000 |
parents | fa45a01185c0 |
children | 6c6b0162bae2 |
files | lisp/add-log.el |
diffstat | 1 files changed, 30 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/add-log.el Tue Aug 15 13:22:09 2000 +0000 +++ b/lisp/add-log.el Tue Aug 15 13:26:16 2000 +0000 @@ -208,8 +208,7 @@ (now (current-time))) (unwind-protect (progn - (set-time-zone-rule - change-log-time-zone-rule) + (set-time-zone-rule change-log-time-zone-rule) (concat (format-time-string "%Y-%m-%d " now) (add-log-iso8601-time-zone now))) @@ -425,7 +424,7 @@ ;; Delete excess empty lines; make just 2. (while (and (not (eobp)) (looking-at "^\\s *$")) (delete-region (point) (line-beginning-position 2))) - (insert "\n\n") + (insert-char ?\n 2) (forward-line -2) (indent-relative-maybe)) (t @@ -435,10 +434,11 @@ (forward-line 1)) (while (and (not (eobp)) (looking-at "^\\s *$")) (delete-region (point) (line-beginning-position 2))) - (insert "\n\n\n") + (insert-char ?\n 3) (forward-line -2) (indent-to left-margin) - (insert "* " (or entry "")))) + (insert "* ") + (if entry (insert entry)))) ;; Now insert the function name, if we have one. ;; Point is at the entry for this file, ;; either at the end of the line or at the first blank line. @@ -811,11 +811,8 @@ Both must be found in Change Log mode (since the merging depends on the appropriate motion commands). -Entries are inserted in chronological order. - -Both the current and old-style time formats for entries are supported, -so this command could be used to convert old-style logs by merging -with an empty log." +Entries are inserted in chronological order. Both the current and +old-style time formats for entries are supported." (interactive "*fLog file name to merge: ") (if (not (eq major-mode 'change-log-mode)) (error "Not in Change Log mode")) @@ -849,6 +846,29 @@ (goto-char (point-max)) (point))))))))) +;;;###autoload +(defun change-log-redate () + "Fix any old-style date entries in the current log file to default format." + (interactive) + (require 'timezone) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "^\\sw.........[0-9:+ ]*" nil t) + (unless (= 12 (- (match-end 0) (match-beginning 0))) + (let* ((date (save-match-data + (timezone-fix-time (match-string 0) nil nil))) + (zone (if (consp (aref date 6)) + (nth 1 (aref date 6))))) + (replace-match (format-time-string + "%Y-%m-%d " + (encode-time (aref date 5) + (aref date 4) + (aref date 3) + (aref date 2) + (aref date 1) + (aref date 0) + zone)))))))) + (provide 'add-log) ;;; add-log.el ends here