因此,在工作中我们使用flexitime(flex hours,flexi hours ...),这很好,但很难跟踪。我目前使用org-mode来记录我的工作时间(org-clock-(out|in)
),但我想扩展到自动计算工作时间是否超过8小时(剩余时间应该添加到我的flexitime帐户中)或更少(取决于我吃了多少午餐时间等等),我的弹性工作“账户”上的余额等等。使用Emacs跟踪flexitime(&org-mode)
其他人使用Emacs吗?
我目前使用的一个非常基本的设置,以跟踪我的时间:
(defun check-in()
(interactive)
(let (pbuf (current-buffer))
(find-file (convert-standard-filename "whatnot"))
(goto-char (point-max))
(insert "\n")
(org-insert-heading)
(org-insert-time-stamp (current-time))
(org-clock-in)
(save-buffer)
(switch-to-buffer pbuf)))
(defun check-out()
(interactive)
(let (pbuf (current-buffer))
(find-file (convert-standard-filename "whatnot"))
(goto-char (point-max))
(org-clock-out)
(save-buffer)
(switch-to-buffer pbuf)))
您的代码会将'current-buffer'与显示在'selected-window'中的缓冲区混淆。从Elisp调用'switch-to-buffer'通常表明存在这样的问题。 '而不是当前缓冲区+查找文件+切换到缓冲区,你想使用'(with-current-buffer(find-file-noselect ...)...)'。还有一点需要注意:不要打扰调用'convert-standard-filename',因为它可能并没有真正做到你的想法,而且你的代码在没有它的情况下也能正常工作。 – Stefan 2012-09-07 14:21:44