Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2016-11-27 23:09:48 +01:00
commit 345449d088
2 changed files with 100 additions and 86 deletions

View File

@ -5583,24 +5583,27 @@ This function is invoked if `org-agenda-todo-ignore-deadlines',
(match-string 1) org-agenda-todo-ignore-timestamp)) (match-string 1) org-agenda-todo-ignore-timestamp))
(t)))))))))) (t))))))))))
(defun org-agenda-get-timestamps (&optional deadline-results) (defun org-agenda-get-timestamps (&optional deadlines)
"Return the date stamp information for agenda display." "Return the date stamp information for agenda display.
Optional argument DEADLINES is a list of deadline items to be
displayed in agenda view."
(let* ((props (list 'face 'org-agenda-calendar-event (let* ((props (list 'face 'org-agenda-calendar-event
'org-not-done-regexp org-not-done-regexp 'org-not-done-regexp org-not-done-regexp
'org-todo-regexp org-todo-regexp 'org-todo-regexp org-todo-regexp
'org-complex-heading-regexp org-complex-heading-regexp 'org-complex-heading-regexp org-complex-heading-regexp
'mouse-face 'highlight 'mouse-face 'highlight
'help-echo 'help-echo
(format "mouse-2 or RET jump to org file %s" (format "mouse-2 or RET jump to Org file %s"
(abbreviate-file-name buffer-file-name)))) (abbreviate-file-name buffer-file-name))))
(d1 (calendar-absolute-from-gregorian date)) (current (calendar-absolute-from-gregorian date))
mm (today (org-today))
(deadline-position-alist (deadline-position-alist
(mapcar (lambda (a) (and (setq mm (get-text-property (mapcar (lambda (d)
0 'org-hd-marker a)) (let ((m (get-text-property 0 'org-hd-marker d)))
(cons (marker-position mm) a))) (and m (marker-position m))))
deadline-results)) deadlines))
(remove-re org-ts-regexp) ;; Match time-stamps set to current date, time-stamps with
;; a repeater, and S-exp time-stamps.
(regexp (regexp
(concat (concat
(if org-agenda-include-inactive-timestamps "[[<]" "<") (if org-agenda-include-inactive-timestamps "[[<]" "<")
@ -5608,89 +5611,100 @@ This function is invoked if `org-agenda-todo-ignore-deadlines',
(substring (substring
(format-time-string (format-time-string
(car org-time-stamp-formats) (car org-time-stamp-formats)
(apply 'encode-time ; DATE bound by calendar (apply #'encode-time ; DATE bound by calendar
(list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
1 11)) 1 11))
"\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[hdwmy]>\\)" "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[hdwmy]>\\)"
"\\|\\(<%%\\(([^>\n]+)\\)>\\)")) "\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
marker hdmarker clockp inactivep donep tmp priority category level ee timestamp-items)
txt timestr tags b0 b3 e3 head todo-state end-of-match show-all
warntime habitp inherited-tags ts-date)
(goto-char (point-min)) (goto-char (point-min))
(while (setq end-of-match (re-search-forward regexp nil t)) (while (re-search-forward regexp nil t)
(setq b0 (match-beginning 0) ;; Skip date ranges, scheduled and deadlines, which are handled
b3 (match-beginning 3) e3 (match-end 3) ;; specially. Also skip time-stamps before first headline as
todo-state (save-match-data (ignore-errors (org-get-todo-state))) ;; there would be no entry to add to the agenda. Eventually,
habitp (and (functionp 'org-is-habit-p) (save-match-data (org-is-habit-p))) ;; ignore clock entries.
show-all (or (eq org-agenda-repeating-timestamp-show-all t) (catch :skip
(save-match-data
(when (or (org-at-date-range-p)
(org-at-planning-p)
(org-before-first-heading-p)
(and org-agenda-include-inactive-timestamps
(org-at-clock-log-p)))
(throw :skip nil))
(org-agenda-skip))
(let* ((pos (match-beginning 0))
(repeat (match-string 1))
(sexp-entry (match-string 3))
(time-stamp (if (or repeat sexp-entry) (match-string 0)
(save-excursion
(goto-char pos)
(looking-at org-ts-regexp-both)
(match-string 0))))
(todo-state (org-get-todo-state))
(show-all (or (eq org-agenda-repeating-timestamp-show-all t)
(member todo-state (member todo-state
org-agenda-repeating-timestamp-show-all))) org-agenda-repeating-timestamp-show-all)))
(catch :skip (warntime (get-text-property (point) 'org-appt-warntime))
(when (org-at-date-range-p) (throw :skip nil)) (done? (member todo-state org-done-keywords)))
(when (org-at-planning-p) (throw :skip nil)) ;; Possibly skip done tasks.
(org-agenda-skip) (when (and done? org-agenda-skip-timestamp-if-done)
(if (and (match-end 1)
(not (= d1 (org-agenda--timestamp-to-absolute
(match-string 1) d1 nil (current-buffer) b0))))
(throw :skip nil))
(if (and e3
(not (org-diary-sexp-entry (buffer-substring b3 e3) "" date)))
(throw :skip nil))
(setq tmp (buffer-substring (max (point-min)
(- b0 org-ds-keyword-length))
b0)
timestr (if b3 "" (buffer-substring b0 (point-at-eol)))
inactivep (= (char-after b0) ?\[)
clockp (and org-agenda-include-inactive-timestamps
(or (string-match org-clock-string tmp)
(string-match "]-+\\'" tmp)))
warntime (get-text-property (point) 'org-appt-warntime)
donep (member todo-state org-done-keywords))
(when (or clockp (and donep org-agenda-skip-timestamp-if-done))
(throw :skip t)) (throw :skip t))
(if (string-match ">" timestr) ;; S-exp entry doesn't match current day: skip it.
;; substring should only run to end of time stamp (when (and sexp-entry (not (org-diary-sexp-entry sexp-entry "" date)))
(setq timestr (substring timestr 0 (match-end 0))))
(setq marker (org-agenda-new-marker b0)
category (org-get-category b0))
(save-excursion
(if (not (re-search-backward org-outline-regexp-bol nil t))
(throw :skip nil)
(goto-char (match-beginning 0))
(if (and (eq t org-agenda-skip-timestamp-if-deadline-is-shown)
(assoc (point) deadline-position-alist))
(throw :skip nil)) (throw :skip nil))
(setq hdmarker (org-agenda-new-marker) ;; When time-stamp doesn't match CURRENT but has a repeater,
inherited-tags ;; make sure it repeats on CURRENT. Furthermore, if
;; SHOW-ALL is nil, ensure that repeater is the very first
;; one to trigger since today.
(when (and repeat
(let ((base (if show-all current today)))
(/= current
(org-agenda--timestamp-to-absolute
repeat base 'future (current-buffer) pos))))
(throw :skip nil))
(save-excursion
(re-search-backward org-outline-regexp-bol nil t)
;; Possibly skip time-stamp when a deadline is set.
(when (and org-agenda-skip-timestamp-if-deadline-is-shown
(assq (point) deadline-position-alist))
(throw :skip nil))
(let* ((category (org-get-category pos))
(inherited-tags
(or (eq org-agenda-show-inherited-tags 'always) (or (eq org-agenda-show-inherited-tags 'always)
(and (listp org-agenda-show-inherited-tags) (and (consp org-agenda-show-inherited-tags)
(memq 'agenda org-agenda-show-inherited-tags)) (memq 'agenda org-agenda-show-inherited-tags))
(and (eq org-agenda-show-inherited-tags t) (and (eq org-agenda-show-inherited-tags t)
(or (eq org-agenda-use-tag-inheritance t) (or (eq org-agenda-use-tag-inheritance t)
(memq 'agenda org-agenda-use-tag-inheritance)))) (memq 'agenda
tags (org-get-tags-at nil (not inherited-tags)) org-agenda-use-tag-inheritance)))))
level (make-string (org-reduced-level (org-outline-level)) ? )) (tags (org-get-tags-at nil (not inherited-tags)))
(looking-at "\\*+[ \t]+\\(.*\\)") (level (make-string (org-reduced-level (org-outline-level))
(setq head (match-string 1)) ?\s))
(setq txt (org-agenda-format-item (head (and (looking-at "\\*+[ \t]+\\(.*\\)")
(if inactivep org-agenda-inactive-leader nil) (match-string 1)))
head level category tags timestr (inactive? (= (char-after pos) ?\[))
remove-re habitp))) (habit? (and (fboundp 'org-is-habit-p) (org-is-habit-p)))
(setq priority (org-get-priority txt)) (item
(org-add-props txt props 'priority priority (org-agenda-format-item
'org-marker marker 'org-hd-marker hdmarker (and inactive? org-agenda-inactive-leader)
head level category tags time-stamp org-ts-regexp habit?)))
(org-add-props item props
'priority (if habit?
(org-habit-get-priority (org-habit-parse-todo))
(org-get-priority item))
'org-marker (org-agenda-new-marker pos)
'org-hd-marker (org-agenda-new-marker)
'date date 'date date
'level level 'level level
'ts-date 'ts-date (if repeat (org-agenda--timestamp-to-absolute repeat)
(ignore-errors (org-time-string-to-absolute timestr)) current)
'todo-state todo-state 'todo-state todo-state
'warntime warntime 'warntime warntime
'type "timestamp") 'type "timestamp")
(push txt ee)) (push item timestamp-items))))
(if org-agenda-skip-additional-timestamps-same-entry (when org-agenda-skip-additional-timestamps-same-entry
(outline-next-heading) (outline-next-heading))))
(goto-char end-of-match)))) (nreverse timestamp-items)))
(nreverse ee)))
(defun org-agenda-get-sexps () (defun org-agenda-get-sexps ()
"Return the sexp information for agenda display." "Return the sexp information for agenda display."

View File

@ -18125,7 +18125,7 @@ INACTIVE-OK."
(defun org-at-clock-log-p nil (defun org-at-clock-log-p nil
"Is the cursor on the clock log line?" "Is the cursor on the clock log line?"
(save-excursion (save-excursion
(move-beginning-of-line 1) (beginning-of-line)
(looking-at org-clock-line-re))) (looking-at org-clock-line-re)))
(defvar org-clock-history) ; defined in org-clock.el (defvar org-clock-history) ; defined in org-clock.el