diff options
| author | Richard M. Stallman | 1999-02-06 05:00:54 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1999-02-06 05:00:54 +0000 |
| commit | f7769aa59edf082f925afdd8226f46cd78f6aa0e (patch) | |
| tree | 6e1ad1719022b2745c934b5704afe7187a25465a | |
| parent | fb9cc9cc6ed485ee141e6e1116920f111a267d80 (diff) | |
| download | emacs-f7769aa59edf082f925afdd8226f46cd78f6aa0e.tar.gz emacs-f7769aa59edf082f925afdd8226f46cd78f6aa0e.zip | |
(time-stamp-format): Format doc tighter.
(time-stamp-line-limit): 0 searches the entire buffer (careful!).
(time-stamp): don't re-write the time stamp if it didn't change.
| -rw-r--r-- | lisp/time-stamp.el | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index b7a85400d72..a9c8b1d31f8 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | ;; Copyright 1989, 1993, 1994, 1995, 1997 Free Software Foundation, Inc. | 3 | ;; Copyright 1989, 1993, 1994, 1995, 1997 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Maintainer's Time-stamp: <1998-03-04 14:14:19 gildea> | 5 | ;; Maintainer's Time-stamp: <1999-01-06 11:06:03 gildea> |
| 6 | ;; Maintainer: Stephen Gildea <gildea@alum.mit.edu> | 6 | ;; Maintainer: Stephen Gildea <gildea@alum.mit.edu> |
| 7 | ;; Keywords: tools | 7 | ;; Keywords: tools |
| 8 | 8 | ||
| @@ -68,8 +68,7 @@ Non-date items: | |||
| 68 | %% a literal percent character: `%' | 68 | %% a literal percent character: `%' |
| 69 | %f file name without directory %F gives absolute pathname | 69 | %f file name without directory %F gives absolute pathname |
| 70 | %s system name | 70 | %s system name |
| 71 | %u user's login name | 71 | %u user's login name %U user's full name |
| 72 | %U user's full name | ||
| 73 | %h mail host name | 72 | %h mail host name |
| 74 | 73 | ||
| 75 | Decimal digits between the % and the type character specify the | 74 | Decimal digits between the % and the type character specify the |
| @@ -129,7 +128,8 @@ Format is the same as that used by the environment variable TZ on your system." | |||
| 129 | "Lines of a file searched; positive counts from start, negative from end. | 128 | "Lines of a file searched; positive counts from start, negative from end. |
| 130 | The patterns `time-stamp-start' and `time-stamp-end' must be found on one | 129 | The patterns `time-stamp-start' and `time-stamp-end' must be found on one |
| 131 | of the first (last) `time-stamp-line-limit' lines of the file for the | 130 | of the first (last) `time-stamp-line-limit' lines of the file for the |
| 132 | file to be time-stamped by \\[time-stamp]. | 131 | file to be time-stamped by \\[time-stamp]. A value of 0 searches the |
| 132 | entire buffer (use with care). | ||
| 133 | 133 | ||
| 134 | Do not change `time-stamp-line-limit', `time-stamp-start', or | 134 | Do not change `time-stamp-line-limit', `time-stamp-start', or |
| 135 | `time-stamp-end' for yourself or you will be incompatible | 135 | `time-stamp-end' for yourself or you will be incompatible |
| @@ -239,10 +239,13 @@ and `time-stamp-end' control finding the template." | |||
| 239 | (goto-char (setq start (point-min))) | 239 | (goto-char (setq start (point-min))) |
| 240 | (forward-line line-limit) | 240 | (forward-line line-limit) |
| 241 | (setq search-limit (point))) | 241 | (setq search-limit (point))) |
| 242 | (t | 242 | ((< line-limit 0) |
| 243 | (goto-char (setq search-limit (point-max))) | 243 | (goto-char (setq search-limit (point-max))) |
| 244 | (forward-line line-limit) | 244 | (forward-line line-limit) |
| 245 | (setq start (point)))) | 245 | (setq start (point))) |
| 246 | (t ;0 => no limit (use with care!) | ||
| 247 | (setq start (point-min)) | ||
| 248 | (setq search-limit (point-max)))) | ||
| 246 | (goto-char start) | 249 | (goto-char start) |
| 247 | (while (and (< (point) search-limit) | 250 | (while (and (< (point) search-limit) |
| 248 | (not end) | 251 | (not end) |
| @@ -269,7 +272,9 @@ and `time-stamp-end' control finding the template." | |||
| 269 | (sit-for 1)) | 272 | (sit-for 1)) |
| 270 | (t | 273 | (t |
| 271 | (let ((new-time-stamp (time-stamp-string ts-format))) | 274 | (let ((new-time-stamp (time-stamp-string ts-format))) |
| 272 | (if (stringp new-time-stamp) | 275 | (if (and (stringp new-time-stamp) |
| 276 | (not (string-equal (buffer-substring start end) | ||
| 277 | new-time-stamp))) | ||
| 273 | (save-excursion | 278 | (save-excursion |
| 274 | (save-restriction | 279 | (save-restriction |
| 275 | (widen) | 280 | (widen) |