emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Gregor Zattler <telegraph@gmx.net>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] org-clock-sum: Wrong type argument: fixnump, nil [9.7-pre (release_9.6.22-1309-g8507ef @ /home/grfz/src/org-mode/lisp/)]
Date: Wed, 27 Mar 2024 00:11:24 +0100	[thread overview]
Message-ID: <875xx8mvvn.fsf@no.lan> (raw)
In-Reply-To: <87frwdnv9l.fsf@localhost>

Hi Ihor,
* Ihor Radchenko <yantar92@posteo.net> [2024-03-26; 10:27 GMT]:
> Gregor Zattler <telegraph@gmx.net> writes:
>
>> In the file.org_archive, with point on a clock line:
>>
>> Debugger entered--Lisp error: (wrong-type-argument fixnump nil)
>>   encode-time((0 nil nil nil nil nil nil -1 nil))
>>   (float-time (encode-time (list 0 (org-element--property :minute-start timestamp nil nil) (org-element--property :hour-start timestamp nil nil) (org-element--property :day-start timestamp nil nil) (org-element--property :month-start timestamp nil nil) (org-element--property :year-start timestamp nil nil) nil -1 nil)))
>
> This is helpful. You have some very strange timestamp.
> May you, when the backtrace window is active, press
> e (buffer-substring-no-properties (line-beginning-position -2) (line-end-position 3)) <RET>
> It should display text around the problematic timestamp.
>
> I'd like to see the problematic timestamp to understand what might be
> going on there.


thanks for your instructions, I edited it a bit:

"	    - SxxxxxII VPN vxx USB Sxxxx (xxxx)
	    CLOCK: [2012-02-02 Do 14:00]--[2012-02-02 Do 16:00] =>  2:00
	    - SxxxxxII; Rxxxxxx kxxxxx, nxxxxxxxxxxxx xxxxxxxxxx
	    Clock: [2012-02-01 Mi 17:34]--[2012-02-01 Mi 18:24] =>  0:50
	    - Gxxxxxxx-... #NV -Fxxxxx axxxxxxxx
	    CLOCK: [2012-02-01 Mi 17:04]--[2012-02-01 Mi 17:33] =>  0:29"


>> seems to be somewhat truncated.  Is there a way to get
>> it unabbreviated?
>
> Press "." (M-x backtrace-expand-ellipses)

this way I get:

Debugger entered--Lisp error: (wrong-type-argument fixnump nil)
  encode-time((0 nil nil nil nil nil nil -1 nil))
  (float-time (encode-time (list 0 (org-element--property :minute-start timestamp nil nil) (org-element--property :hour-start timestamp nil nil) (org-element--property :day-start timestamp nil nil) (org-element--property :month-start timestamp nil nil) (org-element--property :year-start timestamp nil nil) nil -1 nil)))
  (let* ((timestamp (org-element--property :value element nil nil)) (ts (float-time (encode-time (list 0 (org-element--property :minute-start timestamp nil nil) (org-element--property :hour-start timestamp nil nil) (org-element--property :day-start timestamp nil nil) (org-element--property :month-start timestamp nil nil) (org-element--property :year-start timestamp nil nil) nil -1 nil)))) (te (float-time (encode-time (list 0 (org-element--property :minute-end timestamp nil nil) (org-element--property :hour-end timestamp nil nil) (org-element--property :day-end timestamp nil nil) (org-element--property :month-end timestamp nil nil) (org-element--property :year-end timestamp nil nil) nil -1 nil)))) (dt (- (if tend (min te tend) te) (if tstart (max ts tstart) ts)))) (if (> dt 0) (progn (setq t1 (+ t1 (floor dt 60))))))
  (cond ((and (eq element-type 'clock) (match-end 2)) (let* ((timestamp (org-element--property :value element nil nil)) (ts (float-time (encode-time (list 0 (org-element--property :minute-start timestamp nil nil) (org-element--property :hour-start timestamp nil nil) (org-element--property :day-start timestamp nil nil) (org-element--property :month-start timestamp nil nil) (org-element--property :year-start timestamp nil nil) nil -1 nil)))) (te (float-time (encode-time (list 0 (org-element--property :minute-end timestamp nil nil) (org-element--property :hour-end timestamp nil nil) (org-element--property :day-end timestamp nil nil) (org-element--property :month-end timestamp nil nil) (org-element--property :year-end timestamp nil nil) nil -1 nil)))) (dt (- (if tend (min te tend) te) (if tstart (max ts tstart) ts)))) (if (> dt 0) (progn (setq t1 (+ t1 (floor dt 60))))))) ((match-end 4) (setq t1 (+ t1 (string-to-number (match-string 5)) (* 60 (string-to-number (match-string 4)))))) ((memq element-type '(headline inlinetask)) (if (and org-clock-report-include-clocking-task (eq (org-clocking-buffer) (current-buffer)) (eq (marker-position org-clock-hd-marker) (point)) tstart tend (>= (float-time org-clock-start-time) tstart) (<= (float-time org-clock-start-time) tend)) (progn (let ((time (floor (org-time-convert-to-integer (time-since org-clock-start-time)) 60))) (setq t1 (+ t1 time))))) (let* ((headline-forced (get-text-property (point) :org-clock-force-headline-inclusion)) (headline-included (or (null headline-filter) (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (funcall headline-filter)) (set-match-data saved-match-data t))))))) (setq level (- (match-end 1) (match-beginning 1))) (if (>= level lmax) (progn (progn (setq ltimes (vconcat ltimes (make-vector lmax 0))) (setq lmax (* 2 lmax))))) (if (or (> t1 0) (> (aref ltimes level) 0)) (progn (if (or headline-included headline-forced) (progn (if headline-included (let* ((l 0) (--cl-var-- level)) (while (<= l --cl-var--) (aset ltimes l (+ (aref ltimes l) t1)) (setq l (+ l 1))) nil)) (setq time (aref ltimes level)) (goto-char (match-beginning 0)) (put-text-property (point) (line-end-position) (or propname :org-clock-minutes) time) (if headline-filter (progn (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (while (org-up-heading-safe) (put-text-property (point) (line-end-position) :org-clock-force-headline-inclusion t))) (set-match-data saved-match-data t)))))))) (setq t1 0) (let* ((l level) (--cl-var-- (1- lmax))) (while (<= l --cl-var--) (aset ltimes l 0) (setq l (+ l 1))) nil))))))
  (let* ((element (let ((saved-match-data (match-data))) (unwind-protect (progn (org-element-at-point)) (set-match-data saved-match-data t)))) (element-type (org-element-type element))) (cond ((and (eq element-type 'clock) (match-end 2)) (let* ((timestamp (org-element--property :value element nil nil)) (ts (float-time (encode-time (list 0 (org-element--property :minute-start timestamp nil nil) (org-element--property :hour-start timestamp nil nil) (org-element--property :day-start timestamp nil nil) (org-element--property :month-start timestamp nil nil) (org-element--property :year-start timestamp nil nil) nil -1 nil)))) (te (float-time (encode-time (list 0 (org-element--property :minute-end timestamp nil nil) (org-element--property :hour-end timestamp nil nil) (org-element--property :day-end timestamp nil nil) (org-element--property :month-end timestamp nil nil) (org-element--property :year-end timestamp nil nil) nil -1 nil)))) (dt (- (if tend (min te tend) te) (if tstart (max ts tstart) ts)))) (if (> dt 0) (progn (setq t1 (+ t1 (floor dt 60))))))) ((match-end 4) (setq t1 (+ t1 (string-to-number (match-string 5)) (* 60 (string-to-number (match-string 4)))))) ((memq element-type '(headline inlinetask)) (if (and org-clock-report-include-clocking-task (eq (org-clocking-buffer) (current-buffer)) (eq (marker-position org-clock-hd-marker) (point)) tstart tend (>= (float-time org-clock-start-time) tstart) (<= (float-time org-clock-start-time) tend)) (progn (let ((time (floor (org-time-convert-to-integer (time-since org-clock-start-time)) 60))) (setq t1 (+ t1 time))))) (let* ((headline-forced (get-text-property (point) :org-clock-force-headline-inclusion)) (headline-included (or (null headline-filter) (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (funcall headline-filter)) (set-match-data saved-match-data t))))))) (setq level (- (match-end 1) (match-beginning 1))) (if (>= level lmax) (progn (progn (setq ltimes (vconcat ltimes (make-vector lmax 0))) (setq lmax (* 2 lmax))))) (if (or (> t1 0) (> (aref ltimes level) 0)) (progn (if (or headline-included headline-forced) (progn (if headline-included (let* ((l 0) (--cl-var-- level)) (while (<= l --cl-var--) (aset ltimes l (+ (aref ltimes l) t1)) (setq l (+ l 1))) nil)) (setq time (aref ltimes level)) (goto-char (match-beginning 0)) (put-text-property (point) (line-end-position) (or propname :org-clock-minutes) time) (if headline-filter (progn (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (while (org-up-heading-safe) (put-text-property (point) (line-end-position) :org-clock-force-headline-inclusion t))) (set-match-data saved-match-data t)))))))) (setq t1 0) (let* ((l level) (--cl-var-- (1- lmax))) (while (<= l --cl-var--) (aset ltimes l 0) (setq l (+ l 1))) nil)))))))
  (while (re-search-backward re nil t) (let* ((element (let ((saved-match-data (match-data))) (unwind-protect (progn (org-element-at-point)) (set-match-data saved-match-data t)))) (element-type (org-element-type element))) (cond ((and (eq element-type 'clock) (match-end 2)) (let* ((timestamp (org-element--property :value element nil nil)) (ts (float-time (encode-time (list 0 (org-element--property :minute-start timestamp nil nil) (org-element--property :hour-start timestamp nil nil) (org-element--property :day-start timestamp nil nil) (org-element--property :month-start timestamp nil nil) (org-element--property :year-start timestamp nil nil) nil -1 nil)))) (te (float-time (encode-time (list 0 (org-element--property :minute-end timestamp nil nil) (org-element--property :hour-end timestamp nil nil) (org-element--property :day-end timestamp nil nil) (org-element--property :month-end timestamp nil nil) (org-element--property :year-end timestamp nil nil) nil -1 nil)))) (dt (- (if tend (min te tend) te) (if tstart (max ts tstart) ts)))) (if (> dt 0) (progn (setq t1 (+ t1 (floor dt 60))))))) ((match-end 4) (setq t1 (+ t1 (string-to-number (match-string 5)) (* 60 (string-to-number (match-string 4)))))) ((memq element-type '(headline inlinetask)) (if (and org-clock-report-include-clocking-task (eq (org-clocking-buffer) (current-buffer)) (eq (marker-position org-clock-hd-marker) (point)) tstart tend (>= (float-time org-clock-start-time) tstart) (<= (float-time org-clock-start-time) tend)) (progn (let ((time (floor (org-time-convert-to-integer (time-since org-clock-start-time)) 60))) (setq t1 (+ t1 time))))) (let* ((headline-forced (get-text-property (point) :org-clock-force-headline-inclusion)) (headline-included (or (null headline-filter) (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (funcall headline-filter)) (set-match-data saved-match-data t))))))) (setq level (- (match-end 1) (match-beginning 1))) (if (>= level lmax) (progn (progn (setq ltimes (vconcat ltimes (make-vector lmax 0))) (setq lmax (* 2 lmax))))) (if (or (> t1 0) (> (aref ltimes level) 0)) (progn (if (or headline-included headline-forced) (progn (if headline-included (let* ((l 0) (--cl-var-- level)) (while (<= l --cl-var--) (aset ltimes l (+ (aref ltimes l) t1)) (setq l (+ l 1))) nil)) (setq time (aref ltimes level)) (goto-char (match-beginning 0)) (put-text-property (point) (line-end-position) (or propname :org-clock-minutes) time) (if headline-filter (progn (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (while (org-up-heading-safe) (put-text-property (point) (line-end-position) :org-clock-force-headline-inclusion t))) (set-match-data saved-match-data t)))))))) (setq t1 0) (let* ((l level) (--cl-var-- (1- lmax))) (while (<= l --cl-var--) (aset ltimes l 0) (setq l (+ l 1))) nil))))))))
  (save-excursion (goto-char (point-max)) (while (re-search-backward re nil t) (let* ((element (let ((saved-match-data (match-data))) (unwind-protect (progn (org-element-at-point)) (set-match-data saved-match-data t)))) (element-type (org-element-type element))) (cond ((and (eq element-type 'clock) (match-end 2)) (let* ((timestamp (org-element--property :value element nil nil)) (ts (float-time (encode-time (list 0 (org-element--property :minute-start timestamp nil nil) (org-element--property :hour-start timestamp nil nil) (org-element--property :day-start timestamp nil nil) (org-element--property :month-start timestamp nil nil) (org-element--property :year-start timestamp nil nil) nil -1 nil)))) (te (float-time (encode-time (list 0 (org-element--property :minute-end timestamp nil nil) (org-element--property :hour-end timestamp nil nil) (org-element--property :day-end timestamp nil nil) (org-element--property :month-end timestamp nil nil) (org-element--property :year-end timestamp nil nil) nil -1 nil)))) (dt (- (if tend (min te tend) te) (if tstart (max ts tstart) ts)))) (if (> dt 0) (progn (setq t1 (+ t1 (floor dt 60))))))) ((match-end 4) (setq t1 (+ t1 (string-to-number (match-string 5)) (* 60 (string-to-number (match-string 4)))))) ((memq element-type '(headline inlinetask)) (if (and org-clock-report-include-clocking-task (eq (org-clocking-buffer) (current-buffer)) (eq (marker-position org-clock-hd-marker) (point)) tstart tend (>= (float-time org-clock-start-time) tstart) (<= (float-time org-clock-start-time) tend)) (progn (let ((time (floor (org-time-convert-to-integer (time-since org-clock-start-time)) 60))) (setq t1 (+ t1 time))))) (let* ((headline-forced (get-text-property (point) :org-clock-force-headline-inclusion)) (headline-included (or (null headline-filter) (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (funcall headline-filter)) (set-match-data saved-match-data t))))))) (setq level (- (match-end 1) (match-beginning 1))) (if (>= level lmax) (progn (progn (setq ltimes (vconcat ltimes (make-vector lmax 0))) (setq lmax (* 2 lmax))))) (if (or (> t1 0) (> (aref ltimes level) 0)) (progn (if (or headline-included headline-forced) (progn (if headline-included (let* ((l 0) (--cl-var-- level)) (while (<= l --cl-var--) (aset ltimes l (+ (aref ltimes l) t1)) (setq l (+ l 1))) nil)) (setq time (aref ltimes level)) (goto-char (match-beginning 0)) (put-text-property (point) (line-end-position) (or propname :org-clock-minutes) time) (if headline-filter (progn (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (while (org-up-heading-safe) (put-text-property (point) (line-end-position) :org-clock-force-headline-inclusion t))) (set-match-data saved-match-data t)))))))) (setq t1 0) (let* ((l level) (--cl-var-- (1- lmax))) (while (<= l --cl-var--) (aset ltimes l 0) (setq l (+ l 1))) nil)))))))) (setq org-clock-file-total-minutes (aref ltimes 0)))
  (let* ((re (concat "^\\(\\*+\\)[ \11]\\|^[ \11]*" org-clock-string "[ \11]*\\(?:\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)\\|=>[ \11]+\\([0-9]+\\):\\([0-9]+\\)\\)")) (lmax 30) (ltimes (make-vector lmax 0)) (level 0) (tstart (cond ((stringp tstart) (org-time-string-to-seconds tstart)) ((consp tstart) (float-time tstart)) (t tstart))) (tend (cond ((stringp tend) (org-time-string-to-seconds tend)) ((consp tend) (float-time tend)) (t tend))) (t1 0) time) (remove-text-properties (point-min) (point-max) (cons (or propname :org-clock-minutes) '(t :org-clock-force-headline-inclusion t))) (save-excursion (goto-char (point-max)) (while (re-search-backward re nil t) (let* ((element (let ((saved-match-data (match-data))) (unwind-protect (progn (org-element-at-point)) (set-match-data saved-match-data t)))) (element-type (org-element-type element))) (cond ((and (eq element-type 'clock) (match-end 2)) (let* ((timestamp (org-element--property :value element nil nil)) (ts (float-time (encode-time (list 0 (org-element--property :minute-start timestamp nil nil) (org-element--property :hour-start timestamp nil nil) (org-element--property :day-start timestamp nil nil) (org-element--property :month-start timestamp nil nil) (org-element--property :year-start timestamp nil nil) nil -1 nil)))) (te (float-time (encode-time (list 0 (org-element--property :minute-end timestamp nil nil) (org-element--property :hour-end timestamp nil nil) (org-element--property :day-end timestamp nil nil) (org-element--property :month-end timestamp nil nil) (org-element--property :year-end timestamp nil nil) nil -1 nil)))) (dt (- (if tend (min te tend) te) (if tstart (max ts tstart) ts)))) (if (> dt 0) (progn (setq t1 (+ t1 (floor dt 60))))))) ((match-end 4) (setq t1 (+ t1 (string-to-number (match-string 5)) (* 60 (string-to-number (match-string 4)))))) ((memq element-type '(headline inlinetask)) (if (and org-clock-report-include-clocking-task (eq (org-clocking-buffer) (current-buffer)) (eq (marker-position org-clock-hd-marker) (point)) tstart tend (>= (float-time org-clock-start-time) tstart) (<= (float-time org-clock-start-time) tend)) (progn (let ((time (floor (org-time-convert-to-integer (time-since org-clock-start-time)) 60))) (setq t1 (+ t1 time))))) (let* ((headline-forced (get-text-property (point) :org-clock-force-headline-inclusion)) (headline-included (or (null headline-filter) (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (funcall headline-filter)) (set-match-data saved-match-data t))))))) (setq level (- (match-end 1) (match-beginning 1))) (if (>= level lmax) (progn (progn (setq ltimes (vconcat ltimes (make-vector lmax 0))) (setq lmax (* 2 lmax))))) (if (or (> t1 0) (> (aref ltimes level) 0)) (progn (if (or headline-included headline-forced) (progn (if headline-included (let* ((l 0) (--cl-var-- level)) (while (<= l --cl-var--) (aset ltimes l (+ (aref ltimes l) t1)) (setq l (+ l 1))) nil)) (setq time (aref ltimes level)) (goto-char (match-beginning 0)) (put-text-property (point) (line-end-position) (or propname :org-clock-minutes) time) (if headline-filter (progn (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (while (org-up-heading-safe) (put-text-property (point) (line-end-position) :org-clock-force-headline-inclusion t))) (set-match-data saved-match-data t)))))))) (setq t1 0) (let* ((l level) (--cl-var-- (1- lmax))) (while (<= l --cl-var--) (aset ltimes l 0) (setq l (+ l 1))) nil)))))))) (setq org-clock-file-total-minutes (aref ltimes 0))))
  (progn (let* ((re (concat "^\\(\\*+\\)[ \11]\\|^[ \11]*" org-clock-string "[ \11]*\\(?:\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)\\|=>[ \11]+\\([0-9]+\\):\\([0-9]+\\)\\)")) (lmax 30) (ltimes (make-vector lmax 0)) (level 0) (tstart (cond ((stringp tstart) (org-time-string-to-seconds tstart)) ((consp tstart) (float-time tstart)) (t tstart))) (tend (cond ((stringp tend) (org-time-string-to-seconds tend)) ((consp tend) (float-time tend)) (t tend))) (t1 0) time) (remove-text-properties (point-min) (point-max) (cons (or propname :org-clock-minutes) '(t :org-clock-force-headline-inclusion t))) (save-excursion (goto-char (point-max)) (while (re-search-backward re nil t) (let* ((element (let ((saved-match-data (match-data))) (unwind-protect (progn (org-element-at-point)) (set-match-data saved-match-data t)))) (element-type (org-element-type element))) (cond ((and (eq element-type 'clock) (match-end 2)) (let* ((timestamp (org-element--property :value element nil nil)) (ts (float-time (encode-time (list 0 (org-element--property :minute-start timestamp nil nil) (org-element--property :hour-start timestamp nil nil) (org-element--property :day-start timestamp nil nil) (org-element--property :month-start timestamp nil nil) (org-element--property :year-start timestamp nil nil) nil -1 nil)))) (te (float-time (encode-time (list 0 (org-element--property :minute-end timestamp nil nil) (org-element--property :hour-end timestamp nil nil) (org-element--property :day-end timestamp nil nil) (org-element--property :month-end timestamp nil nil) (org-element--property :year-end timestamp nil nil) nil -1 nil)))) (dt (- (if tend (min te tend) te) (if tstart (max ts tstart) ts)))) (if (> dt 0) (progn (setq t1 (+ t1 (floor dt 60))))))) ((match-end 4) (setq t1 (+ t1 (string-to-number (match-string 5)) (* 60 (string-to-number (match-string 4)))))) ((memq element-type '(headline inlinetask)) (if (and org-clock-report-include-clocking-task (eq (org-clocking-buffer) (current-buffer)) (eq (marker-position org-clock-hd-marker) (point)) tstart tend (>= (float-time org-clock-start-time) tstart) (<= (float-time org-clock-start-time) tend)) (progn (let ((time (floor (org-time-convert-to-integer (time-since org-clock-start-time)) 60))) (setq t1 (+ t1 time))))) (let* ((headline-forced (get-text-property (point) :org-clock-force-headline-inclusion)) (headline-included (or (null headline-filter) (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (funcall headline-filter)) (set-match-data saved-match-data t))))))) (setq level (- (match-end 1) (match-beginning 1))) (if (>= level lmax) (progn (progn (setq ltimes (vconcat ltimes (make-vector lmax 0))) (setq lmax (* 2 lmax))))) (if (or (> t1 0) (> (aref ltimes level) 0)) (progn (if (or headline-included headline-forced) (progn (if headline-included (let* ((l 0) (--cl-var-- level)) (while (<= l --cl-var--) (aset ltimes l (+ (aref ltimes l) t1)) (setq l (+ l 1))) nil)) (setq time (aref ltimes level)) (goto-char (match-beginning 0)) (put-text-property (point) (line-end-position) (or propname :org-clock-minutes) time) (if headline-filter (progn (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (while (org-up-heading-safe) (put-text-property (point) (line-end-position) :org-clock-force-headline-inclusion t))) (set-match-data saved-match-data t)))))))) (setq t1 0) (let* ((l level) (--cl-var-- (1- lmax))) (while (<= l --cl-var--) (aset ltimes l 0) (setq l (+ l 1))) nil)))))))) (setq org-clock-file-total-minutes (aref ltimes 0)))))
  (unwind-protect (progn (let* ((re (concat "^\\(\\*+\\)[ \11]\\|^[ \11]*" org-clock-string "[ \11]*\\(?:\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)\\|=>[ \11]+\\([0-9]+\\):\\([0-9]+\\)\\)")) (lmax 30) (ltimes (make-vector lmax 0)) (level 0) (tstart (cond ((stringp tstart) (org-time-string-to-seconds tstart)) ((consp tstart) (float-time tstart)) (t tstart))) (tend (cond ((stringp tend) (org-time-string-to-seconds tend)) ((consp tend) (float-time tend)) (t tend))) (t1 0) time) (remove-text-properties (point-min) (point-max) (cons (or propname :org-clock-minutes) '(t :org-clock-force-headline-inclusion t))) (save-excursion (goto-char (point-max)) (while (re-search-backward re nil t) (let* ((element (let ((saved-match-data (match-data))) (unwind-protect (progn (org-element-at-point)) (set-match-data saved-match-data t)))) (element-type (org-element-type element))) (cond ((and (eq element-type 'clock) (match-end 2)) (let* ((timestamp (org-element--property :value element nil nil)) (ts (float-time (encode-time (list 0 (org-element--property :minute-start timestamp nil nil) (org-element--property :hour-start timestamp nil nil) (org-element--property :day-start timestamp nil nil) (org-element--property :month-start timestamp nil nil) (org-element--property :year-start timestamp nil nil) nil -1 nil)))) (te (float-time (encode-time (list 0 (org-element--property :minute-end timestamp nil nil) (org-element--property :hour-end timestamp nil nil) (org-element--property :day-end timestamp nil nil) (org-element--property :month-end timestamp nil nil) (org-element--property :year-end timestamp nil nil) nil -1 nil)))) (dt (- (if tend (min te tend) te) (if tstart (max ts tstart) ts)))) (if (> dt 0) (progn (setq t1 (+ t1 (floor dt 60))))))) ((match-end 4) (setq t1 (+ t1 (string-to-number (match-string 5)) (* 60 (string-to-number (match-string 4)))))) ((memq element-type '(headline inlinetask)) (if (and org-clock-report-include-clocking-task (eq (org-clocking-buffer) (current-buffer)) (eq (marker-position org-clock-hd-marker) (point)) tstart tend (>= (float-time org-clock-start-time) tstart) (<= (float-time org-clock-start-time) tend)) (progn (let ((time (floor (org-time-convert-to-integer (time-since org-clock-start-time)) 60))) (setq t1 (+ t1 time))))) (let* ((headline-forced (get-text-property (point) :org-clock-force-headline-inclusion)) (headline-included (or (null headline-filter) (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (funcall headline-filter)) (set-match-data saved-match-data t))))))) (setq level (- (match-end 1) (match-beginning 1))) (if (>= level lmax) (progn (progn (setq ltimes (vconcat ltimes (make-vector lmax 0))) (setq lmax (* 2 lmax))))) (if (or (> t1 0) (> (aref ltimes level) 0)) (progn (if (or headline-included headline-forced) (progn (if headline-included (let* ((l 0) (--cl-var-- level)) (while (<= l --cl-var--) (aset ltimes l (+ (aref ltimes l) t1)) (setq l (+ l 1))) nil)) (setq time (aref ltimes level)) (goto-char (match-beginning 0)) (put-text-property (point) (line-end-position) (or propname :org-clock-minutes) time) (if headline-filter (progn (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (while (org-up-heading-safe) (put-text-property (point) (line-end-position) :org-clock-force-headline-inclusion t))) (set-match-data saved-match-data t)))))))) (setq t1 0) (let* ((l level) (--cl-var-- (1- lmax))) (while (<= l --cl-var--) (aset ltimes l 0) (setq l (+ l 1))) nil)))))))) (setq org-clock-file-total-minutes (aref ltimes 0))))) (if (or (not modified) (eq modified 'autosaved)) (progn (restore-buffer-modified-p modified))))
  (let* ((modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) (inhibit-modification-hooks t)) (unwind-protect (progn (let* ((re (concat "^\\(\\*+\\)[ \11]\\|^[ \11]*" org-clock-string "[ \11]*\\(?:\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)\\|=>[ \11]+\\([0-9]+\\):\\([0-9]+\\)\\)")) (lmax 30) (ltimes (make-vector lmax 0)) (level 0) (tstart (cond ((stringp tstart) (org-time-string-to-seconds tstart)) ((consp tstart) (float-time tstart)) (t tstart))) (tend (cond ((stringp tend) (org-time-string-to-seconds tend)) ((consp tend) (float-time tend)) (t tend))) (t1 0) time) (remove-text-properties (point-min) (point-max) (cons (or propname :org-clock-minutes) '(t :org-clock-force-headline-inclusion t))) (save-excursion (goto-char (point-max)) (while (re-search-backward re nil t) (let* ((element (let ((saved-match-data (match-data))) (unwind-protect (progn (org-element-at-point)) (set-match-data saved-match-data t)))) (element-type (org-element-type element))) (cond ((and (eq element-type 'clock) (match-end 2)) (let* ((timestamp (org-element--property :value element nil nil)) (ts (float-time (encode-time (list 0 (org-element--property :minute-start timestamp nil nil) (org-element--property :hour-start timestamp nil nil) (org-element--property :day-start timestamp nil nil) (org-element--property :month-start timestamp nil nil) (org-element--property :year-start timestamp nil nil) nil -1 nil)))) (te (float-time (encode-time (list 0 (org-element--property :minute-end timestamp nil nil) (org-element--property :hour-end timestamp nil nil) (org-element--property :day-end timestamp nil nil) (org-element--property :month-end timestamp nil nil) (org-element--property :year-end timestamp nil nil) nil -1 nil)))) (dt (- (if tend (min te tend) te) (if tstart (max ts tstart) ts)))) (if (> dt 0) (progn (setq t1 (+ t1 (floor dt 60))))))) ((match-end 4) (setq t1 (+ t1 (string-to-number (match-string 5)) (* 60 (string-to-number (match-string 4)))))) ((memq element-type '(headline inlinetask)) (if (and org-clock-report-include-clocking-task (eq (org-clocking-buffer) (current-buffer)) (eq (marker-position org-clock-hd-marker) (point)) tstart tend (>= (float-time org-clock-start-time) tstart) (<= (float-time org-clock-start-time) tend)) (progn (let ((time (floor (org-time-convert-to-integer (time-since org-clock-start-time)) 60))) (setq t1 (+ t1 time))))) (let* ((headline-forced (get-text-property (point) :org-clock-force-headline-inclusion)) (headline-included (or (null headline-filter) (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (funcall headline-filter)) (set-match-data saved-match-data t))))))) (setq level (- (match-end 1) (match-beginning 1))) (if (>= level lmax) (progn (progn (setq ltimes (vconcat ltimes (make-vector lmax 0))) (setq lmax (* 2 lmax))))) (if (or (> t1 0) (> (aref ltimes level) 0)) (progn (if (or headline-included headline-forced) (progn (if headline-included (let* ((l 0) (--cl-var-- level)) (while (<= l --cl-var--) (aset ltimes l (+ (aref ltimes l) t1)) (setq l (+ l 1))) nil)) (setq time (aref ltimes level)) (goto-char (match-beginning 0)) (put-text-property (point) (line-end-position) (or propname :org-clock-minutes) time) (if headline-filter (progn (save-excursion (let ((saved-match-data (match-data))) (unwind-protect (progn (while (org-up-heading-safe) (put-text-property (point) (line-end-position) :org-clock-force-headline-inclusion t))) (set-match-data saved-match-data t)))))))) (setq t1 0) (let* ((l level) (--cl-var-- (1- lmax))) (while (<= l --cl-var--) (aset ltimes l 0) (setq l (+ l 1))) nil)))))))) (setq org-clock-file-total-minutes (aref ltimes 0))))) (if (or (not modified) (eq modified 'autosaved)) (progn (restore-buffer-modified-p modified)))))
  org-clock-sum()
  eval((org-clock-sum) t)
  #f(compiled-function () #<bytecode -0x929962e206d445e>)()
  #f(compiled-function () #<bytecode -0x5db3e1955cb81d1>)()
  eval-expression((org-clock-sum) nil nil 127)
  funcall-interactively(eval-expression (org-clock-sum) nil nil 127)
  command-execute(eval-expression)


HTH, Gregor


  reply	other threads:[~2024-03-26 23:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-23 22:20 [BUG] org-clock-sum: Wrong type argument: fixnump, nil [9.7-pre (release_9.6.22-1309-g8507ef @ /home/grfz/src/org-mode/lisp/)] Gregor Zattler
2024-03-24 13:27 ` Ihor Radchenko
2024-03-25 15:46   ` Gregor Zattler
2024-03-25 18:20     ` Ihor Radchenko
2024-03-25 18:37       ` Gregor Zattler
2024-03-26 10:27         ` Ihor Radchenko
2024-03-26 23:11           ` Gregor Zattler [this message]
2024-03-27 12:00             ` Ihor Radchenko
2024-03-28  7:53               ` Gregor Zattler
2024-03-26 11:34     ` Max Nikulin

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=875xx8mvvn.fsf@no.lan \
    --to=telegraph@gmx.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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).