Mercurial > emacs
changeset 22508:c9307c229265
(time-stamp): Handle newlines in time-stamp-pattern.
(time-stamp-string-preprocess): Handle more than one numeric arg.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Fri, 19 Jun 1998 16:50:37 +0000 |
parents | f189183483a2 |
children | a57016ec7f14 |
files | lisp/time-stamp.el |
diffstat | 1 files changed, 17 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/time-stamp.el Fri Jun 19 16:01:08 1998 +0000 +++ b/lisp/time-stamp.el Fri Jun 19 16:50:37 1998 +0000 @@ -216,7 +216,7 @@ (ts-end time-stamp-end)) (if (stringp time-stamp-pattern) (progn - (string-match "^\\(\\(-?[0-9]+\\)/\\)?\\([^%]+\\)?\\(.*%[-.,:@+_ #^()0-9]*[A-Za-z%]\\)?\\([^%]+\\)?$" time-stamp-pattern) + (string-match "\\`\\(\\(-?[0-9]+\\)/\\)?\\([^%]+\\)?\\(\\(.\\|\n\\)*%[-.,:@+_ #^()0-9]*[A-Za-z%]\\)?\\([^%]+\\)?\\'" time-stamp-pattern) (and (match-beginning 2) (setq line-limit (string-to-int (match-string 2 time-stamp-pattern)))) @@ -225,8 +225,8 @@ (and (match-beginning 4) (not (string-equal (match-string 4 time-stamp-pattern) "%%")) (setq ts-format (match-string 4 time-stamp-pattern))) - (and (match-beginning 5) - (setq ts-end (match-string 5 time-stamp-pattern))))) + (and (match-beginning 6) + (setq ts-end (match-string 6 time-stamp-pattern))))) (cond ((not (integerp line-limit)) (setq line-limit 8) (message "time-stamp-line-limit is not an integer") @@ -319,7 +319,6 @@ cur-char (prev-char nil) (result "") - field-index field-width field-result alt-form change-case require-padding @@ -332,7 +331,7 @@ (cond ((eq cur-char ?%) ;; eat any additional args to allow for future expansion - (setq alt-form nil change-case nil require-padding nil) + (setq alt-form nil change-case nil require-padding nil field-width "") (while (progn (setq ind (1+ ind)) (setq cur-char (if (< ind fmt-len) @@ -350,23 +349,25 @@ (> paren-level 0)) (setq paren-level (1- paren-level)) (and (> paren-level 0) - (< ind fmt-len))))) + (< ind fmt-len))) + (if (and (<= ?0 cur-char) (>= ?9 cur-char)) + ;; get format width + (let ((field-index ind)) + (while (progn + (setq ind (1+ ind)) + (setq cur-char (if (< ind fmt-len) + (aref format ind) + ?\0)) + (and (<= ?0 cur-char) (>= ?9 cur-char)))) + (setq field-width (substring format field-index ind)) + (setq ind (1- ind)) + t)))) (setq prev-char cur-char) ;; some characters we actually use (cond ((eq cur-char ?:) (setq alt-form t)) ((eq cur-char ?#) (setq change-case t)))) - ;; get format width - (setq field-index ind) - (setq ind (1- ind)) - (while (progn - (setq ind (1+ ind)) - (setq cur-char (if (< ind fmt-len) - (aref format ind) - ?\0)) - (and (<= ?0 cur-char) (>= ?9 cur-char)))) - (setq field-width (substring format field-index ind)) (setq field-result (cond ((eq cur-char ?%)