diff options
| author | Dave Love | 2000-08-15 13:26:16 +0000 |
|---|---|---|
| committer | Dave Love | 2000-08-15 13:26:16 +0000 |
| commit | 918f4ac3cf208f9920c8b2d950ade5b9ce305036 (patch) | |
| tree | f8eb495bcb27b6a05f4b2eb1e32f602e158d71cb | |
| parent | f68446efd37a6ee25e8ed0f14231bfe457aaeb9d (diff) | |
| download | emacs-918f4ac3cf208f9920c8b2d950ade5b9ce305036.tar.gz emacs-918f4ac3cf208f9920c8b2d950ade5b9ce305036.zip | |
(change-log-merge): Doc fix.
(change-log-redate): New command.
| -rw-r--r-- | lisp/add-log.el | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/lisp/add-log.el b/lisp/add-log.el index 8f34c8f1f1e..f2b93b8c047 100644 --- a/lisp/add-log.el +++ b/lisp/add-log.el | |||
| @@ -208,8 +208,7 @@ If nil, use local time.") | |||
| 208 | (now (current-time))) | 208 | (now (current-time))) |
| 209 | (unwind-protect | 209 | (unwind-protect |
| 210 | (progn | 210 | (progn |
| 211 | (set-time-zone-rule | 211 | (set-time-zone-rule change-log-time-zone-rule) |
| 212 | change-log-time-zone-rule) | ||
| 213 | (concat | 212 | (concat |
| 214 | (format-time-string "%Y-%m-%d " now) | 213 | (format-time-string "%Y-%m-%d " now) |
| 215 | (add-log-iso8601-time-zone now))) | 214 | (add-log-iso8601-time-zone now))) |
| @@ -425,7 +424,7 @@ non-nil, otherwise in local time." | |||
| 425 | ;; Delete excess empty lines; make just 2. | 424 | ;; Delete excess empty lines; make just 2. |
| 426 | (while (and (not (eobp)) (looking-at "^\\s *$")) | 425 | (while (and (not (eobp)) (looking-at "^\\s *$")) |
| 427 | (delete-region (point) (line-beginning-position 2))) | 426 | (delete-region (point) (line-beginning-position 2))) |
| 428 | (insert "\n\n") | 427 | (insert-char ?\n 2) |
| 429 | (forward-line -2) | 428 | (forward-line -2) |
| 430 | (indent-relative-maybe)) | 429 | (indent-relative-maybe)) |
| 431 | (t | 430 | (t |
| @@ -435,10 +434,11 @@ non-nil, otherwise in local time." | |||
| 435 | (forward-line 1)) | 434 | (forward-line 1)) |
| 436 | (while (and (not (eobp)) (looking-at "^\\s *$")) | 435 | (while (and (not (eobp)) (looking-at "^\\s *$")) |
| 437 | (delete-region (point) (line-beginning-position 2))) | 436 | (delete-region (point) (line-beginning-position 2))) |
| 438 | (insert "\n\n\n") | 437 | (insert-char ?\n 3) |
| 439 | (forward-line -2) | 438 | (forward-line -2) |
| 440 | (indent-to left-margin) | 439 | (indent-to left-margin) |
| 441 | (insert "* " (or entry "")))) | 440 | (insert "* ") |
| 441 | (if entry (insert entry)))) | ||
| 442 | ;; Now insert the function name, if we have one. | 442 | ;; Now insert the function name, if we have one. |
| 443 | ;; Point is at the entry for this file, | 443 | ;; Point is at the entry for this file, |
| 444 | ;; either at the end of the line or at the first blank line. | 444 | ;; either at the end of the line or at the first blank line. |
| @@ -811,11 +811,8 @@ Point is assumed to be at the start of the entry." | |||
| 811 | Both must be found in Change Log mode (since the merging depends on | 811 | Both must be found in Change Log mode (since the merging depends on |
| 812 | the appropriate motion commands). | 812 | the appropriate motion commands). |
| 813 | 813 | ||
| 814 | Entries are inserted in chronological order. | 814 | Entries are inserted in chronological order. Both the current and |
| 815 | 815 | old-style time formats for entries are supported." | |
| 816 | Both the current and old-style time formats for entries are supported, | ||
| 817 | so this command could be used to convert old-style logs by merging | ||
| 818 | with an empty log." | ||
| 819 | (interactive "*fLog file name to merge: ") | 816 | (interactive "*fLog file name to merge: ") |
| 820 | (if (not (eq major-mode 'change-log-mode)) | 817 | (if (not (eq major-mode 'change-log-mode)) |
| 821 | (error "Not in Change Log mode")) | 818 | (error "Not in Change Log mode")) |
| @@ -849,6 +846,29 @@ with an empty log." | |||
| 849 | (goto-char (point-max)) | 846 | (goto-char (point-max)) |
| 850 | (point))))))))) | 847 | (point))))))))) |
| 851 | 848 | ||
| 849 | ;;;###autoload | ||
| 850 | (defun change-log-redate () | ||
| 851 | "Fix any old-style date entries in the current log file to default format." | ||
| 852 | (interactive) | ||
| 853 | (require 'timezone) | ||
| 854 | (save-excursion | ||
| 855 | (goto-char (point-min)) | ||
| 856 | (while (re-search-forward "^\\sw.........[0-9:+ ]*" nil t) | ||
| 857 | (unless (= 12 (- (match-end 0) (match-beginning 0))) | ||
| 858 | (let* ((date (save-match-data | ||
| 859 | (timezone-fix-time (match-string 0) nil nil))) | ||
| 860 | (zone (if (consp (aref date 6)) | ||
| 861 | (nth 1 (aref date 6))))) | ||
| 862 | (replace-match (format-time-string | ||
| 863 | "%Y-%m-%d " | ||
| 864 | (encode-time (aref date 5) | ||
| 865 | (aref date 4) | ||
| 866 | (aref date 3) | ||
| 867 | (aref date 2) | ||
| 868 | (aref date 1) | ||
| 869 | (aref date 0) | ||
| 870 | zone)))))))) | ||
| 871 | |||
| 852 | (provide 'add-log) | 872 | (provide 'add-log) |
| 853 | 873 | ||
| 854 | ;;; add-log.el ends here | 874 | ;;; add-log.el ends here |