Mercurial > emacs
comparison lisp/org/org-clock.el @ 96044:c1ef445563bb
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-colview.el (org-columns-next-allowed-value): Bug fix.
* org-colview-xemacs.el (org-columns-next-allowed-value): Bug fix.
* org-agenda.el (org-agenda-get-closed): Get the end time into the
agenda prefix as well.
* org-publish.el (org-publish-org-index): Make a properly indented
list.
* org.el (org-calendar-agenda-action-key): New option.
(org-get-cursor-date): New function.
(org-mark-entry-for-agenda-action): New command.
(org-overriding-default-time): New variable.
(org-read-date): Respect `org-overriding-default-time'.
* org-remember.el (org-remember-apply-template): Respect the
ovverriding default time.
* org-agenda.el (org-agenda-action-marker): New variable.
(org-agenda-action): New command.
(org-agenda-do-action): New function.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-schedule, org-deadline): Protect scheduled and
deadline tasks against changes that accidently remove the
repeater. Also show a message with the new date when done.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-beginning-of-line): Cater for the case when there
are tags but no headline text.
(org-align-tags-here): Convert to tabs only when indent-tabs-mode
it set.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-mhe.el (org-mhe-get-message-folder-from-index): Make sure
the return value is nil instead of "nil" when there is no match.
* org-exp.el (org-insert-centered): Use fill-column instead of
80.
(org-export-as-ascii): Use string-width to measure the width of
the heading.
* org.el (org-diary-to-ical-string): No longer kill buffer
FROMBUF, this is now done by the caller.
* org-exp.el (org-print-icalendar-entries): Move the call to
`org-diary-to-ical-string' out of the loop, and kill the buffer
afterwords.
* org-remember.el (org-remember-visit-immediately): Position
cursor after moving to the note.
(org-remember-apply-template): Use a text property to record the
cursor position.
(org-remember-handler): Align tags after pasting the note.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-bbdb.el (org-bbdb-follow-anniversary-link): New function.
* org-agenda.el (org-agenda-open-link): If there is an
org-bbdb-name property in the current line, jump to that bbdb
entry.
* org-bbdb.el (org-bbdb-anniversaries): Add the bbdb-name as a
text property, so that the agenda knows where this entry comes
from.
* org-agenda.el (org-agenda-clock-in): Fixed bug in the
interaction between clocking-in from the agenda, and automatic
task state switching.
* org-macs.el (org-with-point-at): Bug fix in macro defintion.
* org.el (org-beginning-of-line, org-end-of-line): Make sure the
zmacs-region stays after this command in XEmacs.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-scan-tags): Allow new values for ACTION parameter.
* org-remember.el (org-remember-templates): Fix bug in
customization type definition.
* org.el (org-map-entries): New function.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-agenda.el (org-agenda-skip-comment-trees): New option.
(org-agenda-skip): Respect `org-agenda-skip-comment-trees'.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-remember.el (org-jump-to-target-location): New variable.
(org-remember-apply-template): Set
`org-remember-apply-template' if requested by template.
(org-remember-handler): Start an idle timer to jump to
remember location.
* org-exp.el (org-get-current-options): Add the FILETAGS setting.
* org.el (org-set-regexps-and-options): Fix bug with parsing of
file tags.
(org-get-tags-at): Add the content of `org-file-tags'.
* org-exp.el (org-export-handle-comments): Fix bug with several
comment lines after each other.
(org-number-to-roman, org-number-to-counter): New functions.
(org-export-section-number-format): New option.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-exp.el (org-export-protect-examples): Catch the case of a
missing end_example line.
* org.el (org-set-regexps-and-options): Set `org-file-properties' and
`org-file-tags' to nil.
* org-colview.el (org-columns-next-allowed-value): Handle next
argument NTH to directly select a value.
* org-colview-xemacs.el (org-columns-next-allowed-value): Handle next
argument NTH to directly select a value.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-agenda.el (org-agenda-scheduled-leaders): Fix docstring.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-columns-ellipses): New option.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-colview.el (org-columns-add-ellipses): New function.
(org-columns-compact-links): New function.
(org-columns-cleanup-item): Call `org-columns-compact-links'.
(org-columns-display-here): Call `org-agenda-columns-cleanup-item'
when in agenda.
(org-columns-edit-value): Fixed bug with editing values from
agenda column view.
(org-columns-redo): Also redo the agenda itself.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-agenda.el (org-agenda-columns-remove-prefix-from-item): New
option.
* org-colview.el (org-agenda-columns-cleanup-item): New function.
* org-exp.el (org-export-ascii-preprocess): Renamed from
`org-export-ascii-clean-string'.
(org-export-kill-licensed-text)
(org-export-define-heading-targets)
(org-export-handle-invisible-targets)
(org-export-target-internal-links)
(org-export-remove-or-extract-drawers)
(org-export-remove-archived-trees)
(org-export-protect-quoted-subtrees)
(org-export-protect-verbatim, org-export-protect-examples)
(org-export-select-backend-specific-text)
(org-export-mark-blockquote-and-verse)
(org-export-remove-comment-blocks-and-subtrees)
(org-export-handle-comments, org-export-mark-radio-links)
(org-export-remove-special-table-lines)
(org-export-normalize-links)
(org-export-concatenate-multiline-links)
(org-export-concatenate-multiline-emphasis): New functions,
obtained from spliiting the export preprocessor.
* org-table.el (org-table-recalculate): Improve error message if
the row number is invalid.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-archive.el (org-archive-save-context-info): Fix bugs in
customization setup and docstring.
* org-exp.el (org-export-html-style): Changed the size of in the
<pre> element to 90%.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-find-src-example-start): Function removed.
(org-edit-src-find-region-and-lang): New function.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-edit-src-exit): New function.
(org-exit-edit-mode): New minor mode.
* org-exp.el (org-export-preprocess-string): Fix bug with removing
comment-like lines from protected examples.
* org.el (org-edit-src-example, org-find-src-example-start)
(org-protect-source-example, org-edit-special): New functions.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-publish.el (org-publish-project-alist): Fix typo in
docstring.
(org-publish-project-alist): Handle :index-title property.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-export-latex.el (org-export-as-latex): Make sure region
bounds are correct. Parse subtree properties relating to export.
* org-exp.el (org-export-add-options-to-plist): New function.
(org-infile-export-plist): Use `org-export-add-options-to-plist'.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-default-properties): Add EXPORT_FILE_NAME and
EXPORT_TITLE.
* org-exp.el (org-export-get-title-from-subtree)
(org-export-as-ascii, org-export-as-html): Make sure the original
region-beginning and region-end are used, even after moving
point.
(org-export-get-title-from-subtree): Also try the EXPORT_TITLE
property.
* org-remember.el (org-remember-last-stored-marker): New variable.
(org-remember-goto-last-stored): Use `org-goto-marker-or-bmk'.
(org-remember-handler): Also use marker to remember
last-stored position.
* org.el (org-goto-marker-or-bmk): New function.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-file-properties): Renamed from `org-local-properties'.
(org-scan-tags): Take file tags into account.
(org-tags-match-list-sublevels): Default changed to t.
* org-exp.el (org-export-as-html): Close paragraph after a
footnote.
* org.el (org-update-parent-todo-statistics): New function.
* org-exp.el (org-icalendar-store-UID): New option.
(org-icalendar-force-UID): Option removed.
(org-print-icalendar-entries): IMplement UIDs.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-mhe.el (org-mhe-follow-link): Fix bug in mhe searches.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-faces.el (org-column): Document how this face is being used
and why sometimes the background faces shine through.
* org-mhe.el (org-mhe-follow-link): Improve handling of searches.
* org-publish.el (org-publish-attachment): Create publishing
directory if it does not yet exist.
* org-table.el (org-calc-default-modes): Change default number
format to (float 8).
* org.el (org-olpath-completing-read): New function.
(org-time-clocksum-format): New option.
(org-minutes-to-hh:mm-string): Use `org-time-clocksum-format'.
* org-clock.el (org-clock-display, org-clock-out)
(org-update-mode-line): Use `org-time-clocksum-format'.
* org-colview-xemacs.el (org-columns-number-to-string): Use
`org-time-clocksum-format'.
* org-colview.el (org-columns-number-to-string): Use
`org-time-clocksum-format'.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-id.el: New file, move from contrib to core.
* org-exp.el (org-icalendar-force-UID): New option.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-exp.el (org-print-icalendar-entries): Make sure DTEND is
shifted by one day if theere is a date range without an end
time.
* org.el (org-try-structure-completion): New function.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-set-font-lock-defaults): Improve fontification of
description lists.
(org-insert-item): Handle description lists.
(org-adaptive-fill-function): Improve auto indentation in
description lists.
* org-exp.el (org-export-as-html, org-export-preprocess-string):
Implement VERSE environment.
(org-export-preprocess-string): Implement the COMMENT
environment.
* org-export-latex.el (org-export-latex-preprocess): Implement
VERSE environment.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-jsinfo.el (org-infojs-opts-table): Add entry for FIXED_TOC
option.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-table.el (orgtbl-to-tsv, orgtbl-to-csv): New functions.
* org.el (org-quote-csv-field): New functions.
* org-table.el (org-table-export-default-format): Remove :splice
from default format, we get the same effect by not specifying
:tstart and :tend.
(org-table-export): Improve setup, distinguish better between
interactive and non-interactive use, allow specifying the format
on the fly, better protection against wrong file names.
(orgtbl-to-generic): Fix documentation. Do not require :tstart
and :tend when :splice is omitted.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-clock.el (org-clock-select-task): Make sure the selection
letters are 1-9 and A-Z, no special characters.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-exp.el (org-export-htmlize): New group.
(org-export-htmlize-output-type)
(org-export-htmlize-css-font-prefix): New options.
(org-export-htmlize-region-for-paste): New function.
(org-export-htmlize-generate-css): New command.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-set-visibility-according-to-property): New function.
(org-ctrl-c-ctrl-c): Do not restart org-mode, just get the options
and compute the regular expressions, and update font-lock.
(org-property-re): Allow a dash in property names.
* org-archive.el (org-extract-archive-file): Insert the file name
without the path into the format, to allow the location format to
contain a subdirectory.
* org-agenda.el (org-agenda-post-command-hook): If point is at end
of buffer, and the `org-agenda-type' property undefined, use the
value from the character before.
* org.el (org-add-planning-info): Don't let indentation for
would-be timestamp become extra whitespace at the end of headline.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-remove-double-quotes, org-file-contents): New
functions.
* org-exp.el (org-infile-export-plist): Also parse the
contents of #+SETUPFILE files, recursively.
* org.el (org-set-regexps-and-options): Also parse the
contents of #+SETUPFILE files, recursively.
* org-exp.el (org-export-handle-include-files): New function.
(org-export-preprocess-string): Call
`org-export-handle-include-files'.
* org.el (org-delete-property-globally)
(org-delete-property, org-set-property): Ignore case during
completion.
(org-set-property): Use `org-completing-read' instead of
`completing-read'.
* org.el (org-complete-expand-structure-template): New,
experimental function.
(org-structure-template-alist): New, experimental option.
(org-complete): Call `org-complete-expand-structure-template'.
2008-06-17 Bastien Guerry <bzg@altern.org>
* org-export-latex.el (org-export-latex-preprocess): Added
support for blockquotes.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-read-date-analyze): Catch the case where only a
weekday is given.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-set-font-lock-defaults): Make the description
tag bold.
* org-exp.el (org-export-as-html, org-close-li): Implement
description lists.
2008-06-17 Jason Riedy <jason@acm.org>
* org-table.el (*orgtbl-default-fmt*): New variable.
(orgtbl-format-line): Use the value of *orgtbl-default-fmt*
when there is no other fmt available.
(orgtbl-to-generic): Allow an explicitly nil :tstart or
:tend to suppress the appropriate string.
(orgtbl-to-orgtbl): New function for translating to another orgtbl
table.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-read-date-analyze): "." as an alias for "+0" in
read date.
* org-clock.el (org-clock-save-markers-for-cut-and-paste):
New function.
* org-agenda.el (org-agenda-save-markers-for-cut-and-paste):
New function.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-clock.el (org-clock-find-position): Don't include notes
into clock drawer.
* org-archive.el (org-archive-subtree): No longer remove an
extra line after cutting the subtree. `org-cut-subtree' already
takes care of this.
* org-remember.el (org-remember-handler): Only kill the target
buffer if it does not contain the running clock.
* org.el (org-markers-to-move): New variable.
(org-save-markers-in-region, org-check-and-save-marker)
(org-reinstall-markers-in-region): New function.
(org-move-subtree-down, org-copy-subtree): Remember relative
marker positions before cutting.
(org-move-subtree-down, org-paste-subtree): Restore relative
marker positions after pasting.
* org-remember.el (org-remember-clock-out-on-exit): New option.
(org-remember-finalize): Clock out only if the setting in
`org-remember-clock-out-on-exit' requires it.
(org-remember-handler): Do the cleanup in the buffer, to make sure
that the clock marker remains in tact.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-clock.el (org-clock-goto): Widen buffer if necessary.
(org-clock-in): Make sure that also tasks outside the narrowed
region will be clocked in correctly.
(org-clock-insert-selection-line): Widen the buffer so that we can
find the correct task heading.
* org.el (org-base-buffer): New function.
* org-exp.el (org-icalendar-cleanup-string): Make sure ',"
and ";" are escaped.
(org-print-icalendar-entries): Also apply
`org-icalendar-cleanup-string' to the headline, not only to the
summary property.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org-exp.el (org-export-preprocess-hook): New hook.
(org-export-preprocess-string): Call
`org-export-preprocess-hook'.
* org.el (org-font-lock-hook): New variable.
(org-font-lock-hook): New function.
(org-set-font-lock-defaults): Call `org-font-lock-hook'.
2008-06-17 Carsten Dominik <dominik@science.uva.nl>
* org.texi: Modify license to no longer include back- and front
cover matters.
(Using the mapping API): New section.
(Agenda column view): New section.
(Moving subtrees): Document archiving to the archive
sibling.
(Agenda commands): Document columns view in the agenda.
(Using the property API): Document the API for
multi-valued properties.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Tue, 17 Jun 2008 15:22:00 +0000 |
parents | ba3167bc4143 |
children | 2bab01f9c7bb |
comparison
equal
deleted
inserted
replaced
96043:a678c02d0c40 | 96044:c1ef445563bb |
---|---|
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.02b | 8 ;; Version: 6.05a |
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 |
95 (defvar org-mode-line-timer nil) | 95 (defvar org-mode-line-timer nil) |
96 (defvar org-clock-heading "") | 96 (defvar org-clock-heading "") |
97 (defvar org-clock-start-time "") | 97 (defvar org-clock-start-time "") |
98 | 98 |
99 (defvar org-clock-history nil | 99 (defvar org-clock-history nil |
100 "Marker pointing to the previous task teking clock time. | 100 "List of marker pointing to recent clocked tasks.") |
101 This is used to find back to the previous task after interrupting work. | |
102 When clocking into a task and the clock is currently running, this marker | |
103 is moved to the position of the currently running task and continues | |
104 to point there even after the task is clocked out.") | |
105 | 101 |
106 (defvar org-clock-default-task (make-marker) | 102 (defvar org-clock-default-task (make-marker) |
107 "Marker pointing to the default task that should clock time. | 103 "Marker pointing to the default task that should clock time. |
108 The clock can be made to switch to this task after clocking out | 104 The clock can be made to switch to this task after clocking out |
109 of a different task.") | 105 of a different task.") |
110 | 106 |
111 (defvar org-clock-interrupted-task (make-marker) | 107 (defvar org-clock-interrupted-task (make-marker) |
112 "Marker pointing to the default task that should clock time. | 108 "Marker pointing to the task that has been interrupted by the current clock.") |
113 The clock can be made to switch to this task after clocking out | |
114 of a different task.") | |
115 | 109 |
116 (defun org-clock-history-push (&optional pos buffer) | 110 (defun org-clock-history-push (&optional pos buffer) |
117 "Push a marker to the clock history." | 111 "Push a marker to the clock history." |
112 (setq org-clock-history-length (max 1 (min 35 org-clock-history-length))) | |
118 (let ((m (move-marker (make-marker) (or pos (point)) buffer)) n l) | 113 (let ((m (move-marker (make-marker) (or pos (point)) buffer)) n l) |
119 (while (setq n (member m org-clock-history)) | 114 (while (setq n (member m org-clock-history)) |
120 (move-marker (car n) nil)) | 115 (move-marker (car n) nil)) |
121 (setq org-clock-history | 116 (setq org-clock-history |
122 (delq nil | 117 (delq nil |
126 (setq org-clock-history | 121 (setq org-clock-history |
127 (nreverse | 122 (nreverse |
128 (nthcdr (- l org-clock-history-length -1) | 123 (nthcdr (- l org-clock-history-length -1) |
129 (nreverse org-clock-history))))) | 124 (nreverse org-clock-history))))) |
130 (push m org-clock-history))) | 125 (push m org-clock-history))) |
126 | |
127 (defun org-clock-save-markers-for-cut-and-paste (beg end) | |
128 "Save relative positions of markers in region." | |
129 (org-check-and-save-marker org-clock-marker beg end) | |
130 (org-check-and-save-marker org-clock-default-task beg end) | |
131 (org-check-and-save-marker org-clock-interrupted-task beg end) | |
132 (mapc (lambda (m) (org-check-and-save-marker m beg end)) | |
133 org-clock-history)) | |
131 | 134 |
132 (defun org-clock-select-task (&optional prompt) | 135 (defun org-clock-select-task (&optional prompt) |
133 "Select a task that recently was associated with clocking." | 136 "Select a task that recently was associated with clocking." |
134 (interactive) | 137 (interactive) |
135 (let (sel-list rpl file task (i 0) s) | 138 (let (sel-list rpl file task (i 0) s) |
153 (mapc | 156 (mapc |
154 (lambda (m) | 157 (lambda (m) |
155 (when (marker-buffer m) | 158 (when (marker-buffer m) |
156 (setq i (1+ i) | 159 (setq i (1+ i) |
157 s (org-clock-insert-selection-line | 160 s (org-clock-insert-selection-line |
158 (string-to-char (number-to-string i)) m)) | 161 (if (< i 10) |
162 (+ i ?0) | |
163 (+ i (- ?A 10))) m)) | |
159 (push s sel-list))) | 164 (push s sel-list))) |
160 org-clock-history) | 165 org-clock-history) |
161 (shrink-window-if-larger-than-buffer) | 166 (if (fboundp 'fit-window-to-buffer) |
167 (fit-window-to-buffer) | |
168 (shrink-window-if-larger-than-buffer)) | |
162 (message (or prompt "Select task for clocking:")) | 169 (message (or prompt "Select task for clocking:")) |
163 (setq rpl (read-char-exclusive)) | 170 (setq rpl (read-char-exclusive)) |
164 (cond | 171 (cond |
165 ((eq rpl ?q) nil) | 172 ((eq rpl ?q) nil) |
166 ((eq rpl ?x) nil) | 173 ((eq rpl ?x) nil) |
168 (t (error "Invalid task choice %c" rpl)))))) | 175 (t (error "Invalid task choice %c" rpl)))))) |
169 | 176 |
170 (defun org-clock-insert-selection-line (i marker) | 177 (defun org-clock-insert-selection-line (i marker) |
171 (when (marker-buffer marker) | 178 (when (marker-buffer marker) |
172 (let (file cat task) | 179 (let (file cat task) |
173 (with-current-buffer (marker-buffer marker) | 180 (with-current-buffer (org-base-buffer (marker-buffer marker)) |
174 (save-excursion | 181 (save-excursion |
175 (goto-char marker) | 182 (save-restriction |
176 (setq file (buffer-file-name (marker-buffer marker)) | 183 (widen) |
177 cat (or (org-get-category) | 184 (goto-char marker) |
178 (progn (org-refresh-category-properties) | 185 (setq file (buffer-file-name (marker-buffer marker)) |
179 (org-get-category))) | 186 cat (or (org-get-category) |
180 task (org-get-heading 'notags)))) | 187 (progn (org-refresh-category-properties) |
188 (org-get-category))) | |
189 task (org-get-heading 'notags))))) | |
181 (when (and cat task) | 190 (when (and cat task) |
182 (insert (format "[%c] %-15s %s\n" i cat task)) | 191 (insert (format "[%c] %-15s %s\n" i cat task)) |
183 (cons i marker))))) | 192 (cons i marker))))) |
184 | 193 |
185 (defun org-update-mode-line () | 194 (defun org-update-mode-line () |
186 (let* ((delta (- (time-to-seconds (current-time)) | 195 (let* ((delta (- (time-to-seconds (current-time)) |
187 (time-to-seconds org-clock-start-time))) | 196 (time-to-seconds org-clock-start-time))) |
188 (h (floor delta 3600)) | 197 (h (floor delta 3600)) |
189 (m (floor (- delta (* 3600 h)) 60))) | 198 (m (floor (- delta (* 3600 h)) 60))) |
190 (setq org-mode-line-string | 199 (setq org-mode-line-string |
191 (propertize (format "-[%d:%02d (%s)]" h m org-clock-heading) | 200 (propertize (format (concat "-[" org-time-clocksum-format " (%s)]") h m org-clock-heading) |
192 'help-echo "Org-mode clock is running")) | 201 'help-echo "Org-mode clock is running")) |
193 (force-mode-line-update))) | 202 (force-mode-line-update))) |
194 | 203 |
195 (defvar org-clock-mode-line-entry nil | 204 (defvar org-clock-mode-line-entry nil |
196 "Information for the modeline about the running clock.") | 205 "Information for the modeline about the running clock.") |
202 clock into. When SELECT is `C-u C-u', clock into the current task and mark | 211 clock into. When SELECT is `C-u C-u', clock into the current task and mark |
203 is as the default task, a special task that will always be offered in | 212 is as the default task, a special task that will always be offered in |
204 the clocking selection, associated with the letter `d'." | 213 the clocking selection, associated with the letter `d'." |
205 (interactive "P") | 214 (interactive "P") |
206 (let ((interrupting (marker-buffer org-clock-marker)) | 215 (let ((interrupting (marker-buffer org-clock-marker)) |
207 ts selected-task) | 216 ts selected-task target-pos) |
208 (when (equal select '(4)) | 217 (when (equal select '(4)) |
209 (setq selected-task (org-clock-select-task "Clock-in on task: ")) | 218 (setq selected-task (org-clock-select-task "Clock-in on task: ")) |
210 (if selected-task | 219 (if selected-task |
211 (setq selected-task (copy-marker selected-task)) | 220 (setq selected-task (copy-marker selected-task)) |
212 (error "Abort"))) | 221 (error "Abort"))) |
213 ;; Are we interrupting the clocking of a differnt task? | 222 (when interrupting |
214 (if interrupting | 223 ;; We are interrupting the clocking of a differnt task. |
215 (progn | 224 ;; Save a marker to this task, so that we can go back. |
216 (move-marker org-clock-interrupted-task | 225 (move-marker org-clock-interrupted-task |
217 (marker-position org-clock-marker) | 226 (marker-position org-clock-marker) |
218 (marker-buffer org-clock-marker)) | 227 (marker-buffer org-clock-marker)) |
219 (org-clock-out t))) | 228 (org-clock-out t)) |
220 | 229 |
221 (when (equal select '(16)) | 230 (when (equal select '(16)) |
231 ;; Mark as default clocking task | |
222 (save-excursion | 232 (save-excursion |
223 (org-back-to-heading t) | 233 (org-back-to-heading t) |
224 (move-marker org-clock-default-task (point)))) | 234 (move-marker org-clock-default-task (point)))) |
225 | 235 |
236 (setq target-pos (point)) ;; we want to clock in at this location | |
226 (save-excursion | 237 (save-excursion |
227 (org-back-to-heading t) | |
228 (when (and selected-task (marker-buffer selected-task)) | 238 (when (and selected-task (marker-buffer selected-task)) |
229 (set-buffer (marker-buffer selected-task)) | 239 ;; There is a selected task, move to the correct buffer |
230 (goto-char selected-task) | 240 ;; and set the new target position. |
241 (set-buffer (org-base-buffer (marker-buffer selected-task))) | |
242 (setq target-pos (marker-position selected-task)) | |
231 (move-marker selected-task nil)) | 243 (move-marker selected-task nil)) |
232 (or interrupting (move-marker org-clock-interrupted-task nil)) | 244 (save-excursion |
233 (org-clock-history-push) | 245 (save-restriction |
234 (when (and org-clock-in-switch-to-state | 246 (widen) |
235 (not (looking-at (concat outline-regexp "[ \t]*" | 247 (goto-char target-pos) |
236 org-clock-in-switch-to-state | 248 (org-back-to-heading t) |
237 "\\>")))) | 249 (or interrupting (move-marker org-clock-interrupted-task nil)) |
238 (org-todo org-clock-in-switch-to-state)) | 250 (org-clock-history-push) |
239 (if (and org-clock-heading-function | 251 (when (and org-clock-in-switch-to-state |
240 (functionp org-clock-heading-function)) | 252 (not (looking-at (concat outline-regexp "[ \t]*" |
241 (setq org-clock-heading (funcall org-clock-heading-function)) | 253 org-clock-in-switch-to-state |
242 (if (looking-at org-complex-heading-regexp) | 254 "\\>")))) |
243 (setq org-clock-heading (match-string 4)) | 255 (org-todo org-clock-in-switch-to-state)) |
244 (setq org-clock-heading "???"))) | 256 (if (and org-clock-heading-function |
245 (setq org-clock-heading (propertize org-clock-heading 'face nil)) | 257 (functionp org-clock-heading-function)) |
246 (org-clock-find-position) | 258 (setq org-clock-heading (funcall org-clock-heading-function)) |
247 | 259 (if (looking-at org-complex-heading-regexp) |
248 (insert "\n") (backward-char 1) | 260 (setq org-clock-heading (match-string 4)) |
249 (indent-relative) | 261 (setq org-clock-heading "???"))) |
250 (insert org-clock-string " ") | 262 (setq org-clock-heading (propertize org-clock-heading 'face nil)) |
251 (setq org-clock-start-time (current-time)) | 263 (org-clock-find-position) |
252 (setq ts (org-insert-time-stamp (current-time) 'with-hm 'inactive)) | 264 |
253 (move-marker org-clock-marker (point) (buffer-base-buffer)) | 265 (insert "\n") (backward-char 1) |
254 (or global-mode-string (setq global-mode-string '(""))) | 266 (indent-relative) |
255 (or (memq 'org-mode-line-string global-mode-string) | 267 (insert org-clock-string " ") |
256 (setq global-mode-string | 268 (setq org-clock-start-time (current-time)) |
257 (append global-mode-string '(org-mode-line-string)))) | 269 (setq ts (org-insert-time-stamp (current-time) 'with-hm 'inactive)) |
258 (org-update-mode-line) | 270 (move-marker org-clock-marker (point) (buffer-base-buffer)) |
259 (setq org-mode-line-timer (run-with-timer 60 60 'org-update-mode-line)) | 271 (or global-mode-string (setq global-mode-string '(""))) |
260 (message "Clock started at %s" ts)))) | 272 (or (memq 'org-mode-line-string global-mode-string) |
273 (setq global-mode-string | |
274 (append global-mode-string '(org-mode-line-string)))) | |
275 (org-update-mode-line) | |
276 (setq org-mode-line-timer | |
277 (run-with-timer 60 60 'org-update-mode-line)) | |
278 (message "Clock started at %s" ts)))))) | |
261 | 279 |
262 (defun org-clock-find-position () | 280 (defun org-clock-find-position () |
263 "Find the location where the next clock line should be inserted." | 281 "Find the location where the next clock line should be inserted." |
264 (org-back-to-heading t) | 282 (org-back-to-heading t) |
265 (catch 'exit | 283 (catch 'exit |
286 (when (and (integerp org-clock-into-drawer) | 304 (when (and (integerp org-clock-into-drawer) |
287 (>= (1+ cnt) org-clock-into-drawer)) | 305 (>= (1+ cnt) org-clock-into-drawer)) |
288 ;; Wrap current entries into a new drawer | 306 ;; Wrap current entries into a new drawer |
289 (goto-char last) | 307 (goto-char last) |
290 (beginning-of-line 2) | 308 (beginning-of-line 2) |
291 (if (org-at-item-p) (org-end-of-item)) | |
292 (insert ":END:\n") | 309 (insert ":END:\n") |
293 (beginning-of-line 0) | 310 (beginning-of-line 0) |
294 (org-indent-line-function) | 311 (org-indent-line-function) |
295 (goto-char first) | 312 (goto-char first) |
296 (insert ":CLOCK:\n") | 313 (insert ":CLOCK:\n") |
356 (cancel-timer org-mode-line-timer) | 373 (cancel-timer org-mode-line-timer) |
357 (setq org-mode-line-timer nil)) | 374 (setq org-mode-line-timer nil)) |
358 (setq global-mode-string | 375 (setq global-mode-string |
359 (delq 'org-mode-line-string global-mode-string)) | 376 (delq 'org-mode-line-string global-mode-string)) |
360 (force-mode-line-update) | 377 (force-mode-line-update) |
361 (message "Clock stopped at %s after HH:MM = %d:%02d%s" te h m | 378 (message (concat "Clock stopped at %s after HH:MM = " org-time-clocksum-format "%s") te h m |
362 (if remove " => LINE REMOVED" ""))))))) | 379 (if remove " => LINE REMOVED" ""))))))) |
363 | 380 |
364 (defun org-clock-cancel () | 381 (defun org-clock-cancel () |
365 "Cancel the running clock be removing the start timestamp." | 382 "Cancel the running clock be removing the start timestamp." |
366 (interactive) | 383 (interactive) |
385 (if (not (marker-buffer m)) | 402 (if (not (marker-buffer m)) |
386 (if select | 403 (if select |
387 (error "No task selected") | 404 (error "No task selected") |
388 (error "No active clock"))) | 405 (error "No active clock"))) |
389 (switch-to-buffer (marker-buffer m)) | 406 (switch-to-buffer (marker-buffer m)) |
407 (if (or (< m (point-min)) (> m (point-max))) (widen)) | |
390 (goto-char m) | 408 (goto-char m) |
391 (org-show-entry) | 409 (org-show-entry) |
392 (org-back-to-heading) | 410 (org-back-to-heading) |
393 (org-cycle-hide-drawers 'children) | 411 (org-cycle-hide-drawers 'children) |
394 (recenter))) | 412 (recenter))) |
467 m (- org-clock-file-total-minutes (* 60 h))) | 485 m (- org-clock-file-total-minutes (* 60 h))) |
468 ;; Arrange to remove the overlays upon next change. | 486 ;; Arrange to remove the overlays upon next change. |
469 (when org-remove-highlights-with-change | 487 (when org-remove-highlights-with-change |
470 (org-add-hook 'before-change-functions 'org-remove-clock-overlays | 488 (org-add-hook 'before-change-functions 'org-remove-clock-overlays |
471 nil 'local)))) | 489 nil 'local)))) |
472 (message "Total file time: %d:%02d (%d hours and %d minutes)" h m h m))) | 490 (message (concat "Total file time: " org-time-clocksum-format " (%d hours and %d minutes)") h m h m))) |
473 | 491 |
474 (defvar org-clock-overlays nil) | 492 (defvar org-clock-overlays nil) |
475 (make-variable-buffer-local 'org-clock-overlays) | 493 (make-variable-buffer-local 'org-clock-overlays) |
476 | 494 |
477 (defun org-put-clock-overlay (time &optional level) | 495 (defun org-put-clock-overlay (time &optional level) |
479 If LEVEL is given, prefix time with a corresponding number of stars. | 497 If LEVEL is given, prefix time with a corresponding number of stars. |
480 This creates a new overlay and stores it in `org-clock-overlays', so that it | 498 This creates a new overlay and stores it in `org-clock-overlays', so that it |
481 will be easy to remove." | 499 will be easy to remove." |
482 (let* ((c 60) (h (floor (/ time 60))) (m (- time (* 60 h))) | 500 (let* ((c 60) (h (floor (/ time 60))) (m (- time (* 60 h))) |
483 (l (if level (org-get-valid-level level 0) 0)) | 501 (l (if level (org-get-valid-level level 0) 0)) |
502 (fmt (concat "%s " org-time-clocksum-format "%s")) | |
484 (off 0) | 503 (off 0) |
485 ov tx) | 504 ov tx) |
486 (org-move-to-column c) | 505 (org-move-to-column c) |
487 (unless (eolp) (skip-chars-backward "^ \t")) | 506 (unless (eolp) (skip-chars-backward "^ \t")) |
488 (skip-chars-backward " \t") | 507 (skip-chars-backward " \t") |
489 (setq ov (org-make-overlay (1- (point)) (point-at-eol)) | 508 (setq ov (org-make-overlay (1- (point)) (point-at-eol)) |
490 tx (concat (buffer-substring (1- (point)) (point)) | 509 tx (concat (buffer-substring (1- (point)) (point)) |
491 (make-string (+ off (max 0 (- c (current-column)))) ?.) | 510 (make-string (+ off (max 0 (- c (current-column)))) ?.) |
492 (org-add-props (format "%s %2d:%02d%s" | 511 (org-add-props (format fmt |
493 (make-string l ?*) h m | 512 (make-string l ?*) h m |
494 (make-string (- 16 l) ?\ )) | 513 (make-string (- 16 l) ?\ )) |
495 '(face secondary-selection)) | 514 '(face secondary-selection)) |
496 "")) | 515 "")) |
497 (if (not (featurep 'xemacs)) | 516 (if (not (featurep 'xemacs)) |
918 lines) | 937 lines) |
919 "\n")))) | 938 "\n")))) |
920 | 939 |
921 (provide 'org-clock) | 940 (provide 'org-clock) |
922 | 941 |
942 ;; arch-tag: 7b42c5d4-9b36-48be-97c0-66a869daed4c | |
943 | |
923 ;;; org-clock.el ends here | 944 ;;; org-clock.el ends here |
924 | |
925 | |
926 ;; arch-tag: 7b42c5d4-9b36-48be-97c0-66a869daed4c |