From mboxrd@z Thu Jan 1 00:00:00 1970 From: Malcolm Purvis Subject: Error with removing zero time clocks in capture. Date: Thu, 11 Sep 2014 19:05:49 +1000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS0KH-0003YI-1A for emacs-orgmode@gnu.org; Thu, 11 Sep 2014 05:06:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XS0KB-0003XA-5N for emacs-orgmode@gnu.org; Thu, 11 Sep 2014 05:06:00 -0400 Received: from mail109.syd.optusnet.com.au ([211.29.132.80]:40364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS0KA-0003Vp-JL for emacs-orgmode@gnu.org; Thu, 11 Sep 2014 05:05:55 -0400 Received: from purvis.id.au (c110-20-44-66.rivrw8.nsw.optusnet.com.au [110.20.44.66]) by mail109.syd.optusnet.com.au (Postfix) with ESMTP id 755C6D64ADD for ; Thu, 11 Sep 2014 19:05:51 +1000 (EST) 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org With the current git version of org (release_8.3beta-323-gec8f24) I'm getting an error in the element cache when I try to capture a task because the clocked time for the captured task is 0. The following minimum configuration demonstrates the problem: --8<---------------cut here---------------start------------->8--- (require 'org) (global-set-key (kbd "C-c c") 'org-capture) (setq org-default-notes-file "/tmp/inbox.org") (setq org-capture-templates (quote (("t" "todo" entry (file) "* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t)))) (setq org-clock-out-remove-zero-time-clocks t) (setq org-log-into-drawer t) --8<---------------cut here---------------end--------------->8--- Typing the sequence "C-c c t C-c C-c" will result in the following backtrace: --8<---------------cut here---------------start------------->8--- Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil) <=(nil 666) (and (memq (org-element-type up) (quote (center-block drawer dynamic-block quote-block special-block))) (<= (org-element-property :contents-begin up) beg) (> (org-element-property :contents-end up) end)) (if (and (memq (org-element-type up) (quote (center-block drawer dynamic-block quote-block special-block))) (<= (org-element-property :contents-begin up) beg) (> (org-element-property :contents-end up) end)) (org-element--cache-shift-positions up offset (quote (:contents-end :end))) (setq before up) (if robust-flag (progn (setq robust-flag nil)))) (while up (if (and (memq (org-element-type up) (quote (center-block drawer dynamic-block quote-block special-block))) (<= (org-element-property :contents-begin up) beg) (> (org-element-property :contents-end up) end)) (org-element--cache-shift-positions up offset (quote (:contents-end :end))) (setq before up) (if robust-flag (progn (setq robust-flag nil)))) (setq up (org-element-property :parent up))) (let ((up before) (robust-flag t)) (while up (if (and (memq (org-element-type up) (quote (center-block drawer dynamic-block quote-block special-block))) (<= (org-element-property :contents-begin up) beg) (> (org-element-property :contents-end up) end)) (org-element--cache-shift-positions up offset (quote (:contents-end :end))) (setq before up) (if robust-flag (progn (setq robust-flag nil)))) (setq up (org-element-property :parent up))) (if (or (< (org-element-property :end before) beg) robust-flag) after before)) (if (not before) after (let ((up before) (robust-flag t)) (while up (if (and (memq (org-element-type up) (quote (center-block drawer dynamic-block quote-block special-block))) (<= (org-element-property :contents-begin up) beg) (> (org-element-property :contents-end up) end)) (org-element--cache-shift-positions up offset (quote (:contents-end :end))) (setq before up) (if robust-flag (progn (setq robust-flag nil)))) (setq up (org-element-property :parent up))) (if (or (< (org-element-property :end before) beg) robust-flag) after before))) (let* ((elements (org-element--cache-find (1- beg) (quote both))) (before (car elements)) (after (cdr elements))) (if (not before) after (let ((up before) (robust-flag t)) (while up (if (and (memq (org-element-type up) (quote ...)) (<= (org-element-property :contents-begin up) beg) (> (org-element-property :contents-end up) end)) (org-element--cache-shift-positions up offset (quote (:contents-end :end))) (setq before up) (if robust-flag (progn (setq robust-flag nil)))) (setq up (org-element-property :parent up))) (if (or (< (org-element-property :end before) beg) robust-flag) after before)))) org-element--cache-for-removal(666 667 -1) (let ((first (org-element--cache-for-removal beg end offset))) (if first (setq org-element--cache-sync-requests (cons (let ((beg (org-element-property :begin first)) (key (org-element--cache-key first))) (cond ((> beg end) (vector key beg nil offset nil nil 1)) ((let ... ...)) (t (let* ... ... ...)))) org-element--cache-sync-requests)) (if org-element--cache-sync-requests (progn (let* ((v (car org-element--cache-sync-requests))) (aset v 3 (+ (aref v 3) offset))))))) (if (and next (zerop (aref next 6)) (> (setq delete-to (+ (aref next 2) (aref next 3))) end) (<= (setq delete-from (aref next 1)) end)) (progn (let* ((v next)) (aset v 3 (+ (aref v 3) offset))) (if (> beg delete-from) (let ((up (aref next 5))) (while up (org-element--cache-shift-positions up offset (quote (:contents-end :end))) (setq up (org-element-property :parent up)))) (let ((first (org-element--cache-for-removal beg delete-to offset))) (if first (progn (aset next 0 (org-element--cache-key first)) (aset next 1 (org-element-property :begin first)) (aset next 5 (org-element-property :parent first))))))) (if next (progn (org-element--cache-sync (current-buffer) end beg))) (let ((first (org-element--cache-for-removal beg end offset))) (if first (setq org-element--cache-sync-requests (con s (let ((beg ...) (key ...)) (cond (... ...) (...) (t ...))) org-element--cache-sync-requests)) (if org-element--cache-sync-requests (progn (let* ((v ...)) (aset v 3 (+ ... offset)))))))) (let ((next (car org-element--cache-sync-requests)) delete-to delete-from) (if (and next (zerop (aref next 6)) (> (setq delete-to (+ (aref next 2) (aref next 3))) end) (<= (setq delete-from (aref next 1)) end)) (progn (let* ((v next)) (aset v 3 (+ (aref v 3) offset))) (if (> beg delete-from) (let ((up (aref next 5))) (while up (org-element--cache-shift-positions up offset (quote ...)) (setq up (org-element-property :parent up)))) (let ((first (org-element--cache-for-removal beg delete-to offset))) (if first (progn (aset next 0 ...) (aset next 1 ...) (aset next 5 ...)))))) (if next (progn (org-element--cache-sync (current-buffer) end beg))) (let ((first (org-element--cache-for-removal beg end offset))) (if first (setq org-element--cache-sync-requests (cons (let (... ...) (cond ... ... ... )) org-element--cache-sync-requests)) (if org-element--cache-sync-requests (progn (let* (...) (aset v 3 ...)))))))) org-element--cache-submit-request(666 667 -1) (let ((offset (- end beg pre))) (org-element--cache-submit-request top (- bottom offset) offset)) (let ((top (point)) (bottom (save-excursion (goto-char end) (line-end-position)))) (if (cond ((memql org-element--cache-change-warning (quote (t))) t) ((eql org-element--cache-change-warning (quote headline)) (not (and (let* (... ... ... ...) (org-at-heading-p)) (= (line-end-position) bottom)))) (t (let ((case-fold-search t)) (re-search-forward org-element--cache-sensitive-re bottom t)))) (progn (let* ((org-called-with-limited-levels t) (org-outline-regexp (org-get-limited-outline-regexp)) (outline-regexp org-outline-regexp) (org-outline-regexp-bol (concat "^" org-outline-regexp))) (setq top (progn (goto-char top) (if (outline-previous-heading) (progn ...)) (point))) (setq bottom (progn (goto-char bottom) (if (outline-next-heading) (1- ...) (point))))))) (let ((offset (- end beg pre))) ( org-element--cache-submit-request top (- bottom offset) offset))) (progn (let ((top (point)) (bottom (save-excursion (goto-char end) (line-end-position)))) (if (cond ((memql org-element--cache-change-warning (quote (t))) t) ((eql org-element--cache-change-warning (quote headline)) (not (and (let* ... ...) (= ... bottom)))) (t (let ((case-fold-search t)) (re-search-forward org-element--cache-sensitive-re bottom t)))) (progn (let* ((org-called-with-limited-levels t) (org-outline-regexp (org-get-limited-outline-regexp)) (outline-regexp org-outline-regexp) (org-outline-regexp-bol (concat "^" org-outline-regexp))) (setq top (progn (goto-char top) (if ... ...) (point))) (setq bottom (progn (goto-char bottom) (if ... ... ...)))))) (let ((offset (- end beg pre))) (org-element--cache-submit-request top (- bottom offset) offset)))) (unwind-protect (progn (let ((top (point)) (bottom (save-excursion (goto-char end) (line-end-position)))) (if (cond ((memql org-element--cache-change-warning (quote ...)) t) ((eql org-element--cache-change-warning (quote headline)) (not (and ... ...))) (t (let (...) (re-search-forward org-element--cache-sensitive-re bottom t)))) (progn (let* ((org-called-with-limited-levels t) (org-outline-regexp ...) (outline-regexp org-outline-regexp) (org-outline-regexp-bol ...)) (setq top (progn ... ... ...)) (setq bottom (progn ... ...))))) (let ((offset (- end beg pre))) (org-element--cache-submit-request top (- bottom offset) offset)))) (set-match-data save-match-data-internal (quote evaporate))) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (let ((top (point)) (bottom (save-excursion (goto-char end) (line-end-position)))) (if (cond ((memql org-element--cache-change-warning ...) t) ((eql org-element--cache-change-warning ...) (not ...)) (t (let ... ...))) (progn (let* (... ... ... ...) (setq top ...) (setq bottom ...)))) (let ((offset (- end beg pre))) (org-element--cache-submit-request top (- bottom offset) offset)))) (set-match-data save-match-data-internal (quote evaporate)))) (save-restriction (widen) (goto-char beg) (beginning-of-line) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (let ((top (point)) (bottom (save-excursion ... ...))) (if (cond (... t) (... ...) (t ...)) (progn (let* ... ... ...))) (let ((offset ...)) (org-element--cache-submit-request top (- bottom offset) offset)))) (set-match-data save-match-data-internal (quote evaporate))))) (save-excursion (save-restriction (widen) (goto-char beg) (beginning-of-line) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (let ((top ...) (bottom ...)) (if (cond ... ... ...) (progn ...)) (let (...) (org-element--cache-submit-request top ... offset)))) (set-match-data save-match-data-internal (quote evaporate)))))) (progn (save-excursion (save-restriction (widen) (goto-char beg) (beginning-of-line) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (let (... ...) (if ... ...) (let ... ...))) (set-match-data save-match-data-internal (quote evaporate)))))) (org-element--cache-set-timer (current-buffer))) (if (org-element--cache-active-p) (progn (save-excursion (save-restriction (widen) (goto-char beg) (beginning-of-line) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (let ... ... ...)) (set-match-data save-match-data-internal (quote evaporate)))))) (org-element--cache-set-timer (current-buffer)))) org-element--cache-after-change(666 666 1) replace-match("") org-capture-empty-lines-after(0) org-capture-finalize(nil) call-interactively(org-capture-finalize nil nil) --8<---------------cut here---------------end--------------->8--- I assume that the cache code is trying to remove the clock information from the draw that has already been removed because org-clock-out-remove-zero-time-clocks is set. Malcolm -- Malcolm Purvis