emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Error with removing zero time clocks in capture.
@ 2014-09-11  9:05 Malcolm Purvis
  2014-09-11 21:20 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Malcolm Purvis @ 2014-09-11  9:05 UTC (permalink / raw)
  To: emacs-orgmode

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 <malcolm@purvis.id.au>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Error with removing zero time clocks in capture.
  2014-09-11  9:05 Error with removing zero time clocks in capture Malcolm Purvis
@ 2014-09-11 21:20 ` Nicolas Goaziou
  2014-09-11 22:31   ` Malcolm Purvis
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2014-09-11 21:20 UTC (permalink / raw)
  To: Malcolm Purvis; +Cc: emacs-orgmode

Hello,

Malcolm Purvis <malcolm@purvis.id.au> writes:

> 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.

This should be fixed. Thank you for reporting it.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Error with removing zero time clocks in capture.
  2014-09-11 21:20 ` Nicolas Goaziou
@ 2014-09-11 22:31   ` Malcolm Purvis
  0 siblings, 0 replies; 3+ messages in thread
From: Malcolm Purvis @ 2014-09-11 22:31 UTC (permalink / raw)
  To: emacs-orgmode

>>>>> "Nicolas" == Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

Nicolas> This should be fixed. Thank you for reporting it.

I can confirm that the error has gone.

Thanks,

Malcolm

-- 
	       Malcolm Purvis <malcolm@purvis.id.au>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-11 22:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-11  9:05 Error with removing zero time clocks in capture Malcolm Purvis
2014-09-11 21:20 ` Nicolas Goaziou
2014-09-11 22:31   ` Malcolm Purvis

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).