有没有一种简单的方法在org-mode中插入当前时间(例如:TIME: [2012-07-02 Mon 16:44])?手册中有很多内容(时钟、截止日期、计划等),但大多数需要手动输入时间。
有没有一种简单的方法在org-mode中插入当前时间(例如:TIME: [2012-07-02 Mon 16:44])?手册中有很多内容(时钟、截止日期、计划等),但大多数需要手动输入时间。C-u C-u C-c .
(org-time-stamp-inactive
(16))`实现。 - itirazimvarC-u C-c !
插入一个不活动的时间戳,当前时间如下:
[2018-05-08 Tue 00:30]
在 Emacs Lisp 中,您可以使用
(org-insert-time-stamp (current-time) t)
使用默认设置,它将生成一个格式为时间戳的时间戳
<2021-06-20 Sun 10:33>
(defun insert-now-timestamp()
"Insert org mode timestamp at point with current date and time."
(interactive)
(org-insert-time-stamp (current-time) t))
在您的.emacs
文件中添加以下代码。您可以使用M-x insert-now-timestamp
调用该函数。
Emacs 27.2,org mode 9.4.4。
编辑:我现在意识到这与@anachronic的解决方案相同。但是我将其保留作为参考。
C-u C-c .
插入日期和时间戳
这里提供一些其他选项:
这两个选项都是非常强大的工具,不仅仅用于插入日期和时间。
M-x
org-time-stamp
。 - SebastianC-u C-c .
快捷键没有相应的M-x命令呢?M-x org-time-stamp
只会将日期插入到当前光标位置而没有时间。有没有关于当前日期和时间的命令呢? - dezhiC-c .
快捷键插入日期的说明: “使用前缀参数,它还将当前时间添加到日期中。” 手册的意思是指 Jon Gauthier所说的:输入C-u C-c .
(<control>-<u> <control>-<c> <full stop>)。这里的前缀参数是C-u
(在命令序列的其余部分之前按一次 <control> 和 <u> 键)。 - baltakatei[]
而不是<>
中吗? - alperc-c !
- joshpetit