comparison lisp/org/org-agenda.el @ 96975:60149c696033

2008-07-24 Carsten Dominik <dominik@science.uva.nl> * org-exp.el (org-export-region-as-html, org-export-as-html): Make sure that calls from `org-export-region-as-html' do not do the special check for a subtree. * org-agenda.el (org-batch-store-agenda-views): Fix parsing bug. * org.el (org-open-file): Use `org-open-directory-means-index-dot-org'. (org-open-directory-means-index-dot-org): New option. * org.el (org-make-link-string): Remove link attributes from description. (org-open-at-point): Remove link attributes bevore using the path. * org-exp.el (org-export-as-html): Handle link attributes. * org.el (org-extract-attributes, org-attributes-to-string): New functions. * org-table.el (org-table-to-lisp): New function. * org.el (org-narrow-to-subtree): Do not include the final newline into the narrowed region. * org-agenda.el (org-agenda-custom-commands-local-options): Fixed bug with user-define skipping condition. * org-agenda.el (org-agenda-get-restriction-and-command): Fixed typo. * org-exp.el (org-export-html-style-default): Automatic overflow handling for pre fields. (org-export-as-ascii, org-export-as-html): Change default format for time stamp. * org-table.el (org-table-export): Offer completion for translator functions, and do not require a heading above the table. * org.el (org-renumber-ordered-list, org-beginning-of-item-list): Cater for the case of a list starting in the first line of the buffer. * org-publish.el (org-publish-find-title): Bug fix. (org-publish-org-index): Implement new :index-style option. * org-publish.el (org-publish-timestamp-filename): Use SHA1-encoded file names in the timestamp directory. * org-publish.el (org-publish-needed-p): Be verbose about files published and files skipped. * org-exp.el (org-export-preprocess-string): Swap link normalization and inernal link targeting. * org-publish.el (org-publish-needed-p): Create timestamp directory when it does not exist. * org-clock.el (org-clock-out-when-done): Doc fix. * org.el (org-agenda-skip-unavailable-files): Doc fix. * org-exp.el (org-export-remove-comment-blocks-and-subtrees): Ignore case when searching for the COMMENT cookie at export time. * org-exp.el (org-get-file-contents) (org-get-and-remove-property): New functions. (org-export-handle-include-files): Handle the new prefix options. (org-export-as-html): Fix the verse environment. * org.el (org-time=, org-time<, org-time<=, org-time>) (org-time>=, org-time<>, org-2ft): New functions. (org-op-to-function): Also provide for the time testing fucntions. * org-exp.el (org-export-html-style-default): New constant. * org-exp.el (org-export-html-style-extra): New variable. (org-export-splice-style): New function. * org-exp.el (org-export-plist-vars, org-export-as-html): Implement `org-export-creator-info'. (org-export-creator-info): New option. * org.el (org-clock-drawer-start-re, org-clock-drawer-end-re) (org-property-drawer-re, org-clock-drawer-re): New constants. * org-exp.el (org-icalendar-use-deadline) (org-icalendar-use-scheduled): New options. (org-icalendar-include-todo): Default changed to t. (org-print-icalendar-entries): Implement better utilization of scheduling and deadline time stamps. (org-export-target-internal-links, org-export-as-html): Allow file lines without the "file:" prefix if the file path is an absolute path or starts with ".". * org-clock.el (org-clocktable-shift): Also undertand yesterday, lastweek etc. (org-clock-special-range): Also undertand yesterday, lastweek etc. * org.el (org-agenda-skip-archived-trees): Docstring now discourages using this. (org-scan-tags): Check for org-agenda-archives-mode. (org-map-entries): Make sure org-agenda-archives-mode is nil. (org-agenda-files): Functionality of second arg changed. * org-agenda.el (org-agenda-archives-mode): New variable (org-write-agenda, org-prepare-agenda, org-agenda-list) (org-search-view, org-todo-list, org-tags-view) (org-agenda-list-stuck-projects): Call `org-agenda-files' with `ifmode' argument. (org-agenda-quit): Reset the archives mode. (org-agenda-archives-mode): New command. (org-agenda-set-mode-name): Include archives info. * org.el (org-paste-subtree): Make sure the yanked headline is visible if it was yanked at a visible point. (org-move-item-up): Fix the bug with moving white space at the end of the item. (org-show-empty-lines-in-parent): New function.
author Carsten Dominik <dominik@science.uva.nl>
date Thu, 24 Jul 2008 13:59:56 +0000
parents c1ef445563bb
children adc2dffbdfc3
comparison
equal deleted inserted replaced
96974:fa6516860909 96975:60149c696033
4 ;; Free Software Foundation, Inc. 4 ;; Free Software Foundation, Inc.
5 5
6 ;; Author: Carsten Dominik <carsten at orgmode dot org> 6 ;; Author: Carsten Dominik <carsten at orgmode dot org>
7 ;; Keywords: outlines, hypermedia, calendar, wp 7 ;; Keywords: outlines, hypermedia, calendar, wp
8 ;; Homepage: http://orgmode.org 8 ;; Homepage: http://orgmode.org
9 ;; Version: 6.05a 9 ;; Version: 6.06a
10 ;; 10 ;;
11 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
12 ;; 12 ;;
13 ;; GNU Emacs is free software: you can redistribute it and/or modify 13 ;; GNU Emacs is free software: you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by 14 ;; it under the terms of the GNU General Public License as published by
209 (const :tag "not scheduled" 'notscheduled) 209 (const :tag "not scheduled" 'notscheduled)
210 (const :tag "deadline" 'deadline) 210 (const :tag "deadline" 'deadline)
211 (const :tag "no deadline" 'notdeadline)))))) 211 (const :tag "no deadline" 'notdeadline))))))
212 (list :tag "Non-standard skipping condition" 212 (list :tag "Non-standard skipping condition"
213 :value (org-agenda-skip-function) 213 :value (org-agenda-skip-function)
214 (list 214 (const org-agenda-skip-function)
215 (const org-agenda-skip-function) 215 (sexp :tag "Function or form (quoted!)"))))
216 (sexp :tag "Function or form (quoted!)")))))
217 "Selection of examples for agenda command settings. 216 "Selection of examples for agenda command settings.
218 This will be spliced into the custom type of 217 This will be spliced into the custom type of
219 `org-agenda-custom-commands'.") 218 `org-agenda-custom-commands'.")
220 219
221 220
390 (defgroup org-agenda-skip nil 389 (defgroup org-agenda-skip nil
391 "Options concerning skipping parts of agenda files." 390 "Options concerning skipping parts of agenda files."
392 :tag "Org Agenda Skip" 391 :tag "Org Agenda Skip"
393 :group 'org-agenda) 392 :group 'org-agenda)
394 393
394 (defvar org-agenda-archives-mode nil
395 "Non-nil means, the agenda will include archived items.
396 If this is the symbol `trees', trees in the selected agenda scope
397 that are marked with the ARCHIVE tag will be included anyway. When this is
398 t, also all archive files associated with the current selection of agenda
399 files will be included.")
400
395 (defcustom org-agenda-skip-comment-trees t 401 (defcustom org-agenda-skip-comment-trees t
396 "Non-nil means, skip trees that start with teh COMMENT keyword. 402 "Non-nil means, skip trees that start with teh COMMENT keyword.
397 When nil, these trees are also scand by agenda commands." 403 When nil, these trees are also scand by agenda commands."
398 :group 'org-agenda-skip 404 :group 'org-agenda-skip
399 :type 'boolean) 405 :type 'boolean)
1103 (int-to-string (pop l)) 'digit-argument))) 1109 (int-to-string (pop l)) 'digit-argument)))
1104 1110
1105 (org-defkey org-agenda-mode-map "f" 'org-agenda-follow-mode) 1111 (org-defkey org-agenda-mode-map "f" 'org-agenda-follow-mode)
1106 (org-defkey org-agenda-mode-map "R" 'org-agenda-clockreport-mode) 1112 (org-defkey org-agenda-mode-map "R" 'org-agenda-clockreport-mode)
1107 (org-defkey org-agenda-mode-map "l" 'org-agenda-log-mode) 1113 (org-defkey org-agenda-mode-map "l" 'org-agenda-log-mode)
1114 (org-defkey org-agenda-mode-map "v" 'org-agenda-archives-mode)
1108 (org-defkey org-agenda-mode-map "D" 'org-agenda-toggle-diary) 1115 (org-defkey org-agenda-mode-map "D" 'org-agenda-toggle-diary)
1109 (org-defkey org-agenda-mode-map "G" 'org-agenda-toggle-time-grid) 1116 (org-defkey org-agenda-mode-map "G" 'org-agenda-toggle-time-grid)
1110 (org-defkey org-agenda-mode-map "r" 'org-agenda-redo) 1117 (org-defkey org-agenda-mode-map "r" 'org-agenda-redo)
1111 (org-defkey org-agenda-mode-map "g" 'org-agenda-redo) 1118 (org-defkey org-agenda-mode-map "g" 'org-agenda-redo)
1112 (org-defkey org-agenda-mode-map "e" 'org-agenda-execute) 1119 (org-defkey org-agenda-mode-map "e" 'org-agenda-execute)
1232 ["Month View" org-agenda-month-view :active (org-agenda-check-type nil 'agenda) 1239 ["Month View" org-agenda-month-view :active (org-agenda-check-type nil 'agenda)
1233 :style radio :selected (member org-agenda-ndays '(28 29 30 31))] 1240 :style radio :selected (member org-agenda-ndays '(28 29 30 31))]
1234 ["Year View" org-agenda-year-view :active (org-agenda-check-type nil 'agenda) 1241 ["Year View" org-agenda-year-view :active (org-agenda-check-type nil 'agenda)
1235 :style radio :selected (member org-agenda-ndays '(365 366))] 1242 :style radio :selected (member org-agenda-ndays '(365 366))]
1236 "--" 1243 "--"
1244 ["Include Diary" org-agenda-toggle-diary
1245 :style toggle :selected org-agenda-include-diary
1246 :active (org-agenda-check-type nil 'agenda)]
1247 ["Use Time Grid" org-agenda-toggle-time-grid
1248 :style toggle :selected org-agenda-use-time-grid
1249 :active (org-agenda-check-type nil 'agenda)]
1250 "--"
1251 ["Show clock report" org-agenda-clockreport-mode
1252 :style toggle :selected org-agenda-clockreport-mode
1253 :active (org-agenda-check-type nil 'agenda)]
1254 "--"
1237 ["Show Logbook entries" org-agenda-log-mode 1255 ["Show Logbook entries" org-agenda-log-mode
1238 :style toggle :selected org-agenda-show-log :active (org-agenda-check-type nil 'agenda 'timeline)] 1256 :style toggle :selected org-agenda-show-log
1239 ["Show clock report" org-agenda-clockreport-mode 1257 :active (org-agenda-check-type nil 'agenda 'timeline)]
1240 :style toggle :selected org-agenda-clockreport-mode :active (org-agenda-check-type nil 'agenda)] 1258 ["Include archived trees" org-agenda-archives-mode
1241 ["Include Diary" org-agenda-toggle-diary 1259 :style toggle :selected org-agenda-archives-mode :active t]
1242 :style toggle :selected org-agenda-include-diary :active (org-agenda-check-type nil 'agenda)] 1260 ["Include archive files" (org-agenda-archives-mode t)
1243 ["Use Time Grid" org-agenda-toggle-time-grid 1261 :style toggle :selected (eq org-agenda-archives-mode t) :active t
1244 :style toggle :selected org-agenda-use-time-grid :active (org-agenda-check-type nil 'agenda)]) 1262 :keys "C-u v"])
1245 ["Write view to file" org-write-agenda t] 1263 ["Write view to file" org-write-agenda t]
1246 ["Rebuild buffer" org-agenda-redo t] 1264 ["Rebuild buffer" org-agenda-redo t]
1247 ["Save all Org-mode Buffers" org-save-all-org-buffers t] 1265 ["Save all Org-mode Buffers" org-save-all-org-buffers t]
1248 "--" 1266 "--"
1249 ["Undo Remote Editing" org-agenda-undo org-agenda-undo-list] 1267 ["Undo Remote Editing" org-agenda-undo org-agenda-undo-list]
1473 (org-switch-to-buffer-other-window " *Agenda Commands*") 1491 (org-switch-to-buffer-other-window " *Agenda Commands*")
1474 (erase-buffer) 1492 (erase-buffer)
1475 (insert (eval-when-compile 1493 (insert (eval-when-compile
1476 (let ((header 1494 (let ((header
1477 " 1495 "
1478 Press key for an agenda command: < Buffer,subtree/region restriction 1496 Press key for an agenda command: < Buffer, subtree/region restriction
1479 -------------------------------- > Remove restriction 1497 -------------------------------- > Remove restriction
1480 a Agenda for current week or day e Export agenda views 1498 a Agenda for current week or day e Export agenda views
1481 t List of all TODO entries T Entries with special TODO kwd 1499 t List of all TODO entries T Entries with special TODO kwd
1482 m Match a TAGS query M Like m, but only TODO entries 1500 m Match a TAGS query M Like m, but only TODO entries
1483 L Timeline for current buffer # List stuck projects (!=configure) 1501 L Timeline for current buffer # List stuck projects (!=configure)
1788 (defmacro org-batch-store-agenda-views (&rest parameters) 1806 (defmacro org-batch-store-agenda-views (&rest parameters)
1789 "Run all custom agenda commands that have a file argument." 1807 "Run all custom agenda commands that have a file argument."
1790 (let ((cmds (org-agenda-normalize-custom-commands org-agenda-custom-commands)) 1808 (let ((cmds (org-agenda-normalize-custom-commands org-agenda-custom-commands))
1791 (pop-up-frames nil) 1809 (pop-up-frames nil)
1792 (dir default-directory) 1810 (dir default-directory)
1793 pars cmd thiscmdkey files opts) 1811 pars cmd thiscmdkey files opts cmd-or-set)
1794 (while parameters 1812 (while parameters
1795 (push (list (pop parameters) (if parameters (pop parameters))) pars)) 1813 (push (list (pop parameters) (if parameters (pop parameters))) pars))
1796 (setq pars (reverse pars)) 1814 (setq pars (reverse pars))
1797 (save-window-excursion 1815 (save-window-excursion
1798 (while cmds 1816 (while cmds
1799 (setq cmd (pop cmds) 1817 (setq cmd (pop cmds)
1800 thiscmdkey (car cmd) 1818 thiscmdkey (car cmd)
1801 opts (nth 4 cmd) 1819 cmd-or-set (nth 2 cmd)
1802 files (nth 5 cmd)) 1820 opts (nth (if (listp cmd-or-set) 3 4) cmd)
1821 files (nth (if (listp cmd-or-set) 4 5) cmd))
1803 (if (stringp files) (setq files (list files))) 1822 (if (stringp files) (setq files (list files)))
1804 (when files 1823 (when files
1805 (eval (list 'let (append org-agenda-exporter-settings opts pars) 1824 (eval (list 'let (append org-agenda-exporter-settings opts pars)
1806 (list 'org-agenda nil thiscmdkey))) 1825 (list 'org-agenda nil thiscmdkey)))
1807 (set-buffer org-agenda-buffer-name) 1826 (set-buffer org-agenda-buffer-name)
1853 (let ((org-agenda-marker-table 1872 (let ((org-agenda-marker-table
1854 (org-create-marker-find-array 1873 (org-create-marker-find-array
1855 (org-agenda-collect-markers))) 1874 (org-agenda-collect-markers)))
1856 (org-icalendar-verify-function 'org-check-agenda-marker-table) 1875 (org-icalendar-verify-function 'org-check-agenda-marker-table)
1857 (org-combined-agenda-icalendar-file file)) 1876 (org-combined-agenda-icalendar-file file))
1858 (apply 'org-export-icalendar 'combine (org-agenda-files)))) 1877 (apply 'org-export-icalendar 'combine
1878 (org-agenda-files nil 'ifmode))))
1859 (t 1879 (t
1860 (let ((bs (buffer-string))) 1880 (let ((bs (buffer-string)))
1861 (find-file file) 1881 (find-file file)
1862 (insert bs) 1882 (insert bs)
1863 (save-buffer 0) 1883 (save-buffer 0)
1935 (insert "\n" (make-string (window-width) ?=) "\n")) 1955 (insert "\n" (make-string (window-width) ?=) "\n"))
1936 (narrow-to-region (point) (point-max))) 1956 (narrow-to-region (point) (point-max)))
1937 (org-agenda-reset-markers) 1957 (org-agenda-reset-markers)
1938 (setq org-agenda-contributing-files nil) 1958 (setq org-agenda-contributing-files nil)
1939 (setq org-agenda-columns-active nil) 1959 (setq org-agenda-columns-active nil)
1940 (org-prepare-agenda-buffers (org-agenda-files)) 1960 (org-prepare-agenda-buffers (org-agenda-files nil 'ifmode))
1941 (setq org-todo-keywords-for-agenda 1961 (setq org-todo-keywords-for-agenda
1942 (org-uniquify org-todo-keywords-for-agenda)) 1962 (org-uniquify org-todo-keywords-for-agenda))
1943 (setq org-done-keywords-for-agenda 1963 (setq org-done-keywords-for-agenda
1944 (org-uniquify org-done-keywords-for-agenda)) 1964 (org-uniquify org-done-keywords-for-agenda))
1945 (let* ((abuf (get-buffer-create org-agenda-buffer-name)) 1965 (let* ((abuf (get-buffer-create org-agenda-buffer-name))
2030 (defun org-agenda-skip () 2050 (defun org-agenda-skip ()
2031 "Throw to `:skip' in places that should be skipped. 2051 "Throw to `:skip' in places that should be skipped.
2032 Also moves point to the end of the skipped region, so that search can 2052 Also moves point to the end of the skipped region, so that search can
2033 continue from there." 2053 continue from there."
2034 (let ((p (point-at-bol)) to fp) 2054 (let ((p (point-at-bol)) to fp)
2035 (and org-agenda-skip-archived-trees 2055 (and org-agenda-skip-archived-trees (not org-agenda-archives-mode)
2036 (get-text-property p :org-archived) 2056 (get-text-property p :org-archived)
2037 (org-end-of-subtree t) 2057 (org-end-of-subtree t)
2038 (throw :skip t)) 2058 (throw :skip t))
2039 (and org-agenda-skip-comment-trees 2059 (and org-agenda-skip-comment-trees
2040 (get-text-property p :org-comment) 2060 (get-text-property p :org-comment)
2253 (org-set-sorting-strategy 'agenda) 2273 (org-set-sorting-strategy 'agenda)
2254 (require 'calendar) 2274 (require 'calendar)
2255 (let* ((org-agenda-start-on-weekday 2275 (let* ((org-agenda-start-on-weekday
2256 (if (or (equal ndays 7) (and (null ndays) (equal 7 org-agenda-ndays))) 2276 (if (or (equal ndays 7) (and (null ndays) (equal 7 org-agenda-ndays)))
2257 org-agenda-start-on-weekday nil)) 2277 org-agenda-start-on-weekday nil))
2258 (thefiles (org-agenda-files)) 2278 (thefiles (org-agenda-files nil 'ifmode))
2259 (files thefiles) 2279 (files thefiles)
2260 (today (time-to-days 2280 (today (time-to-days
2261 (time-subtract (current-time) 2281 (time-subtract (current-time)
2262 (list 0 (* 3600 org-extend-today-until) 0)))) 2282 (list 0 (* 3600 org-extend-today-until) 0))))
2263 (sd (or start-day today)) 2283 (sd (or start-day today))
2371 rtnall nd todayp)) 2391 rtnall nd todayp))
2372 "\n")) 2392 "\n"))
2373 (put-text-property s (1- (point)) 'day d) 2393 (put-text-property s (1- (point)) 'day d)
2374 (put-text-property s (1- (point)) 'org-day-cnt day-cnt)))) 2394 (put-text-property s (1- (point)) 'org-day-cnt day-cnt))))
2375 (when (and org-agenda-clockreport-mode clocktable-start) 2395 (when (and org-agenda-clockreport-mode clocktable-start)
2376 (let ((org-agenda-files (org-agenda-files)) 2396 (let ((org-agenda-files (org-agenda-files nil 'ifmode))
2377 ;; the above line is to ensure the restricted range! 2397 ;; the above line is to ensure the restricted range!
2378 (p org-agenda-clockreport-parameter-plist) 2398 (p org-agenda-clockreport-parameter-plist)
2379 tbl) 2399 tbl)
2380 (setq p (org-plist-delete p :block)) 2400 (setq p (org-plist-delete p :block))
2381 (setq p (plist-put p :tstart clocktable-start)) 2401 (setq p (plist-put p :tstart clocktable-start))
2500 (if (not regexps+) 2520 (if (not regexps+)
2501 (setq regexp (concat "^" org-outline-regexp)) 2521 (setq regexp (concat "^" org-outline-regexp))
2502 (setq regexp (pop regexps+)) 2522 (setq regexp (pop regexps+))
2503 (if hdl-only (setq regexp (concat "^" org-outline-regexp ".*?" 2523 (if hdl-only (setq regexp (concat "^" org-outline-regexp ".*?"
2504 regexp)))) 2524 regexp))))
2505 (setq files (org-agenda-files)) 2525 (setq files (org-agenda-files nil 'ifmode))
2506 (when (eq (car org-agenda-text-search-extra-files) 'agenda-archives) 2526 (when (eq (car org-agenda-text-search-extra-files) 'agenda-archives)
2507 (pop org-agenda-text-search-extra-files) 2527 (pop org-agenda-text-search-extra-files)
2508 (setq files (org-add-archive-files files))) 2528 (setq files (org-add-archive-files files)))
2509 (setq files (append files org-agenda-text-search-extra-files) 2529 (setq files (append files org-agenda-text-search-extra-files)
2510 rtnall nil) 2530 rtnall nil)
2631 (mapcar 'list kwds) nil nil))) 2651 (mapcar 'list kwds) nil nil)))
2632 (and (equal 0 arg) (setq org-select-this-todo-keyword nil)) 2652 (and (equal 0 arg) (setq org-select-this-todo-keyword nil))
2633 (org-set-local 'org-last-arg arg) 2653 (org-set-local 'org-last-arg arg)
2634 (setq org-agenda-redo-command 2654 (setq org-agenda-redo-command
2635 '(org-todo-list (or current-prefix-arg org-last-arg))) 2655 '(org-todo-list (or current-prefix-arg org-last-arg)))
2636 (setq files (org-agenda-files) 2656 (setq files (org-agenda-files nil 'ifmode)
2637 rtnall nil) 2657 rtnall nil)
2638 (while (setq file (pop files)) 2658 (while (setq file (pop files))
2639 (catch 'nextfile 2659 (catch 'nextfile
2640 (org-check-agenda-file file) 2660 (org-check-agenda-file file)
2641 (setq rtn (org-agenda-get-day-entries file date :todo)) 2661 (setq rtn (org-agenda-get-day-entries file date :todo))
2688 (org-prepare-agenda (concat "TAGS " match)) 2708 (org-prepare-agenda (concat "TAGS " match))
2689 (setq org-agenda-query-string match) 2709 (setq org-agenda-query-string match)
2690 (setq org-agenda-redo-command 2710 (setq org-agenda-redo-command
2691 (list 'org-tags-view (list 'quote todo-only) 2711 (list 'org-tags-view (list 'quote todo-only)
2692 (list 'if 'current-prefix-arg nil 'org-agenda-query-string))) 2712 (list 'if 'current-prefix-arg nil 'org-agenda-query-string)))
2693 (setq files (org-agenda-files) 2713 (setq files (org-agenda-files nil 'ifmode)
2694 rtnall nil) 2714 rtnall nil)
2695 (while (setq file (pop files)) 2715 (while (setq file (pop files))
2696 (catch 'nextfile 2716 (catch 'nextfile
2697 (org-check-agenda-file file) 2717 (org-check-agenda-file file)
2698 (setq buffer (if (file-exists-p file) 2718 (setq buffer (if (file-exists-p file)
2825 (org-agenda-overriding-header "List of stuck projects: ") 2845 (org-agenda-overriding-header "List of stuck projects: ")
2826 (matcher (nth 0 org-stuck-projects)) 2846 (matcher (nth 0 org-stuck-projects))
2827 (todo (nth 1 org-stuck-projects)) 2847 (todo (nth 1 org-stuck-projects))
2828 (todo-wds (if (member "*" todo) 2848 (todo-wds (if (member "*" todo)
2829 (progn 2849 (progn
2830 (org-prepare-agenda-buffers (org-agenda-files)) 2850 (org-prepare-agenda-buffers (org-agenda-files
2851 nil 'ifmode))
2831 (org-delete-all 2852 (org-delete-all
2832 org-done-keywords-for-agenda 2853 org-done-keywords-for-agenda
2833 (copy-sequence org-todo-keywords-for-agenda))) 2854 (copy-sequence org-todo-keywords-for-agenda)))
2834 todo)) 2855 todo))
2835 (todo-re (concat "^\\*+[ \t]+\\(" 2856 (todo-re (concat "^\\*+[ \t]+\\("
4000 (org-columns-quit) 4021 (org-columns-quit)
4001 (let ((buf (current-buffer))) 4022 (let ((buf (current-buffer)))
4002 (if (not (one-window-p)) (delete-window)) 4023 (if (not (one-window-p)) (delete-window))
4003 (kill-buffer buf) 4024 (kill-buffer buf)
4004 (org-agenda-reset-markers) 4025 (org-agenda-reset-markers)
4005 (org-columns-remove-overlays)) 4026 (org-columns-remove-overlays)
4027 (setq org-agenda-archives-mode nil))
4006 ;; Maybe restore the pre-agenda window configuration. 4028 ;; Maybe restore the pre-agenda window configuration.
4007 (and org-agenda-restore-windows-after-quit 4029 (and org-agenda-restore-windows-after-quit
4008 (not (eq org-agenda-window-setup 'other-frame)) 4030 (not (eq org-agenda-window-setup 'other-frame))
4009 org-pre-agenda-window-conf 4031 org-pre-agenda-window-conf
4010 (set-window-configuration org-pre-agenda-window-conf)))) 4032 (set-window-configuration org-pre-agenda-window-conf))))
4338 (org-agenda-set-mode-name) 4360 (org-agenda-set-mode-name)
4339 (org-agenda-redo) 4361 (org-agenda-redo)
4340 (message "Log mode is %s" 4362 (message "Log mode is %s"
4341 (if org-agenda-show-log "on" "off"))) 4363 (if org-agenda-show-log "on" "off")))
4342 4364
4365 (defun org-agenda-archives-mode (&optional with-files)
4366 "Toggle log mode in an agenda buffer."
4367 (interactive "P")
4368 (setq org-agenda-archives-mode
4369 (if with-files t (if org-agenda-archives-mode nil 'trees)))
4370 (org-agenda-set-mode-name)
4371 (org-agenda-redo)
4372 (message
4373 "%s"
4374 (cond
4375 ((eq org-agenda-archives-mode nil)
4376 "No archives are included")
4377 ((eq org-agenda-archives-mode 'trees)
4378 (format "Trees with :%s: tag are included" org-archive-tag))
4379 ((eq org-agenda-archives-mode t)
4380 (format "Trees with :%s: tag and all active archive files are included"
4381 org-archive-tag)))))
4382
4343 (defun org-agenda-toggle-diary () 4383 (defun org-agenda-toggle-diary ()
4344 "Toggle diary inclusion in an agenda buffer." 4384 "Toggle diary inclusion in an agenda buffer."
4345 (interactive) 4385 (interactive)
4346 (org-agenda-check-type t 'agenda) 4386 (org-agenda-check-type t 'agenda)
4347 (setq org-agenda-include-diary (not org-agenda-include-diary)) 4387 (setq org-agenda-include-diary (not org-agenda-include-diary))
4368 (if (equal org-agenda-ndays 7) " Week" "") 4408 (if (equal org-agenda-ndays 7) " Week" "")
4369 (if org-agenda-follow-mode " Follow" "") 4409 (if org-agenda-follow-mode " Follow" "")
4370 (if org-agenda-include-diary " Diary" "") 4410 (if org-agenda-include-diary " Diary" "")
4371 (if org-agenda-use-time-grid " Grid" "") 4411 (if org-agenda-use-time-grid " Grid" "")
4372 (if org-agenda-show-log " Log" "") 4412 (if org-agenda-show-log " Log" "")
4413 (if org-agenda-archives-mode
4414 (if (eq org-agenda-archives-mode t)
4415 " Archives"
4416 (format " :%s:" org-archive-tag))
4417 "")
4373 (if org-agenda-clockreport-mode " Clock" ""))) 4418 (if org-agenda-clockreport-mode " Clock" "")))
4374 (force-mode-line-update)) 4419 (force-mode-line-update))
4375 4420
4376 (defun org-agenda-post-command-hook () 4421 (defun org-agenda-post-command-hook ()
4377 (and (eolp) (not (bolp)) (backward-char 1)) 4422 (and (eolp) (not (bolp)) (backward-char 1))