From 16faa2b6c1cf10d1a652c44563a54b0a999ba920 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 3 Jul 2011 13:23:09 +0200 Subject: [PATCH] org-macs.el: new function `org-format-seconds'. * install/git/org-mode/lisp/org-table.el (org-table-time-seconds-to-string): use `org-format-seconds' instead of `format-seconds'. * install/git/org-mode/lisp/org-macs.el (org-format-seconds): handle case where `format-seconds' does not exist. --- lisp/org-macs.el | 6 ++++++ lisp/org-table.el | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 6d5286691..6425977a2 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -361,6 +361,12 @@ The number of levels is controlled by `org-inlinetask-min-level'" (nstars (if org-odd-levels-only (1- (* limit-level 2)) limit-level))) (format "\\*\\{1,%d\\} " nstars)))) +(defun org-format-seconds (string seconds) + "Compatibility function replacing format-seconds" + (if (fboundp 'format-seconds) + (format-seconds string seconds) + (format-time-string string (seconds-to-time seconds)))) + (provide 'org-macs) ;; arch-tag: 7e6a73ce-aac9-4fc0-9b30-ce6f89dc6668 diff --git a/lisp/org-table.el b/lisp/org-table.el index e277f5762..a7fc863ec 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -3220,9 +3220,9 @@ For example: 28 -> AB." (defun org-table-time-seconds-to-string (secs) "Convert a number of seconds to a time string." - (cond ((>= secs 3600) (format-seconds "%h:%.2m:%.2s" secs)) - ((>= secs 60) (format-seconds "%m:%.2s" secs)) - (t (format-seconds "%s" secs)))) + (cond ((>= secs 3600) (org-format-seconds "%h:%.2m:%.2s" secs)) + ((>= secs 60) (org-format-seconds "%m:%.2s" secs)) + (t (org-format-seconds "%s" secs)))) (defun org-table-fedit-convert-buffer (function) "Convert all references in this buffer, using FUNCTION."