1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-25 07:27:57 +00:00

org.el (org-time-stamp): C-u C-u C-c . inserts a timestamp with no prompt.

* org.el (org-time-stamp): With two universal arguments,
insert an active timestamp with the current time without
prompting the user.

This idea came up on the list, I can't recall who proposed this.
Thanks to him anyway!
This commit is contained in:
Bastien Guerry 2012-07-06 13:16:13 +02:00
parent 9780de8b30
commit 2cf1ff345e

View File

@ -15007,13 +15007,20 @@ Return the position where this entry starts, or nil if there is no such entry."
(defun org-time-stamp (arg &optional inactive) (defun org-time-stamp (arg &optional inactive)
"Prompt for a date/time and insert a time stamp. "Prompt for a date/time and insert a time stamp.
If the user specifies a time like HH:MM, or if this command is called If the user specifies a time like HH:MM or if this command is
with a prefix argument, the time stamp will contain date and time. called with at least one prefix argument, the time stamp contains
Otherwise, only the date will be included. All parts of a date not the date and the time. Otherwise, only the date is be included.
specified by the user will be filled in from the current date/time.
So if you press just return without typing anything, the time stamp All parts of a date not specified by the user is filled in from
will represent the current date/time. If there is already a timestamp the current date/time. So if you just press return without
at the cursor, it will be modified." typing anything, the time stamp will represent the current
date/time.
If there is already a timestamp at the cursor, it will be
modified.
With two universal prefix arguments, insert an active timestamp
with the current time without prompting the user."
(interactive "P") (interactive "P")
(let* ((ts nil) (let* ((ts nil)
(default-time (default-time
@ -15059,6 +15066,8 @@ at the cursor, it will be modified."
(concat (substring org-last-inserted-timestamp 0 -1) (concat (substring org-last-inserted-timestamp 0 -1)
" " repeater ">")))) " " repeater ">"))))
(message "Timestamp updated")) (message "Timestamp updated"))
((equal arg '(16))
(org-insert-time-stamp (current-time) t))
(t (t
(setq time (let ((this-command this-command)) (setq time (let ((this-command this-command))
(org-read-date arg 'totime nil nil default-time default-input inactive))) (org-read-date arg 'totime nil nil default-time default-input inactive)))