diff options
| author | Karl Heuer | 1995-05-30 21:20:09 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-05-30 21:20:09 +0000 |
| commit | fe8287c6fa15c482d965d4acdd1d3adeb16dc2b1 (patch) | |
| tree | d5ffa7a85ec1567c0b7ba84cf0c50c18df42a95d | |
| parent | 94bb7f9b4fe4870d5064fd7ddd4a44d5cb296b7d (diff) | |
| download | emacs-fe8287c6fa15c482d965d4acdd1d3adeb16dc2b1.tar.gz emacs-fe8287c6fa15c482d965d4acdd1d3adeb16dc2b1.zip | |
(time-stamp): only warn about time-stamping
being disabled if found a time-stamp that won't get updated.
| -rw-r--r-- | lisp/time-stamp.el | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index fb4c3a3787f..37b74b7008f 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; time-stamp.el --- Maintain last change time stamps in files edited by Emacs | 1 | ;;; time-stamp.el --- Maintain last change time stamps in files edited by Emacs |
| 2 | ;;; Copyright 1989, 1993, 1994, 1995 Free Software Foundation, Inc. | 2 | ;;; Copyright 1989, 1993, 1994, 1995 Free Software Foundation, Inc. |
| 3 | ;;; Maintainer's Time-stamp: <95/05/30 13:28:56 gildea> | ||
| 3 | 4 | ||
| 4 | ;; Maintainer: Stephen Gildea <gildea@lcs.mit.edu> | 5 | ;; Maintainer: Stephen Gildea <gildea@lcs.mit.edu> |
| 5 | ;; Gildea's Last Time-stamp: <95/04/13 13:38:48 gildea> | ||
| 6 | ;; Keywords: tools | 6 | ;; Keywords: tools |
| 7 | 7 | ||
| 8 | ;; This file is free software; you can redistribute it and/or modify | 8 | ;; This file is free software; you can redistribute it and/or modify |
| @@ -48,6 +48,7 @@ | |||
| 48 | ;;; Originally based on the 19 Dec 88 version of | 48 | ;;; Originally based on the 19 Dec 88 version of |
| 49 | ;;; date.el by John Sturdy <mcvax!harlqn.co.uk!jcgs@uunet.uu.net> | 49 | ;;; date.el by John Sturdy <mcvax!harlqn.co.uk!jcgs@uunet.uu.net> |
| 50 | ;;; version 2, January 1995: replaced functions with %-escapes | 50 | ;;; version 2, January 1995: replaced functions with %-escapes |
| 51 | ;;; $Id: time-stamp.el,v 1.1 95/05/30 17:57:24 gildea Exp $ | ||
| 51 | 52 | ||
| 52 | ;;; Code: | 53 | ;;; Code: |
| 53 | 54 | ||
| @@ -126,23 +127,26 @@ The format of the time stamp is determined by the variable time-stamp-format. | |||
| 126 | The variables time-stamp-line-limit, time-stamp-start, and time-stamp-end | 127 | The variables time-stamp-line-limit, time-stamp-start, and time-stamp-end |
| 127 | control finding the template." | 128 | control finding the template." |
| 128 | (interactive) | 129 | (interactive) |
| 129 | (if time-stamp-active | 130 | (let ((case-fold-search nil) |
| 130 | (let ((case-fold-search nil)) | 131 | (need-to-warn nil)) |
| 131 | (if (and (stringp time-stamp-start) | 132 | (if (and (stringp time-stamp-start) |
| 132 | (stringp time-stamp-end)) | 133 | (stringp time-stamp-end)) |
| 133 | (save-excursion | 134 | (save-excursion |
| 134 | (save-restriction | 135 | (save-restriction |
| 135 | (widen) | 136 | (widen) |
| 136 | (goto-char (point-min)) | 137 | (goto-char (point-min)) |
| 137 | (if (re-search-forward time-stamp-start | 138 | (if (re-search-forward time-stamp-start |
| 138 | (save-excursion | 139 | (save-excursion |
| 139 | (forward-line time-stamp-line-limit) | 140 | (forward-line time-stamp-line-limit) |
| 140 | (point)) | 141 | (point)) |
| 141 | t) | 142 | t) |
| 142 | (let ((start (point))) | 143 | (let ((start (point))) |
| 143 | (if (re-search-forward time-stamp-end | 144 | (if (re-search-forward time-stamp-end |
| 144 | (save-excursion (end-of-line) (point)) | 145 | (save-excursion |
| 145 | t) | 146 | (end-of-line) |
| 147 | (point)) | ||
| 148 | t) | ||
| 149 | (if time-stamp-active | ||
| 146 | (let ((end (match-beginning 0))) | 150 | (let ((end (match-beginning 0))) |
| 147 | (delete-region start end) | 151 | (delete-region start end) |
| 148 | (goto-char start) | 152 | (goto-char start) |
| @@ -151,11 +155,17 @@ control finding the template." | |||
| 151 | ;; remove any tabs used to format the time stamp | 155 | ;; remove any tabs used to format the time stamp |
| 152 | (goto-char start) | 156 | (goto-char start) |
| 153 | (if (search-forward "\t" end t) | 157 | (if (search-forward "\t" end t) |
| 154 | (untabify start end)))))))) | 158 | (untabify start end))) |
| 155 | ;; don't signal an error in a write-file-hook | 159 | (if time-stamp-warn-inactive |
| 156 | (message "time-stamp-start or time-stamp-end is not a string"))) | 160 | ;; do the actual warning outside save-excursion |
| 157 | (if time-stamp-warn-inactive | 161 | (setq need-to-warn t)))))))) |
| 158 | (message "Did not time-stamp buffer."))) | 162 | ;; don't signal an error in a write-file-hook |
| 163 | (message "time-stamp-start or time-stamp-end is not a string") | ||
| 164 | (sit-for 1)) | ||
| 165 | (if need-to-warn | ||
| 166 | (progn | ||
| 167 | (message "Warning: did not time-stamp buffer.") | ||
| 168 | (sit-for 1)))) | ||
| 159 | ;; be sure to return nil so can be used on write-file-hooks | 169 | ;; be sure to return nil so can be used on write-file-hooks |
| 160 | nil) | 170 | nil) |
| 161 | 171 | ||