diff options
| author | Richard M. Stallman | 1997-08-24 03:32:38 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-08-24 03:32:38 +0000 |
| commit | 95772e852d156374a4c83b2d3322d36a731f530e (patch) | |
| tree | 95beaf291a27d84c85dae4f897b9567408f46f2a /lisp | |
| parent | 5ed14933028357c40c160bd1b0fa66def9012b6c (diff) | |
| download | emacs-95772e852d156374a4c83b2d3322d36a731f530e.tar.gz emacs-95772e852d156374a4c83b2d3322d36a731f530e.zip | |
(time-stamp-time-zone): New variable.
(time-stamp-string): Use that time zone.
(time-stamp-active, time-stamp-warn-inactive)
(time-stamp-old-format-warn): Definitions moved.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/time-stamp.el | 68 |
1 files changed, 41 insertions, 27 deletions
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index a6aeb2a4d55..d8a279e0082 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: <1997-06-08 16:45:41 gildea> | 5 | ;; Maintainer's Time-stamp: <1997-08-07 14:46:50 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 | ||
| @@ -42,30 +42,6 @@ | |||
| 42 | :group 'data | 42 | :group 'data |
| 43 | :group 'extensions) | 43 | :group 'extensions) |
| 44 | 44 | ||
| 45 | (defcustom time-stamp-active t | ||
| 46 | "*Non-nil to enable time-stamping of buffers by \\[time-stamp]. | ||
| 47 | Can be toggled by \\[time-stamp-toggle-active]. | ||
| 48 | See also the variable `time-stamp-warn-inactive'." | ||
| 49 | :type 'boolean | ||
| 50 | :group 'time-stamp) | ||
| 51 | |||
| 52 | (defcustom time-stamp-warn-inactive t | ||
| 53 | "Non-nil to have \\[time-stamp] warn if a buffer did not get time-stamped. | ||
| 54 | A warning is printed if `time-stamp-active' is nil and the buffer contains | ||
| 55 | a time stamp template that would otherwise have been updated." | ||
| 56 | :type 'boolean | ||
| 57 | :group 'time-stamp) | ||
| 58 | |||
| 59 | (defcustom time-stamp-old-format-warn 'ask | ||
| 60 | "Action to take if `time-stamp-format' is an old-style list. | ||
| 61 | If `error', the format is not used. If `ask', the user is queried about | ||
| 62 | using the time-stamp-format. If `warn', a warning is displayed. | ||
| 63 | If nil, no notification is given." | ||
| 64 | :type '(choice (const :tag "No notification" nil) | ||
| 65 | (const :tag "Don't use the format" error) | ||
| 66 | (const ask) (const warn)) | ||
| 67 | :group 'time-stamp) | ||
| 68 | |||
| 69 | (defcustom time-stamp-format "%:y-%02m-%02d %02H:%02M:%02S %u" | 45 | (defcustom time-stamp-format "%:y-%02m-%02d %02H:%02M:%02S %u" |
| 70 | "*Format of the string inserted by \\[time-stamp]. | 46 | "*Format of the string inserted by \\[time-stamp]. |
| 71 | The value may be a string or a list. Lists are supported only for | 47 | The value may be a string or a list. Lists are supported only for |
| @@ -110,6 +86,35 @@ historical default." | |||
| 110 | :type 'string | 86 | :type 'string |
| 111 | :group 'time-stamp) | 87 | :group 'time-stamp) |
| 112 | 88 | ||
| 89 | (defcustom time-stamp-active t | ||
| 90 | "*Non-nil to enable time-stamping of buffers by \\[time-stamp]. | ||
| 91 | Can be toggled by \\[time-stamp-toggle-active]. | ||
| 92 | See also the variable `time-stamp-warn-inactive'." | ||
| 93 | :type 'boolean | ||
| 94 | :group 'time-stamp) | ||
| 95 | |||
| 96 | (defcustom time-stamp-warn-inactive t | ||
| 97 | "Non-nil to have \\[time-stamp] warn if a buffer did not get time-stamped. | ||
| 98 | A warning is printed if `time-stamp-active' is nil and the buffer contains | ||
| 99 | a time stamp template that would otherwise have been updated." | ||
| 100 | :type 'boolean | ||
| 101 | :group 'time-stamp) | ||
| 102 | |||
| 103 | (defcustom time-stamp-old-format-warn 'ask | ||
| 104 | "Action to take if `time-stamp-format' is an old-style list. | ||
| 105 | If `error', the format is not used. If `ask', the user is queried about | ||
| 106 | using the time-stamp-format. If `warn', a warning is displayed. | ||
| 107 | If nil, no notification is given." | ||
| 108 | :type '(choice (const :tag "No notification" nil) | ||
| 109 | (const :tag "Don't use the format" error) | ||
| 110 | (const ask) (const warn)) | ||
| 111 | :group 'time-stamp) | ||
| 112 | |||
| 113 | (defcustom time-stamp-time-zone nil | ||
| 114 | "If non-nil, a string naming the timezone to be used by \\[time-stamp]. | ||
| 115 | Format is the same as that used by the environment variable TZ on your system." | ||
| 116 | :type 'string | ||
| 117 | :group 'time-stamp) | ||
| 113 | 118 | ||
| 114 | 119 | ||
| 115 | ;;; Do not change time-stamp-line-limit, time-stamp-start, or | 120 | ;;; Do not change time-stamp-line-limit, time-stamp-start, or |
| @@ -456,13 +461,22 @@ The new forms being recommended now will continue to work then.") | |||
| 456 | "The following obsolescent time-stamp-format construct(s) were found:\n\n"))) | 461 | "The following obsolescent time-stamp-format construct(s) were found:\n\n"))) |
| 457 | (insert "\"" old-form "\" -- use " new-form "\n")) | 462 | (insert "\"" old-form "\" -- use " new-form "\n")) |
| 458 | (display-buffer "*Time-stamp-compatibility*")))) | 463 | (display-buffer "*Time-stamp-compatibility*")))) |
| 459 | 464 | ||
| 460 | 465 | ||
| 461 | 466 | ||
| 462 | (defun time-stamp-string () | 467 | (defun time-stamp-string () |
| 463 | "Generate the new string to be inserted by \\[time-stamp]." | 468 | "Generate the new string to be inserted by \\[time-stamp]." |
| 464 | (if (stringp time-stamp-format) | 469 | (if (stringp time-stamp-format) |
| 465 | (format-time-string (time-stamp-string-preprocess time-stamp-format)) | 470 | (if (stringp time-stamp-time-zone) |
| 471 | (let ((real-time-zone (getenv "TZ"))) | ||
| 472 | (unwind-protect | ||
| 473 | (progn | ||
| 474 | (setenv "TZ" time-stamp-time-zone) | ||
| 475 | (format-time-string | ||
| 476 | (time-stamp-string-preprocess time-stamp-format))) | ||
| 477 | (setenv "TZ" real-time-zone))) | ||
| 478 | (format-time-string | ||
| 479 | (time-stamp-string-preprocess time-stamp-format))) | ||
| 466 | ;; handle version 1 compatibility | 480 | ;; handle version 1 compatibility |
| 467 | (cond ((or (eq time-stamp-old-format-warn 'error) | 481 | (cond ((or (eq time-stamp-old-format-warn 'error) |
| 468 | (and (eq time-stamp-old-format-warn 'ask) | 482 | (and (eq time-stamp-old-format-warn 'ask) |