Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun mw-org-insert-item-with-ina-ts-when-on-such-item ()
- "When on org timestamp item insert org timestamp item with current time.
- This holds only for inactive timestamps."
- (when (save-excursion
- (let ((item-pos (org-in-item-p)))
- (when item-pos
- (goto-char item-pos)
- (org-list-at-regexp-after-bullet-p org-ts-regexp-inactive))))
- (let ((item-pos (org-in-item-p))
- (pos (point)))
- (assert item-pos)
- (goto-char item-pos)
- (let* ((struct (org-list-struct))
- (prevs (org-list-prevs-alist struct))
- (s (concat (with-temp-buffer
- (org-insert-time-stamp nil t t)
- (buffer-string)) " ")))
- (setq struct (org-list-insert-item pos struct prevs nil s))
- (org-list-write-struct struct (org-list-parents-alist struct))
- (looking-at org-list-full-item-re)
- (goto-char (match-end 0))
- (end-of-line)))
- t))
- (add-hook
- 'org-metareturn-hook 'mw-org-insert-item-with-ina-ts-when-on-such-item)
Add Comment
Please, Sign In to add comment