From f2d36827fbb58dc29cde26fbd18abc872f085616 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sun, 16 May 2010 15:44:55 +0200 Subject: [PATCH 01/10] Fix copyright years --- lisp/org-docview.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/org-docview.el b/lisp/org-docview.el index 09461d927..5db6594fa 100644 --- a/lisp/org-docview.el +++ b/lisp/org-docview.el @@ -1,7 +1,6 @@ ;;; org-docview.el --- support for links to doc-view-mode buffers -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. ;; Author: Jan Böcker ;; Keywords: outlines, hypermedia, calendar, wp From e3c43d80cdbe1f29a0ea99e40794f6b854861d95 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sun, 16 May 2010 16:12:57 +0200 Subject: [PATCH 02/10] Apply Stefan's simplification --- lisp/org-agenda.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 19ea87c16..76e6019ec 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -5946,9 +5946,8 @@ so that the date SD will be in that range." (defun org-agenda-entry-text-mode (&optional arg) "Toggle entry text mode in an agenda buffer." (interactive "P") - (if (integerp arg) - (setq org-agenda-entry-text-mode t) - (setq org-agenda-entry-text-mode (not org-agenda-entry-text-mode))) + (setq org-agenda-entry-text-mode (or (integerp arg) + (not org-agenda-entry-text-mode))) (org-agenda-entry-text-hide) (and org-agenda-entry-text-mode (let ((org-agenda-entry-text-maxlines From 4d4267320de319071bfed8ddf0c1a52028c293ed Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sun, 16 May 2010 16:18:23 +0200 Subject: [PATCH 03/10] Add Stefans redefinition of orgstruct-mode --- lisp/org-table.el | 147 ++++++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 77 deletions(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 89c65388d..30b47e32c 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -3434,10 +3434,6 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line." ;; active, this binding is ignored inside tables and replaced with a ;; modified self-insert. -(defvar orgtbl-mode nil - "Variable controlling `orgtbl-mode', a minor mode enabling the `org-mode' -table editor in arbitrary modes.") -(make-variable-buffer-local 'orgtbl-mode) (defvar orgtbl-mode-map (make-keymap) "Keymap for `orgtbl-mode'.") @@ -3459,49 +3455,52 @@ table editor in arbitrary modes.") 0 (quote 'org-table) 'prepend)) "Extra font-lock-keywords to be added when orgtbl-mode is active.") +;; Install it as a minor mode. +(put 'orgtbl-mode :included t) +(put 'orgtbl-mode :menu-tag "Org Table Mode") + ;;;###autoload -(defun orgtbl-mode (&optional arg) +(define-minor-mode orgtbl-mode "The `org-mode' table editor as a minor mode for use in other modes." - (interactive) + :lighter " OrgTbl" :keymap orgtbl-mode-map (org-load-modules-maybe) - (if (org-mode-p) - ;; Exit without error, in case some hook functions calls this - ;; by accident in org-mode. - (message "Orgtbl-mode is not useful in org-mode, command ignored") - (setq orgtbl-mode - (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode))) - (if orgtbl-mode - (progn - (and (orgtbl-setup) (defun orgtbl-setup () nil)) - ;; Make sure we are first in minor-mode-map-alist - (let ((c (assq 'orgtbl-mode minor-mode-map-alist))) - (and c (setq minor-mode-map-alist - (cons c (delq c minor-mode-map-alist))))) - (org-set-local (quote org-table-may-need-update) t) - (org-add-hook 'before-change-functions 'org-before-change-function - nil 'local) - (org-set-local 'org-old-auto-fill-inhibit-regexp - auto-fill-inhibit-regexp) - (org-set-local 'auto-fill-inhibit-regexp - (if auto-fill-inhibit-regexp - (concat orgtbl-line-start-regexp "\\|" - auto-fill-inhibit-regexp) - orgtbl-line-start-regexp)) - (add-to-invisibility-spec '(org-cwidth)) - (when (fboundp 'font-lock-add-keywords) - (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords) - (org-restart-font-lock)) - (easy-menu-add orgtbl-mode-menu) - (run-hooks 'orgtbl-mode-hook)) - (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp) - (org-table-cleanup-narrow-column-properties) - (org-remove-from-invisibility-spec '(org-cwidth)) - (remove-hook 'before-change-functions 'org-before-change-function t) - (when (fboundp 'font-lock-remove-keywords) - (font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords) - (org-restart-font-lock)) - (easy-menu-remove orgtbl-mode-menu) - (force-mode-line-update 'all)))) + (cond + ((org-mode-p) + ;; Exit without error, in case some hook functions calls this + ;; by accident in org-mode. + (message "Orgtbl-mode is not useful in org-mode, command ignored")) + (orgtbl-mode + (and (orgtbl-setup) (defun orgtbl-setup () nil)) ;; FIXME: Yuck!?! + ;; Make sure we are first in minor-mode-map-alist + (let ((c (assq 'orgtbl-mode minor-mode-map-alist))) + ;; FIXME: maybe it should use emulation-mode-map-alists? + (and c (setq minor-mode-map-alist + (cons c (delq c minor-mode-map-alist))))) + (org-set-local (quote org-table-may-need-update) t) + (org-add-hook 'before-change-functions 'org-before-change-function + nil 'local) + (org-set-local 'org-old-auto-fill-inhibit-regexp + auto-fill-inhibit-regexp) + (org-set-local 'auto-fill-inhibit-regexp + (if auto-fill-inhibit-regexp + (concat orgtbl-line-start-regexp "\\|" + auto-fill-inhibit-regexp) + orgtbl-line-start-regexp)) + (org-add-to-invisibility-spec '(org-cwidth)) + (when (fboundp 'font-lock-add-keywords) + (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords) + (org-restart-font-lock)) + (easy-menu-add orgtbl-mode-menu)) + (t + (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp) + (org-table-cleanup-narrow-column-properties) + (org-remove-from-invisibility-spec '(org-cwidth)) + (remove-hook 'before-change-functions 'org-before-change-function t) + (when (fboundp 'font-lock-remove-keywords) + (font-lock-remove-keywords nil orgtbl-extra-font-lock-keywords) + (org-restart-font-lock)) + (easy-menu-remove orgtbl-mode-menu) + (force-mode-line-update 'all)))) (defun org-table-cleanup-narrow-column-properties () "Remove all properties related to narrow-column invisibility." @@ -3516,11 +3515,6 @@ table editor in arbitrary modes.") (while (setq s (text-property-any s (point-max) 'invisible 'org-cwidth)) (remove-text-properties s (1+ s) '(invisible t))))) -;; Install it as a minor mode. -(put 'orgtbl-mode :included t) -(put 'orgtbl-mode :menu-tag "Org Table Mode") -(add-minor-mode 'orgtbl-mode " OrgTbl" orgtbl-mode-map) - (defun orgtbl-make-binding (fun n &rest keys) "Create a function for binding in the table minor mode. FUN is the command to call inside a table. N is used to create a unique @@ -3555,34 +3549,33 @@ to execute outside of tables." "Setup orgtbl keymaps." (let ((nfunc 0) (bindings - (list - '([(meta shift left)] org-table-delete-column) - '([(meta left)] org-table-move-column-left) - '([(meta right)] org-table-move-column-right) - '([(meta shift right)] org-table-insert-column) - '([(meta shift up)] org-table-kill-row) - '([(meta shift down)] org-table-insert-row) - '([(meta up)] org-table-move-row-up) - '([(meta down)] org-table-move-row-down) - '("\C-c\C-w" org-table-cut-region) - '("\C-c\M-w" org-table-copy-region) - '("\C-c\C-y" org-table-paste-rectangle) - '("\C-c-" org-table-insert-hline) - '("\C-c}" org-table-toggle-coordinate-overlays) - '("\C-c{" org-table-toggle-formula-debugger) - '("\C-m" org-table-next-row) - '([(shift return)] org-table-copy-down) - '("\C-c?" org-table-field-info) - '("\C-c " org-table-blank-field) - '("\C-c+" org-table-sum) - '("\C-c=" org-table-eval-formula) - '("\C-c'" org-table-edit-formulas) - '("\C-c`" org-table-edit-field) - '("\C-c*" org-table-recalculate) - '("\C-c^" org-table-sort-lines) - '("\M-a" org-table-beginning-of-field) - '("\M-e" org-table-end-of-field) - '([(control ?#)] org-table-rotate-recalc-marks))) + '(([(meta shift left)] org-table-delete-column) + ([(meta left)] org-table-move-column-left) + ([(meta right)] org-table-move-column-right) + ([(meta shift right)] org-table-insert-column) + ([(meta shift up)] org-table-kill-row) + ([(meta shift down)] org-table-insert-row) + ([(meta up)] org-table-move-row-up) + ([(meta down)] org-table-move-row-down) + ("\C-c\C-w" org-table-cut-region) + ("\C-c\M-w" org-table-copy-region) + ("\C-c\C-y" org-table-paste-rectangle) + ("\C-c-" org-table-insert-hline) + ("\C-c}" org-table-toggle-coordinate-overlays) + ("\C-c{" org-table-toggle-formula-debugger) + ("\C-m" org-table-next-row) + ([(shift return)] org-table-copy-down) + ("\C-c?" org-table-field-info) + ("\C-c " org-table-blank-field) + ("\C-c+" org-table-sum) + ("\C-c=" org-table-eval-formula) + ("\C-c'" org-table-edit-formulas) + ("\C-c`" org-table-edit-field) + ("\C-c*" org-table-recalculate) + ("\C-c^" org-table-sort-lines) + ("\M-a" org-table-beginning-of-field) + ("\M-e" org-table-end-of-field) + ([(control ?#)] org-table-rotate-recalc-marks))) elt key fun cmd) (while (setq elt (pop bindings)) (setq nfunc (1+ nfunc)) From d78931408d93c95792d8dd216c2a6034e8f97739 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sun, 16 May 2010 16:24:16 +0200 Subject: [PATCH 04/10] Minor fix --- lisp/org-table.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 30b47e32c..1763b54bf 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -3486,7 +3486,7 @@ Use COMMAND to do the motion, repeat if necessary to end up in a data line." (concat orgtbl-line-start-regexp "\\|" auto-fill-inhibit-regexp) orgtbl-line-start-regexp)) - (org-add-to-invisibility-spec '(org-cwidth)) + (add-to-invisibility-spec '(org-cwidth)) (when (fboundp 'font-lock-add-keywords) (font-lock-add-keywords nil orgtbl-extra-font-lock-keywords) (org-restart-font-lock)) From 6a360dbf4a640d34f68f9ea17a57a2e92b77a2a1 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 16 May 2010 11:42:53 -0400 Subject: [PATCH 05/10] Enhanced functionality of the clock resolver i/q/C-g Ignore this question; the same as keeping all the idle time. k/K Keep X minutes of the idle time (default is all). If this amount is less than the default, you will be clocked out that many minutes after the time that idling began, and then clocked back in at the present time. g/G Indicate that you \"got back\" X minutes ago. This is quite different from 'k': it clocks you out from the beginning of the idle period and clock you back in X minutes ago. s/S Subtract the idle time from the current clock. This is the same as keeping 0 minutes. C Cancel the open timer altogether. It will be as though you never clocked in. j/J Jump to the current clock, to make manual adjustments. For all these options, using uppercase makes your final state to be CLOCKED OUT. --- lisp/ChangeLog | 14 ++++ lisp/org-clock.el | 181 +++++++++++++++++++++++++++------------------- 2 files changed, 120 insertions(+), 75 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4fb3aac20..24b13b0aa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +2010-05-16 John Wiegley + + * org-clock.el (org-clock-clock-in, org-clock-in): Added + parameter `start-time'. + (org-clock-resolve-clock): Added parameter `clock-out-time'. + If set, and resolve-to is a past time, then the clock out + event occurs at `clock-out-time' rather than at `resolve-to'. + In this case, `resolve-to' becomes the clock in time. + (org-clock-jump-to-current-clock): Created new global command + to reveal the current clock. + (org-clock-resolve): Added new commands g/G and j/J, and a + help window describing all commands and their meaning. + (org-clock-resolve-expert): New customization variable. + 2010-05-15 Carsten Dominik * org-latex.el (org-export-latex-format-image): Add support diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 0257bc3b0..91a3a90c6 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -244,6 +244,11 @@ string as argument." :group 'org-clock :type 'boolean) +(defcustom org-clock-resolve-expert nil + "Non-nil means do not show the splash buffer with the clock resolver." + :group 'org-clock + :type 'boolean) + (defvar org-clock-in-prepare-hook nil "Hook run when preparing the clock. This hook is run before anything happens to the task that @@ -624,12 +629,12 @@ This macro also protects the current active clock from being altered." (put 'org-with-clock 'lisp-indent-function 1) -(defsubst org-clock-clock-in (clock &optional resume) +(defsubst org-clock-clock-in (clock &optional resume start-time) "Clock in to the clock located by CLOCK. If necessary, clock-out of the currently active clock." (org-with-clock-position clock (let ((org-clock-in-resume (or resume org-clock-in-resume))) - (org-clock-in)))) + (org-clock-in nil start-time)))) (defsubst org-clock-clock-out (clock &optional fail-quietly at-time) "Clock out of the clock located by CLOCK." @@ -655,39 +660,10 @@ If necessary, clock-out of the currently active clock." (defvar org-clock-resolving-clocks nil) (defvar org-clock-resolving-clocks-due-to-idleness nil) -(defun org-clock-resolve-clock (clock resolve-to &optional close-p - restart-p fail-quietly) +(defun org-clock-resolve-clock (clock resolve-to clock-out-time + &optional close-p restart-p fail-quietly) "Resolve `CLOCK' given the time `RESOLVE-TO', and the present. -`CLOCK' is a cons cell of the form (MARKER START-TIME). -This routine can do one of many things: - - if `RESOLVE-TO' is nil - if `CLOSE-P' is non-nil, give an error - if this clock is the active clock, cancel it - else delete the clock line (as if it never happened) - if `RESTART-P' is non-nil, start a new clock - - else if `RESOLVE-TO' is the symbol `now' - if `RESTART-P' is non-nil, give an error - if `CLOSE-P' is non-nil, clock out the entry and - if this clock is the active clock, stop it - else if this clock is the active clock, do nothing - else if there is no active clock, resume this clock - else ask to cancel the active clock, and if so, - resume this clock after cancelling it - - else if `RESOLVE-TO' is some date in the future - give an error about `RESOLVE-TO' being invalid - - else if `RESOLVE-TO' is some date in the past - if `RESTART-P' is non-nil, give an error - if `CLOSE-P' is non-nil, enter a closing time and - if this clock is the active clock, stop it - else if this clock is the active clock, enter a - closing time, stop the current clock, then - start a new clock for the same item - else just enter a closing time for this clock - and then start a new clock for the same item" +`CLOCK' is a cons cell of the form (MARKER START-TIME)." (let ((org-clock-resolving-clocks t)) (cond ((null resolve-to) @@ -709,11 +685,41 @@ This routine can do one of many things: (t (if restart-p (error "RESTART-P is not valid here")) - (org-clock-clock-out clock fail-quietly resolve-to) + (org-clock-clock-out clock fail-quietly (or clock-out-time + resolve-to)) (unless org-clock-clocking-in (if close-p - (setq org-clock-leftover-time resolve-to) - (org-clock-clock-in clock))))))) + (setq org-clock-leftover-time (and (null clock-out-time) + resolve-to)) + (org-clock-clock-in clock nil (and clock-out-time + resolve-to)))))))) + +(defun org-clock-jump-to-current-clock (&optional effective-clock) + (interactive) + (let ((clock (or effective-clock (cons org-clock-marker + org-clock-start-time)))) + (unless (marker-buffer (car clock)) + (error "No clock is currently running")) + (org-with-clock clock (org-clock-goto)) + (with-current-buffer (marker-buffer (car clock)) + (goto-char (car clock)) + (if org-clock-into-drawer + (let ((logbook + (if (stringp org-clock-into-drawer) + (concat ":" org-clock-into-drawer ":") + ":LOGBOOK:"))) + (ignore-errors + (outline-flag-region + (save-excursion + (outline-back-to-heading t) + (search-forward logbook) + (goto-char (match-beginning 0))) + (save-excursion + (outline-back-to-heading t) + (search-forward logbook) + (search-forward ":END:") + (goto-char (match-end 0))) + nil))))))) (defun org-clock-resolve (clock &optional prompt-fn last-valid fail-quietly) "Resolve an open org-mode clock. @@ -739,50 +745,66 @@ was started." (save-window-excursion (save-excursion (unless org-clock-resolving-clocks-due-to-idleness - (org-with-clock clock (org-clock-goto)) - (with-current-buffer (marker-buffer (car clock)) - (goto-char (car clock)) - (if org-clock-into-drawer - (let ((logbook - (if (stringp org-clock-into-drawer) - (concat ":" org-clock-into-drawer ":") - ":LOGBOOK:"))) - (ignore-errors - (outline-flag-region - (save-excursion - (outline-back-to-heading t) - (search-forward logbook) - (goto-char (match-beginning 0))) - (save-excursion - (outline-back-to-heading t) - (search-forward logbook) - (search-forward ":END:") - (goto-char (match-end 0))) - nil)))))) + (org-clock-jump-to-current-clock clock)) + (unless org-clock-resolve-expert + (with-output-to-temp-buffer "*Org Clock*" + (princ "Select a Clock Resolution Command: + +i/q/C-g Ignore this question; the same as keeping all the idle time. + +k/K Keep X minutes of the idle time (default is all). If this + amount is less than the default, you will be clocked out + that many minutes after the time that idling began, and then + clocked back in at the present time. +g/G Indicate that you \"got back\" X minutes ago. This is quite + different from 'k': it clocks you out from the beginning of + the idle period and clock you back in X minutes ago. +s/S Subtract the idle time from the current clock. This is the + same as keeping 0 minutes. +C Cancel the open timer altogether. It will be as though you + never clocked in. +j/J Jump to the current clock, to make manual adjustments. + +For all these options, using uppercase makes your final state +to be CLOCKED OUT."))) + (org-fit-window-to-buffer (get-buffer-window "*Org Clock*")) (let (char-pressed) (when (featurep 'xemacs) (message (concat (funcall prompt-fn clock) - " [(kK)eep (sS)ubtract (C)ancel]? ")) + " [jkKgGsScCiq]? ")) (setq char-pressed (read-char-exclusive))) (while (or (null char-pressed) - (and (not (memq char-pressed '(?k ?K ?s ?S ?C ?i))) + (and (not (memq char-pressed + '(?k ?K ?g ?G ?s ?S ?C + ?j ?J ?i ?q))) (or (ding) t))) (setq char-pressed (read-char (concat (funcall prompt-fn clock) - " [(kK)p (sS)ub (C)ncl (i)gn]? ") + " [jkKgGSscCiq]? ") nil 45))) - (and (not (eq char-pressed ?i)) char-pressed))))) - (default (floor (/ (org-float-time - (time-subtract (current-time) last-valid)) 60))) - (keep (and (memq ch '(?k ?K)) - (read-number "Keep how many minutes? " default))) + (and (not (memq char-pressed '(?i ?q))) char-pressed))))) + (default + (floor (/ (org-float-time + (time-subtract (current-time) last-valid)) 60))) + (keep + (and (memq ch '(?k ?K)) + (read-number "Keep how many minutes? " default))) + (gotback + (and (memq ch '(?g ?G)) + (read-number "Got back how many minutes ago? " default))) (subtractp (memq ch '(?s ?S))) (barely-started-p (< (- (org-float-time last-valid) (org-float-time (cdr clock))) 45)) (start-over (and subtractp barely-started-p))) - (if (or (null ch) - (not (memq ch '(?k ?K ?s ?S ?C)))) - (message "") + (cond + ((memq ch '(?j ?J)) + (if (eq ch ?J) + (org-clock-resolve-clock clock 'now nil t nil fail-quietly)) + (org-clock-jump-to-current-clock clock)) + ((or (null ch) + (not (memq ch '(?k ?K ?g ?G ?s ?S ?C)))) + (message "")) + (t (org-clock-resolve-clock clock (cond ((or (eq ch ?C) @@ -791,16 +813,24 @@ was started." ;; time... start-over) nil) - (subtractp + ((or subtractp + (and gotback (= gotback 0))) last-valid) - ((= keep default) + ((or (and keep (= keep default)) + (and gotback (= gotback default))) 'now) + (keep + (time-add last-valid (seconds-to-time (* 60 keep)))) + (gotback + (time-subtract (current-time) + (seconds-to-time (* 60 gotback)))) (t - (time-add last-valid (seconds-to-time (* 60 keep))))) - (memq ch '(?K ?S)) + (error "Unexpected, please report this as a bug"))) + (and gotback last-valid) + (memq ch '(?K ?G ?S)) (and start-over - (not (memq ch '(?K ?S ?C)))) - fail-quietly)))) + (not (memq ch '(?K ?G ?S ?C)))) + fail-quietly))))) (defun org-resolve-clocks (&optional also-non-dangling-p prompt-fn last-valid) "Resolve all currently open org-mode clocks. @@ -881,7 +911,7 @@ so long." 60.0)))) org-clock-user-idle-start))))) -(defun org-clock-in (&optional select) +(defun org-clock-in (&optional select start-time) "Start the clock on the current item. If necessary, clock-out of the currently active clock. With prefix arg SELECT, offer a list of recently clocked tasks to @@ -1026,6 +1056,7 @@ the clocking selection, associated with the letter `d'." (/ (- (org-float-time (current-time)) (org-float-time leftover)) 60))) leftover) + start-time (current-time))) (setq ts (org-insert-time-stamp org-clock-start-time 'with-hm 'inactive)))) From 3128e93340ccb67db67f88366fbb74cae9abe7f8 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 16 May 2010 13:11:16 -0400 Subject: [PATCH 06/10] Discovered clocks were not matching up with active clock --- lisp/ChangeLog | 2 ++ lisp/org-clock.el | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 24b13b0aa..cd84f237d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -11,6 +11,8 @@ (org-clock-resolve): Added new commands g/G and j/J, and a help window describing all commands and their meaning. (org-clock-resolve-expert): New customization variable. + (org-find-open-clocks): Fixed a bug that caused discovered + clocks not to match up with the currently active clock. 2010-05-15 Carsten Dominik diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 91a3a90c6..743221796 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -592,7 +592,7 @@ Use alsa's aplay tool if available." (save-excursion (goto-char (point-min)) (while (re-search-forward "CLOCK: \\(\\[.*?\\]\\)$" nil t) - (push (cons (copy-marker (1- (match-end 1)) t) + (push (cons (copy-marker (match-end 1) t) (org-time-string-to-time (match-string 1))) clocks)))) clocks)) @@ -1296,7 +1296,7 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set." (org-clock-delete-current)))))) (defun org-clock-cancel () - "Cancel the running clock be removing the start timestamp." + "Cancel the running clock by removing the start timestamp." (interactive) (when (not (org-clocking-p)) (setq global-mode-string From 99afb931b281265f91712a255c8127bfc631af20 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 16 May 2010 13:20:39 -0400 Subject: [PATCH 07/10] (org-resolve-clocks): Changed meaning of an argument --- lisp/ChangeLog | 3 +++ lisp/org-clock.el | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cd84f237d..d5278edc2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -13,6 +13,9 @@ (org-clock-resolve-expert): New customization variable. (org-find-open-clocks): Fixed a bug that caused discovered clocks not to match up with the currently active clock. + (org-resolve-clocks): Changed the argument + `also-non-dangling-p' to `only-dangling-p', since due to a bug + this was the default behavior all along. 2010-05-15 Carsten Dominik diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 743221796..504f0c977 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -832,10 +832,10 @@ to be CLOCKED OUT."))) (not (memq ch '(?K ?G ?S ?C)))) fail-quietly))))) -(defun org-resolve-clocks (&optional also-non-dangling-p prompt-fn last-valid) +(defun org-resolve-clocks (&optional only-dangling-p prompt-fn last-valid) "Resolve all currently open org-mode clocks. -If `also-non-dangling-p' is non-nil, also ask to resolve -non-dangling (i.e., currently open and valid) clocks." +If `only-dangling-p' is non-nil, only ask to resolve dangling +\(i.e., not currently open and valid) clocks." (interactive "P") (unless org-clock-resolving-clocks (let ((org-clock-resolving-clocks t)) @@ -844,7 +844,7 @@ non-dangling (i.e., currently open and valid) clocks." (dolist (clock clocks) (let ((dangling (or (not (org-clock-is-active)) (/= (car clock) org-clock-marker)))) - (unless (and (not dangling) (not also-non-dangling-p)) + (if (or (not only-dangling-p) dangling) (org-clock-resolve clock (or prompt-fn From b84aa975e00d13008b2f29412e73223c5329b405 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 17 May 2010 11:24:10 +0200 Subject: [PATCH 08/10] Fix some typos --- doc/org.texi | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index e46350c15..4ceed2338 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -1911,7 +1911,7 @@ marked with vertical lines. Here is an example: @end example It is also sufficient to just insert the column group starters after -every vertical line you'd like to have: +every vertical line you would like to have: @example | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) | @@ -8726,10 +8726,10 @@ La@TeX{}, see the variable @code{org-entities} for the complete list. @samp{...} are all converted into special commands creating hyphens of different lengths or a compact set of dots. -If you'd like to see entities displayed as utf8 characters, use the following -command@footnote{You can urn this on by default bu setting the variable -@code{prg-pretty-entities}, or on a per-file base with the @code{#+STARTUP} -option @code{entitiespretty}.}: +If you would like to see entities displayed as utf8 characters, use the +following command@footnote{You can turn this on by default by setting the +variable @code{org-pretty-entities}, or on a per-file base with the +@code{#+STARTUP} option @code{entitiespretty}.}: @table @kbd @kindex C-c C-x \ @@ -9723,12 +9723,12 @@ options that can be used in the optional argument of the @code{figure} environment, add something like @samp{placement=[h!]} to the Attributes. -If you'd like to let text flow around the image, add the word @samp{wrap} to -the @code{#+ATTR_LaTeX:} line, which will make the figure occupy the left -half of the page. To fine-tune, the @code{placement} field will be the -set of additional arguments needed by the @code{wrapfigure} environment. -Note that if you change the size of the image, you need to use compatible -settings for @code{\includegraphics} and @code{wrapfigure}. +If you would like to let text flow around the image, add the word @samp{wrap} +to the @code{#+ATTR_LaTeX:} line, which will make the figure occupy the left +half of the page. To fine-tune, the @code{placement} field will be the set +of additional arguments needed by the @code{wrapfigure} environment. Note +that if you change the size of the image, you need to use compatible settings +for @code{\includegraphics} and @code{wrapfigure}. @cindex #+CAPTION @cindex #+LABEL @@ -9928,7 +9928,7 @@ system. Check variables @code{org-export-docbook-xslt-proc-command} and The stylesheet argument @code{%s} in variable @code{org-export-docbook-xslt-proc-command} is replaced by the value of variable @code{org-export-docbook-xslt-stylesheet}, which needs to be set by -the user. You can also overrule this global setting on a per-file bases by +the user. You can also overrule this global setting on a per-file basis by adding an in-buffer setting @code{#+XSLT:} to the Org file. @kindex C-c C-e v D @@ -10616,7 +10616,7 @@ excluded. To ensure that links are preserved, care should be taken to replicate your directory structure on the web server, and to use relative file paths. For example, if your Org files are kept in @file{~/org} and your -publishable images in @file{~/images}, you'd link to an image with +publishable images in @file{~/images}, you would link to an image with @c @example file:../images/myimage.png From 696c2bf8695bac9d4f6b506c73009a1d9f72c7a6 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 17 May 2010 11:36:09 +0200 Subject: [PATCH 09/10] Add running clock only to report if time scope is right Patch by Bernt Hansen: > When org-clock-report-include-clocking-task is set we always add the > current clocking task to the clock report. This is incorrect if you > are looking at an agenda clock report for a time range that does not > include the current clocking task (e.g. yesterday or last week). > > Now we only include the current clocking task if the clock report > date range includes the current clocking task start time. --- lisp/ChangeLog | 5 +++++ lisp/org-clock.el | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d5278edc2..585b0c023 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-05-17 Carsten Dominik + + * org-clock.el (org-clock-sum): Don't include running clock if + the time block is wrong. + 2010-05-16 John Wiegley * org-clock.el (org-clock-clock-in, org-clock-in): Added diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 504f0c977..07e2e4538 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1396,12 +1396,15 @@ nil are excluded from the clock summation." (* 60 (string-to-number (match-string 4)))))) (t ;; A headline ;; Add the currently clocking item time to the total - (when (and org-clock-report-include-clocking-task - (equal (org-clocking-buffer) (current-buffer)) - (equal (marker-position org-clock-hd-marker) (point))) + (let ((org-clock-start-time-as-float (org-float-time org-clock-start-time))) + (when (and org-clock-report-include-clocking-task + (equal (org-clocking-buffer) (current-buffer)) + (equal (marker-position org-clock-hd-marker) (point)) + (>= org-clock-start-time-as-float tstart) + (<= org-clock-start-time-as-float tend)) (let ((time (floor (- (org-float-time) - (org-float-time org-clock-start-time)) 60))) - (setq t1 (+ t1 time)))) + org-clock-start-time-as-float) 60))) + (setq t1 (+ t1 time))))) (let* ((headline-forced (get-text-property (point) :org-clock-force-headline-inclusion)) From 2daea07630ee48026504c56eedb9f050b66cfdd4 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 17 May 2010 13:56:17 +0200 Subject: [PATCH 10/10] Fix Bernt's previous patch --- lisp/org-clock.el | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 07e2e4538..68a40ce49 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1396,17 +1396,18 @@ nil are excluded from the clock summation." (* 60 (string-to-number (match-string 4)))))) (t ;; A headline ;; Add the currently clocking item time to the total - (let ((org-clock-start-time-as-float (org-float-time org-clock-start-time))) - (when (and org-clock-report-include-clocking-task - (equal (org-clocking-buffer) (current-buffer)) - (equal (marker-position org-clock-hd-marker) (point)) - (>= org-clock-start-time-as-float tstart) - (<= org-clock-start-time-as-float tend)) - (let ((time (floor (- (org-float-time) - org-clock-start-time-as-float) 60))) - (setq t1 (+ t1 time))))) + (when (and org-clock-report-include-clocking-task + (equal (org-clocking-buffer) (current-buffer)) + (equal (marker-position org-clock-hd-marker) (point)) + tstart + tend + (>= (org-float-time org-clock-start-time) tstart) + (<= (org-float-time org-clock-start-time) tend)) + (let ((time (floor (- (org-float-time) + (org-float-time org-clock-start-time)) 60))) + (setq t1 (+ t1 time)))) (let* ((headline-forced - (get-text-property (point) + (get-text-property (point) :org-clock-force-headline-inclusion)) (headline-included (or (null headline-filter)