summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-08-10 22:32:24 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-08-10 22:32:24 +0200
commitaa98f7c79a958da8adfc3788f564a1b387d3550d (patch)
tree566657070de0438a3ff8ab237ad59c3299b7cc7b
parenta472043b74991edebf02a5bfc967801ab390fd83 (diff)
downloadorg-mode-aa98f7c79a958da8adfc3788f564a1b387d3550d.tar.gz
Edit proper timestamp when on a time range
* lisp/org.el (org-time-stamp): Offer appropriate default value depending on position of point in a time range. Reported-by: Christoph LANGE <math.semantic.web@gmail.com> <http://permalink.gmane.org/gmane.emacs.orgmode/99783>
-rwxr-xr-xlisp/org.el11
1 files changed, 4 insertions, 7 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 5817cac..cbc9f9b 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16638,13 +16638,10 @@ with the current time without prompting the user.
When called from lisp, the timestamp is inactive if INACTIVE is
non-nil."
(interactive "P")
- (let* ((ts
- (cond ((org-at-date-range-p t)
- (save-excursion
- (goto-char (match-beginning 0))
- (looking-at (if inactive org-ts-regexp-both org-ts-regexp)))
- (match-string 0))
- ((org-at-timestamp-p t) (match-string 0))))
+ (let* ((ts (cond
+ ((org-at-date-range-p t)
+ (match-string (if (< (point) (- (match-beginning 2) 2)) 1 2)))
+ ((org-at-timestamp-p t) (match-string 0))))
;; Default time is either the timestamp at point or today.
;; When entering a range, only the range start is considered.
(default-time (if (not ts) (current-time)