소스 검색

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>
Nicolas Goaziou 10 년 전
부모
커밋
aa98f7c79a
1개의 변경된 파일4개의 추가작업 그리고 7개의 파일을 삭제
  1. 4 7
      lisp/org.el

+ 4 - 7
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
 When called from lisp, the timestamp is inactive if INACTIVE is
 non-nil."
 non-nil."
   (interactive "P")
   (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.
 	 ;; Default time is either the timestamp at point or today.
 	 ;; When entering a range, only the range start is considered.
 	 ;; When entering a range, only the range start is considered.
          (default-time (if (not ts) (current-time)
          (default-time (if (not ts) (current-time)