Mercurial > emacs
comparison lisp/org/org.el @ 99866:57447f70a253
2008-11-24 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-get-closed): Re-apply changes
accidentially overwritten by last commit to Emacs.
* org.el (org-outline-path-complete-in-steps): New option.
(org-refile-get-location): Honor
`org-outline-path-complete-in-steps'.
(org-agenda-change-all-lines, org-tags-sparse-tree)
(org-time-string-to-absolute, org-small-year-to-year)
(org-link-escape): Re-apply changes accidentially overwritten
by last commit to Emacs.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Mon, 24 Nov 2008 12:16:13 +0000 |
parents | 621e15919df0 |
children | c851df8e004e |
comparison
equal
deleted
inserted
replaced
99865:7a3672b295e4 | 99866:57447f70a253 |
---|---|
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | 3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
4 ;; | 4 ;; |
5 ;; Author: Carsten Dominik <carsten at orgmode dot org> | 5 ;; Author: Carsten Dominik <carsten at orgmode dot org> |
6 ;; Keywords: outlines, hypermedia, calendar, wp | 6 ;; Keywords: outlines, hypermedia, calendar, wp |
7 ;; Homepage: http://orgmode.org | 7 ;; Homepage: http://orgmode.org |
8 ;; Version: 6.13 | 8 ;; Version: 6.13a |
9 ;; | 9 ;; |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 ;; | 11 ;; |
12 ;; GNU Emacs is free software: you can redistribute it and/or modify | 12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
90 | 90 |
91 ;;;; Customization variables | 91 ;;;; Customization variables |
92 | 92 |
93 ;;; Version | 93 ;;; Version |
94 | 94 |
95 (defconst org-version "6.13" | 95 (defconst org-version "6.13a" |
96 "The version number of the file org.el.") | 96 "The version number of the file org.el.") |
97 | 97 |
98 (defun org-version (&optional here) | 98 (defun org-version (&optional here) |
99 "Show the org-mode version in the echo area. | 99 "Show the org-mode version in the echo area. |
100 With prefix arg HERE, insert it at point." | 100 With prefix arg HERE, insert it at point." |
1243 (string :tag "Command") | 1243 (string :tag "Command") |
1244 (sexp :tag "Lisp form"))))) | 1244 (sexp :tag "Lisp form"))))) |
1245 | 1245 |
1246 (defgroup org-refile nil | 1246 (defgroup org-refile nil |
1247 "Options concerning refiling entries in Org-mode." | 1247 "Options concerning refiling entries in Org-mode." |
1248 :tag "Org Remember" | 1248 :tag "Org Refile" |
1249 :group 'org) | 1249 :group 'org) |
1250 | 1250 |
1251 (defcustom org-directory "~/org" | 1251 (defcustom org-directory "~/org" |
1252 "Directory with org files. | 1252 "Directory with org files. |
1253 This directory will be used as default to prompt for org files. | 1253 This directory will be used as default to prompt for org files. |
1273 Allowed vaues are: | 1273 Allowed vaues are: |
1274 outline The interface shows an outline of the relevant file | 1274 outline The interface shows an outline of the relevant file |
1275 and the correct heading is found by moving through | 1275 and the correct heading is found by moving through |
1276 the outline or by searching with incremental search. | 1276 the outline or by searching with incremental search. |
1277 outline-path-completion Headlines in the current buffer are offered via | 1277 outline-path-completion Headlines in the current buffer are offered via |
1278 completion." | 1278 completion. This is the interface also used by |
1279 the refile command." | |
1279 :group 'org-refile | 1280 :group 'org-refile |
1280 :type '(choice | 1281 :type '(choice |
1281 (const :tag "Outline" outline) | 1282 (const :tag "Outline" outline) |
1282 (const :tag "Outline-path-completion" outline-path-completion))) | 1283 (const :tag "Outline-path-completion" outline-path-completion))) |
1283 | 1284 |
1285 "Non-nil means, store new notes at the beginning of a file or entry. | 1286 "Non-nil means, store new notes at the beginning of a file or entry. |
1286 When nil, new notes will be filed to the end of a file or entry. | 1287 When nil, new notes will be filed to the end of a file or entry. |
1287 This can also be a list with cons cells of regular expressions that | 1288 This can also be a list with cons cells of regular expressions that |
1288 are matched against file names, and values." | 1289 are matched against file names, and values." |
1289 :group 'org-remember | 1290 :group 'org-remember |
1291 :group 'org-refile | |
1290 :type '(choice | 1292 :type '(choice |
1291 (const :tag "Reverse always" t) | 1293 (const :tag "Reverse always" t) |
1292 (const :tag "Reverse never" nil) | 1294 (const :tag "Reverse never" nil) |
1293 (repeat :tag "By file name regexp" | 1295 (repeat :tag "By file name regexp" |
1294 (cons regexp boolean)))) | 1296 (cons regexp boolean)))) |
1312 - a cons cell (:level . N). Any headline of level N is considered a target. | 1314 - a cons cell (:level . N). Any headline of level N is considered a target. |
1313 - a cons cell (:maxlevel . N). Any headline with level <= N is a target. | 1315 - a cons cell (:maxlevel . N). Any headline with level <= N is a target. |
1314 | 1316 |
1315 When this variable is nil, all top-level headlines in the current buffer | 1317 When this variable is nil, all top-level headlines in the current buffer |
1316 are used, equivalent to the value `((nil . (:level . 1))'." | 1318 are used, equivalent to the value `((nil . (:level . 1))'." |
1317 :group 'org-remember | 1319 :group 'org-refile |
1318 :type '(repeat | 1320 :type '(repeat |
1319 (cons | 1321 (cons |
1320 (choice :value org-agenda-files | 1322 (choice :value org-agenda-files |
1321 (const :tag "All agenda files" org-agenda-files) | 1323 (const :tag "All agenda files" org-agenda-files) |
1322 (const :tag "Current buffer" nil) | 1324 (const :tag "Current buffer" nil) |
1331 (defcustom org-refile-use-outline-path nil | 1333 (defcustom org-refile-use-outline-path nil |
1332 "Non-nil means, provide refile targets as paths. | 1334 "Non-nil means, provide refile targets as paths. |
1333 So a level 3 headline will be available as level1/level2/level3. | 1335 So a level 3 headline will be available as level1/level2/level3. |
1334 When the value is `file', also include the file name (without directory) | 1336 When the value is `file', also include the file name (without directory) |
1335 into the path. When `full-file-path', include the full file path." | 1337 into the path. When `full-file-path', include the full file path." |
1336 :group 'org-remember | 1338 :group 'org-refile |
1337 :type '(choice | 1339 :type '(choice |
1338 (const :tag "Not" nil) | 1340 (const :tag "Not" nil) |
1339 (const :tag "Yes" t) | 1341 (const :tag "Yes" t) |
1340 (const :tag "Start with file name" file) | 1342 (const :tag "Start with file name" file) |
1341 (const :tag "Start with full file path" full-file-path))) | 1343 (const :tag "Start with full file path" full-file-path))) |
1344 | |
1345 (defcustom org-outline-path-complete-in-steps t | |
1346 "Non-nil means, complete the outline path in hierarchical steps. | |
1347 When Org-mode uses the refile interface to select an outline path | |
1348 \(see variable `org-refile-use-outline-path'), the completion of | |
1349 the path can be done is a single go, or if can be done in steps down | |
1350 the headline hierarchy. Going in steps is probably the best if you | |
1351 do not use a special completion package like `ido' or `icicles'. | |
1352 However, when using these packages, going in one step can be very | |
1353 fast, while still showing the whole path to the entry." | |
1354 :group 'org-refile | |
1355 :type 'boolean) | |
1342 | 1356 |
1343 (defgroup org-todo nil | 1357 (defgroup org-todo nil |
1344 "Options concerning TODO items in Org-mode." | 1358 "Options concerning TODO items in Org-mode." |
1345 :tag "Org TODO" | 1359 :tag "Org TODO" |
1346 :group 'org) | 1360 :group 'org) |
2379 (declare-function org-agenda-skip "org-agenda" ()) | 2393 (declare-function org-agenda-skip "org-agenda" ()) |
2380 (declare-function org-format-agenda-item "org-agenda" | 2394 (declare-function org-format-agenda-item "org-agenda" |
2381 (extra txt &optional category tags dotime noprefix remove-re)) | 2395 (extra txt &optional category tags dotime noprefix remove-re)) |
2382 (declare-function org-agenda-new-marker "org-agenda" (&optional pos)) | 2396 (declare-function org-agenda-new-marker "org-agenda" (&optional pos)) |
2383 (declare-function org-agenda-change-all-lines "org-agenda" | 2397 (declare-function org-agenda-change-all-lines "org-agenda" |
2384 (newhead hdmarker &optional fixface)) | 2398 (newhead hdmarker &optional fixface just-this)) |
2385 (declare-function org-agenda-set-restriction-lock "org-agenda" (&optional type)) | 2399 (declare-function org-agenda-set-restriction-lock "org-agenda" (&optional type)) |
2386 (declare-function org-agenda-maybe-redo "org-agenda" ()) | 2400 (declare-function org-agenda-maybe-redo "org-agenda" ()) |
2387 (declare-function org-agenda-save-markers-for-cut-and-paste "org-agenda" | 2401 (declare-function org-agenda-save-markers-for-cut-and-paste "org-agenda" |
2388 (beg end)) | 2402 (beg end)) |
2389 (declare-function org-agenda-copy-local-variable "org-agenda" (var)) | 2403 (declare-function org-agenda-copy-local-variable "org-agenda" (var)) |
6324 '((?\ . "%20")) ; 32 for the SPC char | 6338 '((?\ . "%20")) ; 32 for the SPC char |
6325 "Association list of escapes for some characters problematic in links. | 6339 "Association list of escapes for some characters problematic in links. |
6326 This is the list that is used before handing over to the browser.") | 6340 This is the list that is used before handing over to the browser.") |
6327 | 6341 |
6328 (defun org-link-escape (text &optional table) | 6342 (defun org-link-escape (text &optional table) |
6329 "Escape charaters in TEXT that are problematic for links." | 6343 "Escape characters in TEXT that are problematic for links." |
6330 (setq table (or table org-link-escape-chars)) | 6344 (setq table (or table org-link-escape-chars)) |
6331 (when text | 6345 (when text |
6332 (let ((re (mapconcat (lambda (x) (regexp-quote | 6346 (let ((re (mapconcat (lambda (x) (regexp-quote |
6333 (char-to-string (car x)))) | 6347 (char-to-string (car x)))) |
6334 table "\\|"))) | 6348 table "\\|"))) |
7502 (org-refile-use-outline-path org-refile-use-outline-path)) | 7516 (org-refile-use-outline-path org-refile-use-outline-path)) |
7503 (setq org-refile-target-table (org-get-refile-targets default-buffer))) | 7517 (setq org-refile-target-table (org-get-refile-targets default-buffer))) |
7504 (unless org-refile-target-table | 7518 (unless org-refile-target-table |
7505 (error "No refile targets")) | 7519 (error "No refile targets")) |
7506 (let* ((cbuf (current-buffer)) | 7520 (let* ((cbuf (current-buffer)) |
7507 (cfunc (if org-refile-use-outline-path | 7521 (cfunc (if (and org-refile-use-outline-path |
7522 org-outline-path-complete-in-steps) | |
7508 'org-olpath-completing-read | 7523 'org-olpath-completing-read |
7509 'org-ido-completing-read)) | 7524 'org-ido-completing-read)) |
7510 (extra (if org-refile-use-outline-path "/" "")) | 7525 (extra (if org-refile-use-outline-path "/" "")) |
7511 (filename (buffer-file-name (buffer-base-buffer cbuf))) | 7526 (filename (buffer-file-name (buffer-base-buffer cbuf))) |
7512 (fname (and filename (file-truename filename))) | 7527 (fname (and filename (file-truename filename))) |
9080 tags))))) | 9095 tags))))) |
9081 | 9096 |
9082 (defvar todo-only) ;; dynamically scoped | 9097 (defvar todo-only) ;; dynamically scoped |
9083 | 9098 |
9084 (defun org-tags-sparse-tree (&optional todo-only match) | 9099 (defun org-tags-sparse-tree (&optional todo-only match) |
9085 "Create a sparse tree according to tags string MATCH. | 9100 "Create a sparse tree according to tags string MATCH. |
9086 MATCH can contain positive and negative selection of tags, like | 9101 MATCH can contain positive and negative selection of tags, like |
9087 \"+WORK+URGENT-WITHBOSS\". | 9102 \"+WORK+URGENT-WITHBOSS\". |
9088 If optional argument TODO_ONLY is non-nil, only select lines that are | 9103 If optional argument TODO-ONLY is non-nil, only select lines that are |
9089 also TODO lines." | 9104 also TODO lines." |
9090 (interactive "P") | 9105 (interactive "P") |
9091 (org-prepare-agenda-buffers (list (current-buffer))) | 9106 (org-prepare-agenda-buffers (list (current-buffer))) |
9092 (org-scan-tags 'sparse-tree (cdr (org-make-tags-matcher match)) todo-only)) | 9107 (org-scan-tags 'sparse-tree (cdr (org-make-tags-matcher match)) todo-only)) |
9093 | 9108 |
11226 | 11241 |
11227 (defun org-time-string-to-absolute (s &optional daynr prefer show-all) | 11242 (defun org-time-string-to-absolute (s &optional daynr prefer show-all) |
11228 "Convert a time stamp to an absolute day number. | 11243 "Convert a time stamp to an absolute day number. |
11229 If there is a specifyer for a cyclic time stamp, get the closest date to | 11244 If there is a specifyer for a cyclic time stamp, get the closest date to |
11230 DAYNR. | 11245 DAYNR. |
11231 PREFER and SHOW_ALL are passed through to `org-closest-date'." | 11246 PREFER and SHOW-ALL are passed through to `org-closest-date'." |
11232 (cond | 11247 (cond |
11233 ((and daynr (string-match "\\`%%\\((.*)\\)" s)) | 11248 ((and daynr (string-match "\\`%%\\((.*)\\)" s)) |
11234 (if (org-diary-sexp-entry (match-string 1 s) "" date) | 11249 (if (org-diary-sexp-entry (match-string 1 s) "" date) |
11235 daynr | 11250 daynr |
11236 (+ daynr 1000))) | 11251 (+ daynr 1000))) |
11246 (car (calendar-iso-from-absolute days))) | 11261 (car (calendar-iso-from-absolute days))) |
11247 | 11262 |
11248 (defun org-small-year-to-year (year) | 11263 (defun org-small-year-to-year (year) |
11249 "Convert 2-digit years into 4-digit years. | 11264 "Convert 2-digit years into 4-digit years. |
11250 38-99 are mapped into 1938-1999. 1-37 are mapped into 2001-2007. | 11265 38-99 are mapped into 1938-1999. 1-37 are mapped into 2001-2007. |
11251 The year 2000 cannot be abbreviated. Any year lager than 99 | 11266 The year 2000 cannot be abbreviated. Any year larger than 99 |
11252 is retrned unchanged." | 11267 is returned unchanged." |
11253 (if (< year 38) | 11268 (if (< year 38) |
11254 (setq year (+ 2000 year)) | 11269 (setq year (+ 2000 year)) |
11255 (if (< year 100) | 11270 (if (< year 100) |
11256 (setq year (+ 1900 year)))) | 11271 (setq year (+ 1900 year)))) |
11257 year) | 11272 year) |