简体   繁体   English

如何让用户使用elisp输入日期?

[英]How do I let the user enter a date using elisp?

I'm writing a tool to track time spent on projects in Emacs (kind of like timeclock with reporting and more functions). 我正在编写一个工具来跟踪在Emacs中花费的时间(有点像报告时间和更多功能)。 Short of ripping org-read-date out of org-mode, however, I'm unable to find a good way of allowing the user to enter a dates for reporting without requiring that they enter it in the format "2011-04-22T00:00:00", which is not so human-friendly. 但是,如果没有从组织模式中删除org-read-date ,我就无法找到允许用户输入报告日期的好方法,而无需他们以“2011-04-22T00”格式输入:00:00“,这不是那么人性化。

Is there an obvious way I'm missing? 有一种明显的方式我会失踪吗? If not, can you suggest a not-too-complex way of writing one? 如果没有,你能建议一种不太复杂的写作方式吗?

Are you sure you can't use org-read-date ? 你确定你不能使用org-read-date吗? It also understands human-friendly input formats like "10 Jul 8pm". 它还理解人性化的输入格式,如“7月8日晚上8点”。 And org is bundled in recent Emacs. 最近的Emacs捆绑了org。

If you're willing to tolerate a dependency on the calendar package, there's also the function calendar-read-date . 如果您愿意容忍对日历包的依赖,那么还有函数calendar-read-date It's not as fancy as org-mode 's prompts, but the calendar package may be a more palatable prerequisite. 它并不像org-mode的提示那样华丽,但日历包可能是一个更可口的先决条件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM