emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carlos Noguera <carlos.francisco.noguera@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Bug: clock in generates bad drawer [8.3.4 (8.3.4-47-gaf853d-elpa @ /home/carlos/.emacs.d/elpa/org-20160502/)]
Date: Tue, 10 May 2016 12:42:42 +0000	[thread overview]
Message-ID: <CAKjOv==kiaZimefPBmeFSXU0QhPFW4OMVqfUoSGq=d3aPAzo3Q@mail.gmail.com> (raw)
In-Reply-To: <CAKjOv=nU5iXYR-Wz=0vAJyiVo_Q2_ZMJBi5Akkfp6ZZZxrnGFQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 30012 bytes --]

Hello Nicolas,


FYI, I just discovered that the behaviour happens if  "Org Clock Into
Drawer" option in "Org Clock group" is set to "When at least N clock
entries: 3" and I go from two entries to 3.
If I change it to  "Into LOGBOOK drawer" I don't have the problem any more.

For the moment, I'll keep in " Into LOGBOOK drawer" as a workaround.

Hope this helps.

Carlos


On Tue, May 10, 2016 at 9:05 AM Carlos Noguera <
carlos.francisco.noguera@gmail.com> wrote:

> Hi Nicolas,
>
>
> Here you have a trace with an uncompiled Org. Let me know if you need
> something else.
>
> Carlos.
>
> Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
> insert(":" nil ":\n")
> (save-excursion (insert ":" drawer ":\n"))
> (let ((end (point-marker))) (goto-char beg) (save-excursion (insert ":"
> drawer ":\n")) (org-flag-drawer t) (org-indent-region (point) end)
> (forward-line) (if org-log-states-order-reversed nil (goto-char end)
> (beginning-of-line -1)) (set-marker end nil))
> (let ((beg (point))) (insert (mapconcat (function (lambda (p)
> (save-excursion (goto-char p) (org-trim (delete-and-extract-region ...
> ...))))) positions "\n") "\n:END:\n") (let ((end (point-marker)))
> (goto-char beg) (save-excursion (insert ":" drawer ":\n")) (org-flag-drawer
> t) (org-indent-region (point) end) (forward-line) (if
> org-log-states-order-reversed nil (goto-char end) (beginning-of-line -1))
> (set-marker end nil)))
> (cond ((null positions) (org-end-of-meta-data) (if (bolp) nil (insert
> "\n")) (if (and org-clock-into-drawer (or (not (wholenump
> org-clock-into-drawer)) (< org-clock-into-drawer 2))) (progn (let ((beg
> (point))) (insert ":" drawer ":\n:END:\n") (org-indent-region beg (point))
> (goto-char beg) (org-flag-drawer t) (forward-line))))) ((or drawer (and
> (wholenump org-clock-into-drawer) (>= (1+ count) org-clock-into-drawer)))
> (org-end-of-meta-data) (let ((beg (point))) (insert (mapconcat (function
> (lambda (p) (save-excursion ... ...))) positions "\n") "\n:END:\n") (let
> ((end (point-marker))) (goto-char beg) (save-excursion (insert ":" drawer
> ":\n")) (org-flag-drawer t) (org-indent-region (point) end) (forward-line)
> (if org-log-states-order-reversed nil (goto-char end) (beginning-of-line
> -1)) (set-marker end nil)))) (org-log-states-order-reversed (goto-char (car
> (last positions)))) (t (goto-char (car positions))))
> (let ((clock-re (concat "^[ ]*" org-clock-string)) (count 0) positions
> first) (save-excursion (while (re-search-forward clock-re end t) (let
> ((element (org-element-at-point))) (if (eq (org-element-type element)
> (quote clock)) (progn (setq positions (cons ... positions) count (1+
> count))))))) (cond ((null positions) (org-end-of-meta-data) (if (bolp) nil
> (insert "\n")) (if (and org-clock-into-drawer (or (not (wholenump
> org-clock-into-drawer)) (< org-clock-into-drawer 2))) (progn (let ((beg
> ...)) (insert ":" drawer ":\n:END:\n") (org-indent-region beg (point))
> (goto-char beg) (org-flag-drawer t) (forward-line))))) ((or drawer (and
> (wholenump org-clock-into-drawer) (>= (1+ count) org-clock-into-drawer)))
> (org-end-of-meta-data) (let ((beg (point))) (insert (mapconcat (function
> (lambda ... ...)) positions "\n") "\n:END:\n") (let ((end (point-marker)))
> (goto-char beg) (save-excursion (insert ":" drawer ":\n")) (org-flag-drawer
> t) (org-indent-region (point) end) (forward-line) (if
> org-log-states-order-reversed nil (goto-char end) (beginning-of-line -1))
> (set-marker end nil)))) (org-log-states-order-reversed (goto-char (car
> (last positions)))) (t (goto-char (car positions)))))
> (let* ((beg (line-beginning-position)) (end (save-excursion
> (outline-next-heading) (point))) (org-clock-into-drawer
> (org-clock-into-drawer)) (drawer (org-clock-drawer-name))) (if
> find-unclosed (progn (let ((open-clock-re (concat "^[ ]*" org-clock-string
> " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" " *\\sw+
> +[012][0-9]:[0-5][0-9]\\)\\][ ]*quot;))) (while (re-search-forward
> open-clock-re end t) (let ((element ...)) (if (and ... ...) (progn ...
> ...))))))) (if drawer (progn (goto-char beg) (let ((drawer-re (concat "^[
> ]*:" (regexp-quote drawer) ":[ ]*quot;))) (while (re-search-forward
> drawer-re end t) (let ((element ...)) (if (eq ... ...) (progn ...)))))))
> (goto-char beg) (let ((clock-re (concat "^[ ]*" org-clock-string)) (count
> 0) positions first) (save-excursion (while (re-search-forward clock-re end
> t) (let ((element (org-element-at-point))) (if (eq (org-element-type
> element) (quote clock)) (progn (setq positions ... count ...)))))) (cond
> ((null positions) (org-end-of-meta-data) (if (bolp) nil (insert "\n")) (if
> (and org-clock-into-drawer (or (not ...) (< org-clock-into-drawer 2)))
> (progn (let (...) (insert ":" drawer ":\n:END:\n") (org-indent-region beg
> ...) (goto-char beg) (org-flag-drawer t) (forward-line))))) ((or drawer
> (and (wholenump org-clock-into-drawer) (>= (1+ count)
> org-clock-into-drawer))) (org-end-of-meta-data) (let ((beg (point)))
> (insert (mapconcat (function ...) positions "\n") "\n:END:\n") (let ((end
> ...)) (goto-char beg) (save-excursion (insert ":" drawer ":\n"))
> (org-flag-drawer t) (org-indent-region (point) end) (forward-line) (if
> org-log-states-order-reversed nil (goto-char end) (beginning-of-line -1))
> (set-marker end nil)))) (org-log-states-order-reversed (goto-char (car
> (last positions)))) (t (goto-char (car positions))))))
> (catch (quote exit) (let* ((beg (line-beginning-position)) (end
> (save-excursion (outline-next-heading) (point))) (org-clock-into-drawer
> (org-clock-into-drawer)) (drawer (org-clock-drawer-name))) (if
> find-unclosed (progn (let ((open-clock-re (concat "^[ ]*" org-clock-string
> " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" " *\\sw+
> +[012][0-9]:[0-5][0-9]\\)\\][ ]*quot;))) (while (re-search-forward
> open-clock-re end t) (let (...) (if ... ...)))))) (if drawer (progn
> (goto-char beg) (let ((drawer-re (concat "^[ ]*:" ... ":[ ]*quot;)))
> (while (re-search-forward drawer-re end t) (let (...) (if ... ...))))))
> (goto-char beg) (let ((clock-re (concat "^[ ]*" org-clock-string)) (count
> 0) positions first) (save-excursion (while (re-search-forward clock-re end
> t) (let ((element ...)) (if (eq ... ...) (progn ...))))) (cond ((null
> positions) (org-end-of-meta-data) (if (bolp) nil (insert "\n")) (if (and
> org-clock-into-drawer (or ... ...)) (progn (let ... ... ... ... ... ...))))
> ((or drawer (and (wholenump org-clock-into-drawer) (>= ...
> org-clock-into-drawer))) (org-end-of-meta-data) (let ((beg ...)) (insert
> (mapconcat ... positions "\n") "\n:END:\n") (let (...) (goto-char beg)
> (save-excursion ...) (org-flag-drawer t) (org-indent-region ... end)
> (forward-line) (if org-log-states-order-reversed nil ... ...) (set-marker
> end nil)))) (org-log-states-order-reversed (goto-char (car (last
> positions)))) (t (goto-char (car positions)))))))
> org-clock-find-position(nil)
> (save-restriction (widen) (goto-char target-pos) (org-back-to-heading t)
> (or interrupting (move-marker org-clock-interrupted-task nil)) (run-hooks
> (quote org-clock-in-prepare-hook)) (org-clock-history-push) (setq
> org-clock-current-task (nth 4 (org-heading-components))) (cond ((functionp
> org-clock-in-switch-to-state) (looking-at org-complex-heading-regexp) (let
> ((newstate (funcall org-clock-in-switch-to-state (match-string 2)))) (if
> newstate (org-todo newstate)))) ((and org-clock-in-switch-to-state (not
> (looking-at (concat org-outline-regexp "[ ]*" org-clock-in-switch-to-state
> "\\>")))) (org-todo org-clock-in-switch-to-state))) (setq org-clock-heading
> (cond ((and org-clock-heading-function (functionp
> org-clock-heading-function)) (funcall org-clock-heading-function)) ((nth 4
> (org-heading-components)) (replace-regexp-in-string
> "\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]" "\\1" (match-string-no-properties 4))) (t
> "???"))) (org-clock-find-position org-clock-in-resume) (cond ((and
> org-clock-in-resume (looking-at (concat "^[ ]*" org-clock-string "
> \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" " *\\sw+.?
> +[012][0-9]:[0-5][0-9]\\)\\][ ]*quot;))) (message "Matched %s"
> (match-string 1)) (setq ts (concat "[" (match-string 1) "]")) (goto-char
> (match-end 1)) (setq org-clock-start-time (apply (quote encode-time)
> (org-parse-time-string (match-string 1)))) (setq org-clock-effort
> (org-entry-get (point) org-effort-property)) (setq org-clock-total-time
> (org-clock-sum-current-item (org-clock-get-sum-start)))) ((eq
> org-clock-in-resume (quote auto-restart)) (message "Cannot restart clock
> because task does not contain unfinished clock") (ding) (sit-for 2) (throw
> (quote abort) nil)) (t (insert-before-markers "\n") (backward-char 1)
> (org-indent-line) (if (and (save-excursion (end-of-line 0)
> (org-in-item-p))) (progn (beginning-of-line 1) (org-indent-line-to (-
> (org-get-indentation) 2)))) (insert org-clock-string " ") (setq
> org-clock-effort (org-entry-get (point) org-effort-property)) (setq
> org-clock-total-time (org-clock-sum-current-item
> (org-clock-get-sum-start))) (setq org-clock-start-time (or (and
> org-clock-continuously org-clock-out-time) (and leftover (y-or-n-p (format
> "You stopped another clock %d mins ago; start this one from then? " ...))
> leftover) start-time (org-current-time org-clock-rounding-minutes t)))
> (setq ts (org-insert-time-stamp org-clock-start-time (quote with-hm) (quote
> inactive))))) (move-marker org-clock-marker (point) (buffer-base-buffer))
> (move-marker org-clock-hd-marker (save-excursion (org-back-to-heading t)
> (point)) (buffer-base-buffer)) (setq org-clock-has-been-used t) (if (or (eq
> org-clock-clocked-in-display (quote mode-line)) (eq
> org-clock-clocked-in-display (quote both))) (progn (or global-mode-string
> (setq global-mode-string (quote ("")))) (or (memq (quote
> org-mode-line-string) global-mode-string) (setq global-mode-string (append
> global-mode-string (quote (org-mode-line-string))))))) (if (or (eq
> org-clock-clocked-in-display (quote frame-title)) (eq
> org-clock-clocked-in-display (quote both))) (progn (setq frame-title-format
> org-clock-frame-title-format))) (org-clock-update-mode-line) (if
> org-clock-mode-line-timer (progn (cancel-timer org-clock-mode-line-timer)
> (setq org-clock-mode-line-timer nil))) (if org-clock-clocked-in-display
> (progn (setq org-clock-mode-line-timer (run-with-timer
> org-clock-update-period org-clock-update-period (quote
> org-clock-update-mode-line))))) (if org-clock-idle-timer (progn
> (cancel-timer org-clock-idle-timer) (setq org-clock-idle-timer nil))) (setq
> org-clock-idle-timer (run-with-timer 60 60 (quote
> org-resolve-clocks-if-idle))) (message "Clock starts at %s - %s" ts
> org--msg-extra) (run-hooks (quote org-clock-in-hook)))
> (save-excursion (save-restriction (widen) (goto-char target-pos)
> (org-back-to-heading t) (or interrupting (move-marker
> org-clock-interrupted-task nil)) (run-hooks (quote
> org-clock-in-prepare-hook)) (org-clock-history-push) (setq
> org-clock-current-task (nth 4 (org-heading-components))) (cond ((functionp
> org-clock-in-switch-to-state) (looking-at org-complex-heading-regexp) (let
> ((newstate (funcall org-clock-in-switch-to-state ...))) (if newstate
> (org-todo newstate)))) ((and org-clock-in-switch-to-state (not (looking-at
> (concat org-outline-regexp "[ ]*" org-clock-in-switch-to-state "\\>"))))
> (org-todo org-clock-in-switch-to-state))) (setq org-clock-heading (cond
> ((and org-clock-heading-function (functionp org-clock-heading-function))
> (funcall org-clock-heading-function)) ((nth 4 (org-heading-components))
> (replace-regexp-in-string "\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]" "\\1"
> (match-string-no-properties 4))) (t "???"))) (org-clock-find-position
> org-clock-in-resume) (cond ((and org-clock-in-resume (looking-at (concat
> "^[ ]*" org-clock-string " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" "
> *\\sw+.? +[012][0-9]:[0-5][0-9]\\)\\][ ]*quot;))) (message "Matched %s"
> (match-string 1)) (setq ts (concat "[" (match-string 1) "]")) (goto-char
> (match-end 1)) (setq org-clock-start-time (apply (quote encode-time)
> (org-parse-time-string (match-string 1)))) (setq org-clock-effort
> (org-entry-get (point) org-effort-property)) (setq org-clock-total-time
> (org-clock-sum-current-item (org-clock-get-sum-start)))) ((eq
> org-clock-in-resume (quote auto-restart)) (message "Cannot restart clock
> because task does not contain unfinished clock") (ding) (sit-for 2) (throw
> (quote abort) nil)) (t (insert-before-markers "\n") (backward-char 1)
> (org-indent-line) (if (and (save-excursion (end-of-line 0)
> (org-in-item-p))) (progn (beginning-of-line 1) (org-indent-line-to (- ...
> 2)))) (insert org-clock-string " ") (setq org-clock-effort (org-entry-get
> (point) org-effort-property)) (setq org-clock-total-time
> (org-clock-sum-current-item (org-clock-get-sum-start))) (setq
> org-clock-start-time (or (and org-clock-continuously org-clock-out-time)
> (and leftover (y-or-n-p ...) leftover) start-time (org-current-time
> org-clock-rounding-minutes t))) (setq ts (org-insert-time-stamp
> org-clock-start-time (quote with-hm) (quote inactive))))) (move-marker
> org-clock-marker (point) (buffer-base-buffer)) (move-marker
> org-clock-hd-marker (save-excursion (org-back-to-heading t) (point))
> (buffer-base-buffer)) (setq org-clock-has-been-used t) (if (or (eq
> org-clock-clocked-in-display (quote mode-line)) (eq
> org-clock-clocked-in-display (quote both))) (progn (or global-mode-string
> (setq global-mode-string (quote ("")))) (or (memq (quote
> org-mode-line-string) global-mode-string) (setq global-mode-string (append
> global-mode-string (quote ...)))))) (if (or (eq
> org-clock-clocked-in-display (quote frame-title)) (eq
> org-clock-clocked-in-display (quote both))) (progn (setq frame-title-format
> org-clock-frame-title-format))) (org-clock-update-mode-line) (if
> org-clock-mode-line-timer (progn (cancel-timer org-clock-mode-line-timer)
> (setq org-clock-mode-line-timer nil))) (if org-clock-clocked-in-display
> (progn (setq org-clock-mode-line-timer (run-with-timer
> org-clock-update-period org-clock-update-period (quote
> org-clock-update-mode-line))))) (if org-clock-idle-timer (progn
> (cancel-timer org-clock-idle-timer) (setq org-clock-idle-timer nil))) (setq
> org-clock-idle-timer (run-with-timer 60 60 (quote
> org-resolve-clocks-if-idle))) (message "Clock starts at %s - %s" ts
> org--msg-extra) (run-hooks (quote org-clock-in-hook))))
> (save-excursion (if (and selected-task (marker-buffer selected-task))
> (progn (set-buffer (org-base-buffer (marker-buffer selected-task))) (setq
> target-pos (marker-position selected-task)) (move-marker selected-task
> nil))) (save-excursion (save-restriction (widen) (goto-char target-pos)
> (org-back-to-heading t) (or interrupting (move-marker
> org-clock-interrupted-task nil)) (run-hooks (quote
> org-clock-in-prepare-hook)) (org-clock-history-push) (setq
> org-clock-current-task (nth 4 (org-heading-components))) (cond ((functionp
> org-clock-in-switch-to-state) (looking-at org-complex-heading-regexp) (let
> ((newstate ...)) (if newstate (org-todo newstate)))) ((and
> org-clock-in-switch-to-state (not (looking-at ...))) (org-todo
> org-clock-in-switch-to-state))) (setq org-clock-heading (cond ((and
> org-clock-heading-function (functionp org-clock-heading-function)) (funcall
> org-clock-heading-function)) ((nth 4 (org-heading-components))
> (replace-regexp-in-string "\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]" "\\1"
> (match-string-no-properties 4))) (t "???"))) (org-clock-find-position
> org-clock-in-resume) (cond ((and org-clock-in-resume (looking-at (concat
> "^[ ]*" org-clock-string " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" "
> *\\sw+.? +[012][0-9]:[0-5][0-9]\\)\\][ ]*quot;))) (message "Matched %s"
> (match-string 1)) (setq ts (concat "[" (match-string 1) "]")) (goto-char
> (match-end 1)) (setq org-clock-start-time (apply (quote encode-time)
> (org-parse-time-string ...))) (setq org-clock-effort (org-entry-get (point)
> org-effort-property)) (setq org-clock-total-time
> (org-clock-sum-current-item (org-clock-get-sum-start)))) ((eq
> org-clock-in-resume (quote auto-restart)) (message "Cannot restart clock
> because task does not contain unfinished clock") (ding) (sit-for 2) (throw
> (quote abort) nil)) (t (insert-before-markers "\n") (backward-char 1)
> (org-indent-line) (if (and (save-excursion ... ...)) (progn
> (beginning-of-line 1) (org-indent-line-to ...))) (insert org-clock-string "
> ") (setq org-clock-effort (org-entry-get (point) org-effort-property))
> (setq org-clock-total-time (org-clock-sum-current-item
> (org-clock-get-sum-start))) (setq org-clock-start-time (or (and
> org-clock-continuously org-clock-out-time) (and leftover ... leftover)
> start-time (org-current-time org-clock-rounding-minutes t))) (setq ts
> (org-insert-time-stamp org-clock-start-time (quote with-hm) (quote
> inactive))))) (move-marker org-clock-marker (point) (buffer-base-buffer))
> (move-marker org-clock-hd-marker (save-excursion (org-back-to-heading t)
> (point)) (buffer-base-buffer)) (setq org-clock-has-been-used t) (if (or (eq
> org-clock-clocked-in-display (quote mode-line)) (eq
> org-clock-clocked-in-display (quote both))) (progn (or global-mode-string
> (setq global-mode-string (quote ...))) (or (memq (quote
> org-mode-line-string) global-mode-string) (setq global-mode-string (append
> global-mode-string ...))))) (if (or (eq org-clock-clocked-in-display (quote
> frame-title)) (eq org-clock-clocked-in-display (quote both))) (progn (setq
> frame-title-format org-clock-frame-title-format)))
> (org-clock-update-mode-line) (if org-clock-mode-line-timer (progn
> (cancel-timer org-clock-mode-line-timer) (setq org-clock-mode-line-timer
> nil))) (if org-clock-clocked-in-display (progn (setq
> org-clock-mode-line-timer (run-with-timer org-clock-update-period
> org-clock-update-period (quote org-clock-update-mode-line))))) (if
> org-clock-idle-timer (progn (cancel-timer org-clock-idle-timer) (setq
> org-clock-idle-timer nil))) (setq org-clock-idle-timer (run-with-timer 60
> 60 (quote org-resolve-clocks-if-idle))) (message "Clock starts at %s - %s"
> ts org--msg-extra) (run-hooks (quote org-clock-in-hook)))))
> (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness)
> (org-clocking-p))) ts selected-task target-pos (org--msg-extra "")
> (leftover (and (not org-clock-resolving-clocks) org-clock-leftover-time)))
> (if (and org-clock-auto-clock-resolution (or (not interrupting) (eq t
> org-clock-auto-clock-resolution)) (not org-clock-clocking-in) (not
> org-clock-resolving-clocks)) (progn (setq org-clock-leftover-time nil) (let
> ((org-clock-clocking-in t)) (org-resolve-clocks)))) (if (equal select
> (quote (64))) (progn (let ((org-clock-continuously t)) (org-clock-in nil
> org-clock-out-time)))) (if (equal select (quote (4))) (progn (setq
> selected-task (org-clock-select-task "Clock-in on task: ")) (if
> selected-task (setq selected-task (copy-marker selected-task)) (error
> "Abort")))) (if (equal select (quote (16))) (progn
> (org-clock-mark-default-task))) (if interrupting (progn (if (save-excursion
> (if selected-task nil (org-back-to-heading t)) (and (equal (marker-buffer
> org-clock-hd-marker) (if selected-task ... ...)) (= (marker-position
> org-clock-hd-marker) (if selected-task ... ...)) (equal
> org-clock-current-task (nth 4 ...)))) (progn (message "Clock continues in
> \"%s\"" org-clock-heading) (throw (quote abort) nil))) (move-marker
> org-clock-interrupted-task (marker-position org-clock-marker)
> (marker-buffer org-clock-marker)) (let ((org-clock-clocking-in t))
> (org-clock-out nil t)))) (setq target-pos (if (and (eobp) (not
> (org-at-heading-p))) (point-at-bol 0) (point))) (save-excursion (if (and
> selected-task (marker-buffer selected-task)) (progn (set-buffer
> (org-base-buffer (marker-buffer selected-task))) (setq target-pos
> (marker-position selected-task)) (move-marker selected-task nil)))
> (save-excursion (save-restriction (widen) (goto-char target-pos)
> (org-back-to-heading t) (or interrupting (move-marker
> org-clock-interrupted-task nil)) (run-hooks (quote
> org-clock-in-prepare-hook)) (org-clock-history-push) (setq
> org-clock-current-task (nth 4 (org-heading-components))) (cond ((functionp
> org-clock-in-switch-to-state) (looking-at org-complex-heading-regexp) (let
> (...) (if newstate ...))) ((and org-clock-in-switch-to-state (not ...))
> (org-todo org-clock-in-switch-to-state))) (setq org-clock-heading (cond
> ((and org-clock-heading-function ...) (funcall org-clock-heading-function))
> ((nth 4 ...) (replace-regexp-in-string "\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]"
> "\\1" ...)) (t "???"))) (org-clock-find-position org-clock-in-resume) (cond
> ((and org-clock-in-resume (looking-at ...)) (message "Matched %s"
> (match-string 1)) (setq ts (concat "[" ... "]")) (goto-char (match-end 1))
> (setq org-clock-start-time (apply ... ...)) (setq org-clock-effort
> (org-entry-get ... org-effort-property)) (setq org-clock-total-time
> (org-clock-sum-current-item ...))) ((eq org-clock-in-resume (quote
> auto-restart)) (message "Cannot restart clock because task does not contain
> unfinished clock") (ding) (sit-for 2) (throw (quote abort) nil)) (t
> (insert-before-markers "\n") (backward-char 1) (org-indent-line) (if (and
> ...) (progn ... ...)) (insert org-clock-string " ") (setq org-clock-effort
> (org-entry-get ... org-effort-property)) (setq org-clock-total-time
> (org-clock-sum-current-item ...)) (setq org-clock-start-time (or ... ...
> start-time ...)) (setq ts (org-insert-time-stamp org-clock-start-time ...
> ...)))) (move-marker org-clock-marker (point) (buffer-base-buffer))
> (move-marker org-clock-hd-marker (save-excursion (org-back-to-heading t)
> (point)) (buffer-base-buffer)) (setq org-clock-has-been-used t) (if (or (eq
> org-clock-clocked-in-display (quote mode-line)) (eq
> org-clock-clocked-in-display (quote both))) (progn (or global-mode-string
> (setq global-mode-string ...)) (or (memq ... global-mode-string) (setq
> global-mode-string ...)))) (if (or (eq org-clock-clocked-in-display (quote
> frame-title)) (eq org-clock-clocked-in-display (quote both))) (progn (setq
> frame-title-format org-clock-frame-title-format)))
> (org-clock-update-mode-line) (if org-clock-mode-line-timer (progn
> (cancel-timer org-clock-mode-line-timer) (setq org-clock-mode-line-timer
> nil))) (if org-clock-clocked-in-display (progn (setq
> org-clock-mode-line-timer (run-with-timer org-clock-update-period
> org-clock-update-period ...)))) (if org-clock-idle-timer (progn
> (cancel-timer org-clock-idle-timer) (setq org-clock-idle-timer nil))) (setq
> org-clock-idle-timer (run-with-timer 60 60 (quote
> org-resolve-clocks-if-idle))) (message "Clock starts at %s - %s" ts
> org--msg-extra) (run-hooks (quote org-clock-in-hook))))))
> (catch (quote abort) (let ((interrupting (and (not
> org-clock-resolving-clocks-due-to-idleness) (org-clocking-p))) ts
> selected-task target-pos (org--msg-extra "") (leftover (and (not
> org-clock-resolving-clocks) org-clock-leftover-time))) (if (and
> org-clock-auto-clock-resolution (or (not interrupting) (eq t
> org-clock-auto-clock-resolution)) (not org-clock-clocking-in) (not
> org-clock-resolving-clocks)) (progn (setq org-clock-leftover-time nil) (let
> ((org-clock-clocking-in t)) (org-resolve-clocks)))) (if (equal select
> (quote (64))) (progn (let ((org-clock-continuously t)) (org-clock-in nil
> org-clock-out-time)))) (if (equal select (quote (4))) (progn (setq
> selected-task (org-clock-select-task "Clock-in on task: ")) (if
> selected-task (setq selected-task (copy-marker selected-task)) (error
> "Abort")))) (if (equal select (quote (16))) (progn
> (org-clock-mark-default-task))) (if interrupting (progn (if (save-excursion
> (if selected-task nil (org-back-to-heading t)) (and (equal ... ...) (= ...
> ...) (equal org-clock-current-task ...))) (progn (message "Clock continues
> in \"%s\"" org-clock-heading) (throw (quote abort) nil))) (move-marker
> org-clock-interrupted-task (marker-position org-clock-marker)
> (marker-buffer org-clock-marker)) (let ((org-clock-clocking-in t))
> (org-clock-out nil t)))) (setq target-pos (if (and (eobp) (not
> (org-at-heading-p))) (point-at-bol 0) (point))) (save-excursion (if (and
> selected-task (marker-buffer selected-task)) (progn (set-buffer
> (org-base-buffer (marker-buffer selected-task))) (setq target-pos
> (marker-position selected-task)) (move-marker selected-task nil)))
> (save-excursion (save-restriction (widen) (goto-char target-pos)
> (org-back-to-heading t) (or interrupting (move-marker
> org-clock-interrupted-task nil)) (run-hooks (quote
> org-clock-in-prepare-hook)) (org-clock-history-push) (setq
> org-clock-current-task (nth 4 (org-heading-components))) (cond ((functionp
> org-clock-in-switch-to-state) (looking-at org-complex-heading-regexp) (let
> ... ...)) ((and org-clock-in-switch-to-state ...) (org-todo
> org-clock-in-switch-to-state))) (setq org-clock-heading (cond (... ...)
> (... ...) (t "???"))) (org-clock-find-position org-clock-in-resume) (cond
> ((and org-clock-in-resume ...) (message "Matched %s" ...) (setq ts ...)
> (goto-char ...) (setq org-clock-start-time ...) (setq org-clock-effort ...)
> (setq org-clock-total-time ...)) ((eq org-clock-in-resume ...) (message
> "Cannot restart clock because task does not contain unfinished clock")
> (ding) (sit-for 2) (throw ... nil)) (t (insert-before-markers "\n")
> (backward-char 1) (org-indent-line) (if ... ...) (insert org-clock-string "
> ") (setq org-clock-effort ...) (setq org-clock-total-time ...) (setq
> org-clock-start-time ...) (setq ts ...))) (move-marker org-clock-marker
> (point) (buffer-base-buffer)) (move-marker org-clock-hd-marker
> (save-excursion (org-back-to-heading t) (point)) (buffer-base-buffer))
> (setq org-clock-has-been-used t) (if (or (eq org-clock-clocked-in-display
> ...) (eq org-clock-clocked-in-display ...)) (progn (or global-mode-string
> ...) (or ... ...))) (if (or (eq org-clock-clocked-in-display ...) (eq
> org-clock-clocked-in-display ...)) (progn (setq frame-title-format
> org-clock-frame-title-format))) (org-clock-update-mode-line) (if
> org-clock-mode-line-timer (progn (cancel-timer org-clock-mode-line-timer)
> (setq org-clock-mode-line-timer nil))) (if org-clock-clocked-in-display
> (progn (setq org-clock-mode-line-timer ...))) (if org-clock-idle-timer
> (progn (cancel-timer org-clock-idle-timer) (setq org-clock-idle-timer
> nil))) (setq org-clock-idle-timer (run-with-timer 60 60 (quote
> org-resolve-clocks-if-idle))) (message "Clock starts at %s - %s" ts
> org--msg-extra) (run-hooks (quote org-clock-in-hook)))))))
>
> org-clock-in(nil)
> call-interactively(org-clock-in nil nil)
> command-execute(org-clock-in)
>
>
>
> On Thu, May 5, 2016 at 9:52 AM Nicolas Goaziou <mail@nicolasgoaziou.fr>
> wrote:
>
>> Hello,
>>
>> Carlos Noguera <carlos.francisco.noguera@gmail.com> writes:
>>
>> > When clocking in under a headline that already has clock entries, the
>> > entries are not correclty bundled in a drawer, generating a: (I removed
>> > the bytecode because gmail didn't like it)
>> >
>> > Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
>> >   byte-code("REMOVED" [beg end org-clock-into-drawer drawer
>> find-unclosed
>> > org-clock-string line-beginning-position outline-next-heading
>> > org-clock-drawer-name "^[ ]*" "
>> > \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" " *\\sw+
>> > +[012][0-9]:[0-5][0-9]\\)\\][ ]*$" re-search-forward t
>> org-element-at-point
>> > org-element-type clock org-element-property :status running
>> > beginning-of-line throw exit "^[ ]*:" regexp-quote ":[ ]*$"
>> :contents-end
>> > nil 0 org-end-of-meta-data "\n" wholenump 2 ":" ":\n:END:\n"
>> > org-indent-region org-flag-drawer mapconcat #[(p) "\212
>> > b\210\302\212\303\304x\210\305\306!)\305\306!\"
>> > \307\310\311\307\312\311 ##*\207"
>> > [p s delete-and-extract-region "
>> > \n" nil line-beginning-position 2 replace-regexp-in-string "\\`[ \n
>> > ]+" "" "[ \n
>> > ]+\\'"] 7] "\n:END:\n" point-marker ":\n" -1 last open-clock-re element
>> > drawer-re cend org-log-states-order-reversed first ...] 4)
>> >   org-clock-find-position(nil)
>> >   byte-code("REMOVED" [org-clock-resolving-clocks-due-to-idleness
>> > org-clock-resolving-clocks org-clock-leftover-time leftover
>> org--msg-extra
>> > target-pos org-clocking-p nil "" t org-resolve-clocks (64) org-clock-in
>> (4)
>> > org-clock-select-task "Clock-in on task: " copy-marker error "Abort"
>> (16)
>> > org-clock-mark-default-task org-back-to-heading marker-buffer
>> > marker-position 4 org-heading-components message "Clock continues in
>> > \"%s\"" throw abort org-clock-out org-at-heading-p point-at-bol 0
>> > org-base-buffer run-hooks org-clock-in-prepare-hook
>> org-clock-history-push
>> > functionp looking-at match-string 2 org-todo "[ ]*" "\\>"
>> > replace-regexp-in-string "\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]" "\\1"
>> > match-string-no-properties "???" ...] 8)
>> >   org-clock-in(nil)
>> >   call-interactively(org-clock-in nil nil)
>> >   command-execute(org-clock-in)
>> >
>> > that prevents the clock in
>> > I go from
>> >
>> > ** TODO a task
>> > CLOCK: [2016-04-29 Fri 13:14]--[2016-04-29 Fri 14:43] =>  1:29
>> > CLOCK: [2016-05-04 Wed 12:44]--[2016-05-04 Wed 12:44] =>  0:00
>> >
>> > C-c C-x C-i
>> >
>> > to
>> >
>> > ** TODO a task
>> > :CLOCK: [2016-05-04 Wed 12:44]--[2016-05-04 Wed 12:44] =>  0:00
>> > CLOCK: [2016-04-29 Fri 13:14]--[2016-04-29 Fri 14:43] =>  1:29
>> > :END:
>>
>> I cannot reproduce it. In the example above, I get
>>
>>   * NEXT a task
>>   :LOGBOOK:
>>   CLOCK: [2016-05-05 Thu 09:52]
>>   CLOCK: [2016-05-04 Wed 12:44]--[2016-05-04 Wed 12:44] =>  0:00
>>   CLOCK: [2016-04-29 Fri 13:14]--[2016-04-29 Fri 14:43] =>  1:29
>>   :END:
>>
>> > Any ideas?
>>
>> Not quite. Could you provide a backtrace with an uncompiled Org
>> (org-reload with universal argument) ?
>>
>> Regards,
>>
>> --
>> Nicolas Goaziou
>>
>

[-- Attachment #2: Type: text/html, Size: 32165 bytes --]

  reply	other threads:[~2016-05-10 12:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04 10:59 Bug: clock in generates bad drawer [8.3.4 (8.3.4-47-gaf853d-elpa @ /home/carlos/.emacs.d/elpa/org-20160502/)] Carlos Noguera
2016-05-05  7:52 ` Nicolas Goaziou
2016-05-10  7:05   ` Carlos Noguera
2016-05-10 12:42     ` Carlos Noguera [this message]
2016-05-10 21:10       ` Nicolas Goaziou
2016-05-11  8:57         ` Carlos Noguera

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKjOv==kiaZimefPBmeFSXU0QhPFW4OMVqfUoSGq=d3aPAzo3Q@mail.gmail.com' \
    --to=carlos.francisco.noguera@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).