0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-07-20 18:26:29 +00:00

Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode

This commit is contained in:
David Maus 2010-11-29 21:04:50 +01:00
commit e2ea50ebe9
7 changed files with 245 additions and 58 deletions

View file

@ -5820,6 +5820,7 @@ be selected:
2007-12-31 @r{New year eve 2007}
2007-12 @r{December 2007}
2007-W50 @r{ISO-week 50 in 2007}
2007-Q2 @r{2nd quarter in 2007}
2007 @r{the year 2007}
today, yesterday, today-@var{N} @r{a relative day}
thisweek, lastweek, thisweek-@var{N} @r{a relative week}
@ -7120,13 +7121,15 @@ it more compact:
@item
@vindex org-agenda-todo-ignore-scheduled
@vindex org-agenda-todo-ignore-deadlines
@vindex org-agenda-todo-ignore-timestamp
@vindex org-agenda-todo-ignore-with-date
Some people view a TODO item that has been @emph{scheduled} for execution or
have a @emph{deadline} (@pxref{Timestamps}) as no longer @emph{open}.
Configure the variables @code{org-agenda-todo-ignore-scheduled},
@code{org-agenda-todo-ignore-deadlines}, and/or
@code{org-agenda-todo-ignore-with-date} to exclude such items from the
global TODO list.
@code{org-agenda-todo-ignore-deadlines},
@code{org-agenda-todo-ignore-timestamp} and/or
@code{org-agenda-todo-ignore-with-date} to exclude such items from the global
TODO list.
@item
@vindex org-agenda-todo-list-sublevels
TODO items may have sublevels to break up the task into subtasks. In

View file

@ -28,7 +28,7 @@
;;; Requirements:
;;; A working clojure install. This also implies a working java executable
;;; - clojure (at least 1.2.0)
;;; - clojure-mode
;;; - slime
;;; - swank-clojure
@ -63,7 +63,7 @@
(if (or (member "code" result-params)
(member "pp" result-params))
(format (concat "(let [org-mode-print-catcher (java.io.StringWriter.)]"
"(with-pprint-dispatch %s-dispatch"
"(clojure.pprint/with-pprint-dispatch %s-dispatch"
"(clojure.pprint/pprint %s org-mode-print-catcher)"
"(str org-mode-print-catcher)))")
(if (member "code" result-params) "code" "simple") body)

View file

@ -562,6 +562,33 @@ See also the variable `org-agenda-tags-todo-honor-ignore-options'."
:group 'org-agenda-todo-list
:type 'boolean)
(defcustom org-agenda-todo-ignore-timestamp nil
"Non-nil means don't show entries with a timestamp.
This applies when creating the global todo list.
Valid values are:
past Don't show entries for today or in the past.
future Don't show entries with a timestamp in the future.
The idea behind this is that if it has a future
timestamp, you don't want to think about it until the
date.
all Don't show any entries with a timestamp in the global todo list.
The idea behind this is that by setting a timestamp, you
have already \"taken care\" of this item.
See also `org-agenda-todo-ignore-with-date'.
See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want
to make his option also apply to the tags-todo list."
:group 'org-agenda-skip
:group 'org-agenda-todo-list
:type '(choice
(const :tag "Ignore future timestamp todos" future)
(const :tag "Ignore past or present timestamp todos" past)
(const :tag "Ignore all timestamp todos" all)
(const :tag "Show timestamp todos" nil)))
(defcustom org-agenda-todo-ignore-scheduled nil
"Non-nil means, ignore some scheduled TODO items when making TODO list.
This applies when creating the global todo list.
@ -632,7 +659,8 @@ to make his option also apply to the tags-todo list."
"Non-nil means honor todo-list ...ignore options also in tags-todo search.
The variables
`org-agenda-todo-ignore-with-date',
`org-agenda-todo-ignore-scheduled'
`org-agenda-todo-ignore-timestamp',
`org-agenda-todo-ignore-scheduled',
`org-agenda-todo-ignore-deadlines'
make the global TODO list skip entries that have time stamps of certain
kinds. If this option is set, the same options will also apply for the
@ -4435,7 +4463,8 @@ the documentation of `org-diary'."
"Do we have a reason to ignore this TODO entry because it has a time stamp?"
(when (or org-agenda-todo-ignore-with-date
org-agenda-todo-ignore-scheduled
org-agenda-todo-ignore-deadlines)
org-agenda-todo-ignore-deadlines
org-agenda-todo-ignore-timestamp)
(setq end (or end (save-excursion (outline-next-heading) (point))))
(save-excursion
(or (and org-agenda-todo-ignore-with-date
@ -4458,7 +4487,29 @@ the documentation of `org-diary'."
(> (org-days-to-time (match-string 1)) 0))
((eq org-agenda-todo-ignore-deadlines 'past)
(<= (org-days-to-time (match-string 1)) 0))
(t (org-deadline-close (match-string 1)))))))))
(t (org-deadline-close (match-string 1)))))
(and org-agenda-todo-ignore-timestamp
(let ((buffer (current-buffer))
(regexp
(concat
org-scheduled-time-regexp "\\|" org-deadline-time-regexp))
(start (point)))
;; Copy current buffer into a temporary one
(with-temp-buffer
(insert-buffer-substring buffer start end)
(goto-char (point-min))
;; Delete SCHEDULED and DEADLINE items
(while (re-search-forward regexp end t)
(delete-region (match-beginning 0) (match-end 0)))
(goto-char (point-min))
;; No search for timestamp left
(when (re-search-forward org-ts-regexp nil t)
(cond
((eq org-agenda-todo-ignore-timestamp 'future)
(> (org-days-to-time (match-string 1)) 0))
((eq org-agenda-todo-ignore-timestamp 'past)
(<= (org-days-to-time (match-string 1)) 0))
(t))))))))))
(defconst org-agenda-no-heading-message
"No heading for this item in buffer or region.")
@ -5044,7 +5095,9 @@ Any match of REMOVE-RE will be removed from TXT."
org-agenda-show-inherited-tags
org-agenda-hide-tags-regexp))
(let* ((category (or category
org-category
(if (stringp org-category)
org-category
(symbol-name org-category))
(if buffer-file-name
(file-name-sans-extension
(file-name-nondirectory buffer-file-name))

View file

@ -1654,6 +1654,65 @@ buffer and update it."
(>= (match-end 0) pos)
start))))
(defun org-day-of-week (day month year)
"Returns the day of the week as an integer."
(nth 6
(decode-time
(date-to-time
(format "%d-%02d-%02dT00:00:00" year month day)))))
(defun org-quarter-to-date (quarter year)
"Get the date (week day year) of the first day of a given quarter."
(cond
((= quarter 1)
(setq startday (org-day-of-week 1 1 year))
(cond
((= startday 0)
(list 52 7 (- year 1)))
((= startday 6)
(list 52 6 (- year 1)))
((<= startday 4)
(list 1 startday year))
((> startday 4)
(list 53 startday (- year 1)))
)
)
((= quarter 2)
(setq startday (org-day-of-week 1 4 year))
(cond
((= startday 0)
(list 13 startday year))
((< startday 4)
(list 14 startday year))
((>= startday 4)
(list 13 startday year))
)
)
((= quarter 3)
(setq startday (org-day-of-week 1 7 year))
(cond
((= startday 0)
(list 26 startday year))
((< startday 4)
(list 27 startday year))
((>= startday 4)
(list 26 startday year))
)
)
((= quarter 4)
(setq startday (org-day-of-week 1 10 year))
(cond
((= startday 0)
(list 39 startday year))
((<= startday 4)
(list 40 startday year))
((> startday 4)
(list 39 startday year))
)
)
)
)
(defun org-clock-special-range (key &optional time as-strings)
"Return two times bordering a special time range.
Key is a symbol specifying the range and can be one of `today', `yesterday',
@ -1670,6 +1729,10 @@ the returned times will be formatted strings."
(dow (nth 6 tm))
(skey (symbol-name key))
(shift 0)
(q (cond ((>= (nth 4 tm) 10) 4)
((>= (nth 4 tm) 7) 3)
((>= (nth 4 tm) 4) 2)
((>= (nth 4 tm) 1) 1)))
s1 m1 h1 d1 month1 y1 diff ts te fm txt w date)
(cond
((string-match "^[0-9]+$" skey)
@ -1687,6 +1750,15 @@ the returned times will be formatted strings."
(setq d (nth 1 date) month (car date) y (nth 2 date)
dow 1
key 'week))
((string-match "^\\([0-9]+\\)-[qQ]\\([1-4]\\)$" skey)
(require 'cal-iso)
(setq y (string-to-number (match-string 1 skey)))
(setq q (string-to-number (match-string 2 skey)))
(setq date (calendar-gregorian-from-absolute
(calendar-absolute-from-iso (org-quarter-to-date q y))))
(setq d (nth 1 date) month (car date) y (nth 2 date)
dow 1
key 'quarter))
((string-match "^\\([0-9]+\\)-\\([0-9]\\{1,2\\}\\)-\\([0-9]\\{1,2\\}\\)$" skey)
(setq y (string-to-number (match-string 1 skey))
month (string-to-number (match-string 2 skey))
@ -1694,12 +1766,17 @@ the returned times will be formatted strings."
key 'day))
((string-match "\\([-+][0-9]+\\)$" skey)
(setq shift (string-to-number (match-string 1 skey))
key (intern (substring skey 0 (match-beginning 1))))))
key (intern (substring skey 0 (match-beginning 1))))
(if(and (memq key '(quarter thisq)) (> shift 0))
(error "Looking forward with quarters isn't implemented.")
())))
(when (= shift 0)
(cond ((eq key 'yesterday) (setq key 'today shift -1))
((eq key 'lastweek) (setq key 'week shift -1))
((eq key 'lastmonth) (setq key 'month shift -1))
((eq key 'lastyear) (setq key 'year shift -1))))
(cond ((eq key 'yesterday) (setq key 'today shift -1))
((eq key 'lastweek) (setq key 'week shift -1))
((eq key 'lastmonth) (setq key 'month shift -1))
((eq key 'lastyear) (setq key 'year shift -1))
((eq key 'lastq) (setq key 'quarter shift -1))))
(cond
((memq key '(day today))
(setq d (+ d shift) h 0 m 0 h1 24 m1 0))
@ -1708,6 +1785,28 @@ the returned times will be formatted strings."
m 0 h 0 d (- d diff) d1 (+ 7 d)))
((memq key '(month thismonth))
(setq d 1 h 0 m 0 d1 1 month (+ month shift) month1 (1+ month) h1 0 m1 0))
((memq key '(quarter thisq))
; compute if this shift remains in this year
; if not, compute how many years and quarters we have to shift (via floor*)
; and compute the shifted years, months and quarters
(cond
((< (+ (- q 1) shift) 0) ; shift not in this year
(setq interval (* -1 (+ (- q 1) shift)))
; set tmp to ((years to shift) (quarters to shift))
(setq tmp (floor* interval 4))
; due to the use of floor, 0 quarters actually means 4
(if (= 0 (nth 1 tmp))
(setq shiftedy (- y (nth 0 tmp))
shiftedm 1
shiftedq 1)
(setq shiftedy (- y (+ 1 (nth 0 tmp)))
shiftedm (- 13 (* 3 (nth 1 tmp)))
shiftedq (- 5 (nth 1 tmp))))
(setq d 1 h 0 m 0 d1 1 month shiftedm month1 (+ 3 shiftedm) h1 0 m1 0 y shiftedy))
((> (+ q shift) 0) ; shift is whitin this year
(setq shiftedq (+ q shift))
(setq shiftedy y)
(setq d 1 h 0 m 0 d1 1 month (+ 1 (* 3 (- (+ q shift) 1))) month1 (+ 4 (* 3 (- (+ q shift) 1))) h1 0 m1 0))))
((memq key '(year thisyear))
(setq m 0 h 0 d 1 month 1 y (+ y shift) y1 (1+ y)))
(t (error "No such time block %s" key)))
@ -1723,11 +1822,21 @@ the returned times will be formatted strings."
((memq key '(month thismonth))
(setq txt (format-time-string "%B %Y" ts)))
((memq key '(year thisyear))
(setq txt (format-time-string "the year %Y" ts))))
(setq txt (format-time-string "the year %Y" ts)))
((memq key '(quarter thisq))
(setq txt (concatenate 'string (org-count-quarter shiftedq) " quarter of " (number-to-string shiftedy))))
)
(if as-strings
(list (format-time-string fm ts) (format-time-string fm te) txt)
(list ts te txt))))
(defun org-count-quarter (n)
(cond
((= n 1) "1st")
((= n 2) "2nd")
((= n 3) "3rd")
((= n 4) "4th")))
(defun org-clocktable-shift (dir n)
"Try to shift the :block date of the clocktable at point.
Point must be in the #+BEGIN: line of a clocktable, or this function
@ -1750,45 +1859,63 @@ the currently selected interval size."
((equal s "yesterday") (setq s "today-1"))
((equal s "lastweek") (setq s "thisweek-1"))
((equal s "lastmonth") (setq s "thismonth-1"))
((equal s "lastyear") (setq s "thisyear-1")))
(cond
((string-match "^\\(today\\|thisweek\\|thismonth\\|thisyear\\)\\([-+][0-9]+\\)?$" s)
(setq block (match-string 1 s)
shift (if (match-end 2)
(string-to-number (match-string 2 s))
0))
(setq shift (+ shift n))
(setq ins (if (= shift 0) block (format "%s%+d" block shift))))
((string-match "\\([0-9]+\\)\\(-\\([wW]?\\)\\([0-9]\\{1,2\\}\\)\\(-\\([0-9]\\{1,2\\}\\)\\)?\\)?" s)
;; 1 1 2 3 3 4 4 5 6 6 5 2
(setq y (string-to-number (match-string 1 s))
wp (and (match-end 3) (match-string 3 s))
mw (and (match-end 4) (string-to-number (match-string 4 s)))
d (and (match-end 6) (string-to-number (match-string 6 s))))
(cond
(d (setq ins (format-time-string
"%Y-%m-%d"
(encode-time 0 0 0 (+ d n) m y))))
((and wp mw (> (length wp) 0))
(require 'cal-iso)
(setq date (calendar-gregorian-from-absolute (calendar-absolute-from-iso (list (+ mw n) 1 y))))
(setq ins (format-time-string
"%G-W%V"
(encode-time 0 0 0 (nth 1 date) (car date) (nth 2 date)))))
(mw
(setq ins (format-time-string
"%Y-%m"
(encode-time 0 0 0 1 (+ mw n) y))))
(y
(setq ins (number-to-string (+ y n))))))
(t (error "Cannot shift clocktable block")))
(when ins
(goto-char b)
(insert ins)
(delete-region (point) (+ (point) (- e b)))
(beginning-of-line 1)
(org-update-dblock)
t)))))
((equal s "lastyear") (setq s "thisyear-1"))
((equal s "lastq") (setq s "thisq-1")))
(cond
((string-match "^\\(today\\|thisweek\\|thismonth\\|thisyear\\|thisq\\)\\([-+][0-9]+\\)?$" s)
(setq block (match-string 1 s)
shift (if (match-end 2)
(string-to-number (match-string 2 s))
0))
(setq shift (+ shift n))
(setq ins (if (= shift 0) block (format "%s%+d" block shift))))
((string-match "\\([0-9]+\\)\\(-\\([wWqQ]?\\)\\([0-9]\\{1,2\\}\\)\\(-\\([0-9]\\{1,2\\}\\)\\)?\\)?" s)
;; 1 1 2 3 3 4 4 5 6 6 5 2
(setq y (string-to-number (match-string 1 s))
wp (and (match-end 3) (match-string 3 s))
mw (and (match-end 4) (string-to-number (match-string 4 s)))
d (and (match-end 6) (string-to-number (match-string 6 s))))
(cond
(d (setq ins (format-time-string
"%Y-%m-%d"
(encode-time 0 0 0 (+ d n) m y))))
((and wp (string-match "w\\|W" wp) mw (> (length wp) 0))
(require 'cal-iso)
(setq date (calendar-gregorian-from-absolute (calendar-absolute-from-iso (list (+ mw n) 1 y))))
(setq ins (format-time-string
"%G-W%V"
(encode-time 0 0 0 (nth 1 date) (car date) (nth 2 date)))))
((and wp (string-match "q\\|Q" wp) mw (> (length wp) 0))
(require 'cal-iso)
; if the 4th + 1 quarter is requested we flip to the 1st quarter of the next year
(if (> (+ mw n) 4)
(setq mw 0
y (+ 1 y))
())
; if the 1st - 1 quarter is requested we flip to the 4th quarter of the previous year
(if (= (+ mw n) 0)
(setq mw 5
y (- y 1))
())
(setq date (calendar-gregorian-from-absolute (calendar-absolute-from-iso (org-quarter-to-date (+ mw n) y))))
(setq ins (format-time-string
(concatenate 'string (number-to-string y) "-Q" (number-to-string (+ mw n)))
(encode-time 0 0 0 (nth 1 date) (car date) (nth 2 date)))))
(mw
(setq ins (format-time-string
"%Y-%m"
(encode-time 0 0 0 1 (+ mw n) y))))
(y
(setq ins (number-to-string (+ y n))))))
(t (error "Cannot shift clocktable block")))
(when ins
(goto-char b)
(insert ins)
(delete-region (point) (+ (point) (- e b)))
(beginning-of-line 1)
(org-update-dblock)
t)))))
(defun org-dblock-write:clocktable (params)
"Write the standard clocktable."

View file

@ -2383,7 +2383,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
"\n"
(match-string 1 res))
t t res)))
(insert res "\n"))))
(insert res))))
(defconst org-latex-entities
'("\\!"

View file

@ -518,7 +518,11 @@ List ending is determined by the indentation of text. See
(setq ind-ref ind)
(forward-line 1))
((<= ind ind-ref)
(throw 'exit (point-at-bol)))
(throw 'exit (progn
;; Again, ensure bottom is just after a
;; non-blank line.
(skip-chars-backward " \r\t\n")
(min (point-max) (1+ (point-at-eol))))))
((looking-at "#\\+begin_")
(re-search-forward "[ \t]*#\\+end_")
(forward-line 1))

View file

@ -2732,10 +2732,10 @@ To disable these tags on a per-file basis, insert anywhere in the file:
(defcustom org-complete-tags-always-offer-all-agenda-tags nil
"If non-nil, always offer completion for all tags of all agenda files.
Instead of customizing this variable directly, you might want to
set it locally for remember buffers, because there no list of
set it locally for capture buffers, because there no list of
tags in that file can be created dynamically (there are none).
(add-hook 'org-remember-mode-hook
(add-hook 'org-capture-mode-hook
(lambda ()
(set (make-local-variable
'org-complete-tags-always-offer-all-agenda-tags)