diff options
author | Gerd Moellmann <gerd@gnu.org> | 2000-03-28 11:24:00 +0000 |
---|---|---|
committer | Gerd Moellmann <gerd@gnu.org> | 2000-03-28 11:24:00 +0000 |
commit | 07d505c1542656ba375ef4ea06206db8344dcabb (patch) | |
tree | 62b2398e14f3c4bb87b2b717a731c9d34e2eee67 /lisp/emacs-lisp | |
parent | e9b309ac910a5e3c13cca480b32a9231d76b2d9b (diff) | |
download | emacs-07d505c1542656ba375ef4ea06206db8344dcabb.tar.gz emacs-07d505c1542656ba375ef4ea06206db8344dcabb.tar.bz2 emacs-07d505c1542656ba375ef4ea06206db8344dcabb.zip |
(lm-last-modified-date): Add parameter
ISO-DATE. If non-nil, return date in ISO 8601 format.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/lisp-mnt.el | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el index 0fac9d944ae..2f50541fe6f 100644 --- a/lisp/emacs-lisp/lisp-mnt.el +++ b/lisp/emacs-lisp/lisp-mnt.el @@ -287,21 +287,25 @@ The return value has the form (NAME . ADDRESS)." (lm-with-file file (lm-header "created"))) -(defun lm-last-modified-date (&optional file) - "Return the modify-date given in file FILE, or current buffer if FILE is nil." +(defun lm-last-modified-date (&optional file iso-date) + "Return the modify-date given in file FILE, or current buffer if FILE is nil. +ISO-DATE non-nil means return the date in ISO 8601 format." (lm-with-file file - (if (progn - (goto-char (point-min)) - (re-search-forward - "\\$[I]d: [^ ]+ [^ ]+ \\([^/]+\\)/\\([^/]+\\)/\\([^ ]+\\) " - (lm-code-mark) t)) - (format "%s %s %s" - (match-string 3) - (nth (string-to-int - (match-string 2)) - '("" "Jan" "Feb" "Mar" "Apr" "May" "Jun" - "Jul" "Aug" "Sep" "Oct" "Nov" "Dec")) - (match-string 1))))) + (when (progn (goto-char (point-min)) + (re-search-forward + "\\$[I]d: [^ ]+ [^ ]+ \\([^/]+\\)/\\([^/]+\\)/\\([^ ]+\\) " + (lm-code-mark) t)) + (let ((dd (match-string 3)) + (mm (match-string 2)) + (yyyy (match-string 1))) + (if iso-date + (format "%s-%s-%s" yyyy mm dd) + (format "%s %s %s" + dd + (nth (string-to-int mm) + '("" "Jan" "Feb" "Mar" "Apr" "May" "Jun" + "Jul" "Aug" "Sep" "Oct" "Nov" "Dec")) + yyyy)))))) (defun lm-version (&optional file) "Return the version listed in file FILE, or current buffer if FILE is nil. @@ -474,4 +478,3 @@ Prompts for bug subject TOPIC. Leaves you in a mail buffer." (provide 'lisp-mnt) ;;; lisp-mnt.el ends here - |