org.el (org-read-date-display): Fix bug when displaying the overlay.

* org.el (org-read-date-display): Fix bug when displaying the
overlay.

TINYCHANGE
This commit is contained in:
Zachary Kanfer 2012-02-06 21:22:16 +00:00 committed by Bastien Guerry
parent 628431b06f
commit 4e4a7eb029

View file

@ -15130,35 +15130,35 @@ user."
(when org-read-date-display-live (when org-read-date-display-live
(when org-read-date-overlay (when org-read-date-overlay
(delete-overlay org-read-date-overlay)) (delete-overlay org-read-date-overlay))
(let ((p (point))) (when (minibufferp (current-buffer))
(end-of-line 1) (save-excursion
(while (not (equal (buffer-substring (end-of-line 1)
(max (point-min) (- (point) 4)) (point)) (while (not (equal (buffer-substring
" ")) (max (point-min) (- (point) 4)) (point))
(insert " ")) " "))
(goto-char p)) (insert " ")))
(let* ((ans (concat (buffer-substring (point-at-bol) (point-max)) (let* ((ans (concat (buffer-substring (point-at-bol) (point-max))
" " (or org-ans1 org-ans2))) " " (or org-ans1 org-ans2)))
(org-end-time-was-given nil) (org-end-time-was-given nil)
(f (org-read-date-analyze ans org-def org-defdecode)) (f (org-read-date-analyze ans org-def org-defdecode))
(fmts (if org-dcst (fmts (if org-dcst
org-time-stamp-custom-formats org-time-stamp-custom-formats
org-time-stamp-formats)) org-time-stamp-formats))
(fmt (if (or org-with-time (fmt (if (or org-with-time
(and (boundp 'org-time-was-given) org-time-was-given)) (and (boundp 'org-time-was-given) org-time-was-given))
(cdr fmts) (cdr fmts)
(car fmts))) (car fmts)))
(txt (concat "=> " (format-time-string fmt (apply 'encode-time f))))) (txt (concat "=> " (format-time-string fmt (apply 'encode-time f)))))
(when (and org-end-time-was-given (when (and org-end-time-was-given
(string-match org-plain-time-of-day-regexp txt)) (string-match org-plain-time-of-day-regexp txt))
(setq txt (concat (substring txt 0 (match-end 0)) "-" (setq txt (concat (substring txt 0 (match-end 0)) "-"
org-end-time-was-given org-end-time-was-given
(substring txt (match-end 0))))) (substring txt (match-end 0)))))
(when org-read-date-analyze-futurep (when org-read-date-analyze-futurep
(setq txt (concat txt " (=>F)"))) (setq txt (concat txt " (=>F)")))
(setq org-read-date-overlay (setq org-read-date-overlay
(make-overlay (1- (point-at-eol)) (point-at-eol))) (make-overlay (1- (point-at-eol)) (point-at-eol)))
(org-overlay-display org-read-date-overlay txt 'secondary-selection)))) (org-overlay-display org-read-date-overlay txt 'secondary-selection)))))
(defun org-read-date-analyze (ans org-def org-defdecode) (defun org-read-date-analyze (ans org-def org-defdecode)
"Analyze the combined answer of the date prompt." "Analyze the combined answer of the date prompt."