diff --git a/org b/org index 20513fd98..b25cf9dca 100644 --- a/org +++ b/org @@ -5,7 +5,7 @@ START-INFO-DIR-ENTRY * Org Mode: (org). outline-based notes management and organizer END-INFO-DIR-ENTRY - This manual is for Org-mode (version 4.36). + This manual is for Org-mode (version 4.37). Copyright (C) 2004, 2005, 2006 Free Software Foundation @@ -27,7 +27,7 @@ File: org, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) Org Mode Manual *************** -This manual is for Org-mode (version 4.36). +This manual is for Org-mode (version 4.37). Copyright (C) 2004, 2005, 2006 Free Software Foundation @@ -114,7 +114,6 @@ Internal links TODO items * TODO basics:: Marking and displaying TODO entries -* Progress logging:: Document your productivity * TODO extensions:: Workflow and assignments * Priorities:: Some things are more important than others @@ -128,6 +127,12 @@ Timestamps * Time stamps:: Assigning a time to a tree entry * Creating timestamps:: Commands which insert timestamps +* Progress logging:: Documenting when what work was done. + +Progress Logging + +* Closing items:: When was this entry makred DONE? +* Clocking work time:: When exactly did you work on this item? Tags @@ -1731,12 +1736,11 @@ overview over all things you have to do. * Menu: * TODO basics:: Marking and displaying TODO entries -* Progress logging:: Document your productivity * TODO extensions:: Workflow and assignments * Priorities:: Some things are more important than others  -File: org, Node: TODO basics, Next: Progress logging, Prev: TODO items, Up: TODO items +File: org, Node: TODO basics, Next: TODO extensions, Prev: TODO items, Up: TODO items 5.1 Basic TODO functionality ============================ @@ -1779,29 +1783,9 @@ The most important commands to work with TODO entries are: information.  -File: org, Node: Progress logging, Next: TODO extensions, Prev: TODO basics, Up: TODO items +File: org, Node: TODO extensions, Next: Priorities, Prev: TODO basics, Up: TODO items -5.2 Progress Logging -==================== - -If you want to keep track of _when_ a certain TODO item was finished, -turn on logging with - - (setq org-log-done t) - -Then each time you turn a TODO entry into DONE using either `C-c C-t' -in the Org-mode buffer or `t' in the agenda buffer, a line `CLOSED: -[timestamp]' will be inserted just after the headline. If you turn the -entry back into a TODO item again through further state cycling, that -line will be removed again. In the timeline (*note Timeline::) and in -the agenda (*note Weekly/Daily agenda::), you can then use the `L' key -to display the TODO items closed on each day, giving you an overview of -what has been done on a day. - - -File: org, Node: TODO extensions, Next: Priorities, Prev: Progress logging, Up: TODO items - -5.3 Extended use of TODO keywords +5.2 Extended use of TODO keywords ================================= The default implementation of TODO entries is just two states: TODO and @@ -1822,7 +1806,7 @@ TODO items in particular (*note Tags::).  File: org, Node: Workflow states, Next: TODO types, Prev: TODO extensions, Up: TODO extensions -5.3.1 TODO keywords as workflow states +5.2.1 TODO keywords as workflow states -------------------------------------- You can use TODO keywords to indicate different states in the process @@ -1842,7 +1826,7 @@ Completion::) to insert these words into the buffer.  File: org, Node: TODO types, Next: Per file keywords, Prev: Workflow states, Up: TODO extensions -5.3.2 TODO keywords as types +5.2.2 TODO keywords as types ---------------------------- The second possibility is to use TODO keywords to indicate different @@ -1878,7 +1862,7 @@ buffers.  File: org, Node: Per file keywords, Prev: TODO types, Up: TODO extensions -5.3.3 Setting up TODO keywords for individual files +5.2.3 Setting up TODO keywords for individual files --------------------------------------------------- It can be very useful to use different aspects of the TODO mechanism in @@ -1919,7 +1903,7 @@ will be respected.  File: org, Node: Priorities, Prev: TODO extensions, Up: TODO items -5.4 Priorities +5.3 Priorities ============== If you use Org-mode extensively to organize your work, you may end up @@ -1961,6 +1945,7 @@ planning. * Time stamps:: Assigning a time to a tree entry * Creating timestamps:: Commands which insert timestamps +* Progress logging:: Documenting when what work was done.  File: org, Node: Time stamps, Next: Creating timestamps, Prev: Timestamps, Up: Timestamps @@ -2022,8 +2007,15 @@ TIME STAMP WITH CLOSED KEYWORD Progress logging::). This time stamp is enclosed in square brackets instead of angular brackets. +TIME RANGE WITH CLOCK KEYWORD + When using the clock to time the work that is being done on + specific items, time ranges preceeded by the CLOCK keyword are + inserted automatically into the file. The time stamps are + enclosed in square brackets instead of angular brackets. *Note + Clocking work time::. +  -File: org, Node: Creating timestamps, Prev: Time stamps, Up: Timestamps +File: org, Node: Creating timestamps, Next: Progress logging, Prev: Time stamps, Up: Timestamps 6.2 Creating timestamps ======================= @@ -2130,6 +2122,83 @@ date can be selected with the following commands: `' Choose date in calendar (only if nothing typed into minibuffer). + +File: org, Node: Progress logging, Prev: Creating timestamps, Up: Timestamps + +6.3 Progress Logging +==================== + +Org-mode can automatically record a time stamp when you mark a TODO item +as DONE. You can also measure precisely the time you spent on specific +items in a project by starting and stopping a clock when you start and +stop working on an aspect of a project. + +* Menu: + +* Closing items:: When was this entry makred DONE? +* Clocking work time:: When exactly did you work on this item? + + +File: org, Node: Closing items, Next: Clocking work time, Prev: Progress logging, Up: Progress logging + +6.3.1 Closing items +------------------- + +If you want to keep track of _when_ a certain TODO item was finished, +turn on logging with + + (setq org-log-done t) + +Then each time you turn a TODO entry into DONE using either `C-c C-t' +in the Org-mode buffer or `t' in the agenda buffer, a line `CLOSED: +[timestamp]' will be inserted just after the headline. If you turn the +entry back into a TODO item again through further state cycling, that +line will be removed again. In the timeline (*note Timeline::) and in +the agenda (*note Weekly/Daily agenda::), you can then use the `l' key +to display the TODO items closed on each day, giving you an overview of +what has been done on a day. + + +File: org, Node: Clocking work time, Prev: Closing items, Up: Progress logging + +6.3.2 Clocking work time +------------------------ + +Org-mode allows you to clock the time you spent on specific tasks in a +project. When you start working on an item, you can start the clock. +When you stop working on that tast, or when you makr the task done, the +clock is stoppend and the corresponding time interval is recorded. It +also computes the total time spent on each subtree of a project. + +`C-c C-x C-i' + Start the clock on the current item (clock-in). This inserts the + CLOCK keyword together with a timestamp. + +`C-c C-x C-o' + Stop the clock (clock-out). The inserts another timestamp at the + same location where the clock was last started. It also directly + computes the resulting time in inserts it after the time range as + `=> HH:MM'. + +`C-c C-t' + Changing the TODO state of an item to DONE automatically stops the + clock if it is running in this same item. + +`C-c C-x C-x' + Cancel the current clock. This is useful if a clock was started by + mistake, or if you ended up working on something else. + +`C-c C-x C-d' + Display time summaries for each subtree in the current buffer. + This puts overlays at the end of each headline, showing the total + time recorded under that heading, including the time of any + subheadings. You can use visibility cycling to study the tree, but + the overlays disappear automatically when the buffer is changed. + + The `l' key may be used in the timeline (*note Timeline::) and in +the agenda (*note Weekly/Daily agenda::) to show which tasks have been +worked on or closed during a day. +  File: org, Node: Tags, Next: Agenda views, Prev: Timestamps, Up: Top @@ -2677,7 +2746,7 @@ View/GoTo org file `l' Toggle Logbook mode. In Logbook mode, entries that where marked DONE while logging was on (variable `org-log-done') are shown in - the agenda. + the agenda, as are entries that have been clocked on that day. Change display .............. @@ -2776,11 +2845,15 @@ Remote editing The key `>' has been chosen, because it is the same as `S-.' on my keyboard. -`i' - Insert a new entry into the diary. Prompts for the type of entry - (day, weekly, monthly, yearly, anniversary, cyclic) and creates a - new entry in the diary, just as `i d' etc. would do in the - calendar. The date is taken from the cursor position. +`I' + Start the clock on the current item. If a clock is running + already, it is stopped first. + +`O' + Stop the previously started clock. + +`X' + Cancel the currently running clock. Calendar commands ................. @@ -2792,6 +2865,12 @@ Calendar commands When in the calendar, compute and show the Org-mode agenda for the date at the cursor. +`i' + Insert a new entry into the diary. Prompts for the type of entry + (day, weekly, monthly, yearly, anniversary, cyclic) and creates a + new entry in the diary, just as `i d' etc. would do in the + calendar. The date is taken from the cursor position. + `M' Show the phases of the moon for the three months around current date. @@ -4184,7 +4263,7 @@ File: org, Node: Index, Next: Key Index, Prev: Miscellaneous, Up: Top * agenda: Weekly/Daily agenda. (line 6) * agenda commands, custom: Agenda dispatcher. (line 6) * agenda dispatcher: Agenda dispatcher. (line 6) -* agenda files, removing buffers: Agenda commands. (line 195) +* agenda files, removing buffers: Agenda commands. (line 205) * agenda views: Agenda views. (line 6) * agenda, for single file: Timeline. (line 6) * allout.el: Conflicts. (line 6) @@ -4216,6 +4295,7 @@ File: org, Node: Index, Next: Key Index, Prev: Miscellaneous, Up: Top * checkboxes: Plain lists. (line 36) * children, subtree visibility state: Visibility cycling. (line 10) * clean outline view: Clean view. (line 6) +* CLOCK keyword: Time stamps. (line 61) * CLOSED keyword: Time stamps. (line 55) * column formula: Column formulas. (line 6) * commands, in agenda buffer: Agenda commands. (line 6) @@ -4252,7 +4332,7 @@ File: org, Node: Index, Next: Key Index, Prev: Miscellaneous, Up: Top * DEADLINE keyword: Time stamps. (line 43) * deadlines: Time stamps. (line 6) * demotion, of subtrees: Structure editing. (line 6) -* diary entries, creating from agenda: Agenda commands. (line 153) +* diary entries, creating from agenda: Agenda commands. (line 173) * diary integration: Calendar/Diary integration. (line 6) * dictionary word completion: Completion. (line 6) @@ -4511,8 +4591,8 @@ File: org, Node: Key Index, Prev: Index, Up: Top * : Visibility cycling. (line 10) * > <1>: Agenda commands. (line 148) * >: Creating timestamps. (line 79) -* C: Agenda commands. (line 178) -* c: Agenda commands. (line 162) +* C: Agenda commands. (line 188) +* c: Agenda commands. (line 166) * C-#: Built-in table editor. (line 155) * C-,: Agenda files. (line 18) @@ -4590,6 +4670,7 @@ File: org, Node: Key Index, Prev: Index, Up: Top * C-c C-r: Timeline. (line 13) * C-c C-s <1>: Agenda commands. (line 130) * C-c C-s: Creating timestamps. (line 48) +* C-c C-t <1>: Clocking work time. (line 20) * C-c C-t: TODO basics. (line 13) * C-c C-u: Motion. (line 18) * C-c C-v: TODO basics. (line 26) @@ -4597,13 +4678,17 @@ File: org, Node: Key Index, Prev: Index, Up: Top * C-c C-x a: ASCII export. (line 9) * C-c C-x b: HTML export. (line 11) * C-c C-x c: iCalendar export. (line 20) -* C-c C-x C-c: Agenda commands. (line 185) -* C-c C-x C-i: iCalendar export. (line 15) +* C-c C-x C-c: Agenda commands. (line 195) +* C-c C-x C-d: Clocking work time. (line 28) +* C-c C-x C-i <1>: iCalendar export. (line 15) +* C-c C-x C-i: Clocking work time. (line 12) * C-c C-x C-k: Structure editing. (line 36) +* C-c C-x C-o: Clocking work time. (line 14) * C-c C-x C-w <1>: Built-in table editor. (line 108) * C-c C-x C-w: Structure editing. (line 36) -* C-c C-x C-x: XOXO export. (line 10) +* C-c C-x C-x <1>: XOXO export. (line 10) +* C-c C-x C-x: Clocking work time. (line 24) * C-c C-x C-y <1>: Built-in table editor. (line 112) * C-c C-x C-y: Structure editing. (line 43) @@ -4631,11 +4716,12 @@ File: org, Node: Key Index, Prev: Index, Up: Top * d: Agenda commands. (line 65) * f: Agenda commands. (line 44) * g: Agenda commands. (line 72) -* H: Agenda commands. (line 182) -* i: Agenda commands. (line 153) +* H: Agenda commands. (line 192) +* i: Agenda commands. (line 173) +* I: Agenda commands. (line 153) * l: Agenda commands. (line 51) * L: Agenda commands. (line 32) -* M: Agenda commands. (line 169) +* M: Agenda commands. (line 179) * M-: Built-in table editor. (line 82) * M- <1>: Built-in table editor. @@ -4679,13 +4765,14 @@ File: org, Node: Key Index, Prev: Index, Up: Top * mouse-3 <1>: Agenda commands. (line 28) * mouse-3: Handling links. (line 78) * n: Agenda commands. (line 19) +* O: Agenda commands. (line 155) * o: Agenda commands. (line 59) * P: Agenda commands. (line 117) * p: Agenda commands. (line 20) -* q: Agenda commands. (line 192) +* q: Agenda commands. (line 202) * r <1>: Agenda commands. (line 76) * r: Global TODO list. (line 20) -* S: Agenda commands. (line 173) +* S: Agenda commands. (line 183) * S- <1>: Agenda commands. (line 126) * S- <2>: Creating timestamps. (line 58) * S- <3>: Priorities. (line 25) @@ -4708,128 +4795,131 @@ File: org, Node: Key Index, Prev: Index, Up: Top * T: Agenda commands. (line 104) * t: Agenda commands. (line 100) * w: Agenda commands. (line 62) -* x: Agenda commands. (line 195) +* x: Agenda commands. (line 205) +* X: Agenda commands. (line 158)  Tag Table: Node: Top959 -Node: Introduction8679 -Node: Summary8993 -Node: Installation and activation11249 -Node: Feedback12907 -Node: Document structure13693 -Node: Outlines14459 -Node: Headlines15119 -Node: Visibility cycling15742 -Ref: Visibility cycling-Footnote-117217 -Ref: Visibility cycling-Footnote-217275 -Node: Motion17325 -Node: Structure editing18109 -Node: Archiving20218 -Node: Sparse trees21078 -Ref: Sparse trees-Footnote-123057 -Ref: Sparse trees-Footnote-223149 -Node: Plain lists23264 -Ref: Plain lists-Footnote-127162 -Node: Tables27519 -Node: Built-in table editor28067 -Node: Narrow columns35674 -Ref: Narrow columns-Footnote-137613 -Node: Table calculations37659 -Node: Formula syntax38979 -Ref: Formula syntax-Footnote-141884 -Node: Lisp formulas42184 -Node: Column formulas42973 -Node: Advanced features44735 -Node: Named-field formulas47989 -Node: Editing/debugging formulas48629 -Node: Appetizer50387 -Node: orgtbl-mode51490 -Node: table.el51981 -Node: Hyperlinks52958 -Node: Link format53663 -Node: Internal links54956 -Ref: Internal links-Footnote-156945 -Node: Radio targets57077 -Node: CamelCase links57792 -Node: External links58290 -Node: Handling links60421 -Node: Search options64971 -Ref: Search options-Footnote-166745 -Node: Custom searches66826 -Node: Remember67874 -Node: TODO items71564 -Node: TODO basics72487 -Node: Progress logging74015 -Node: TODO extensions74801 -Node: Workflow states75601 -Node: TODO types76469 -Ref: TODO types-Footnote-178127 -Node: Per file keywords78209 -Ref: Per file keywords-Footnote-179663 -Node: Priorities79891 -Node: Timestamps81107 -Node: Time stamps81428 -Node: Creating timestamps84202 -Node: Tags87523 -Node: Tag inheritance88285 -Node: Setting tags89222 -Ref: Setting tags-Footnote-192352 -Ref: Setting tags-Footnote-292464 -Node: Tag searches92544 -Node: Agenda views93753 -Node: Agenda files95292 -Ref: Agenda files-Footnote-196252 -Ref: Agenda files-Footnote-296401 -Node: Agenda dispatcher96593 -Node: Weekly/Daily agenda98723 -Node: Categories99858 -Node: Time-of-day specifications100506 -Node: Calendar/Diary integration102482 -Node: Sorting of agenda items103859 -Node: Global TODO list104691 -Node: Matching headline tags106052 -Node: Timeline106995 -Node: Agenda commands107868 -Node: Exporting113336 -Node: ASCII export114469 -Node: HTML export115755 -Node: XOXO export118589 -Node: iCalendar export119028 -Node: Text interpretation120851 -Node: Comment lines121328 -Node: Enhancing text121797 -Node: Export options123721 -Node: Publishing125323 -Ref: Publishing-Footnote-1126119 -Node: Configuration126315 -Node: Project alist127036 -Node: File sources and destinations128107 -Node: Selecting files128659 -Node: Publishing action129412 -Node: Publishing options130527 -Node: Publishing links132566 -Node: Project page index133369 -Node: Sample configuration134147 -Node: Simple example134639 -Node: Complex example135312 -Node: Triggering publication137388 -Node: Miscellaneous138044 -Node: Completion138803 -Node: Customization139799 -Node: Summary of in-buffer settings140406 -Node: The very busy C-c C-c key143648 -Node: Clean view145163 -Node: TTY keys147740 -Node: FAQ149341 -Node: Interaction157139 -Node: Extensions157599 -Node: Cooperation158851 -Node: Conflicts160545 -Node: Bugs162137 -Node: Acknowledgments164035 -Node: Index167473 -Node: Key Index189792 +Node: Introduction8845 +Node: Summary9159 +Node: Installation and activation11415 +Node: Feedback13073 +Node: Document structure13859 +Node: Outlines14625 +Node: Headlines15285 +Node: Visibility cycling15908 +Ref: Visibility cycling-Footnote-117383 +Ref: Visibility cycling-Footnote-217441 +Node: Motion17491 +Node: Structure editing18275 +Node: Archiving20384 +Node: Sparse trees21244 +Ref: Sparse trees-Footnote-123223 +Ref: Sparse trees-Footnote-223315 +Node: Plain lists23430 +Ref: Plain lists-Footnote-127328 +Node: Tables27685 +Node: Built-in table editor28233 +Node: Narrow columns35840 +Ref: Narrow columns-Footnote-137779 +Node: Table calculations37825 +Node: Formula syntax39145 +Ref: Formula syntax-Footnote-142050 +Node: Lisp formulas42350 +Node: Column formulas43139 +Node: Advanced features44901 +Node: Named-field formulas48155 +Node: Editing/debugging formulas48795 +Node: Appetizer50553 +Node: orgtbl-mode51656 +Node: table.el52147 +Node: Hyperlinks53124 +Node: Link format53829 +Node: Internal links55122 +Ref: Internal links-Footnote-157111 +Node: Radio targets57243 +Node: CamelCase links57958 +Node: External links58456 +Node: Handling links60587 +Node: Search options65137 +Ref: Search options-Footnote-166911 +Node: Custom searches66992 +Node: Remember68040 +Node: TODO items71730 +Node: TODO basics72594 +Node: TODO extensions74121 +Node: Workflow states74916 +Node: TODO types75784 +Ref: TODO types-Footnote-177442 +Node: Per file keywords77524 +Ref: Per file keywords-Footnote-178978 +Node: Priorities79206 +Node: Timestamps80422 +Node: Time stamps80812 +Node: Creating timestamps83910 +Node: Progress logging87256 +Node: Closing items87786 +Node: Clocking work time88581 +Node: Tags90266 +Node: Tag inheritance91028 +Node: Setting tags91965 +Ref: Setting tags-Footnote-195095 +Ref: Setting tags-Footnote-295207 +Node: Tag searches95287 +Node: Agenda views96496 +Node: Agenda files98035 +Ref: Agenda files-Footnote-198995 +Ref: Agenda files-Footnote-299144 +Node: Agenda dispatcher99336 +Node: Weekly/Daily agenda101466 +Node: Categories102601 +Node: Time-of-day specifications103249 +Node: Calendar/Diary integration105225 +Node: Sorting of agenda items106602 +Node: Global TODO list107434 +Node: Matching headline tags108795 +Node: Timeline109738 +Node: Agenda commands110611 +Node: Exporting116330 +Node: ASCII export117463 +Node: HTML export118749 +Node: XOXO export121583 +Node: iCalendar export122022 +Node: Text interpretation123845 +Node: Comment lines124322 +Node: Enhancing text124791 +Node: Export options126715 +Node: Publishing128317 +Ref: Publishing-Footnote-1129113 +Node: Configuration129309 +Node: Project alist130030 +Node: File sources and destinations131101 +Node: Selecting files131653 +Node: Publishing action132406 +Node: Publishing options133521 +Node: Publishing links135560 +Node: Project page index136363 +Node: Sample configuration137141 +Node: Simple example137633 +Node: Complex example138306 +Node: Triggering publication140382 +Node: Miscellaneous141038 +Node: Completion141797 +Node: Customization142793 +Node: Summary of in-buffer settings143400 +Node: The very busy C-c C-c key146642 +Node: Clean view148157 +Node: TTY keys150734 +Node: FAQ152335 +Node: Interaction160133 +Node: Extensions160593 +Node: Cooperation161845 +Node: Conflicts163539 +Node: Bugs165131 +Node: Acknowledgments167029 +Node: Index170467 +Node: Key Index192859  End Tag Table diff --git a/org-publish.el b/org-publish.el index 96e195a4c..cabea0656 100644 --- a/org-publish.el +++ b/org-publish.el @@ -1,12 +1,12 @@ ;;; org-publish.el --- publish related org-mode files as a website -;; Copyright (C) 2006 Free Software Foundation, Inc. +;; Copyright (C) 2006 David O'Toole ;; Author: David O'Toole ;; Keywords: hypermedia, outlines ;; Version: -;; $Id: org-publish.el,v 1.69 2006/06/03 17:17:53 dto Exp dto $ +;; $Id: org-publish.el,v 1.67 2006/05/30 10:44:31 dto Exp dto $ ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -23,6 +23,8 @@ ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. +;; This file is NOT part of GNU Emacs. + ;;; Commentary: ;; Requires at least version 4.27 of org.el @@ -448,6 +450,7 @@ FILENAME is the filename of the file to be published." If :auto-index is set, publish the index too." (let* ((exclude-regexp (plist-get plist :exclude)) (publishing-function (or (plist-get plist :publishing-function) 'org-publish-org-to-html)) + (buf (current-buffer)) (index-p (plist-get plist :auto-index)) (index-filename (or (plist-get plist :index-filename) "index.org")) (index-function (or (plist-get plist :index-function) 'org-publish-org-index)) @@ -460,7 +463,9 @@ FILENAME is the filename of the file to be published." ;; check timestamps (when (org-publish-needed-p f) (funcall publishing-function plist f) - (org-publish-update-timestamp f)))))) + (org-publish-update-timestamp f)))) + ;; back to original buffer + (switch-to-buffer buf))) (defun org-publish-org-index (plist &optional index-filename) diff --git a/org.el b/org.el index 853c28f55..8d352a483 100644 --- a/org.el +++ b/org.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ -;; Version: 4.36 +;; Version: 4.36b ;; ;; This file is part of GNU Emacs. ;; @@ -90,6 +90,10 @@ ;; ;; Recent changes ;; -------------- +;; Version 4.37 +;; - Clock-feature for measuring time spent on specific items. +;; - Improved emphasizing allows configuration and stacking. +;; ;; Version 4.36 ;; - Improved indentation of ASCII export, when headlines become items. ;; - Handling of 12am and 12pm fixed. Times beyond 24:00 can be used @@ -122,7 +126,7 @@ ;; - All context-sensitive commands use `call-interactively' to dispatch. ;; - `org-confirm-shell-links' renamed to `org-confirm-shell-link-function'. ;; - Bug fixes. -;; +;; ;; Version 4.31 ;; - Bug fixes. ;; @@ -163,7 +167,7 @@ ;; ;;; Code: -(eval-when-compile +(eval-when-compile (require 'cl) (require 'calendar)) (require 'outline) @@ -172,7 +176,7 @@ ;;; Customization variables -(defvar org-version "4.36" +(defvar org-version "4.36b" "The version number of the file org.el.") (defun org-version () (interactive) @@ -333,6 +337,11 @@ Changes become only effective after restarting Emacs." :group 'org-keywords :type 'string) +(defcustom org-clock-string "CLOCK:" + "String used as prefix for timestamps clocking work hours on an item." + :group 'org-keywords + :type 'string) + (defcustom org-comment-string "COMMENT" "Entries starting with this keyword will never be exported. An entry can be toggled between COMMENT and normal with @@ -2134,6 +2143,95 @@ Changing this variable requires a restart of Emacs to take effect." :group 'org-font-lock :type 'boolean) +(defvar org-emph-re nil + "Regular expression for matching emphasis.") +(defvar org-emphasis-regexp-components) ; defined just below +(defvar org-emphasis-alist) ; defined just below +(defun org-set-emph-re (var val) + "Set variable and compute the emphasis regular expression." + (set var val) + (when (and (boundp 'org-emphasis-alist) + (boundp 'org-emphasis-regexp-components) + org-emphasis-alist org-emphasis-regexp-components) + (let* ((e org-emphasis-regexp-components) + (pre (car e)) + (post (nth 1 e)) + (border (nth 2 e)) + (body (nth 3 e)) + (nl (nth 4 e)) + (stacked (nth 5 e)) + (body1 (concat body "*?")) + (markers (mapconcat 'car org-emphasis-alist ""))) + ;; make sure special characters appear at the right position in the class + (if (string-match "\\^" markers) + (setq markers (concat (replace-match "" t t markers) "^"))) + (if (string-match "-" markers) + (setq markers (concat (replace-match "" t t markers) "-"))) + (while (>= (setq nl (1- nl)) 0) (setq body1 (concat body1 "\n?" body "*?"))) + ;; Make the regexp + (setq org-emph-re + (concat "\\([" pre (if stacked markers) "]\\|^\\)" + "\\(" + "\\([" markers "]\\)" + "\\(" + "[^" border markers "]" + body1 + "[^" border markers "]" + "\\)" + "\\3\\)" + "\\([" post (if stacked markers) "]\\|$\\)"))))) + +(defcustom org-emphasis-regexp-components + '(" \t(" " \t.,?;:'\")" " \t\r\n,." "." 1 nil) + "Components used to build the reqular expression for emphasis. +This is a list with 6 entries. Terminology: In an emphasis string +like \" *strong word* \", we call the initial space PREMATCH, the final +space POSTMATCH, the stars MARKERS, \"s\" and \"d\" are BORDER characters +and \"trong wor\" is the body. The different components in this variable +specify what is allowed/forbidden in each part: + +pre Chars allowed as prematch. Beginning of line will be allowed too. +post Chars allowed as postmatch. End of line will be allowed too. +border The chars *forbidden* as border characters. In addition to the + characters given here, all marker characters are forbidden too. +body-regexp A regexp like \".\" to match a body character. Don't use + non-shy groups here, and don't allow newline here. +newline The maximum number of newlines allowed in an emphasis exp. +stacked Non-nil means, allow stacked styles. This works only in HTML + export. When this is set, all marker characters (as given in + `org-emphasis-alist') will be allowed as pre/post, aiding + inside-out matching. +Use customize to modify this, or restart emacs after changing it." + :group 'org-fixme + :set 'org-set-emph-re + :type '(list + (sexp :tag "Allowed chars in pre ") + (sexp :tag "Allowed chars in post ") + (sexp :tag "Forbidden chars in border ") + (sexp :tag "Regexp for body ") + (integer :tag "number of newlines allowed") + (boolean :tag "Stacking allowed "))) + +(defcustom org-emphasis-alist + '(("*" bold "" "") + ("/" italic "" "") + ("_" underline "" "") + ("=" shadow "" "")) +"Special syntax for emphasised text. +Text starting and ending with a special character will be emphasized, for +example *bold*, _underlined_ and /italic/. This variable sets the marker +characters, the face to bbe used by font-lock for highlighting in Org-mode +emacs buffers, and the HTML tags to be used for this. +Use customize to modify this, or restart emacs after changing it." + :group 'org-fixme + :set 'org-set-emph-re + :type '(repeat + (list + (string :tag "Marker character") + (face :tag "Font-lock-face") + (string :tag "HTML start tag") + (string :tag "HTML end tag")))) + (defgroup org-faces nil "Faces in Org-mode." :tag "Org Faces" @@ -2374,21 +2472,6 @@ This face is only used if `org-fontify-done-headline' is set." )) (defconst org-n-levels (length org-level-faces)) -(defconst org-bold-re - (if (featurep 'xemacs) - "\\([ ]\\|^\\)\\(\\*\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)\\*\\)\\([ ,.]\\|$\\)" - "\\([ ]\\|^\\)\\(\\*\\(\\w[[:word:] -_]*?\\w\\)\\*\\)\\([ ,.]\\|$\\)") - "Regular expression for bold emphasis.") -(defconst org-italic-re - (if (featurep 'xemacs) - "\\([ ]\\|^\\)\\(/\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)/\\)\\([ ,.]\\|$\\)" - "\\([ ]\\|^\\)\\(/\\(\\w[[:word:] -_]*?\\w\\)/\\)\\([ ,.]\\|$\\)") - "Regular expression for italic emphasis.") -(defconst org-underline-re - (if (featurep 'xemacs) - "\\([ ]\\|^\\)\\(_\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)_\\)\\([ ,.]\\|$\\)" - "\\([ ]\\|^\\)\\(_\\(\\w[[:word:] -_]*?\\w\\)_\\)\\([ ,.]\\|$\\)") - "Regular expression for underline emphasis.") ;; Variables for pre-computed regular expressions, all buffer local (defvar org-done-string nil @@ -2582,12 +2665,14 @@ Also put tags into group 4 if tags are present.") org-keyword-time-regexp (concat "\\<\\(" org-scheduled-string "\\|" org-deadline-string - "\\|" org-closed-string "\\)" + "\\|" org-closed-string + "\\|" org-clock-string "\\)" " *[[<]\\([^]>]+\\)[]>]") org-maybe-keyword-time-regexp (concat "\\(\\<\\(" org-scheduled-string "\\|" org-deadline-string - "\\|" org-closed-string "\\)\\)?" + "\\|" org-closed-string + "\\|" org-clock-string "\\)\\)?" " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^]\r\n>]*?[]>]\\)")) (org-set-font-lock-defaults))) @@ -2609,6 +2694,7 @@ Also put tags into group 4 if tags are present.") (defvar timecnt) ; dynamically scoped parameter (defvar levels-open) ; dynamically scoped parameter (defvar entry) ; dynamically scoped parameter +(defvar state) ; dynamically scoped into `org-after-todo-state-change-hook' (defvar date) ; dynamically scoped parameter (defvar description) ; dynamically scoped parameter (defvar ans1) ; dynamically scoped parameter @@ -2640,7 +2726,7 @@ Also put tags into group 4 if tags are present.") ;;; Define the mode -(defvar org-mode-map +(defvar org-mode-map (if (and (not (keymapp outline-mode-map)) (featurep 'allout)) (error "Conflict with outdated version of allout.el. Load org.el before allout.el, or ugrade to newer allout, for example by switching to Emacs 22.") (copy-keymap outline-mode-map)) @@ -2711,10 +2797,11 @@ The following commands are available: (when (and org-ellipsis (stringp org-ellipsis)) (unless org-display-table (setq org-display-table (make-display-table))) - (set-display-table-slot org-display-table + (set-display-table-slot org-display-table 4 (string-to-vector org-ellipsis)) (setq buffer-display-table org-display-table)) (org-set-regexps-and-options) + (modify-syntax-entry ?# "<") (if org-startup-truncated (setq truncate-lines t)) (set (make-local-variable 'font-lock-unfontify-region-function) 'org-unfontify-region) @@ -2722,6 +2809,8 @@ The following commands are available: (set (make-local-variable 'org-table-may-need-update) t) (org-add-hook 'before-change-functions 'org-before-change-function nil 'local) + ;; Check for running clock before killing a buffer + (org-add-hook 'kill-buffer-hook 'org-check-running-clock nil 'local) ;; Paragraphs and auto-filling (org-set-autofill-regexps) (org-update-radio-target-regexp) @@ -2793,7 +2882,7 @@ that will be added to PLIST. Returns the string that was modified." (defconst org-non-link-chars "]\t\n\r<>") (defconst org-link-types '("https?" "ftp" "mailto" "file" "news" "bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp")) -(defconst org-link-re-with-space +(defconst org-link-re-with-space (concat "?") "Matches a link with spaces, optional angular brackets around it.") -(defconst org-angle-link-re +(defconst org-angle-link-re (concat "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):" "\\([^" org-non-link-chars " ]" @@ -2859,6 +2948,21 @@ that will be added to PLIST. Returns the string that was modified." org-ts-regexp "\\)?") "Regular expression matching a time stamp or time stamp range.") +(defvar org-§emph-face nil) + +(defun org-do-emphasis-faces (limit) + "Run through the buffer and add overlays to links." + (if (re-search-forward org-emph-re limit t) + (progn + (font-lock-prepend-text-property (match-beginning 2) (match-end 2) + 'face + (nth 1 (assoc (match-string 3) + org-emphasis-alist))) + (add-text-properties (match-beginning 2) (match-end 2) + '(font-lock-multiline t)) + (backward-char 1) + t))) + (defun org-activate-plain-links (limit) "Run through the buffer and add overlays to links." (if (re-search-forward org-plain-link-re limit t) @@ -3050,10 +3154,9 @@ between words." (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t)) (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t)) (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t)) + (list (concat "\\<" org-clock-string) '(0 'org-special-keyword t)) ;; Emphasis - (if em (list org-bold-re 2 ''bold 'prepend)) - (if em (list org-italic-re 2 ''italic 'prepend)) - (if em (list org-underline-re 2 ''underline 'prepend)) + (if em '(org-do-emphasis-faces)) ;; Checkboxes, similar to Frank Ruell's org-checklet.el '("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[ X]\\]\\)" 2 'bold prepend) @@ -3148,7 +3251,7 @@ between words." (if org-cycle-include-plain-lists "\\*+\\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) " outline-regexp)) - (bob-special (and org-cycle-global-at-bob (bobp) + (bob-special (and org-cycle-global-at-bob (bobp) (not (looking-at outline-regexp)))) (org-cycle-hook (if bob-special nil org-cycle-hook)) (pos (point))) @@ -3268,10 +3371,15 @@ between words." (org-cycle)))))) ;;;###autoload -(defun org-global-cycle () +(defun org-global-cycle (&optional arg) "Cycle the global visibility. For details see `org-cycle'." - (interactive) - (org-cycle '(4))) + (interactive "P") + (if (integerp arg) + (progn + (show-all) + (hide-sublevels arg) + (setq org-cycle-global-status 'contents)) + (org-cycle '(4)))) (defun org-overview () "Switch to overview mode, shoing only top-level headlines. @@ -3484,11 +3592,13 @@ the current headline." (match-string 0)) (error "*")))) pos) - (cond - ((and (org-on-heading-p) (bolp) + (cond + ((and (org-on-heading-p) (bolp) (save-excursion (backward-char 1) (not (org-invisible-p)))) (open-line 1)) - ((bolp) nil) + ((and (bolp) (save-excursion + (backward-char 1) (not (org-invisible-p)))) + nil) (t (newline))) (insert head) (just-one-space) (setq pos (point)) @@ -3657,6 +3767,7 @@ in the region." (not (eobp))) (funcall fun))))) +;; FIXME: this does not work well with Tabulators. This has to be re-written entirely. (defun org-fixup-indentation (from to prohibit) "Change the indentation in the current entry by re-replacing FROM with TO. However, if the regexp PROHIBIT matches at all, don't do anything. @@ -3999,7 +4110,7 @@ Error if not at a plain list, or if this is the last item in the list." (setq ind1 (org-get-indentation)) (unless (and (org-at-item-p) (= ind ind1)) (goto-char pos) - (error "On last item")))) + (error "On last item")))) (defun org-previous-item () "Move to the beginning of the previous item in the current plain list. @@ -4560,7 +4671,8 @@ be removed." (goto-char (1+ (match-end 0))) (if (and (not (looking-at outline-regexp)) (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp - "[^\r\n]*"))) + "[^\r\n]*")) + (not (equal (match-string 1) org-clock-string))) (narrow-to-region (match-beginning 0) (match-end 0)) (insert "\n") (backward-char 1) @@ -4589,7 +4701,7 @@ be removed." " ") (insert (setq ts - (format-time-string + (format-time-string (if (eq what 'closed) (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]") (car org-time-stamp-formats)) @@ -5258,6 +5370,193 @@ If there is already a time stamp at the cursor position, update it." (interactive) (org-timestamp-change 0 'calendar)) +;;; The clock for measuring work time. + +(defvar org-clock-marker (make-marker) + "Marker recording the last clock-in.") + +(defun org-clock-in () + "Start the clock on the current item. +If necessary, clock-out of the currently active clock." + (interactive) + (org-clock-out t) + (let (ts) + (save-excursion + (org-back-to-heading t) + (beginning-of-line 2) + (if (and (looking-at (concat "[ \t]*" org-keyword-time-regexp)) + (not (equal (match-string 1) org-clock-string))) + (beginning-of-line 1)) + (insert "\n") (backward-char 1) + (indent-relative) + (insert org-clock-string " " + (setq ts (concat "[" (format-time-string + (substring + (cdr org-time-stamp-formats) 1 -1) + (current-time)) + "]"))) + (move-marker org-clock-marker (point)) + (message "Clock started at %s" ts)))) + +(defun org-clock-out (&optional fail-quietly) + "Stop the currently running clock. +If there is no running clock, throw an error, unless FAIL-QUIETLY is set." + (interactive) + (catch 'exit + (if (not (marker-buffer org-clock-marker)) + (if fail-quietly (throw 'exit t) (error "No active clock"))) + (let (ts te s h m) + (save-excursion + (set-buffer (marker-buffer org-clock-marker)) + (goto-char org-clock-marker) + (beginning-of-line 1) + (if (and (looking-at (concat "[ \t]*" org-keyword-time-regexp)) + (equal (match-string 1) org-clock-string)) + (setq ts (match-string 2)) + (if fail-quietly (throw 'exit nil) (error "Clock start time is gone"))) + (goto-char org-clock-marker) + (setq te (concat "[" (format-time-string + (substring + (cdr org-time-stamp-formats) 1 -1) + (current-time)) + "]")) + (setq s (- (time-to-seconds (apply 'encode-time (org-parse-time-string te))) + (time-to-seconds (apply 'encode-time (org-parse-time-string ts)))) + h (floor (/ s 3600)) + s (- s (* 3600 h)) + m (floor (/ s 60)) + s (- s (* 60 s))) + (insert "--" te " => " (format "%2d:%02d" h m)) + (move-marker org-clock-marker nil) + (message "Clock stopped at %s after HH:MM = %d:%02d" te h m))))) + +(defun org-clock-cancel () + "Cancel the running clock be removing the start timestamp." + (interactive) + (if (not (marker-buffer org-clock-marker)) + (error "No active clock")) + (save-excursion + (set-buffer (marker-buffer org-clock-marker)) + (goto-char org-clock-marker) + (delete-region (1- (point-at-bol)) (point-at-eol))) + (message "Clock canceled")) + +(defvar org-clock-file-total-minutes nil + "Holds the file total time in minutes, after a call to `org-clock-sum'.") + (make-variable-buffer-local 'org-clock-file-total-minutes) + +(defun org-clock-sum () + "Sum the times for each subtree. +Puts the resulting times in minutes as a text property on each headline." + (interactive) + (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t)) + (let* ((re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" + org-clock-string + ".*=>[ \t]*\\([0-9]+\\):\\([0-9]+\\)[ \t]*$")) + (lmax 30) + (ltimes (make-vector lmax 0)) + (t1 0) + (level 0) + (lastlevel 0) time) + (save-excursion + (goto-char (point-max)) + (while (re-search-backward re nil t) + (if (match-end 2) + ;; A time + (setq t1 (+ t1 (* 60 (string-to-number (match-string 2))) + (string-to-number (match-string 3)))) + ;; A headline + (setq level (- (match-end 1) (match-beginning 1))) + (when (or (> t1 0) (> (aref ltimes level) 0)) + (loop for l from 0 to level do + (aset ltimes l (+ (aref ltimes l) t1))) + (setq t1 0 time (aref ltimes level)) + (loop for l from level to (1- lmax) do + (aset ltimes l 0)) + (goto-char (match-beginning 0)) + (put-text-property (point) (point-at-eol) :org-clock-minutes time)))) + (setq org-clock-file-total-minutes (aref ltimes 0))))) + +(defun org-clock-display (&optional total-only) + "Show subtree times in the entire buffer. +If TOTAL-ONLY is non-nil, only show the total time for the entire file +in the echo area." + (interactive) + (org-remove-clock-overlays) + (let (time h m p) + (org-clock-sum) + (unless total-only + (save-excursion + (goto-char (point-min)) + (while (setq p (next-single-property-change (point) :org-clock-minutes)) + (goto-char p) + (when (setq time (get-text-property p :org-clock-minutes)) + (org-put-clock-overlay time (funcall outline-level)))) + (setq h (/ org-clock-file-total-minutes 60) + m (- org-clock-file-total-minutes (* 60 h))) + ;; Arrange to remove the overlays upon next change. + (org-add-hook 'before-change-functions 'org-remove-clock-overlays + nil 'local))) + (message "Total file time: %d:%02d (%d hours and %d minutes)" h m h m))) + +(defvar org-clock-overlays nil) +(defun org-put-clock-overlay (time &optional level) + "Put an overlays on the current line, displaying TIME. +If LEVEL is given, prefix time with a corresponding number of stars. +This creates a new overlay and stores it in `org-clock-overlays', so that it +will be easy to remove." + (let* ((c 60) (h (floor (/ time 60))) (m (- time (* 60 h))) + (l (if level (org-get-legal-level level 0) 0)) + (off 0) + ov tx) + (move-to-column c) + (if (eolp) (setq off 1)) + (unless (eolp) (skip-chars-backward "^ \t")) + (skip-chars-backward " \t") + (setq ov (org-make-overlay (- (point) off) (point-at-eol)) + tx (concat (make-string (+ off (max 0 (- c (current-column)))) ?.) + (org-add-props (format "%s %2d:%02d%s" + (make-string l ?*) h m + (make-string (- 10 l) ?\ )) + '(face secondary-selection)) + "")) + (org-overlay-put ov 'display tx) + (push ov org-clock-overlays))) + +(defun org-remove-clock-overlays (&optional beg end noremove) + "Remove the occur highlights from the buffer. +BEG and END are ignored. If NOREMOVE is nil, remove this function +from the `before-change-functions' in the current buffer." + (interactive) + (mapc 'org-delete-overlay org-clock-overlays) + (setq org-clock-overlays nil) + (unless noremove + (remove-hook 'before-change-functions + 'org-remove-clock-overlays 'local))) + +(defun org-clock-out-if-current () + "Clock out if the current entry contains the running clock. +This is used to stop the clock after a TODO entry is marked DONE." + (when (and (equal state org-done-string) + (equal (marker-buffer org-clock-marker) (current-buffer)) + (< (point) org-clock-marker) + (> (save-excursion (outline-next-heading) (point)) + org-clock-marker)) + (org-clock-out))) + +(add-hook 'org-after-todo-state-change-hook + 'org-clock-out-if-current) + +(defun org-check-running-clock () + "Check if the current buffer contains the running clock. +If yes, offer to stop it and to save the buffer with the changes." + (when (and (equal (marker-buffer org-clock-marker) (current-buffer)) + (y-or-n-p (format "Clock-out in buffer %s before killing it? " + (buffer-name)))) + (org-clock-out) + (when (y-or-n-p "Save changed buffer?") + (save-buffer)))) + ;;; Agenda, and Diary Integration ;;; Define the mode @@ -5361,6 +5660,9 @@ The following commands are available: (define-key org-agenda-mode-map "h" 'org-agenda-holidays) (define-key org-agenda-mode-map "H" 'org-agenda-holidays) (define-key org-agenda-mode-map "+" 'org-agenda-priority-up) +(define-key org-agenda-mode-map "I" 'org-agenda-clock-in) +(define-key org-agenda-mode-map "O" 'org-clock-out) +(define-key org-agenda-mode-map "X" 'org-clock-cancel) (define-key org-agenda-mode-map "-" 'org-agenda-priority-down) (define-key org-agenda-mode-map (org-key 'S-up) 'org-agenda-priority-up) (define-key org-agenda-mode-map (org-key 'S-down) 'org-agenda-priority-down) @@ -6619,7 +6921,7 @@ the documentation of `org-diary'." (format "mouse-2 or RET jump to org file %s" (abbreviate-file-name buffer-file-name)))) (regexp (concat - "\\<" org-closed-string " *\\[" + "\\<\\(" org-closed-string "\\|" org-clock-string "\\) *\\[" (regexp-quote (substring (format-time-string @@ -6627,13 +6929,14 @@ the documentation of `org-diary'." (apply 'encode-time ; DATE bound by calendar (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) 1 11)))) - marker hdmarker priority category tags + marker hdmarker priority category tags closedp ee txt timestr) (goto-char (point-min)) (while (re-search-forward regexp nil t) (if (not (save-match-data (org-at-date-range-p))) (progn (setq marker (org-agenda-new-marker (match-beginning 0)) + closedp (equal (match-string 1) org-closed-string) category (org-get-category (match-beginning 0)) timestr (buffer-substring (match-beginning 0) (point-at-eol)) ;; donep (org-entry-is-done-p) @@ -6649,7 +6952,7 @@ the documentation of `org-diary'." tags (org-get-tags-at)) (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") (setq txt (org-format-agenda-item - "Closed: " + (if closedp "Closed: " "Clocked: ") (match-string 1) category tags timestr))) (setq txt org-agenda-no-heading-message)) (setq priority 100000) @@ -6701,7 +7004,7 @@ the documentation of `org-diary'." (setq txt (org-format-agenda-item (format "In %3d d.: " diff) head category tags)))) (setq txt org-agenda-no-heading-message)) - (when txt + (when txt (setq face (cond ((<= diff 0) 'org-warning) ((<= diff 5) 'org-upcoming-deadline) (t nil))) @@ -6897,7 +7200,7 @@ only the correctly processes TXT should be returned - this is used by (and org-agenda-remove-tags-when-in-prefix org-prefix-has-tag)) (setq txt (replace-match "" t t txt)) - (setq txt (replace-match + (setq txt (replace-match (concat (make-string (max (- 50 (length txt)) 1) ?\ ) (match-string 2 txt)) t t txt)))) @@ -7083,7 +7386,7 @@ and by additional input from the age of a schedules or deadline entry." (interactive) (let* ((tags (get-text-property (point-at-bol) 'tags))) (if tags - (message "Tags are :%s:" + (message "Tags are :%s:" (org-no-properties (mapconcat 'identity tags ":"))) (message "No tags associated with this line")))) @@ -7283,7 +7586,7 @@ the tags of the current headline come last." (condition-case nil (while t (if (looking-at "[^\r\n]+?:\\([a-zA-Z_@0-9:]+\\):[ \t]*\\([\n\r]\\|\\'\\)") - (setq tags (append (org-split-string + (setq tags (append (org-split-string (org-match-string-no-properties 1) ":") tags))) (or org-use-tag-inheritance (error "")) @@ -7400,6 +7703,20 @@ be used to request time specification in the time stamp." (match-string 1) ""))) +(defun org-agenda-clock-in (&optional arg) + "Start the clock on the currently selected item." + (interactive "P") + (org-agenda-check-no-diary) + (let* ((marker (or (get-text-property (point) 'org-marker) + (org-agenda-error))) + (buffer (marker-buffer marker)) + (pos (marker-position marker)) + (hdmarker (get-text-property (point) 'org-hd-marker))) + (with-current-buffer (marker-buffer marker) + (widen) + (goto-char pos) + (org-clock-in)))) + (defun org-agenda-diary-entry () "Make a diary entry, like the `i' command from the calendar. All the standard commands work: block, weekly etc." @@ -7837,7 +8154,7 @@ Returns the new tags string, or nil to not change the current settings." (setq tbl table char ?a cnt 0) (while (setq e (pop tbl)) (cond - ((equal e '(:startgroup)) + ((equal e '(:startgroup)) (push '() groups) (setq ingroup t) (when (not (= cnt 0)) (setq cnt 0) @@ -7852,7 +8169,7 @@ Returns the new tags string, or nil to not change the current settings." (setq c (cdr e)) ;; automatically assign a character. (setq c1 (string-to-char - (downcase (substring + (downcase (substring tg (if (= (string-to-char tg) ?@) 1 0))))) (if (or (rassoc c1 ntable) (rassoc c1 table)) (while (or (rassoc char ntable) (rassoc char table)) @@ -7885,7 +8202,7 @@ Returns the new tags string, or nil to not change the current settings." (setq c (read-char-exclusive)) (cond ((= c ?\r) (throw 'exit t)) - ((= c ?!) + ((= c ?!) (setq groups nil) (goto-char (point-min)) (while (re-search-forward "[{}]" nil t) (replace-match " "))) @@ -8198,7 +8515,7 @@ in all files." (pre "") (post "") words re0 re1 re2 re3 re4 re5 re2a reall camel) (cond - ;; First check if there are any special + ;; First check if there are any special ((run-hook-with-args-until-success 'org-execute-file-search-functions s)) ;; Now try the builtin stuff ((save-excursion @@ -8644,8 +8961,8 @@ for this link." (interactive (list (y-or-n-p "Would you like to be queried for a description at each link?"))) (save-excursion (goto-char (point-min)) - (let ((re (concat "\\([^[]\\)<\\(" - "\\(" (mapconcat 'identity org-link-types "\\|") + (let ((re (concat "\\([^[]\\)<\\(" + "\\(" (mapconcat 'identity org-link-types "\\|") "\\):" "[^" org-non-link-chars "]+\\)>")) l1 l2 (cnt 0)) @@ -8763,7 +9080,7 @@ For file links, arg negates `org-context-in-file-links'." link (org-make-link cpltxt))) ((eq major-mode 'Info-mode) - (setq link (org-make-link "info:" + (setq link (org-make-link "info:" (file-name-nondirectory Info-current-file) ":" Info-current-node)) (setq cpltxt (concat (file-name-nondirectory Info-current-file) @@ -9110,8 +9427,8 @@ is in the current directory or below." ;; We do have a link at point, and we are going to edit it. (setq remove (list (match-beginning 0) (match-end 0))) (setq desc (if (match-end 3) (org-match-string-no-properties 3))) - (setq link (read-string "Link: " - (org-link-unescape + (setq link (read-string "Link: " + (org-link-unescape (org-match-string-no-properties 1))))) (complete-file ;; Completing read for file names. @@ -9172,7 +9489,7 @@ is in the current directory or below." (setq path (file-relative-name path))) (t (save-match-data - (if (string-match (concat "^" (regexp-quote + (if (string-match (concat "^" (regexp-quote (file-name-as-directory (expand-file-name ".")))) (expand-file-name path)) @@ -9187,7 +9504,7 @@ is in the current directory or below." (insert (org-make-link-string link desc)))) (defun org-completing-read (&rest args) - (let ((minibuffer-local-completion-map + (let ((minibuffer-local-completion-map (copy-keymap minibuffer-local-completion-map))) (define-key minibuffer-local-completion-map " " 'self-insert-command) (apply 'completing-read args))) @@ -9667,7 +9984,7 @@ This is being used to correctly align a single field after TAB or RET.") (error "Cannot narrow field starting with wide link \"%s\"" (match-string 0 xx))) (add-text-properties f1 (length xx) (list 'org-cwidth t) xx) - (add-text-properties (- f1 2) f1 + (add-text-properties (- f1 2) f1 (list 'display org-narrow-column-arrow) xx))))) ;; Get the maximum width for each column @@ -10229,7 +10546,7 @@ With prefix ARG, insert above the current line." (buffer-substring (point-at-bol) (point-at-eol)))) (col (current-column))) (while (string-match "|\\( +\\)|" line) - (setq line (replace-match + (setq line (replace-match (concat "+" (make-string (- (match-end 1) (match-beginning 1)) ?-) "|") t t line))) (and (string-match "\\+" line) (setq line (replace-match "|" t t line))) @@ -11776,7 +12093,7 @@ overwritten, and the table is not marked as requiring realignment." (while (re-search-forward re nil t) (setq key (org-match-string-no-properties 1) val (org-match-string-no-properties 2)) - (cond + (cond ((string-equal key "TITLE") (setq p (plist-put p :title val))) ((string-equal key "AUTHOR")(setq p (plist-put p :author val))) ((string-equal key "EMAIL") (setq p (plist-put p :email val))) @@ -11789,7 +12106,7 @@ overwritten, and the table is not marked as requiring realignment." (let ((op '(("H" . :headline-levels) ("num" . :section-numbers) ("toc" . :table-of-contents) - ("\\n" . :preserve-breaks) + ("\\n" . :preserve-breaks) ("@" . :expand-quoted-html) (":" . :fixed-width) ("|" . :tables) @@ -11798,7 +12115,7 @@ overwritten, and the table is not marked as requiring realignment." ("TeX" . :TeX-macros))) o) (while (setq o (pop op)) - (if (string-match (concat (regexp-quote (car o)) + (if (string-match (concat (regexp-quote (car o)) ":\\([^ \t\n\r;,.]*\\)") options) (setq p (plist-put p (cdr o) @@ -11863,6 +12180,49 @@ ones and overrule settings in the other lists." (t (setq rtn (cons line rtn))))) (nreverse rtn))) +(defun org-export (&optional arg) + (interactive) + (let ((help "[t] insert the export option template +\[v] limit export to visible part of outline tree + +\[a] export as ASCII +\[h] export as HTML +\[b] export as HTML and browse immediately +\[x] export as XOXO + +\[i] export current file as iCalendar file +\[I] export all agenda files as iCalendar files +\[c] export agenda files into combined iCalendar file + +\[F] publish current file +\[P] publish current project +\[X] publish... (project will be prompted for) +\[A] publish all projects") + (cmds + '((?v . org-export-visible) + (?a . org-export-as-ascii) + (?h . org-export-as-html) + (?b . org-export-as-html-and-open) + (?x . org-export-as-xoxo) + (?i . org-export-icalendar-this-file) + (?I . org-export-icalendar-all-agenda-files) + (?c . org-export-icalendar-combine-agenda-files) + (?F . org-publish-current-file) + (?P . org-publish-current-project) + (?X . org-publish) + (?A . org-publish-all))) + r1 r2 ass) + (save-window-excursion + (delete-other-windows) + (with-output-to-temp-buffer "*Org Export/Publishing Help*" + (princ help)) + (message "Select command: ") + (setq r1 (read-char-exclusive))) + (setq r2 (if (< r1 27) (+ r1 96) r1)) + (if (setq ass (assq r2 cmds)) + (call-interactively (cdr ass)) + (error "No command associated with key %c" r1)))) + ;; ASCII (defconst org-html-entities @@ -12163,7 +12523,7 @@ The list contains HTML entities for Latin-1, Greek and other symbols. It is supplemented by a number of commonly used TeX macros with appropriate translations. There is currently no way for users to extend this.") -(defun org-cleaned-string-for-export (string) +(defun org-cleaned-string-for-export (string &rest parameters) "Cleanup a buffer substring so that links can be created safely." (interactive) (let* ((cb (current-buffer)) @@ -12196,15 +12556,21 @@ translations. There is currently no way for users to extend this.") (goto-char (point-min)) (while (re-search-forward re-plain-link nil t) (replace-match - (concat + (concat (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]") t t)) (goto-char (point-min)) (while (re-search-forward re-angle-link nil t) (replace-match - (concat + (concat (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]") t t)) + ;; Find multiline emphasis and put them into single line + (when (assq :emph-multiline parameters) + (goto-char (point-min)) + (while (re-search-forward org-emph-re nil t) + (subst-char-in-region (match-beginning 0) (match-end 0) ?\n ?\ t) + (goto-char (1- (match-end 0))))) ;; Remove comments (goto-char (point-min)) @@ -12293,7 +12659,7 @@ underlined headlines. The default is 3." (case-fold-search nil) (filename (concat (file-name-as-directory (org-export-directory :ascii opt-plist)) - (file-name-sans-extension + (file-name-sans-extension (file-name-nondirectory buffer-file-name)) ".txt")) (buffer (find-file-noselect filename)) @@ -12327,7 +12693,7 @@ underlined headlines. The default is 3." ;; create local variables for all options, to make sure all called ;; functions get the correct information (mapcar (lambda (x) - (set (make-local-variable (cdr x)) + (set (make-local-variable (cdr x)) (plist-get opt-plist (car x)))) org-export-plist-vars) (set (make-local-variable 'org-odd-levels-only) odd) @@ -12401,7 +12767,7 @@ underlined headlines. The default is 3." (setq level (org-tr-level (- (match-end 1) (match-beginning 1))) txt (match-string 2 line)) (org-ascii-level-start level txt umax lines)) - (t + (t (insert (org-fix-indentation line org-ascii-current-indentation) "\n")))) (normal-mode) (save-buffer) @@ -12459,7 +12825,7 @@ underlined headlines. The default is 3." (let (char (n (- level umax 1)) (ind 0)) (if (> level umax) (progn - (insert (make-string (* 2 n) ?\ ) + (insert (make-string (* 2 n) ?\ ) (char-to-string (nth (% n (length org-export-ascii-bullets)) org-export-ascii-bullets)) " " title "\n") @@ -12489,13 +12855,14 @@ key. As a special case, if the you type SPC at the prompt, the temporary org-mode file will not be removed but presented to you so that you can continue to use it. The prefix arg ARG is passed through to the exporting command." - (interactive + (interactive (list (progn (message "Export visible: [a]SCII [h]tml [b]rowse HTML [x]OXO [ ]keep buffer") (char-to-string (read-char-exclusive))) current-prefix-arg)) (if (not (member type '("a" "\C-a" "b" "\C-b" "h" "x" " "))) (error "Invalid export key")) + ;; FIXME: do this more explicit? (let* ((binding (key-binding (concat "\C-c\C-x" type))) (keepp (equal type " ")) (file buffer-file-name) @@ -12680,7 +13047,7 @@ org-mode's default settings, but still inferior to file-local settings." (let* ((opt-plist (org-combine-plists (org-default-export-plist) ext-plist (org-infile-export-plist))) - + (style (plist-get opt-plist :style)) (odd org-odd-levels-only) (region-p (org-region-active-p)) @@ -12690,14 +13057,15 @@ org-mode's default settings, but still inferior to file-local settings." (if region-p (region-end) (point-max)))) (all_lines (org-skip-comments (org-split-string - (org-cleaned-string-for-export region) + (org-cleaned-string-for-export + region :emph-multiline) "[\r\n]"))) (lines (org-export-find-first-heading-line all_lines)) (level 0) (line "") (origline "") txt todo (umax nil) - (filename (concat (file-name-as-directory + (filename (concat (file-name-as-directory (org-export-directory :html opt-plist)) - (file-name-sans-extension + (file-name-sans-extension (file-name-nondirectory buffer-file-name)) ".html")) (buffer (find-file-noselect filename)) @@ -12755,7 +13123,7 @@ org-mode's default settings, but still inferior to file-local settings." ;; create local variables for all options, to make sure all called ;; functions get the correct information (mapcar (lambda (x) - (set (make-local-variable (cdr x)) + (set (make-local-variable (cdr x)) (plist-get opt-plist (car x)))) org-export-plist-vars) (setq umax (if arg (prefix-numeric-value arg) @@ -12946,7 +13314,7 @@ lang=\"%s\" xml:lang=\"%s\"> (if (string-match "::\\(.*\\)" filename) (setq search (match-string 1 filename) filename (replace-match "" t nil filename))) - (setq file-is-image-p + (setq file-is-image-p (string-match (org-image-file-name-regexp) filename)) (setq thefile (if abs-p (expand-file-name filename) filename)) (when (and org-export-html-link-org-files-as-html @@ -12959,7 +13327,7 @@ lang=\"%s\" xml:lang=\"%s\"> (not (string-match "^[0-9]*$" search)) (not (string-match "^\\*" search)) (not (string-match "^/.*/$" search))) - (setq thefile (concat thefile "#" + (setq thefile (concat thefile "#" (org-solidify-link-text (org-link-unescape search))))) (when (string-match "^file:" desc) @@ -13039,7 +13407,7 @@ lang=\"%s\" xml:lang=\"%s\"> line) (setq ind (org-get-string-indentation line) start-is-num (match-beginning 4) - starter (if (match-beginning 2) + starter (if (match-beginning 2) (substring (match-string 2 line) 0 -1)) line (substring line (match-beginning 5))) (unless (string-match "[^ \t]" line) @@ -13068,7 +13436,7 @@ lang=\"%s\" xml:lang=\"%s\"> (org-close-li) (insert "
  • \n"))) (if (string-match "^[ \t]*\\[\\([X ]\\)\\]" line) - (setq line + (setq line (replace-match (if (equal (match-string 1 line) "X") "[X]" @@ -13088,7 +13456,7 @@ lang=\"%s\" xml:lang=\"%s\"> (setq line (concat line "
    ")))) (insert line "\n"))))) - + ;; Properly close all local lists and other lists (when inquote (insert "\n")) (when in-local-list @@ -13115,7 +13483,7 @@ lang=\"%s\" xml:lang=\"%s\"> (insert "

    " (nth 2 lang-words) ": " date " " time "

    \n"))) - + (if org-export-html-with-timestamp (insert org-export-html-html-helper-timestamp)) (insert (or (plist-get opt-plist :postamble) "")) @@ -13288,9 +13656,9 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used." (if (not org-export-with-timestamps) (setq r (concat r (substring s 0 (match-beginning 0))) s (substring s (match-end 0))) - (setq r (concat + (setq r (concat r (substring s 0 (match-beginning 0)) - (if (match-end 1) + (if (match-end 1) (format "@%s @" (match-string 1 s))) (format " @%s@" @@ -13403,12 +13771,9 @@ stacked delimiters is N. Escaping delimiters is not possible." string) (defun org-export-html-convert-emphasize (string) - (while (string-match org-italic-re string) - (setq string (replace-match "\\1\\3\\4" t nil string))) - (while (string-match org-bold-re string) - (setq string (replace-match "\\1\\3\\4" t nil string))) - (while (string-match org-underline-re string) - (setq string (replace-match "\\1\\3\\4" t nil string))) + "Apply emphasis." + (while (string-match org-emph-re string) + (setq string (replace-match (concat "\\1" (nth 2 (assoc (match-string 3 string) org-emphasis-alist)) "\\4" (nth 3 (assoc (match-string 3 string) org-emphasis-alist)) "\\5") t nil string))) string) (defvar org-par-open nil) @@ -13446,12 +13811,12 @@ When TITLE is nil, just close all open levels." ;; If title is nil, this means this function is called to close ;; all levels, so the rest is done only if title is given (when (string-match "\\(:[a-zA-Z0-9_@:]+:\\)[ \t]*$" title) - (setq title (replace-match + (setq title (replace-match (if org-export-with-tags (save-match-data (concat "   " - (mapconcat 'identity (org-split-string + (mapconcat 'identity (org-split-string (match-string 1 title) ":") " ") "")) @@ -13527,6 +13892,7 @@ When LEVEL is non-nil, increase section numbers on that level." string)) +;;;###autoload (defun org-export-icalendar-this-file () "Export current file as an iCalendar file. The iCalendar file will be located in the same directory as the Org-mode @@ -13551,7 +13917,7 @@ The XOXO buffer is named *xoxo-*" (org-infile-export-plist))) (filename (concat (file-name-as-directory (org-export-directory :xoxo opt-plist)) - (file-name-sans-extension + (file-name-sans-extension (file-name-nondirectory buffer-file-name)) ".html")) (out (find-file-noselect filename)) @@ -13636,11 +14002,11 @@ The file is stored under the name `org-combined-agenda-icalendar-file'." If COMBINE is non-nil, combine all calendar entries into a single large file and store it under the name `org-combined-agenda-icalendar-file'." (save-excursion - (let* ((dir (org-export-directory + (let* ((dir (org-export-directory :ical (list :publishing-directory org-export-publishing-directory))) file ical-file ical-buffer category started org-agenda-new-buffers) - + (when combine (setq ical-file (if (file-name-absolute-p org-combined-agenda-icalendar-file) @@ -13654,7 +14020,7 @@ file and store it under the name `org-combined-agenda-icalendar-file'." (set-buffer (org-get-agenda-file-buffer file)) (unless combine (setq ical-file (concat (file-name-as-directory dir) - (file-name-sans-extension + (file-name-sans-extension (file-name-nondirectory buffer-file-name)) ".ics")) (setq ical-buffer (org-get-agenda-file-buffer ical-file)) @@ -13793,7 +14159,6 @@ a time), or the day by one (if it does not contain a time)." ;; Make `C-c C-x' a prefix key (define-key org-mode-map "\C-c\C-x" (make-sparse-keymap)) -(define-key org-mode-map "\C-c\C-e" (make-sparse-keymap)) ;; TAB key with modifiers (define-key org-mode-map "\C-i" 'org-cycle) @@ -13889,40 +14254,46 @@ a time), or the day by one (if it does not contain a time)." (define-key org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks) (define-key org-mode-map "\C-c~" 'org-table-create-with-table.el) (define-key org-mode-map "\C-c\C-q" 'org-table-wrap-region) -(define-key org-mode-map "\C-c\C-xa" 'org-export-as-ascii) -(define-key org-mode-map "\C-c\C-x\C-a" 'org-export-as-ascii) -(define-key org-mode-map "\C-c\C-xv" 'org-export-visible) -(define-key org-mode-map "\C-c\C-x\C-v" 'org-export-visible) +(define-key org-mode-map "\C-c\C-e" 'org-export) +;(define-key org-mode-map "\C-c\C-xa" 'org-export-as-ascii) +;(define-key org-mode-map "\C-c\C-x\C-a" 'org-export-as-ascii) +;(define-key org-mode-map "\C-c\C-xv" 'org-export-visible) +;(define-key org-mode-map "\C-c\C-x\C-v" 'org-export-visible) ;; OPML support is only an option for the future ;(define-key org-mode-map "\C-c\C-xo" 'org-export-as-opml) ;(define-key org-mode-map "\C-c\C-x\C-o" 'org-export-as-opml) -(define-key org-mode-map "\C-c\C-xi" 'org-export-icalendar-this-file) -(define-key org-mode-map "\C-c\C-x\C-i" 'org-export-icalendar-all-agenda-files) -(define-key org-mode-map "\C-c\C-xc" 'org-export-icalendar-combine-agenda-files) -(define-key org-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files) -(define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template) +;(define-key org-mode-map "\C-c\C-xi" 'org-export-icalendar-this-file) +;(define-key org-mode-map "\C-c\C-x\C-i" 'org-export-icalendar-all-agenda-files) +;(define-key org-mode-map "\C-c\C-xc" 'org-export-icalendar-combine-agenda-files) +;(define-key org-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files) +;(define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template) (define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section) -(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html) -(define-key org-mode-map "\C-c\C-xx" 'org-export-as-xoxo) -(define-key org-mode-map "\C-c\C-x\C-x" 'org-export-as-xoxo) -(define-key org-mode-map "\C-c\C-xb" 'org-export-as-html-and-open) -(define-key org-mode-map "\C-c\C-x\C-b" 'org-export-as-html-and-open) +;(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html) +;(define-key org-mode-map "\C-c\C-xx" 'org-export-as-xoxo) +;(define-key org-mode-map "\C-c\C-x\C-x" 'org-export-as-xoxo) +;(define-key org-mode-map "\C-c\C-xb" 'org-export-as-html-and-open) +;(define-key org-mode-map "\C-c\C-x\C-b" 'org-export-as-html-and-open) (define-key org-mode-map "\C-c\C-x\C-k" 'org-cut-special) (define-key org-mode-map "\C-c\C-x\C-w" 'org-cut-special) (define-key org-mode-map "\C-c\C-x\M-w" 'org-copy-special) (define-key org-mode-map "\C-c\C-x\C-y" 'org-paste-special) -(define-key org-mode-map "\C-c\C-ef" 'org-publish-current-file) -(define-key org-mode-map "\C-c\C-ep" 'org-publish-current-project) -(define-key org-mode-map "\C-c\C-ec" 'org-publish) -(define-key org-mode-map "\C-c\C-ea" 'org-publish-all) -(define-key org-mode-map "\C-c\C-e\C-f" 'org-publish-current-file) -(define-key org-mode-map "\C-c\C-e\C-p" 'org-publish-current-project) -(define-key org-mode-map "\C-c\C-e\C-c" 'org-publish) -(define-key org-mode-map "\C-c\C-e\C-a" 'org-publish-all) +(define-key org-mode-map "\C-c\C-x\C-i" 'org-clock-in) +(define-key org-mode-map "\C-c\C-x\C-o" 'org-clock-out) +(define-key org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel) +(define-key org-mode-map "\C-c\C-x\C-d" 'org-clock-display) -(when (featurep 'xemacs) +;(define-key org-mode-map "\C-c\C-ef" 'org-publish-current-file) +;(define-key org-mode-map "\C-c\C-ep" 'org-publish-current-project) +;(define-key org-mode-map "\C-c\C-ec" 'org-publish) +;(define-key org-mode-map "\C-c\C-ea" 'org-publish-all) +;(define-key org-mode-map "\C-c\C-e\C-f" 'org-publish-current-file) +;(define-key org-mode-map "\C-c\C-e\C-p" 'org-publish-current-project) +;(define-key org-mode-map "\C-c\C-e\C-c" 'org-publish) +;(define-key org-mode-map "\C-c\C-e\C-a" 'org-publish-all) + +(when (featurep 'xemacs) (define-key org-mode-map 'button3 'popup-mode-menu)) (defsubst org-table-p () (org-at-table-p)) @@ -13965,7 +14336,7 @@ because, in this case the deletion might narrow the column." (eq N 1) (string-match "|" (buffer-substring (point-at-bol) (point))) (looking-at ".*?|")) - (let ((pos (point)) + (let ((pos (point)) (noalign (looking-at "[^|\n\r]* |")) (c org-table-may-need-update)) (backward-delete-char N) @@ -14028,12 +14399,12 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names." "Throw an error because Shift-Cursor command was applied in wrong context." (error "This command is active in special context like tables, headlines or timestamps")) -(defun org-shifttab () +(defun org-shifttab (&optional arg) "Global visibility cycling or move to previous table field. Calls `org-cycle' with argument t, or `org-table-previous-field', depending on context. See the individual commands for more information." - (interactive) + (interactive "P") (cond ((org-at-table-p) (call-interactively 'org-table-previous-field)) (t (call-interactively 'org-global-cycle)))) @@ -14204,7 +14575,7 @@ This command does many different things, depending on context: - If the cursor is in one of the special #+KEYWORD lines, this triggers scanning the buffer for these lines and updating the - information. + information. - If the cursor is inside a table, realign the table. This command works even if the automatic table editor has been turned off. @@ -14227,6 +14598,12 @@ This command does many different things, depending on context: (interactive "P") (let ((org-enable-table-editor t)) (cond + (org-clock-overlays + (org-remove-clock-overlays) + (message "Clock overlays removed")) + (org-occur-highlights + (org-remove-occur-highlights) + (message "occur highlights removed")) ((and (local-variable-p 'org-finish-function (current-buffer)) (fboundp org-finish-function)) (funcall org-finish-function)) @@ -14403,6 +14780,18 @@ See the individual commands for more information." "--" ["Goto Calendar" org-goto-calendar t] ["Date from Calendar" org-date-from-calendar t]) + ("Logging work" + ["Clock in" org-clock-in t] + ["Clock out" org-clock-out t] + ["Clock cancel" org-clock-cancel t] + ["Display times" org-clock-display t] + "--" + ["Record DONE time" + (progn (setq org-log-done (not org-log-done)) + (message "Switching to %s will %s record a timestamp" + org-done-string + (if org-log-done "automatically" "not"))) + :style toggle :selected org-log-done]) "--" ["Agenda Command" org-agenda t] ("File List for Agenda") @@ -14426,28 +14815,10 @@ See the individual commands for more information." :style radio :selected (not (member '(org-link) buffer-invisibility-spec))] "--" ["Upgrade all to [[link][desc]]" org-upgrade-old-links - (save-excursion (goto-char (point-min)) + (save-excursion (goto-char (point-min)) (re-search-forward "<[a-z]+:" nil t))]) "--" - ("Export" - ["ASCII" org-export-as-ascii t] - ["Export visible part..." org-export-visible t] - ["HTML" org-export-as-html t] - ["HTML and Open" org-export-as-html-and-open t] - ["XOXO" org-export-as-xoxo t] - "--" - ["iCalendar this file" org-export-icalendar-this-file t] - ["iCalendar all agenda files" org-export-icalendar-all-agenda-files - :active t :keys "C-c C-x C-i"] - ["iCalendar combined" org-export-icalendar-combine-agenda-files t] - "--" - ["Option Template" org-insert-export-options-template t] - ["Toggle Fixed Width" org-toggle-fixed-width-section t]) - ("Publish" - ["Current File" org-publish-current-file t] - ["Current Project" org-publish-current-project t] - ["Project..." org-publish t] - ["All Projects" org-publish-all t]) + ["Export/Publish" org-export t] "--" ("Documentation" ["Show Version" org-version t] @@ -14649,6 +15020,7 @@ return nil." ;; But only if the user has not turned off tables or fixed-width regions (set (make-local-variable 'auto-fill-inhibit-regexp) (concat "\\*\\|#" + "\\|[ \t]*" org-keyword-time-regexp (if (or org-enable-table-editor org-enable-fixed-width-editor) (concat "\\|[ \t]*[" @@ -14962,16 +15334,14 @@ Show the heading too, if it is currently invisible." (org-invisible-p))) (org-show-hierarchy-above))) +;;; Experimental code + + ;;; Finish up (provide 'org) (run-hooks 'org-load-hook) - ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd ;;; org.el ends here - - - - diff --git a/org.pdf b/org.pdf index 97bc6e302..d3bdf5d37 100644 Binary files a/org.pdf and b/org.pdf differ diff --git a/org.texi b/org.texi index 27970a1ae..c88205887 100644 --- a/org.texi +++ b/org.texi @@ -1,10 +1,9 @@ \input texinfo - @c %**start of header @setfilename ../info/org @settitle Org Mode Manual -@set VERSION 4.36 +@set VERSION 4.37 @set DATE June 2006 @dircategory Emacs @@ -146,7 +145,6 @@ Internal links TODO items * TODO basics:: Marking and displaying TODO entries -* Progress logging:: Document your productivity * TODO extensions:: Workflow and assignments * Priorities:: Some things are more important than others @@ -160,6 +158,12 @@ Timestamps * Time stamps:: Assigning a time to a tree entry * Creating timestamps:: Commands which insert timestamps +* Progress logging:: Documenting when what work was done. + +Progress Logging + +* Closing items:: When was this entry makred DONE? +* Clocking work time:: When exactly did you work on this item? Tags @@ -1921,12 +1925,11 @@ things you have to do. @menu * TODO basics:: Marking and displaying TODO entries -* Progress logging:: Document your productivity * TODO extensions:: Workflow and assignments * Priorities:: Some things are more important than others @end menu -@node TODO basics, Progress logging, TODO items, TODO items +@node TODO basics, TODO extensions, TODO items, TODO items @section Basic TODO functionality Any headline can become a TODO item by starting it with the word TODO, @@ -1978,28 +1981,8 @@ the TODO entries directly from that buffer (@pxref{Agenda commands}). @c agenda, customize the variable @code{org-agenda-include-all-todo}. @end table -@node Progress logging, TODO extensions, TODO basics, TODO items -@section Progress Logging -@cindex progress logging -@cindex logging, of progress -If you want to keep track of @emph{when} a certain TODO item was -finished, turn on logging with -@lisp -(setq org-log-done t) -@end lisp - -@noindent -Then each time you turn a TODO entry into DONE using either @kbd{C-c -C-t} in the Org-mode buffer or @kbd{t} in the agenda buffer, a line -@samp{CLOSED: [timestamp]} will be inserted just after the headline. -If you turn the entry back into a TODO item again through further -state cycling, that line will be removed again. In the timeline -(@pxref{Timeline}) and in the agenda (@pxref{Weekly/Daily agenda}), -you can then use the @kbd{L} key to display the TODO items closed on -each day, giving you an overview of what has been done on a day. - -@node TODO extensions, Priorities, Progress logging, TODO items +@node TODO extensions, Priorities, TODO basics, TODO items @section Extended use of TODO keywords @cindex extended TODO keywords @@ -2166,6 +2149,7 @@ planning. @menu * Time stamps:: Assigning a time to a tree entry * Creating timestamps:: Commands which insert timestamps +* Progress logging:: Documenting when what work was done. @end menu @@ -2239,9 +2223,17 @@ When @code{org-log-done} is non-nil, Org-mode will automatically insert a special time stamp each time a TODO entry is marked done (@pxref{Progress logging}). This time stamp is enclosed in square brackets instead of angular brackets. + +@item Time range with CLOCK keyword +@cindex CLOCK keyword +When using the clock to time the work that is being done on specific +items, time ranges preceeded by the CLOCK keyword are inserted +automatically into the file. The time stamps are enclosed in square +brackets instead of angular brackets. @xref{Clocking work time}. +@c FIXME: Reference needed @end table -@node Creating timestamps, , Time stamps, Timestamps +@node Creating timestamps, Progress logging, Time stamps, Timestamps @section Creating timestamps @cindex creating timestamps @cindex timestamps, creating @@ -2373,6 +2365,82 @@ One month back. Choose date in calendar (only if nothing typed into minibuffer). @end table +@node Progress logging, , Creating timestamps, Timestamps +@section Progress Logging +@cindex progress logging +@cindex logging, of progress + +Org-mode can automatically record a time stamp when you mark a TODO item +as DONE. You can also measure precisely the time you spent on specific +items in a project by starting and stopping a clock when you start and +stop working on an aspect of a project. + +@menu +* Closing items:: When was this entry makred DONE? +* Clocking work time:: When exactly did you work on this item? +@end menu + +@node Closing items, Clocking work time, Progress logging, Progress logging +@subsection Closing items + +If you want to keep track of @emph{when} a certain TODO item was +finished, turn on logging with + +@lisp +(setq org-log-done t) +@end lisp + +@noindent +Then each time you turn a TODO entry into DONE using either @kbd{C-c +C-t} in the Org-mode buffer or @kbd{t} in the agenda buffer, a line +@samp{CLOSED: [timestamp]} will be inserted just after the headline. +If you turn the entry back into a TODO item again through further +state cycling, that line will be removed again. In the timeline +(@pxref{Timeline}) and in the agenda (@pxref{Weekly/Daily agenda}), +you can then use the @kbd{l} key to display the TODO items closed on +each day, giving you an overview of what has been done on a day. + +@node Clocking work time, , Closing items, Progress logging +@subsection Clocking work time + +Org-mode allows you to clock the time you spent on specific tasks in a +project. When you start working on an item, you can start the clock. +When you stop working on that tast, or when you makr the task done, the +clock is stoppend and the corresponding time interval is recorded. It +also computes the total time spent on each subtree of a project. + +@table @kbd +@kindex C-c C-x C-i +@item C-c C-x C-i +Start the clock on the current item (clock-in). This inserts the CLOCK +keyword together with a timestamp. +@kindex C-c C-x C-o +@item C-c C-x C-o +Stop the clock (clock-out). The inserts another timestamp at the same +location where the clock was last started. It also directly computes +the resulting time in inserts it after the time range as @samp{=> +HH:MM}. +@kindex C-c C-t +@item C-c C-t +Changing the TODO state of an item to DONE automatically stops the clock +if it is running in this same item. +@kindex C-c C-x C-x +@item C-c C-x C-x +Cancel the current clock. This is useful if a clock was started by +mistake, or if you ended up working on something else. +@kindex C-c C-x C-d +@item C-c C-x C-d +Display time summaries for each subtree in the current buffer. This +puts overlays at the end of each headline, showing the total time +recorded under that heading, including the time of any subheadings. You +can use visibility cycling to study the tree, but the overlays disappear +automatically when the buffer is changed. +@end table + +The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in +the agenda (@pxref{Weekly/Daily agenda}) to show which tasks have been +worked on or closed during a day. + @node Tags, Agenda views, Timestamps, Top @chapter Tags @cindex tags @@ -2958,7 +3026,8 @@ agenda buffers can be set with the variable @kindex l @item l Toggle Logbook mode. In Logbook mode, entries that where marked DONE while -logging was on (variable @code{org-log-done}) are shown in the agenda. +logging was on (variable @code{org-log-done}) are shown in the agenda, +as are entries that have been clocked on that day. @tsubheading{Change display} @kindex o @@ -3075,13 +3144,16 @@ Change the time stamp associated with the current line to today. The key @kbd{>} has been chosen, because it is the same as @kbd{S-.} on my keyboard. -@cindex diary entries, creating from agenda -@kindex i -@item i -Insert a new entry into the diary. Prompts for the type of entry -(day, weekly, monthly, yearly, anniversary, cyclic) and creates a new -entry in the diary, just as @kbd{i d} etc. would do in the calendar. -The date is taken from the cursor position. +@kindex I +@item I +Start the clock on the current item. If a clock is running already, it +is stopped first. +@kindex O +@item O +Stop the previously started clock. +@kindex X +@item X +Cancel the currently running clock. @tsubheading{Calendar commands} @kindex c @@ -3092,6 +3164,14 @@ Open the Emacs calendar and move to the date at the agenda cursor. When in the calendar, compute and show the Org-mode agenda for the date at the cursor. +@cindex diary entries, creating from agenda +@kindex i +@item i +Insert a new entry into the diary. Prompts for the type of entry +(day, weekly, monthly, yearly, anniversary, cyclic) and creates a new +entry in the diary, just as @kbd{i d} etc. would do in the calendar. +The date is taken from the cursor position. + @kindex M @item M Show the phases of the moon for the three months around current date. diff --git a/orgcard.pdf b/orgcard.pdf index 34227bc9f..232753826 100644 Binary files a/orgcard.pdf and b/orgcard.pdf differ diff --git a/orgcard.tex b/orgcard.tex index 5a019328a..646a03b02 100644 --- a/orgcard.tex +++ b/orgcard.tex @@ -1,5 +1,5 @@ % Reference Card for Org Mode -\def\orgversionnumber{4.36} +\def\orgversionnumber{4.37} \def\year{2006} % %**start of header @@ -336,83 +336,6 @@ To set archive location for current file, add a line like$^2$: \key{create sparse tree with matching tags}{C-c \\} \key{globally (agenda) match tags at cursor}{C-c C-o} -\section{TODO Items} - -\key{rotate the state of the current item}{C-c C-t} -\key{view TODO items in a sparse tree}{C-c C-v} -\key{view 3rd TODO keyword's sparse tree}{C-3 C-c C-v} - -\key{set the priority of the current item}{C-c , [ABC]} -\key{remove priority cookie from current item}{C-c , SPC} -\key{raise priority of current item}{S-UP$^3$} -\key{lower priority of current item}{S-DOWN$^3$} - -\key{\kbd{\#+SEQ_TODO: TODO TRY BLUFF DONE}}{\rm todo workflow} -\key{\kbd{\#+TYP_TODO: Phil home work DONE}}{\rm todo types} - -\section{Timestamps} - -\key{prompt for date and insert timestamp}{C-c .} -\key{like \kbd{C-c} . but insert date and time format}{C-u C-c .} -\key{Like \kbd{C-c .} but make stamp inactive}{C-c !} % FIXME -\key{insert DEADLINE timestamp}{C-c C-d} -\key{insert SCHEDULED timestamp}{C-c C-s} -\key{create sparse tree with all deadlines due}{C-c C-w} -\key{the time between 2 dates in a time range}{C-c C-y} -\key{change timestamp at cursor by $\pm 1$ day}{S-RIGHT/LEFT$^3$} -\key{change year/month/day at cursor by $\pm 1$}{S-UP/DOWN$^3$} -\key{access the calendar for the current date}{C-c >} -\key{insert timestamp matching date in calendar}{C-c <} -\key{access agenda for current date}{C-c C-o} -\key{Select date while prompted}{mouse-1/RET} -%\key{... select date in calendar}{mouse-1/RET} -%\key{... scroll calendar back/forward one month}{< / >} -%\key{... forward/backward one day}{S-LEFT/RIGHT} -%\key{... forward/backward one week}{S-UP/DOWN} -%\key{... forward/backward one month}{M-S-LEFT/RIGT} - -\section{Links} - -\key{globally store link to the current location}{C-c l$^1$} -\key{insert a link (TAB completes stored links)}{C-c C-l} -\key{insert file link with file name completion}{C-u C-c C-l} -\key{edit (also hidden part of) link at point}{C-c C-l} - -\key{open file links in emacs (\kbd{C-u} : in emacs)}{C-c C-o} -\key{open link at point (3: in emacs)}{mouse-2/3} -%\key{open file links in emacs}{mouse-3} -%\key{record a position in mark ring}{C-c \%} -\key{jump back to last followed link(s)}{C-c \&} - -{\bf Internal Links} - -\key{\kbd{<>}}{\rm target} -\key{\kbd{<<>>}}{\rm radio target$^2$} -\key{\kbd{[[*this text]]}}{\rm find headline} -\metax{\kbd{[[this text]]}}{\rm find target or text in buffer} -\metax{\kbd{[[this text][description]]}}{\rm optional link text} - -{\bf External Links} - -\key{\kbd{file:/home/dominik/img/mars.jpg}}{\rm file, absolute} -\key{\kbd{file:papers/last.pdf}}{\rm file, relative} -\key{\kbd{file:projects.org::*that text}}{\rm find headline} -\key{\kbd{file:projects.org::find me}}{\rm find tgt/string} -%\key{\kbd{file:projects.org::/regexp/}}{\rm regexp search} -\key{\kbd{http://www.astro.uva.nl/~dominik}}{\rm on the web} -\key{\kbd{mailto:adent@galaxy.net}}{\rm EMail address} -\key{\kbd{news:comp.emacs}}{\rm Usenet group} -\key{\kbd{bbdb:Richard Stallman}}{\rm BBDB person} -\key{\kbd{gnus:group}}{\rm GNUS group} -\key{\kbd{gnus:group\#id}}{\rm GNUS message} -\key{\kbd{vm|wl|mhe|rmail:folder}}{\rm Mail folder} -\key{\kbd{vm|wl|mhe|rmail:folder\#id}}{\rm Mail message} -\key{\kbd{info:emacs:Regexps}}{\rm Info file:node} -\key{\kbd{shell:ls *.org}}{\rm shell command} -\key{\kbd{elisp:(calendar)}}{\rm elisp form} -\metax{\kbd{[[external link][description]]}}{\rm optional link text} -%\key{\kbd{vm://myself@some.where.org/folder\#id}}{\rm VM remote} - \section{Tables} %Org-mode has its own built-in intuitive table editor with unique @@ -500,11 +423,98 @@ formula, \kbd{:=} a named-field formula. \key{recognize existing table.el table}{C-c C-c} \key{convert table (Org-mode $\leftrightarrow$ table.el)}{C-c ~} +\section{Links} + +\key{globally store link to the current location}{C-c l$^1$} +\key{insert a link (TAB completes stored links)}{C-c C-l} +\key{insert file link with file name completion}{C-u C-c C-l} +\key{edit (also hidden part of) link at point}{C-c C-l} + +\key{open file links in emacs (\kbd{C-u} : in emacs)}{C-c C-o} +\key{open link at point (3: in emacs)}{mouse-2/3} +%\key{open file links in emacs}{mouse-3} +%\key{record a position in mark ring}{C-c \%} +\key{jump back to last followed link(s)}{C-c \&} + +{\bf Internal Links} + +\key{\kbd{<>}}{\rm target} +\key{\kbd{<<>>}}{\rm radio target$^2$} +\key{\kbd{[[*this text]]}}{\rm find headline} +\metax{\kbd{[[this text]]}}{\rm find target or text in buffer} +\metax{\kbd{[[this text][description]]}}{\rm optional link text} + +{\bf External Links} + +\key{\kbd{file:/home/dominik/img/mars.jpg}}{\rm file, absolute} +\key{\kbd{file:papers/last.pdf}}{\rm file, relative} +\key{\kbd{file:projects.org::*that text}}{\rm find headline} +\key{\kbd{file:projects.org::find me}}{\rm find tgt/string} +%\key{\kbd{file:projects.org::/regexp/}}{\rm regexp search} +\key{\kbd{http://www.astro.uva.nl/~dominik}}{\rm on the web} +\key{\kbd{mailto:adent@galaxy.net}}{\rm EMail address} +\key{\kbd{news:comp.emacs}}{\rm Usenet group} +\key{\kbd{bbdb:Richard Stallman}}{\rm BBDB person} +\key{\kbd{gnus:group}}{\rm GNUS group} +\key{\kbd{gnus:group\#id}}{\rm GNUS message} +\key{\kbd{vm|wl|mhe|rmail:folder}}{\rm Mail folder} +\key{\kbd{vm|wl|mhe|rmail:folder\#id}}{\rm Mail message} +\key{\kbd{info:emacs:Regexps}}{\rm Info file:node} +\key{\kbd{shell:ls *.org}}{\rm shell command} +\key{\kbd{elisp:(calendar)}}{\rm elisp form} +\metax{\kbd{[[external link][description]]}}{\rm optional link text} +%\key{\kbd{vm://myself@some.where.org/folder\#id}}{\rm VM remote} + + +\section{TODO Items} + +\key{rotate the state of the current item}{C-c C-t} +\key{view TODO items in a sparse tree}{C-c C-v} +\key{view 3rd TODO keyword's sparse tree}{C-3 C-c C-v} + +\key{set the priority of the current item}{C-c , [ABC]} +\key{remove priority cookie from current item}{C-c , SPC} +\key{raise priority of current item}{S-UP$^3$} +\key{lower priority of current item}{S-DOWN$^3$} + +\key{\kbd{\#+SEQ_TODO: TODO TRY BLUFF DONE}}{\rm todo workflow} +\key{\kbd{\#+TYP_TODO: Phil home work DONE}}{\rm todo types} + +\section{Timestamps} + +\key{prompt for date and insert timestamp}{C-c .} +\key{like \kbd{C-c} . but insert date and time format}{C-u C-c .} +\key{Like \kbd{C-c .} but make stamp inactive}{C-c !} % FIXME +\key{insert DEADLINE timestamp}{C-c C-d} +\key{insert SCHEDULED timestamp}{C-c C-s} +\key{create sparse tree with all deadlines due}{C-c C-w} +\key{the time between 2 dates in a time range}{C-c C-y} +\key{change timestamp at cursor by $\pm 1$ day}{S-RIGHT/LEFT$^3$} +\key{change year/month/day at cursor by $\pm 1$}{S-UP/DOWN$^3$} +\key{access the calendar for the current date}{C-c >} +\key{insert timestamp matching date in calendar}{C-c <} +\key{access agenda for current date}{C-c C-o} +\key{Select date while prompted}{mouse-1/RET} +%\key{... select date in calendar}{mouse-1/RET} +%\key{... scroll calendar back/forward one month}{< / >} +%\key{... forward/backward one day}{S-LEFT/RIGHT} +%\key{... forward/backward one week}{S-UP/DOWN} +%\key{... forward/backward one month}{M-S-LEFT/RIGT} + + \newcolumn \title{Org-Mode Reference Card (2/2)} \centerline{(for version \orgversionnumber)} +\section{Clocking Time} + +\key{start clock on current item}{C-c C-x C-i} +\key{stop clock on current item}{C-c C-x C-o} +\key{cancel current clock}{C-c C-x C-x} +\key{display total subtree times}{C-c C-x C-d} +\key{remove displayed times}{C-c C-c} + \section{Agenda Views} \key{add/move current file to front of agenda}{C-c [} @@ -563,6 +573,12 @@ To set categories, add lines like$^2$: \key{change timestamp to today}{>} \key{insert new entry into diary}{i} +\key{Start the clock on current item (clock-in)}{I} +\key{Stop the clock (clock-out)}{O} +\key{Cancel current clock}{X} + +\newcolumn + {\bf Calendar commands} \key{find agenda cursor date in calendar}{c} @@ -577,23 +593,16 @@ To set categories, add lines like$^2$: \key{quit agenda, remove agenda buffer}{q} \key{exit agenda, remove all agenda buffers}{x} -\section{Exporting} +\section{Exporting and Publishing} Exporting creates files with extensions {\it .txt\/} and {\it .html\/} -in the current directory. +in the current directory. Publishing puts the resulting file into +some other place. -\key{export as ASCII file}{C-c C-x a} -\key{export visible text only (e.g. for printing)}{C-c C-x v} -\key{export as HTML file}{C-c C-x h} -\key{export as HTML and open in browser}{C-c C-x b} -\key{prefix arg sets nb. of headline levels, e.g.}{C-3 C-c C-x h} - -\key{export as iCalendar file}{C-c C-x i} -\key{export all agenda files as iCalendar files}{C-c C-x C-i} -\key{combine all agenda files to single iCal file}{C-c C-x C-c} +\key{export/publish dispatcher}{C-c C-e} +\key{export visible part only}{C-c C-e v} \key{insert template of export options}{C-c C-x t} - \key{toggle fixed width for entry or region}{C-c :} {\bf HTML formatting} @@ -642,13 +651,6 @@ Subtrees whose header starts with COMMENT are never exported. \key{toggle COMMENT keyword on entry}{C-c ;} - -\section{Publishing (requires org-publish.el)} -\key{publishcurrent file}{C-c C-e C-f} -\key{publish current project}{C-c C-e C-p} -\key{publish project (prompted for)}{C-c C-e C-c} -\key{publish all projects}{C-c C-e C-a} - \section{Completion} In-buffer completion completes TODO keywords at headline start, TeX