diff options
| author | Glenn Morris | 2016-01-20 20:11:16 -0500 |
|---|---|---|
| committer | Glenn Morris | 2016-01-20 20:11:16 -0500 |
| commit | 9830b81292917f2ec989c8b70b4728e366a9f3f1 (patch) | |
| tree | da82c940b5d105b6fb0cdf01ba7d651a24ff1038 | |
| parent | 4786c02b83a521bb35f8928dac33a884b6ca7cfa (diff) | |
| download | emacs-9830b81292917f2ec989c8b70b4728e366a9f3f1.tar.gz emacs-9830b81292917f2ec989c8b70b4728e366a9f3f1.zip | |
Remove handling of non-string time-stamp formats, obsolete for 20 years.
* lisp/time-stamp.el (time-stamp-format): Doc fix.
(time-stamp-old-format-warn, time-stamp-fconcat): Remove.
(time-stamp-string): Ignore non-string formats.
; * etc/NEWS: Mention this.
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/time-stamp.el | 58 |
2 files changed, 8 insertions, 53 deletions
| @@ -59,6 +59,9 @@ in these situations. | |||
| 59 | 59 | ||
| 60 | *** The kqueue library is integrated for *BSD and Mac OS X machines. | 60 | *** The kqueue library is integrated for *BSD and Mac OS X machines. |
| 61 | 61 | ||
| 62 | --- | ||
| 63 | ** Support for non-string values of `time-stamp-format' has been removed. | ||
| 64 | |||
| 62 | ** Tramp | 65 | ** Tramp |
| 63 | 66 | ||
| 64 | *** New connection method "sg", which allows to edit files under | 67 | *** New connection method "sg", which allows to edit files under |
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index d58942c3a2b..79524fb7280 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el | |||
| @@ -43,10 +43,7 @@ | |||
| 43 | 43 | ||
| 44 | (defcustom time-stamp-format "%:y-%02m-%02d %02H:%02M:%02S %u" | 44 | (defcustom time-stamp-format "%:y-%02m-%02d %02H:%02M:%02S %u" |
| 45 | "Format of the string inserted by \\[time-stamp]. | 45 | "Format of the string inserted by \\[time-stamp]. |
| 46 | The value may be a string or a list. Lists are supported only for | 46 | This is a string, used verbatim except for character sequences beginning |
| 47 | backward compatibility; see variable `time-stamp-old-format-warn'. | ||
| 48 | |||
| 49 | A string is used verbatim except for character sequences beginning | ||
| 50 | with %, as follows. The values of non-numeric formatted items depend | 47 | with %, as follows. The values of non-numeric formatted items depend |
| 51 | on the locale setting recorded in `system-time-locale' and | 48 | on the locale setting recorded in `system-time-locale' and |
| 52 | `locale-coding-system'. The examples here are for the default | 49 | `locale-coding-system'. The examples here are for the default |
| @@ -107,17 +104,6 @@ otherwise would have been updated." | |||
| 107 | :group 'time-stamp | 104 | :group 'time-stamp |
| 108 | :version "19.29") | 105 | :version "19.29") |
| 109 | 106 | ||
| 110 | (defcustom time-stamp-old-format-warn 'ask | ||
| 111 | "Action if `time-stamp-format' is an old-style list. | ||
| 112 | If `error', the format is not used. If `ask', the user is queried about | ||
| 113 | using the time-stamp-format. If `warn', a warning is displayed. | ||
| 114 | If nil, no notification is given." | ||
| 115 | :type '(choice (const :tag "Don't use the format" error) | ||
| 116 | (const ask) | ||
| 117 | (const warn) | ||
| 118 | (const :tag "No notification" nil)) | ||
| 119 | :group 'time-stamp) | ||
| 120 | |||
| 121 | (defcustom time-stamp-time-zone nil | 107 | (defcustom time-stamp-time-zone nil |
| 122 | "The time zone to be used by \\[time-stamp]. | 108 | "The time zone to be used by \\[time-stamp]. |
| 123 | Its format is that of the ZONE argument of the `format-time-string' function," | 109 | Its format is that of the ZONE argument of the `format-time-string' function," |
| @@ -420,26 +406,14 @@ With ARG, turn time stamping on if and only if arg is positive." | |||
| 420 | "Generate the new string to be inserted by \\[time-stamp]. | 406 | "Generate the new string to be inserted by \\[time-stamp]. |
| 421 | Optionally use format TS-FORMAT instead of `time-stamp-format' to | 407 | Optionally use format TS-FORMAT instead of `time-stamp-format' to |
| 422 | format the string." | 408 | format the string." |
| 423 | (or ts-format | 409 | (if (stringp (or ts-format (setq ts-format time-stamp-format))) |
| 424 | (setq ts-format time-stamp-format)) | 410 | (time-stamp--format (time-stamp-string-preprocess ts-format) nil))) |
| 425 | (if (stringp ts-format) | 411 | |
| 426 | (time-stamp--format (time-stamp-string-preprocess ts-format) nil) | ||
| 427 | ;; handle version 1 compatibility | ||
| 428 | (cond ((or (eq time-stamp-old-format-warn 'error) | ||
| 429 | (and (eq time-stamp-old-format-warn 'ask) | ||
| 430 | (not (y-or-n-p "Use non-string time-stamp-format? ")))) | ||
| 431 | (message "Warning: no time-stamp: time-stamp-format not a string") | ||
| 432 | (sit-for 1) | ||
| 433 | nil) | ||
| 434 | (t | ||
| 435 | (cond ((eq time-stamp-old-format-warn 'warn) | ||
| 436 | (message "Obsolescent time-stamp-format type; should be string") | ||
| 437 | (sit-for 1))) | ||
| 438 | (time-stamp-fconcat ts-format " "))))) | ||
| 439 | 412 | ||
| 440 | (defconst time-stamp-no-file "(no file)" | 413 | (defconst time-stamp-no-file "(no file)" |
| 441 | "String to use when the buffer is not associated with a file.") | 414 | "String to use when the buffer is not associated with a file.") |
| 442 | 415 | ||
| 416 | ;;; FIXME This comment was written in 1996! | ||
| 443 | ;;; time-stamp is transitioning to using the new, expanded capabilities | 417 | ;;; time-stamp is transitioning to using the new, expanded capabilities |
| 444 | ;;; of format-time-string. During the process, this function implements | 418 | ;;; of format-time-string. During the process, this function implements |
| 445 | ;;; intermediate, compatible formats and complains about old, soon to | 419 | ;;; intermediate, compatible formats and complains about old, soon to |
| @@ -676,28 +650,6 @@ otherwise the value of the function `system-name'." | |||
| 676 | mail-host-address) | 650 | mail-host-address) |
| 677 | (system-name))) | 651 | (system-name))) |
| 678 | 652 | ||
| 679 | ;;; the rest of this file is for version 1 compatibility | ||
| 680 | |||
| 681 | (defun time-stamp-fconcat (list sep) | ||
| 682 | "Similar to (mapconcat \\='funcall LIST SEP) but LIST allows literals. | ||
| 683 | If an element of LIST is a symbol, it is funcalled to get the string to use; | ||
| 684 | the separator SEP is used between two strings obtained by funcalling a | ||
| 685 | symbol. Otherwise the element itself is inserted; no separator is used | ||
| 686 | around literals." | ||
| 687 | (let ((return-string "") | ||
| 688 | (insert-sep-p nil)) | ||
| 689 | (while list | ||
| 690 | (cond ((symbolp (car list)) | ||
| 691 | (if insert-sep-p | ||
| 692 | (setq return-string (concat return-string sep))) | ||
| 693 | (setq return-string (concat return-string (funcall (car list)))) | ||
| 694 | (setq insert-sep-p t)) | ||
| 695 | (t | ||
| 696 | (setq return-string (concat return-string (car list))) | ||
| 697 | (setq insert-sep-p nil))) | ||
| 698 | (setq list (cdr list))) | ||
| 699 | return-string)) | ||
| 700 | |||
| 701 | (provide 'time-stamp) | 653 | (provide 'time-stamp) |
| 702 | 654 | ||
| 703 | ;;; time-stamp.el ends here | 655 | ;;; time-stamp.el ends here |