diff options
| author | Karl Heuer | 1998-06-19 16:50:37 +0000 |
|---|---|---|
| committer | Karl Heuer | 1998-06-19 16:50:37 +0000 |
| commit | 15ceaba4b3370a90601ec97d72cc2b81f22f6e4f (patch) | |
| tree | b13371506ff792471254e683c35a6b7868230190 /lisp | |
| parent | 9d843bef01373c831809fb3b773d1ddd6d008cf1 (diff) | |
| download | emacs-15ceaba4b3370a90601ec97d72cc2b81f22f6e4f.tar.gz emacs-15ceaba4b3370a90601ec97d72cc2b81f22f6e4f.zip | |
(time-stamp): Handle newlines in time-stamp-pattern.
(time-stamp-string-preprocess): Handle more than one numeric arg.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/time-stamp.el | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index 7eab5a7a794..fd41a345ab6 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el | |||
| @@ -216,7 +216,7 @@ and `time-stamp-end' control finding the template." | |||
| 216 | (ts-end time-stamp-end)) | 216 | (ts-end time-stamp-end)) |
| 217 | (if (stringp time-stamp-pattern) | 217 | (if (stringp time-stamp-pattern) |
| 218 | (progn | 218 | (progn |
| 219 | (string-match "^\\(\\(-?[0-9]+\\)/\\)?\\([^%]+\\)?\\(.*%[-.,:@+_ #^()0-9]*[A-Za-z%]\\)?\\([^%]+\\)?$" time-stamp-pattern) | 219 | (string-match "\\`\\(\\(-?[0-9]+\\)/\\)?\\([^%]+\\)?\\(\\(.\\|\n\\)*%[-.,:@+_ #^()0-9]*[A-Za-z%]\\)?\\([^%]+\\)?\\'" time-stamp-pattern) |
| 220 | (and (match-beginning 2) | 220 | (and (match-beginning 2) |
| 221 | (setq line-limit | 221 | (setq line-limit |
| 222 | (string-to-int (match-string 2 time-stamp-pattern)))) | 222 | (string-to-int (match-string 2 time-stamp-pattern)))) |
| @@ -225,8 +225,8 @@ and `time-stamp-end' control finding the template." | |||
| 225 | (and (match-beginning 4) | 225 | (and (match-beginning 4) |
| 226 | (not (string-equal (match-string 4 time-stamp-pattern) "%%")) | 226 | (not (string-equal (match-string 4 time-stamp-pattern) "%%")) |
| 227 | (setq ts-format (match-string 4 time-stamp-pattern))) | 227 | (setq ts-format (match-string 4 time-stamp-pattern))) |
| 228 | (and (match-beginning 5) | 228 | (and (match-beginning 6) |
| 229 | (setq ts-end (match-string 5 time-stamp-pattern))))) | 229 | (setq ts-end (match-string 6 time-stamp-pattern))))) |
| 230 | (cond ((not (integerp line-limit)) | 230 | (cond ((not (integerp line-limit)) |
| 231 | (setq line-limit 8) | 231 | (setq line-limit 8) |
| 232 | (message "time-stamp-line-limit is not an integer") | 232 | (message "time-stamp-line-limit is not an integer") |
| @@ -319,7 +319,6 @@ With arg, turn time stamping on if and only if arg is positive." | |||
| 319 | cur-char | 319 | cur-char |
| 320 | (prev-char nil) | 320 | (prev-char nil) |
| 321 | (result "") | 321 | (result "") |
| 322 | field-index | ||
| 323 | field-width | 322 | field-width |
| 324 | field-result | 323 | field-result |
| 325 | alt-form change-case require-padding | 324 | alt-form change-case require-padding |
| @@ -332,7 +331,7 @@ With arg, turn time stamping on if and only if arg is positive." | |||
| 332 | (cond | 331 | (cond |
| 333 | ((eq cur-char ?%) | 332 | ((eq cur-char ?%) |
| 334 | ;; eat any additional args to allow for future expansion | 333 | ;; eat any additional args to allow for future expansion |
| 335 | (setq alt-form nil change-case nil require-padding nil) | 334 | (setq alt-form nil change-case nil require-padding nil field-width "") |
| 336 | (while (progn | 335 | (while (progn |
| 337 | (setq ind (1+ ind)) | 336 | (setq ind (1+ ind)) |
| 338 | (setq cur-char (if (< ind fmt-len) | 337 | (setq cur-char (if (< ind fmt-len) |
| @@ -350,23 +349,25 @@ With arg, turn time stamping on if and only if arg is positive." | |||
| 350 | (> paren-level 0)) | 349 | (> paren-level 0)) |
| 351 | (setq paren-level (1- paren-level)) | 350 | (setq paren-level (1- paren-level)) |
| 352 | (and (> paren-level 0) | 351 | (and (> paren-level 0) |
| 353 | (< ind fmt-len))))) | 352 | (< ind fmt-len))) |
| 353 | (if (and (<= ?0 cur-char) (>= ?9 cur-char)) | ||
| 354 | ;; get format width | ||
| 355 | (let ((field-index ind)) | ||
| 356 | (while (progn | ||
| 357 | (setq ind (1+ ind)) | ||
| 358 | (setq cur-char (if (< ind fmt-len) | ||
| 359 | (aref format ind) | ||
| 360 | ?\0)) | ||
| 361 | (and (<= ?0 cur-char) (>= ?9 cur-char)))) | ||
| 362 | (setq field-width (substring format field-index ind)) | ||
| 363 | (setq ind (1- ind)) | ||
| 364 | t)))) | ||
| 354 | (setq prev-char cur-char) | 365 | (setq prev-char cur-char) |
| 355 | ;; some characters we actually use | 366 | ;; some characters we actually use |
| 356 | (cond ((eq cur-char ?:) | 367 | (cond ((eq cur-char ?:) |
| 357 | (setq alt-form t)) | 368 | (setq alt-form t)) |
| 358 | ((eq cur-char ?#) | 369 | ((eq cur-char ?#) |
| 359 | (setq change-case t)))) | 370 | (setq change-case t)))) |
| 360 | ;; get format width | ||
| 361 | (setq field-index ind) | ||
| 362 | (setq ind (1- ind)) | ||
| 363 | (while (progn | ||
| 364 | (setq ind (1+ ind)) | ||
| 365 | (setq cur-char (if (< ind fmt-len) | ||
| 366 | (aref format ind) | ||
| 367 | ?\0)) | ||
| 368 | (and (<= ?0 cur-char) (>= ?9 cur-char)))) | ||
| 369 | (setq field-width (substring format field-index ind)) | ||
| 370 | (setq field-result | 371 | (setq field-result |
| 371 | (cond | 372 | (cond |
| 372 | ((eq cur-char ?%) | 373 | ((eq cur-char ?%) |