【发布时间】:2013-12-01 20:19:10
【问题描述】:
我有如下函数定义:
(defun nth (n)
(format
(concat
"%d"
(if (memq n '(11 12 13)) "th"
(let ((last-digit (% n 10)))
(case last-digit
(1 "st")
(2 "nd")
(3 "rd")
(otherwise "th"))))) n))
我希望能够在format-time-string 中使用它。
通常,我会查看函数的源代码,但这个函数是在 C 源代码中定义的。 (我认为这会阻止将某些东西挂在上面,但我会得到纠正。)
如何添加另一个格式说明符(例如,%o)以将nth 应用于适当的参数?
所需用途:
(format-time-string "%A, %B %o, %T (%z)" (seconds-to-time 1250553600))
=> "Monday, August 17th, 20:00:00 (-0400)"
【问题讨论】:
标签: emacs elisp format-string