comparison lisp/time-stamp.el @ 32874:12f068b4d5ac

(time-stamp-string-preprocess): Fix a wrong type argument error.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 25 Oct 2000 12:06:41 +0000
parents 08bfb5555d7b
children ccf845685d1c
comparison
equal deleted inserted replaced
32873:1dbdec58e580 32874:12f068b4d5ac
1 ;;; time-stamp.el --- Maintain last change time stamps in files edited by Emacs 1 ;;; time-stamp.el --- Maintain last change time stamps in files edited by Emacs
2 2
3 ;; Copyright 1989, 1993, 1994, 1995, 1997, 2000 3 ;; Copyright 1989, 1993, 1994, 1995, 1997, 2000
4 ;;; Free Software Foundation, Inc. 4 ;;; Free Software Foundation, Inc.
5 5
6 ;; Maintainer's Time-stamp: <2000-06-07 13:05:45 gildea> 6 ;; Maintainer's Time-stamp: <2000-10-23 16:08:34 gildea>
7 ;; Maintainer: Stephen Gildea <gildea@alum.mit.edu> 7 ;; Maintainer: Stephen Gildea <gildea@alum.mit.edu>
8 ;; Keywords: tools 8 ;; Keywords: tools
9 9
10 ;; This file is free software; you can redistribute it and/or modify 10 ;; This file is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by 11 ;; it under the terms of the GNU General Public License as published by
573 ((eq cur-char ?L) ;(undocumented alt user full name) 573 ((eq cur-char ?L) ;(undocumented alt user full name)
574 (user-full-name)) 574 (user-full-name))
575 ((eq cur-char ?h) ;mail host name 575 ((eq cur-char ?h) ;mail host name
576 (time-stamp-mail-host-name)) 576 (time-stamp-mail-host-name))
577 )) 577 ))
578 (if (string-equal field-width "") 578 (let ((padded-result
579 field-result 579 (format (format "%%%s%c"
580 (let ((padded-result 580 field-width
581 (format (format "%%%s%c" 581 (if (numberp field-result) ?d ?s))
582 field-width 582 (or field-result ""))))
583 (if (numberp field-result) ?d ?s)) 583 (let* ((initial-length (length padded-result))
584 (or field-result "")))) 584 (desired-length (if (string-equal field-width "")
585 (let ((initial-length (length padded-result)) 585 initial-length
586 (desired-length (string-to-int field-width))) 586 (string-to-int field-width))))
587 (if (> initial-length desired-length) 587 (if (> initial-length desired-length)
588 ;; truncate strings on right, years on left 588 ;; truncate strings on right, years on left
589 (if (stringp field-result) 589 (if (stringp field-result)
590 (substring padded-result 0 desired-length) 590 (substring padded-result 0 desired-length)
591 (if (eq cur-char ?y) 591 (if (eq cur-char ?y)
592 (substring padded-result (- desired-length)) 592 (substring padded-result (- desired-length))
593 padded-result)) ;non-year numbers don't truncate 593 padded-result)) ;non-year numbers don't truncate
594 padded-result))))) 594 padded-result))))
595 (t 595 (t
596 (char-to-string cur-char))))) 596 (char-to-string cur-char)))))
597 (setq ind (1+ ind))) 597 (setq ind (1+ ind)))
598 result)) 598 result))
599 599