Closed boudiccas closed 7 months ago
Can you produce the entire stack trace? Run M-x toggle-debug-on-error
then reproduce the problem. A stacktrace buffer should pop up.
This is the output.
Debug on Error enabled globally
(wrong-number-of-arguments (1 . 1) 2) in org-clock-sum
Does that help?
It gets to the stage where its created the buffer to display the org-clock-budget report, but does not populate it, which is why I feel that there is some error in my clock budget timesheets which is causing the problem. Plus the rather strange syntax of (1 . 1) 2), as if somewhere in my timesheets 1+1 does not equal 2! Does that make sense?
The above is not the whole stack trace, it should have at least 20 lines. It shows me how the code is called in sequence so that I can debug the chain.
The syntax (1 . 1) 2
means that the function expects at least 1 and at most 1 argument (which means exactly one) but we are giving it two arguments. Which might mean that something changed in newer versions of org-mode
and this code is no longer compatible.
Can you use C-h f org-clock-sum
and paste the documentation here?
This is what I get
org-clock-sum is an autoloaded Lisp closure in `org-clock.el'.
(org-clock-sum &optional TSTART TEND HEADLINE-FILTER PROPNAME)
Sum the times for each subtree.
Puts the resulting times in minutes as a text property on each headline.
TSTART and TEND can mark a time range to be considered.
HEADLINE-FILTER is a zero-arg function that, if specified, is called for
each headline in the time range with point at the headline. Headlines for
which HEADLINE-FILTER returns nil are excluded from the clock summation.
PROPNAME lets you set a custom text property instead of :org-clock-minutes.
[back]
As you can see on the second line it accepts 4 arguments.
org-clock-sum is an autoloaded compiled Lisp function in ‘org-clock.el’.
(org-clock-sum &optional TSTART TEND HEADLINE-FILTER PROPNAME)
Sum the times for each subtree. Puts the resulting times in minutes as a text property on each headline. TSTART and TEND can mark a time range to be considered. HEADLINE-FILTER is a zero-arg function that, if specified, is called for each headline in the time range with point at the headline. Headlines for which HEADLINE-FILTER returns nil are excluded from the clock summation. PROPNAME lets you set a custom text property instead of :org-clock-minutes.
Hm, then the problem is somewhere else. Unfortunately I can't repro this and without the stack trace it's quite difficult to figure out.
Can you check what the value of the variable debug-on-error
is? If it is nil
, then use M-x toggle-debug-on-error
once more and check it changes to t
. (you can check the value of the variable with C-h v
debug-on-error is a variable defined in ‘C source code’.
Its value is t
Original value was nil
What happens if you have two time-clock entries, exactly the same date and times in a different project? could that cause my problem? i can't check it at this end because everything seem to be okay, When I generate a clocksum for each of my projects that is tracked with org-clock-budget there doesn't seem to be any discrepancies thrown up.
I started using 'org-super-agenda' on 24/7/2107 so maybe this is what's causing my problem? That is the only program that I know that may affect org-clock-budget, and my updated org-plus-contrib from 14/08/2017.
It shouldn't matter, each entry is summed separately. The error here is that something somewhere changed the API and we are trying to send in data which it can't handle. If org-super-agenda
redefines some built-in functions that can be a problem. But I don't know that package at all.
@alphapapa Do you have any ideas here? Any help is appreciated :)
I've commented org-super-agenda out and removed it with a paradox. but the problem still remains, so its not org-super-agenda. I'm calling org-clock-budget from my easy menu with this line
["Clock budget report" org-clock-budget-report]
and this is its setting in my conf file
*** org-clock-budget
#+begin_src emacs-lisp
(require 'org-clock-budget)
#+end_src
[2016-08-14 Sun 09:50]
I have no entries for org-clock-budget in my custom.el, and my org-clock-budget.el is stored as
/home/boudiccas/.emacs.d/lisp/org-clock-budget.el
and is dated 21-08-2016.
Just for your info which might help in diagnosing the problem.
org-super-agenda
doesn't redefine any functions, it only advises a single function, org-agenda-finalize-entries
, and that only affects agenda views.
Two questions:
Three suggestions:
emacs -q
and emacs -Q
. If it doesn't happen with those, it must be someting in your personal config.~/.emacs.d
directory and run grep -r "(defun org-clock-sum"
, to see if anything is redefining that function. Although I guess that isn't the case, since the describe-function
for it seems correct.bug-hunter
package, which will bisect your init file and isolate the form that causes the problem, which might be the loading of a certain package.Provisional answers 1 - emacs 25.1.1 2 - org-mode version = Org mode version 9.0.9 (9.0.9-88-g251f88-elpaplus @ /home/boudiccas/.emacs.d/elpa/org-plus-contrib-20170821/)
2 -
grep -r "(defun org-clock-sum"
elpa/org-plus-contrib-20170821/org-clock.el:(defun org-clock-sum-today (&optional headline-filter)
elpa/org-plus-contrib-20170821/org-clock.el:(defun org-clock-sum-custom (&optional headline-filter range propname)
elpa/org-plus-contrib-20170821/org-clock.el:(defun org-clock-sum (&optional tstart tend headline-filter propname)
elpa/org-plus-contrib-20170821/org-clock.el:(defun org-clock-sum-current-item (&optional tstart)
No errors reported with bug-hunter on my init.el, so I ran bug-hunter-file on org-clock-budget.el, and this is what it says -
Doing some initial tests...
Initial tests done. Hunting for the cause...
#("/home/boudiccas/.emacs.d/lisp/org-clock-budget.el" 25 30 (face flx-highlight-face)), line 29 pos 0:
The following error was signaled here:
(file-error "Cannot open load file" "No such file or directory" "dash")
Caused by the following expression:
(require 'dash)
Then it seems you need to install the dash
library. Did you use package.el to install this package? If so it should pull dependencies automatically. If not, grab it here: https://github.com/magnars/dash.el
dash was loaded as a dependency, I've now explicitly loaded it as (require 'dash) and restarted emacs but the problem still remains. dash is version 20170810.
Perhaps there is something changed in dash that affects org-clock-budget? or in org-clock? Or some Frankenstein-like error thrown up with the combination of both of them?
But I'm getting the same bug-hunter problem as already shown.
I recommend deleting all copies of dash
and org-clock-budget
and reinstalling org-clock-budget
. There may be a problem with stale .elc
files. I come across this from time-to-time and I haven't been able to figure out what happens, but clearing out stale .elc
files often fixes it.
i can't delete dash, its a dependency of ereader, xml+, wrap-region, tile, string-edit, spaceline, smartparens, skeletor, and even more. I gave up at that point! I then tried physically removing it from elpa and then started paradox again, which showed dash as being deleted but i wasn't able to reinstall it or delete it through paradox, so I'm stuck now! I've reinstalled all those I've marked earlier and it should hopefully be okay if I was to restart emacs. So I don't know what the solution is now.
looking at dash I wonder if pull request #222 is causing the problem that I've found in org-clock-budget, as that seems to have triggered the update of 20170810?
Sorry, I wasn't clear:
~/.emacs.d/elpa/dash-*
and ~/.emacs.d/elpa/org-clock-budget-*
package-install
and install dash
and org-clock-budget
.I don't see how https://github.com/magnars/dash.el/pull/222 could have caused any problems, since all it does is add new functions to dash.
I suspect that if you reinstall the relevant packages from scratch, after deleting all traces of them from the elpa
directory, the problem will go away. That's usually the case for me when I have inexplicable problems with addon packages.
~/.emacs.d/elpa/dash-*
then paradox (the package manager) lists it as deleted, and I then can't reinstall it. org-clock-budget
is just one file living in ~/.emacs.d/lisp/
. If I then try to install dash through M-x package-install
it does not give me the option of installing dash, so I'm stymied again. I've removed and replaced org-clock-budget
from a fresh update of the git repo, and its made no difference.As bug-hunter-file run on org-clock-budget shows that its finding a problem at line #29 which is (require 'dash)
I'm opining that the problem is lying within dash itself. And possibly with the merge-request of #222, which is possibly the reason for the dash update.
rm -rf ~/.emacs.d/elpa/dash-* ~/.emacs.d/lisp/org-clock-budget*
package-install
.org-clock-budget
file.done exactly
as you prescribed, but the problem still remains, unfortunately.
Although I do notice one difference, I removed dash 20170810
and have just installed dash 2.12.0
You can also try to use edebug
to walk through the function and pinpoint the problematic place: https://www.gnu.org/software/emacs/manual/html_node/elisp/Using-Edebug.html
Ok, I think we're back to needing the full backtrace. What you gave earlier was just:
Debug on Error enabled globally
(wrong-number-of-arguments (1 . 1) 2) in org-clock-sum
It should be several lines long.
I'm sorry, but I've reached the limits of my comfort zone, I don't feel happy or confident to attempt to use edebug
You should be able to produce the full backtrace by setting debug-on-error
and reproducing the problem. That doesn't require edebug.
When I run debug-on-error
this is what I get
Debug on Error enabled globally
(wrong-number-of-arguments (1 . 1) 2) in org-clock-sum
What buffer are you copying that from? There should be a *Backtrace*
buffer containing the full backtrace.
After eviscerating my config file, I've finally been able to produce a backtrace, so here it is -
Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 1) 2)
org-time-string-to-seconds("2017-01-01" t)
org-clock-sum("2017-01-01" "2017-12-31 23:59:59")
org-clock-budget--get-entry-clocked("2017-01-01" "2017-12-31 23:59:59")
org-clock-budget--get-entries-with-budget("2017-01-01" "2017-12-31 23:59:59" "BUDGET_YEAR")
#[257 "\211\211A\262\242@\211 \211A\262\242\300#\266\203\207" [org-clock-budget--get-entries-with-budget] 11 "\n\n(fn INPUT0)"](("BUDGET_YEAR" org-clock-budget-interval-this-year))
#[257 "\300!\207" [#[257 "\211\211A\262\242@\211 \211A\262\242\300#\266\203\207" [org-clock-budget--get-entries-with-budget] 11 "\n\n(fn INPUT0)"]] 3 "\n\n(fn IT)"](("BUDGET_YEAR" org-clock-budget-interval-this-year))
mapcar(#[257 "\300!\207" [#[257 "\211\211A\262\242@\211 \211A\262\242\300#\266\203\207" [org-clock-budget--get-entries-with-budget] 11 "\n\n(fn INPUT0)"]] 3 "\n\n(fn IT)"] (("BUDGET_YEAR" org-clock-budget-interval-this-year) ("BUDGET_MONTH" org-clock-budget-interval-this-month) ("BUDGET_WEEK" org-clock-budget-interval-this-week)))
-mapcat(#[257 "\211\211A\262\242@\211 \211A\262\242\300#\266\203\207" [org-clock-budget--get-entries-with-budget] 11 "\n\n(fn INPUT0)"] (("BUDGET_YEAR" org-clock-budget-interval-this-year) ("BUDGET_MONTH" org-clock-budget-interval-this-month) ("BUDGET_WEEK" org-clock-budget-interval-this-week)))
org-clock-budget()
#[257 "r\300!q\210\301 )\207" [org-get-agenda-file-buffer org-clock-budget] 3 "\n\n(fn IT)"]("/home/boudiccas/.emacs.d/org/organiser.org")
mapcar(#[257 "r\300!q\210\301 )\207" [org-get-agenda-file-buffer org-clock-budget] 3 "\n\n(fn IT)"] ("~/.emacs.d/org/works.org" "~/.emacs.d/org/today.org" "/home/boudiccas/.emacs.d/org/organiser.org"))
org-clock-budget-report()
funcall-interactively(org-clock-budget-report)
call-interactively(org-clock-budget-report record nil)
command-execute(org-clock-budget-report record)
execute-extended-command(nil "org-clock-budget-report" nil)
funcall-interactively(execute-extended-command nil "org-clock-budget-report" nil)
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
Does this help?
Yes, very much. We can see that the function
org-time-string-to-seconds is a Lisp closure in `org.el'.
(org-time-string-to-seconds S)
Convert a timestamp string to a number of seconds.
now only takes one argument instead of two. So that is the problem right there. I think that you are loading an old version of the org-clock.el
file (possibly an .elc
there somewhere) because the code was updated at the same time so a fresh org install should make things work.
But org-plus-contrib was only upgraded on the 20170821, so surely when I restart emacs it should be loading that version? And M-x org-version
shows that I am.
Org mode version 9.0.9 (9.0.9-88-g251f88-elpaplus @ /home/boudiccas/.emacs.d/elpa/org-plus-contrib-20170821/)
So what's happening then? Is there a regression in their org-clock file then?
As I said, sometimes stale .elc
files inexplicably get left behind, and Emacs loads them, and inexplicable problems follow. There's nothing to do but delete all versions of the affected packages and reinstall them.
@alphapapa I've deleted and reinstalled org-plus-contribs like you showed earlier, and its still showing up the original error when I try to use org-clock-budget.
@Fuco1 I'm getting this backtrace now -
Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 1) 2)
org-time-string-to-seconds("2017-01-01" t)
org-clock-sum("2017-01-01" "2017-12-31 23:59:59")
org-clock-budget--get-entry-clocked("2017-01-01" "2017-12-31 23:59:59")
org-clock-budget--get-entries-with-budget("2017-01-01" "2017-12-31 23:59:59" "BUDGET_YEAR")
#[257 "\211\211A\262\242@\211 \211A\262\242\300#\266\203\207" [org-clock-budget--get-entries-with-budget] 11 "\n\n(fn INPUT0)"](("BUDGET_YEAR" org-clock-budget-interval-this-year))
#[257 "\300!\207" [#[257 "\211\211A\262\242@\211 \211A\262\242\300#\266\203\207" [org-clock-budget--get-entries-with-budget] 11 "\n\n(fn INPUT0)"]] 3 "\n\n(fn IT)"](("BUDGET_YEAR" org-clock-budget-interval-this-year))
mapcar(#[257 "\300!\207" [#[257 "\211\211A\262\242@\211 \211A\262\242\300#\266\203\207" [org-clock-budget--get-entries-with-budget] 11 "\n\n(fn INPUT0)"]] 3 "\n\n(fn IT)"] (("BUDGET_YEAR" org-clock-budget-interval-this-year) ("BUDGET_MONTH" org-clock-budget-interval-this-month) ("BUDGET_WEEK" org-clock-budget-interval-this-week)))
-mapcat(#[257 "\211\211A\262\242@\211 \211A\262\242\300#\266\203\207" [org-clock-budget--get-entries-with-budget] 11 "\n\n(fn INPUT0)"] (("BUDGET_YEAR" org-clock-budget-interval-this-year) ("BUDGET_MONTH" org-clock-budget-interval-this-month) ("BUDGET_WEEK" org-clock-budget-interval-this-week)))
org-clock-budget()
#[257 "r\300!q\210\301 )\207" [org-get-agenda-file-buffer org-clock-budget] 3 "\n\n(fn IT)"]("/home/boudiccas/.emacs.d/org/organiser.org")
mapcar(#[257 "r\300!q\210\301 )\207" [org-get-agenda-file-buffer org-clock-budget] 3 "\n\n(fn IT)"] ("~/.emacs.d/org/works.org" "~/.emacs.d/org/today.org" "/home/boudiccas/.emacs.d/org/organiser.org"))
org-clock-budget-report()
funcall-interactively(org-clock-budget-report)
call-interactively(org-clock-budget-report record nil)
command-execute(org-clock-budget-report record)
execute-extended-command(nil "org-clock-budget-report" nil)
funcall-interactively(execute-extended-command nil "org-clock-budget-report" nil)
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
Did you restart Emacs after reinstalling it?
Yes.
Ok, run C-h f org-time-string-to-seconds
and see what it says. Then click on the link at the top and look at the function definition. It should look like this:
(defun org-time-string-to-time (s &optional zone)
"Convert timestamp string S into internal time.
The optional ZONE is omitted or nil for Emacs local time, t for
Universal Time, ‘wall’ for system wall clock time, or a string as
in the TZ environment variable."
(apply #'encode-time (org-parse-time-string s nil zone)))
Well, when I say "should," I mean, if everything were working correctly. That function was changed to the two-argument version on July 7th in this commit, so your function is from before it:
97a1a498956da2e1961df5a0506df4cbb98fff52
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
AuthorDate: Fri Jul 7 18:23:10 2017 +0200
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>
CommitDate: Fri Jul 7 18:23:10 2017 +0200
Parent: fd6a6b5 Merge branch 'maint'
Merged: maint
Containing: agenda-overriding-header-improvements agenda-overriding-header-macro agenda-overriding-header-none (2 more)
Follows: release_9.0.9 (627)
Fix failing tests in non-daylight saving time zones
* lisp/org.el (org-time-string-to-time): Remove optional POS and
BUFFER arguments. Accept new optional ZONE argument.
(org-time-string-to-seconds): Accept optional ZONE argument.
(org-check-before-date):
(org-check-after-date):
(org-check-dates-range):
(org-goto-calendar):
* lisp/ob-gnuplot.el (org-time-string-to-time):
* lisp/org-agenda.el (org-agenda-get-blocks):
* lisp/org-clock.el (org-clock-timestamps-change):
* lisp/org-list.el (org-time-string-to-seconds): Use UTC for time
difference and time comparison.
* testing/lisp/test-org-clock.el (org-test-clock-create-clock): Use
UTC for time differences.
By the way, since you have org-plus-contrib
installed, another possibility is that you have an older version of org
that you need to delete from elpa
. This is actually fairly likely, I think.
org.el
shows this -
(defun org-time-string-to-seconds (s)
"Convert a timestamp string to a number of seconds."
(float-time (org-time-string-to-time s)))
Because I found that org-plus-contrib was continually asking for org I use a dummy package of org with the date of org-29991231
since 2014-12-21, and its never shown any problems. It shows as a dependency in paradox with this message Dummy package to satisfy dependencies on org
You said that your org-plus-contrib was upgraded on 20170821, which is after the function was changed to the two-argument version, so it shouldn't be possible for org.el to still contain the one-argument version. Something is wrong with your packages.
You didn't give the full path to org.el
, so we don't know where it is coming from.
/home/boudiccas/.emacs.d/elpa/org-plus-contrib-20170821/org.el
which I installed through paradox at 1307, which shows at line #17695 -
(defun org-time-string-to-seconds (s)
"Convert a timestamp string to a number of seconds."
(float-time (org-time-string-to-time s)))
Okay, this is strange: I downloaded org-20180821.tar from the Org ELPA and opened org.el, and it does have the single-argument version. Then I looked in org-clock.el from that package, and it makes calls to that function with two arguments. Something is wrong in the package itself. I wonder if you are the first to notice...
So I'm not going mad then by my org-clock-budget refusing to work? That is a very great relief, thanks. :)
No, you're not going mad at all. My apologies for doubting you; I have had so many similar problems that were caused by old .elc files that I thought surely that was causing this. I'm trying to figure out why the old version of org-clock.el is being included in the package, because this bug was fixed on August 5th.
Well, I'm stumped: I check org.el from the current git master branch, and it has the updated function that takes 1 or 2 arguments, and that change was made here:
97a1a498956da2e1961df5a0506df4cbb98fff52
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
AuthorDate: Fri Jul 7 18:23:10 2017 +0200
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>
CommitDate: Fri Jul 7 18:23:10 2017 +0200
Parent: fd6a6b5 Merge branch 'maint'
Merged: maint
Containing: agenda-overriding-header-improvements agenda-overriding-header-macro agenda-overriding-header-none (2 more)
Follows: release_9.0.9 (627)
Fix failing tests in non-daylight saving time zones
* lisp/org.el (org-time-string-to-time): Remove optional POS and
BUFFER arguments. Accept new optional ZONE argument.
(org-time-string-to-seconds): Accept optional ZONE argument.
(org-check-before-date):
(org-check-after-date):
(org-check-dates-range):
(org-goto-calendar):
* lisp/ob-gnuplot.el (org-time-string-to-time):
* lisp/org-agenda.el (org-agenda-get-blocks):
* lisp/org-clock.el (org-clock-timestamps-change):
* lisp/org-list.el (org-time-string-to-seconds): Use UTC for time
difference and time comparison.
* testing/lisp/test-org-clock.el (org-test-clock-create-clock): Use
UTC for time differences.
7 files changed, 52 insertions(+), 31 deletions(-)
etc/ORG-NEWS | 5 ++++-
lisp/ob-gnuplot.el | 2 +-
lisp/org-agenda.el | 22 +++++++++++++++++++--
lisp/org-clock.el | 4 ++--
lisp/org-list.el | 2 +-
lisp/org.el | 43 +++++++++++++++++++++---------------------
testing/lisp/test-org-clock.el | 5 +++--
modified etc/ORG-NEWS
@@ -23,7 +23,7 @@ Consider setting ~org-duration-units~ instead.
*** ~org-at-timestamp-p~ optional argument accepts different values
-See docustrings for the allowed values. For backward compatibility,
+See docstrings for the allowed values. For backward compatibility,
~(org-at-timestamp-p t)~ is still supported, but should be updated
accordingly.
@@ -85,6 +85,8 @@ list as their first argument.
The optional argument is now a string to extract the repeater from.
See docstring for details.
+*** Change signature for ~org-time-string-to-time~
+See docstring for changes.
** New features
*** New Org duration library
This new library implements tools to read and print time durations in
@@ -392,6 +394,7 @@ suitable as a default value.
*** New entities : ~\dollar~ and ~\USD~
*** ~org-parse-time-string~ accepts a new optional argument
=ZONE= specifies the current time zone.
+*** ~org-time-string-to-seconds~ now accepts an optional =ZONE= argument
*** Support for date style URLs in =org-protocol://open-source=
URLs like =https://cool-blog.com/2017/05/20/cool-post/= are
covered by rewrite rules.
modified lisp/ob-gnuplot.el
@@ -40,7 +40,7 @@
;;; Code:
(require 'ob)
-(declare-function org-time-string-to-time "org" (s &optional buffer pos))
+(declare-function org-time-string-to-time "org" (s &optional zone))
(declare-function org-combine-plists "org" (&rest plists))
(declare-function orgtbl-to-generic "org-table" (table params))
(declare-function gnuplot-mode "ext:gnuplot-mode" ())
modified lisp/org-agenda.el
@@ -6264,8 +6264,26 @@ scheduled items with an hour specification like [h]h:mm."
(end-time (match-string 2)))
(setq s1 (match-string 1)
s2 (match-string 2)
- d1 (time-to-days (org-time-string-to-time s1 (current-buffer) pos))
- d2 (time-to-days (org-time-string-to-time s2 (current-buffer) pos)))
+ d1 (time-to-days
+ (condition-case err
+ (org-time-string-to-time s1)
+ (error
+ (error
+ "Bad timestamp %S at %d in buffer %S\nError was: %s"
+ s1
+ pos
+ (current-buffer)
+ (error-message-string err)))))
+ d2 (time-to-days
+ (condition-case err
+ (org-time-string-to-time s2)
+ (error
+ (error
+ "Bad timestamp %S at %d in buffer %S\nError was: %s"
+ s2
+ pos
+ (current-buffer)
+ (error-message-string err))))))
(if (and (> (- d0 d1) -1) (> (- d2 d0) -1))
;; Only allow days between the limits, because the normal
;; date stamps will catch the limits.
modified lisp/org-clock.el
@@ -1701,8 +1701,8 @@ Optional argument N tells to change by that many units."
(begts (if updatets1 begts1 begts2)))
(setq tdiff
(time-subtract
- (org-time-string-to-time org-last-changed-timestamp)
- (org-time-string-to-time ts)))
+ (org-time-string-to-time org-last-changed-timestamp t)
+ (org-time-string-to-time ts t)))
(save-excursion
(goto-char begts)
(org-timestamp-change
modified lisp/org-list.el
@@ -149,7 +149,7 @@
(declare-function org-remove-indentation "org" (code &optional n))
(declare-function org-show-subtree "org" ())
(declare-function org-sort-remove-invisible "org" (S))
-(declare-function org-time-string-to-seconds "org" (s))
+(declare-function org-time-string-to-seconds "org" (s &optional zone))
(declare-function org-timer-hms-to-secs "org-timer" (hms))
(declare-function org-timer-item "org-timer" (&optional arg))
(declare-function org-trim "org" (s &optional keep-lead))
modified lisp/org.el
@@ -17439,8 +17439,8 @@ both scheduled and deadline timestamps."
'timestamp)
(org-at-planning-p))
(time-less-p
- (org-time-string-to-time match)
- (org-time-string-to-time d)))))))
+ (org-time-string-to-time match t)
+ (org-time-string-to-time d t)))))))
(message "%d entries before %s"
(org-occur regexp nil callback)
d)))
@@ -17461,8 +17461,8 @@ both scheduled and deadline timestamps."
'timestamp)
(org-at-planning-p))
(not (time-less-p
- (org-time-string-to-time match)
- (org-time-string-to-time d))))))))
+ (org-time-string-to-time match t)
+ (org-time-string-to-time d t))))))))
(message "%d entries after %s"
(org-occur regexp nil callback)
d)))
@@ -17485,11 +17485,11 @@ both scheduled and deadline timestamps."
'timestamp)
(org-at-planning-p))
(not (time-less-p
- (org-time-string-to-time match)
- (org-time-string-to-time start-date)))
+ (org-time-string-to-time match t)
+ (org-time-string-to-time start-date t)))
(time-less-p
- (org-time-string-to-time match)
- (org-time-string-to-time end-date))))))))
+ (org-time-string-to-time match t)
+ (org-time-string-to-time end-date t))))))))
(message "%d entries between %s and %s"
(org-occur regexp nil callback) start-date end-date)))
@@ -17574,19 +17574,19 @@ days in order to avoid rounding problems."
(push m l))
(apply 'format fmt (nreverse l))))
-(defun org-time-string-to-time (s &optional buffer pos)
- "Convert a timestamp string into internal time."
- (condition-case errdata
- (apply 'encode-time (org-parse-time-string s))
- (error (error "Bad timestamp `%s'%s\nError was: %s"
- s (if (not (and buffer pos))
- ""
- (format-message " at %d in buffer `%s'" pos buffer))
- (cdr errdata)))))
+(defun org-time-string-to-time (s &optional zone)
+ "Convert timestamp string S into internal time.
+The optional ZONE is omitted or nil for Emacs local time, t for
+Universal Time, ‘wall’ for system wall clock time, or a string as
+in the TZ environment variable."
+ (apply #'encode-time (org-parse-time-string s nil zone)))
-(defun org-time-string-to-seconds (s)
- "Convert a timestamp string to a number of seconds."
- (float-time (org-time-string-to-time s)))
+(defun org-time-string-to-seconds (s &optional zone)
+ "Convert a timestamp string S into a number of seconds.
+The optional ZONE is omitted or nil for Emacs local time, t for
+Universal Time, ‘wall’ for system wall clock time, or a string as
+in the TZ environment variable."
+ (float-time (org-time-string-to-time s zone)))
(org-define-error 'org-diary-sexp-no-match "Unable to match diary sexp")
@@ -18159,8 +18159,7 @@ A prefix ARG can be used to force the current date."
(when (or (org-at-timestamp-p 'lax)
(org-match-line (concat ".*" org-ts-regexp)))
(let ((d1 (time-to-days (current-time)))
- (d2 (time-to-days
- (org-time-string-to-time (match-string 1)))))
+ (d2 (time-to-days (org-time-string-to-time (match-string 1)))))
(setq diff (- d2 d1))))
(calendar)
(calendar-goto-today)
modified testing/lisp/test-org-clock.el
@@ -48,8 +48,9 @@ range. INPUT2 can be omitted if clock hasn't finished yet.
Return the clock line as a string."
(let* ((beg (org-test-clock-create-timestamp input1 t t))
(end (and input2 (org-test-clock-create-timestamp input2 t t)))
- (sec-diff (and input2 (floor (- (org-time-string-to-seconds end)
- (org-time-string-to-seconds beg))))))
+ (sec-diff (and input2
+ (floor (- (org-time-string-to-seconds end t)
+ (org-time-string-to-seconds beg t))))))
(concat org-clock-string " " beg
(when end
(concat "--" end " => "
And that introduced a bug that was fixed in org-clock.el here:
7e241af591df15d2b7587648ed2342ae3a5d0e5b
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
AuthorDate: Sat Aug 5 15:28:06 2017 +0200
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>
CommitDate: Sat Aug 5 15:35:37 2017 +0200
Parent: e67f0f2 ox-icalendar: Prevent duplicates when writing agenda view
Merged: maint
Containing: agenda-overriding-header-improvements agenda-overriding-header-macro agenda-overriding-header-none (2 more)
Follows: release_9.0.9 (61)
org-clock: Fix regression in `org-clock-sum'
* lisp/org-clock.el (org-clock-sum): Fix regression introduced in
112c5ba479d52c3c36de5c7aafd14ab6bc075005. Small refactoring.
Reported-by: Josh Moller-Mara <jmm@cns.nyu.edu>
http://lists.gnu.org/archive/html/emacs-orgmode/2017-08/msg00117.html
1 file changed, 24 insertions(+), 22 deletions(-)
lisp/org-clock.el | 46 ++++++++++++++++++++++++----------------------
modified lisp/org-clock.el
@@ -1803,14 +1803,15 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
"[ \t]*\\(?:\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)\\|=>[ \t]+\\([0-9]+\\):\\([0-9]+\\)\\)"))
(lmax 30)
(ltimes (make-vector lmax 0))
- (t1 0)
(level 0)
- ts te dt
+ (tstart (cond ((stringp tstart) (org-time-string-to-seconds tstart t))
+ ((consp tstart) (float-time tstart))
+ (t tstart)))
+ (tend (cond ((stringp tend) (org-time-string-to-seconds tend t))
+ ((consp tend) (float-time tend))
+ (t tend)))
+ (t1 0)
time)
- (if (stringp tstart) (setq tstart (org-time-string-to-seconds tstart)))
- (if (stringp tend) (setq tend (org-time-string-to-seconds tend)))
- (if (consp tstart) (setq tstart (float-time tstart)))
- (if (consp tend) (setq tend (float-time tend)))
(remove-text-properties (point-min) (point-max)
`(,(or propname :org-clock-minutes) t
:org-clock-force-headline-inclusion t))
@@ -1819,26 +1820,27 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
(while (re-search-backward re nil t)
(cond
((match-end 2)
- ;; Two time stamps
- (setq ts (match-string 2)
- te (match-string 3)
- ts (float-time
- (apply #'encode-time (org-parse-time-string ts nil t)))
- te (float-time
- (apply #'encode-time (org-parse-time-string te nil t)))
- ts (if tstart (max ts tstart) ts)
- te (if tend (min te tend) te)
- dt (- te ts)
- t1 (if (> dt 0) (+ t1 (floor (/ dt 60))) t1)))
+ ;; Two time stamps.
+ (let* ((ts (float-time
+ (apply #'encode-time
+ (save-match-data
+ (org-parse-time-string
+ (match-string 2) nil t)))))
+ (te (float-time
+ (apply #'encode-time
+ (org-parse-time-string (match-string 3) nil t))))
+ (dt (- (if tend (min te tend) te)
+ (if tstart (max ts tstart) ts))))
+ (when (> dt 0) (cl-incf t1 (floor (/ dt 60))))))
((match-end 4)
- ;; A naked time
+ ;; A naked time.
(setq t1 (+ t1 (string-to-number (match-string 5))
(* 60 (string-to-number (match-string 4))))))
- (t ;; A headline
- ;; Add the currently clocking item time to the total
+ (t ;A headline
+ ;; Add the currently clocking item time to the total.
(when (and org-clock-report-include-clocking-task
- (equal (org-clocking-buffer) (current-buffer))
- (equal (marker-position org-clock-hd-marker) (point))
+ (eq (org-clocking-buffer) (current-buffer))
+ (eq (marker-position org-clock-hd-marker) (point))
tstart
tend
(>= (float-time org-clock-start-time) tstart)
And that was merged to master here:
569b7d105c0e9572eed7c8d652052433e0a10f1e
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
AuthorDate: Sat Aug 5 15:38:13 2017 +0200
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>
CommitDate: Sat Aug 5 15:38:13 2017 +0200
Parent: d5690b6 Merge branch 'maint'
Parent: 7e241af org-clock: Fix regression in `org-clock-sum'
Merged: maint
Containing: agenda-overriding-header-improvements agenda-overriding-header-macro agenda-overriding-header-none (2 more)
Follows: release_9.0.9 (702)
Merge branch 'maint'
1 file changed, 24 insertions(+), 22 deletions(-)
lisp/org-clock.el | 46 ++++++++++++++++++++++++----------------------
Then I check org.el from the org-20170821.tar and it has the old function that only takes 1 argument. How is the old org.el file ending up in the new tar?
I guess you should post this on the mailing list so one of the maintainers can look into it. Unless I'm also going mad, something's not right here.
I'm curious, so I will go ahead and post it to the mailing list.
@alphapapa thanks for investigating! I'm so flustered right now I wouldn't be able to do the detective work.
Achim Gratz responded on the mailing list:
It seems that org.el in org-20170821.tar is out of date. Sharon Kimble noticed that something was wrong, and after much digging, we found that org-clock.el has been updated to have calls to org-time-string-to-seconds with 2 arguments, but the function definition in org.el only takes 1 argument.
This is very strange, because the addition of the extra arg to org-time-string-to-seconds was made back on July 7, and that introduced
That change is only on master, so whatever trouble you are seeing in the ELPA tarball is unrelated to that change.
a bug which was fixed in org-clock.el on August 5, yet the tarball from August 21 has the pre-July 7 org-time-string-to-seconds function.
That fix was introduced on maint and merged to master, which seems to be in error since the bug was in master only.
I don't know how the build process works, but IIUC, the tarballs are built from the maint branch, and the regression was on master, and the regression fix was applied to maint, which broke maint. So hopefully that can be fixed soon.
I have just updated my emacs packages which have included 'org-plus-contrib-20170828' but my original problem still remains. I have closed emacs and then restarted it but its made no difference. Arrrgghhh!
I think you will need to get an older version instead. I run 20170515
and it does not have the problem.
I was hoping one of the Org maintainers would respond to that thread on the mailing list, but I see that none have. :(
And I've now got org-clock-budget working again. I updated my org-mode cloning in my git directory, and then set my emacs config to be read from there, and its all working nicely. So thanks folks, I'm a happy bunny again.
I'm getting an error report when I try to run org-clock-budget which says
Nothing has changed in my setup, and I'm guessing that its related to something with the actual time clocking. Can you give me any guidance as to what is wrong please?