From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carlos Noguera 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 07:05:51 +0000 Message-ID: References: <87eg9hosal.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c37ad2bcd47e0532778ee2 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b01kB-0006Gi-5K for emacs-orgmode@gnu.org; Tue, 10 May 2016 03:06:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b01k2-0007xJ-Uv for emacs-orgmode@gnu.org; Tue, 10 May 2016 03:06:09 -0400 Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]:33511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b01k2-0007xB-6I for emacs-orgmode@gnu.org; Tue, 10 May 2016 03:06:02 -0400 Received: by mail-lf0-x22f.google.com with SMTP id y84so4317477lfc.0 for ; Tue, 10 May 2016 00:06:01 -0700 (PDT) In-Reply-To: <87eg9hosal.fsf@saiph.selenimh> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --001a11c37ad2bcd47e0532778ee2 Content-Type: text/plain; charset=UTF-8 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 wrote: > Hello, > > Carlos Noguera 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 > --001a11c37ad2bcd47e0532778ee2 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Nicolas,


Here you hav= e 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 &qu= ot;:\n"))
(let ((end (point-marker))) (goto-char beg) (save-excur= sion (insert ":" drawer ":\n")) (org-flag-drawer t) (or= g-indent-region (point) end) (forward-line) (if org-log-states-order-revers= ed nil (goto-char end) (beginning-of-line -1)) (set-marker end nil))
(= let ((beg (point))) (insert (mapconcat (function (lambda (p) (save-excursio= n (goto-char p) (org-trim (delete-and-extract-region ... ...))))) positions= "\n") "\n:END:\n") (let ((end (point-marker))) (goto-c= har beg) (save-excursion (insert ":" drawer ":\n")) (or= g-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-mar= ker end nil)))
(cond ((null positions) (org-end-of-meta-data) (if (bol= p) nil (insert "\n")) (if (and org-clock-into-drawer (or (not (wh= olenump org-clock-into-drawer)) (< org-clock-into-drawer 2))) (progn (le= t ((beg (point))) (insert ":" drawer ":\n:END:\n") (org= -indent-region beg (point)) (goto-char beg) (org-flag-drawer t) (forward-li= ne))))) ((or drawer (and (wholenump org-clock-into-drawer) (>=3D (1+ cou= nt) org-clock-into-drawer))) (org-end-of-meta-data) (let ((beg (point))) (i= nsert (mapconcat (function (lambda (p) (save-excursion ... ...))) positions= "\n") "\n:END:\n") (let ((end (point-marker))) (goto-c= har beg) (save-excursion (insert ":" drawer ":\n")) (or= g-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-mar= ker end nil)))) (org-log-states-order-reversed (goto-char (car (last positi= ons)))) (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-po= int))) (if (eq (org-element-type element) (quote clock)) (progn (setq posit= ions (cons ... positions) count (1+ count))))))) (cond ((null positions) (o= rg-end-of-meta-data) (if (bolp) nil (insert "\n")) (if (and org-c= lock-into-drawer (or (not (wholenump org-clock-into-drawer)) (< org-cloc= k-into-drawer 2))) (progn (let ((beg ...)) (insert ":" drawer &qu= ot;:\n:END:\n") (org-indent-region beg (point)) (goto-char beg) (org-f= lag-drawer t) (forward-line))))) ((or drawer (and (wholenump org-clock-into= -drawer) (>=3D (1+ count) org-clock-into-drawer))) (org-end-of-meta-data= ) (let ((beg (point))) (insert (mapconcat (function (lambda ... ...)) posit= ions "\n") "\n:END:\n") (let ((end (point-marker))) (go= to-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 po= sitions)))) (t (goto-char (car positions)))))
(let* ((beg (line-beginn= ing-position)) (end (save-excursion (outline-next-heading) (point))) (org-c= lock-into-drawer (org-clock-into-drawer)) (drawer (org-clock-drawer-name)))= (if find-unclosed (progn (let ((open-clock-re (concat "^[ ]*" or= g-clock-string " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}" &q= uot; *\\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) &quo= t;:[ ]*quot;))) (while (re-search-forwar= d 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 cloc= k-re end t) (let ((element (org-element-at-point))) (if (eq (org-element-ty= pe element) (quote clock)) (progn (setq positions ... count ...)))))) (cond= ((null positions) (org-end-of-meta-data) (if (bolp) nil (insert "\n&q= uot;)) (if (and org-clock-into-drawer (or (not ...) (< org-clock-into-dr= awer 2))) (progn (let (...) (insert ":" drawer ":\n:END:\n&q= uot;) (org-indent-region beg ...) (goto-char beg) (org-flag-drawer t) (forw= ard-line))))) ((or drawer (and (wholenump org-clock-into-drawer) (>=3D (= 1+ count) org-clock-into-drawer))) (org-end-of-meta-data) (let ((beg (point= ))) (insert (mapconcat (function ...) positions "\n") "\n:EN= D:\n") (let ((end ...)) (goto-char beg) (save-excursion (insert "= :" drawer ":\n")) (org-flag-drawer t) (org-indent-region (po= int) end) (forward-line) (if org-log-states-order-reversed nil (goto-char e= nd) (beginning-of-line -1)) (set-marker end nil)))) (org-log-states-order-r= eversed (goto-char (car (last positions)))) (t (goto-char (car positions)))= )))
(catch (quote exit) (let* ((beg (line-beginning-position)) (end (s= ave-excursion (outline-next-heading) (point))) (org-clock-into-drawer (org-= clock-into-drawer)) (drawer (org-clock-drawer-name))) (if find-unclosed (pr= ogn (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 (r= e-search-forward open-clock-re end t) (let (...) (if ... ...)))))) (if draw= er (progn (goto-char beg) (let ((drawer-re (concat "^[ ]*:" ... &= quot;:[ ]*quot;))) (while (re-search-for= ward drawer-re end t) (let (...) (if ... ...)))))) (goto-char beg) (let ((c= lock-re (concat "^[ ]*" org-clock-string)) (count 0) positions fi= rst) (save-excursion (while (re-search-forward clock-re end t) (let ((eleme= nt ...)) (if (eq ... ...) (progn ...))))) (cond ((null positions) (org-end-= of-meta-data) (if (bolp) nil (insert "\n")) (if (and org-clock-in= to-drawer (or ... ...)) (progn (let ... ... ... ... ... ...)))) ((or drawer= (and (wholenump org-clock-into-drawer) (>=3D ... org-clock-into-drawer)= )) (org-end-of-meta-data) (let ((beg ...)) (insert (mapconcat ... positions= "\n") "\n:END:\n") (let (...) (goto-char beg) (save-ex= cursion ...) (org-flag-drawer t) (org-indent-region ... end) (forward-line)= (if org-log-states-order-reversed nil ... ...) (set-marker end nil)))) (or= g-log-states-order-reversed (goto-char (car (last positions)))) (t (goto-ch= ar (car positions)))))))
org-clock-find-position(nil)
(save-restr= iction (widen) (goto-char target-pos) (org-back-to-heading t) (or interrupt= ing (move-marker org-clock-interrupted-task nil)) (run-hooks (quote org-clo= ck-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 newsta= te)))) ((and org-clock-in-switch-to-state (not (looking-at (concat org-outl= ine-regexp "[ ]*" org-clock-in-switch-to-state "\\>"= )))) (org-todo org-clock-in-switch-to-state))) (setq org-clock-heading (con= d ((and org-clock-heading-function (functionp org-clock-heading-function)) = (funcall org-clock-heading-function)) ((nth 4 (org-heading-components)) (re= place-regexp-in-string "\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]" "\\1= " (match-string-no-properties 4))) (t "???"))) (org-clock-fi= nd-position org-clock-in-resume) (cond ((and org-clock-in-resume (looking-a= t (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-ef= fort (org-entry-get (point) org-effort-property)) (setq org-clock-total-tim= e (org-clock-sum-current-item (org-clock-get-sum-start)))) ((eq org-clock-i= n-resume (quote auto-restart)) (message "Cannot restart clock because = task does not contain unfinished clock") (ding) (sit-for 2) (throw (qu= ote 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-indentatio= n) 2)))) (insert org-clock-string " ") (setq org-clock-effort (or= g-entry-get (point) org-effort-property)) (setq org-clock-total-time (org-c= lock-sum-current-item (org-clock-get-sum-start))) (setq org-clock-start-tim= e (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-roundi= ng-minutes t))) (setq ts (org-insert-time-stamp org-clock-start-time (quote= with-hm) (quote inactive))))) (move-marker org-clock-marker (point) (buffe= r-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-cloc= k-clocked-in-display (quote both))) (progn (or global-mode-string (setq glo= bal-mode-string (quote ("")))) (or (memq (quote org-mode-line-str= ing) global-mode-string) (setq global-mode-string (append global-mode-strin= g (quote (org-mode-line-string))))))) (if (or (eq org-clock-clocked-in-disp= lay (quote frame-title)) (eq org-clock-clocked-in-display (quote both))) (p= rogn (setq frame-title-format org-clock-frame-title-format))) (org-clock-up= date-mode-line) (if org-clock-mode-line-timer (progn (cancel-timer org-cloc= k-mode-line-timer) (setq org-clock-mode-line-timer nil))) (if org-clock-clo= cked-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-li= ne))))) (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-tim= er 60 60 (quote org-resolve-clocks-if-idle))) (message "Clock starts a= t %s - %s" ts org--msg-extra) (run-hooks (quote org-clock-in-hook))) (save-excursion (save-restriction (widen) (goto-char target-pos) (org-b= ack-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 ((fu= nctionp org-clock-in-switch-to-state) (looking-at org-complex-heading-regex= p) (let ((newstate (funcall org-clock-in-switch-to-state ...))) (if newstat= e (org-todo newstate)))) ((and org-clock-in-switch-to-state (not (looking-a= t (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-h= eading-function)) (funcall org-clock-heading-function)) ((nth 4 (org-headin= g-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 &qu= ot;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 o= rg-clock-total-time (org-clock-sum-current-item (org-clock-get-sum-start)))= ) ((eq org-clock-in-resume (quote auto-restart)) (message "Cannot rest= art 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 (or= g-entry-get (point) org-effort-property)) (setq org-clock-total-time (org-c= lock-sum-current-item (org-clock-get-sum-start))) (setq org-clock-start-tim= e (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) (q= uote inactive))))) (move-marker org-clock-marker (point) (buffer-base-buffe= r)) (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-str= ing (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 or= g-clock-clocked-in-display (quote both))) (progn (setq frame-title-format o= rg-clock-frame-title-format))) (org-clock-update-mode-line) (if org-clock-m= ode-line-timer (progn (cancel-timer org-clock-mode-line-timer) (setq org-cl= ock-mode-line-timer nil))) (if org-clock-clocked-in-display (progn (setq or= g-clock-mode-line-timer (run-with-timer org-clock-update-period org-clock-u= pdate-period (quote org-clock-update-mode-line))))) (if org-clock-idle-time= r (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-clo= cks-if-idle))) (message "Clock starts at %s - %s" ts org--msg-ext= ra) (run-hooks (quote org-clock-in-hook))))
(save-excursion (if (and s= elected-task (marker-buffer selected-task)) (progn (set-buffer (org-base-bu= ffer (marker-buffer selected-task))) (setq target-pos (marker-position sele= cted-task)) (move-marker selected-task nil))) (save-excursion (save-restric= tion (widen) (goto-char target-pos) (org-back-to-heading t) (or interruptin= g (move-marker org-clock-interrupted-task nil)) (run-hooks (quote org-clock= -in-prepare-hook)) (org-clock-history-push) (setq org-clock-current-task (n= th 4 (org-heading-components))) (cond ((functionp org-clock-in-switch-to-st= ate) (looking-at org-complex-heading-regexp) (let ((newstate ...)) (if news= tate (org-todo newstate)))) ((and org-clock-in-switch-to-state (not (lookin= g-at ...))) (org-todo org-clock-in-switch-to-state))) (setq org-clock-headi= ng (cond ((and org-clock-heading-function (functionp org-clock-heading-func= tion)) (funcall org-clock-heading-function)) ((nth 4 (org-heading-component= s)) (replace-regexp-in-string "\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]" &q= uot;\\1" (match-string-no-properties 4))) (t "???"))) (org-c= lock-find-position org-clock-in-resume) (cond ((and org-clock-in-resume (lo= oking-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-resu= me (quote auto-restart)) (message "Cannot restart clock because task d= oes not contain unfinished clock") (ding) (sit-for 2) (throw (quote ab= ort) 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-cl= ock-total-time (org-clock-sum-current-item (org-clock-get-sum-start))) (set= q 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 w= ith-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 globa= l-mode-string (quote ...))) (or (memq (quote org-mode-line-string) global-m= ode-string) (setq global-mode-string (append global-mode-string ...))))) (i= f (or (eq org-clock-clocked-in-display (quote frame-title)) (eq org-clock-c= locked-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-m= ode-line-timer (run-with-timer org-clock-update-period org-clock-update-per= iod (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-id= le))) (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-res= olving-clocks) org-clock-leftover-time))) (if (and org-clock-auto-clock-res= olution (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-cloc= ks)))) (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-c= lock-hd-marker) (if selected-task ... ...)) (=3D (marker-position org-clock= -hd-marker) (if selected-task ... ...)) (equal org-clock-current-task (nth = 4 ...)))) (progn (message "Clock continues in \"%s\"" o= rg-clock-heading) (throw (quote abort) nil))) (move-marker org-clock-interr= upted-task (marker-position org-clock-marker) (marker-buffer org-clock-mark= er)) (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))) (sav= e-excursion (save-restriction (widen) (goto-char target-pos) (org-back-to-h= eading t) (or interrupting (move-marker org-clock-interrupted-task nil)) (r= un-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 ...)) (or= g-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 (app= ly ... ...)) (setq org-clock-effort (org-entry-get ... org-effort-property)= ) (setq org-clock-total-time (org-clock-sum-current-item ...))) ((eq org-cl= ock-in-resume (quote auto-restart)) (message "Cannot restart clock bec= ause task does not contain unfinished clock") (ding) (sit-for 2) (thro= w (quote abort) nil)) (t (insert-before-markers "\n") (backward-c= har 1) (org-indent-line) (if (and ...) (progn ... ...)) (insert org-clock-s= tring " ") (setq org-clock-effort (org-entry-get ... org-effort-p= roperty)) (setq org-clock-total-time (org-clock-sum-current-item ...)) (set= q org-clock-start-time (or ... ... start-time ...)) (setq ts (org-insert-ti= me-stamp org-clock-start-time ... ...)))) (move-marker org-clock-marker (po= int) (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-strin= g (setq global-mode-string ...)) (or (memq ... global-mode-string) (setq gl= obal-mode-string ...)))) (if (or (eq org-clock-clocked-in-display (quote fr= ame-title)) (eq org-clock-clocked-in-display (quote both))) (progn (setq fr= ame-title-format org-clock-frame-title-format))) (org-clock-update-mode-lin= e) (if org-clock-mode-line-timer (progn (cancel-timer org-clock-mode-line-t= imer) (setq org-clock-mode-line-timer nil))) (if org-clock-clocked-in-displ= ay (progn (setq org-clock-mode-line-timer (run-with-timer org-clock-update-= period org-clock-update-period ...)))) (if org-clock-idle-timer (progn (can= cel-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-hook= s (quote org-clock-in-hook))))))
(catch (quote abort) (let ((interrupt= ing (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-cl= ock-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-mar= ker selected-task)) (error "Abort")))) (if (equal select (quote (= 16))) (progn (org-clock-mark-default-task))) (if interrupting (progn (if (s= ave-excursion (if selected-task nil (org-back-to-heading t)) (and (equal ..= . ...) (=3D ... ...) (equal org-clock-current-task ...))) (progn (message &= quot;Clock continues in \"%s\"" org-clock-heading) (throw (q= uote abort) nil))) (move-marker org-clock-interrupted-task (marker-position= org-clock-marker) (marker-buffer org-clock-marker)) (let ((org-clock-clock= ing-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 sel= ected-task (marker-buffer selected-task)) (progn (set-buffer (org-base-buff= er (marker-buffer selected-task))) (setq target-pos (marker-position select= ed-task)) (move-marker selected-task nil))) (save-excursion (save-restricti= on (widen) (goto-char target-pos) (org-back-to-heading t) (or interrupting = (move-marker org-clock-interrupted-task nil)) (run-hooks (quote org-clock-i= n-prepare-hook)) (org-clock-history-push) (setq org-clock-current-task (nth= 4 (org-heading-components))) (cond ((functionp org-clock-in-switch-to-stat= e) (looking-at org-complex-heading-regexp) (let ... ...)) ((and org-clock-i= n-switch-to-state ...) (org-todo org-clock-in-switch-to-state))) (setq org-= clock-heading (cond (... ...) (... ...) (t "???"))) (org-clock-fi= nd-position org-clock-in-resume) (cond ((and org-clock-in-resume ...) (mess= age "Matched %s" ...) (setq ts ...) (goto-char ...) (setq org-clo= ck-start-time ...) (setq org-clock-effort ...) (setq org-clock-total-time .= ..)) ((eq org-clock-in-resume ...) (message "Cannot restart clock beca= use 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 or= g-clock-effort ...) (setq org-clock-total-time ...) (setq org-clock-start-t= ime ...) (setq ts ...))) (move-marker org-clock-marker (point) (buffer-base= -buffer)) (move-marker org-clock-hd-marker (save-excursion (org-back-to-hea= ding 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-cl= ock-clocked-in-display ...) (eq org-clock-clocked-in-display ...)) (progn (= setq frame-title-format org-clock-frame-title-format))) (org-clock-update-m= ode-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-i= n-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<= br> > entries are not correclty bundled in a drawer, generating a: (I remove= d
> the bytecode because gmail didn't like it)
>
> Debugger entered--Lisp error: (wrong-type-argument char-or-string-p ni= l)
>=C2=A0 =C2=A0byte-code("REMOVED" [beg end org-clock-into-draw= er 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-elemen= t-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 ":" &q= uot;:\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)
>=C2=A0 =C2=A0org-clock-find-position(nil)
>=C2=A0 =C2=A0byte-code("REMOVED" [org-clock-resolving-clocks-= due-to-idleness
> org-clock-resolving-clocks org-clock-leftover-time leftover org--msg-e= xtra
> target-pos org-clocking-p nil "" t org-resolve-clocks (64) o= rg-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 poin= t-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 "\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]" &q= uot;\\1"
> match-string-no-properties "???" ...] 8)
>=C2=A0 =C2=A0org-clock-in(nil)
>=C2=A0 =C2=A0call-interactively(org-clock-in nil nil)
>=C2=A0 =C2=A0command-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] =3D>=C2=A0 1:= 29
> CLOCK: [2016-05-04 Wed 12:44]--[2016-05-04 Wed 12:44] =3D>=C2=A0 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] =3D>=C2=A0 0= :00
> CLOCK: [2016-04-29 Fri 13:14]--[2016-04-29 Fri 14:43] =3D>=C2=A0 1:= 29
> :END:

I cannot reproduce it. In the example above, I get

=C2=A0 * NEXT a task
=C2=A0 :LOGBOOK:
=C2=A0 CLOCK: [2016-05-05 Thu 09:52]
=C2=A0 CLOCK: [2016-05-04 Wed 12:44]--[2016-05-04 Wed 12:44] =3D>=C2=A0 = 0:00
=C2=A0 CLOCK: [2016-04-29 Fri 13:14]--[2016-04-29 Fri 14:43] =3D>=C2=A0 = 1:29
=C2=A0 :END:

> Any ideas?

Not quite. Could you provide a backtrace with an uncompiled Org
(org-reload with universal argument) ?

Regards,

--
Nicolas Goaziou
--001a11c37ad2bcd47e0532778ee2--