summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-01-24 15:34:54 +0100
committerBastien Guerry <bzg@altern.org>2012-01-24 15:34:54 +0100
commit9b299af8374245fe707cf40322952dad8189fd9d (patch)
tree91c0b2fe608d094a92c087d6adb735e94fee3bfd
parentcc7acb65fff77f5662508254e9caec61dda8147d (diff)
downloadorg-mode-9b299af8374245fe707cf40322952dad8189fd9d.tar.gz
Use [...] in the `org-read-date' overlay when inserting inactive timestamps.
* org.el (org-read-date): New parameter `inactive' when reading for insertion of inactive timestamps. (org-time-stamp, org-read-date-display): Use the new parameter. Thanks to François Pinard for this suggestion.
-rw-r--r--lisp/org.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/org.el b/lisp/org.el
index a2e1e00..79cb138 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14786,11 +14786,11 @@ at the cursor, it will be modified."
(insert "--")
(setq time (let ((this-command this-command))
(org-read-date arg 'totime nil nil
- default-time default-input)))
+ default-time default-input inactive)))
(org-insert-time-stamp time (or org-time-was-given arg) inactive))
((org-at-timestamp-p t)
(setq time (let ((this-command this-command))
- (org-read-date arg 'totime nil nil default-time default-input)))
+ (org-read-date arg 'totime nil nil default-time default-input inactive)))
(when (org-at-timestamp-p t) ; just to get the match data
; (setq inactive (eq (char-after (match-beginning 0)) ?\[))
(replace-match "")
@@ -14805,7 +14805,7 @@ at the cursor, it will be modified."
(message "Timestamp updated"))
(t
(setq time (let ((this-command this-command))
- (org-read-date arg 'totime nil nil default-time default-input)))
+ (org-read-date arg 'totime nil nil default-time default-input inactive)))
(org-insert-time-stamp time (or org-time-was-given arg) inactive
nil nil (list org-end-time-was-given))))))
@@ -14853,7 +14853,7 @@ So these are more for recording a certain time/date."
(defvar org-read-date-analyze-forced-year nil)
(defun org-read-date (&optional with-time to-time from-string prompt
- default-time default-input)
+ default-time default-input inactive)
"Read a date, possibly a time, and make things smooth for the user.
The prompt will suggest to enter an ISO date, but you can also enter anything
which will at least partially be understood by `parse-time-string'.
@@ -15002,6 +15002,7 @@ user."
(unwind-protect
(progn
(use-local-map map)
+ (setq org-read-date-inactive inactive)
(add-hook 'post-command-hook 'org-read-date-display)
(setq org-ans0 (read-string prompt default-input
'org-read-date-history nil))
@@ -15049,6 +15050,7 @@ user."
(defvar def)
(defvar defdecode)
(defvar with-time)
+(defvar org-read-date-inactive)
(defun org-read-date-display ()
"Display the current date prompt interpretation in the minibuffer."
(when org-read-date-display-live
@@ -15072,7 +15074,9 @@ user."
(and (boundp 'org-time-was-given) org-time-was-given))
(cdr fmts)
(car fmts)))
- (txt (concat "=> " (format-time-string fmt (apply 'encode-time f)))))
+ (txt (format-time-string fmt (apply 'encode-time f)))
+ (txt (if org-read-date-inactive (concat "[" (substring txt 1 -1) "]") txt))
+ (txt (concat "=> " txt)))
(when (and org-end-time-was-given
(string-match org-plain-time-of-day-regexp txt))
(setq txt (concat (substring txt 0 (match-end 0)) "-"