Ver código fonte

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.
Bastien Guerry 13 anos atrás
pai
commit
16faa2b6c1
2 arquivos alterados com 9 adições e 3 exclusões
  1. 6 0
      lisp/org-macs.el
  2. 3 3
      lisp/org-table.el

+ 6 - 0
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

+ 3 - 3
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."