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)
(member todo-state
org-agenda-repeating-timestamp-show-all)))
(catch :skip (catch :skip
(when (org-at-date-range-p) (throw :skip nil)) (save-match-data
(when (org-at-planning-p) (throw :skip nil)) (when (or (org-at-date-range-p)
(org-agenda-skip) (org-at-planning-p)
(if (and (match-end 1) (org-before-first-heading-p)
(not (= d1 (org-agenda--timestamp-to-absolute (and org-agenda-include-inactive-timestamps
(match-string 1) d1 nil (current-buffer) b0)))) (org-at-clock-log-p)))
(throw :skip nil)) (throw :skip nil))
(if (and e3 (org-agenda-skip))
(not (org-diary-sexp-entry (buffer-substring b3 e3) "" date))) (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
org-agenda-repeating-timestamp-show-all)))
(warntime (get-text-property (point) 'org-appt-warntime))
(done? (member todo-state org-done-keywords)))
;; Possibly skip done tasks.
(when (and done? org-agenda-skip-timestamp-if-done)
(throw :skip t))
;; S-exp entry doesn't match current day: skip it.
(when (and sexp-entry (not (org-diary-sexp-entry sexp-entry "" date)))
(throw :skip nil)) (throw :skip nil))
(setq tmp (buffer-substring (max (point-min) ;; When time-stamp doesn't match CURRENT but has a repeater,
(- b0 org-ds-keyword-length)) ;; make sure it repeats on CURRENT. Furthermore, if
b0) ;; SHOW-ALL is nil, ensure that repeater is the very first
timestr (if b3 "" (buffer-substring b0 (point-at-eol))) ;; one to trigger since today.
inactivep (= (char-after b0) ?\[) (when (and repeat
clockp (and org-agenda-include-inactive-timestamps (let ((base (if show-all current today)))
(or (string-match org-clock-string tmp) (/= current
(string-match "]-+\\'" tmp))) (org-agenda--timestamp-to-absolute
warntime (get-text-property (point) 'org-appt-warntime) repeat base 'future (current-buffer) pos))))
donep (member todo-state org-done-keywords)) (throw :skip nil))
(when (or clockp (and donep org-agenda-skip-timestamp-if-done)) (save-excursion
(throw :skip t)) (re-search-backward org-outline-regexp-bol nil t)
(if (string-match ">" timestr) ;; Possibly skip time-stamp when a deadline is set.
;; substring should only run to end of time stamp (when (and org-agenda-skip-timestamp-if-deadline-is-shown
(setq timestr (substring timestr 0 (match-end 0)))) (assq (point) deadline-position-alist))
(setq marker (org-agenda-new-marker b0) (throw :skip nil))
category (org-get-category b0)) (let* ((category (org-get-category pos))
(save-excursion (inherited-tags
(if (not (re-search-backward org-outline-regexp-bol nil t)) (or (eq org-agenda-show-inherited-tags 'always)
(throw :skip nil) (and (consp org-agenda-show-inherited-tags)
(goto-char (match-beginning 0)) (memq 'agenda org-agenda-show-inherited-tags))
(if (and (eq t org-agenda-skip-timestamp-if-deadline-is-shown) (and (eq org-agenda-show-inherited-tags t)
(assoc (point) deadline-position-alist)) (or (eq org-agenda-use-tag-inheritance t)
(throw :skip nil)) (memq 'agenda
(setq hdmarker (org-agenda-new-marker) org-agenda-use-tag-inheritance)))))
inherited-tags (tags (org-get-tags-at nil (not inherited-tags)))
(or (eq org-agenda-show-inherited-tags 'always) (level (make-string (org-reduced-level (org-outline-level))
(and (listp org-agenda-show-inherited-tags) ?\s))
(memq 'agenda org-agenda-show-inherited-tags)) (head (and (looking-at "\\*+[ \t]+\\(.*\\)")
(and (eq org-agenda-show-inherited-tags t) (match-string 1)))
(or (eq org-agenda-use-tag-inheritance t) (inactive? (= (char-after pos) ?\[))
(memq 'agenda org-agenda-use-tag-inheritance)))) (habit? (and (fboundp 'org-is-habit-p) (org-is-habit-p)))
tags (org-get-tags-at nil (not inherited-tags)) (item
level (make-string (org-reduced-level (org-outline-level)) ? )) (org-agenda-format-item
(looking-at "\\*+[ \t]+\\(.*\\)") (and inactive? org-agenda-inactive-leader)
(setq head (match-string 1)) head level category tags time-stamp org-ts-regexp habit?)))
(setq txt (org-agenda-format-item (org-add-props item props
(if inactivep org-agenda-inactive-leader nil) 'priority (if habit?
head level category tags timestr (org-habit-get-priority (org-habit-parse-todo))
remove-re habitp))) (org-get-priority item))
(setq priority (org-get-priority txt)) 'org-marker (org-agenda-new-marker pos)
(org-add-props txt props 'priority priority 'org-hd-marker (org-agenda-new-marker)
'org-marker marker 'org-hd-marker hdmarker 'date date
'date date 'level level
'level level 'ts-date (if repeat (org-agenda--timestamp-to-absolute repeat)
'ts-date current)
(ignore-errors (org-time-string-to-absolute timestr)) 'todo-state todo-state
'todo-state todo-state 'warntime warntime
'warntime warntime 'type "timestamp")
'type "timestamp") (push item timestamp-items))))
(push txt ee)) (when org-agenda-skip-additional-timestamps-same-entry
(if org-agenda-skip-additional-timestamps-same-entry (outline-next-heading))))
(outline-next-heading) (nreverse timestamp-items)))
(goto-char end-of-match))))
(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