pomidor icon indicating copy to clipboard operation
pomidor copied to clipboard

Pomidor history: Symbol's function definition is void: parse-iso8601-time-string

Open ghost opened this issue 4 years ago • 5 comments

Hi,

When I attempt to look at pomidor history, I get the message error. I found some issues with parsing in emacs here, but I'm not sure how to fix it for pomidor.

https://emacs.stackexchange.com/questions/60175/parse-time-string-doesnt-accept-iso-8601-string-contrary-to-what-the-documenta

ghost avatar Jun 28 '21 15:06 ghost

Hey! What Emacs version do you use?

TatriX avatar Jun 29 '21 08:06 TatriX

Though I had the latest version, but it's 25.5. This error is apparently fixed in 28.0 version of emacs. Upgrading it should be good I guess. In the meantime, if you have an idea of how to fix it by changing a bit your code I'm interested ;) Sounds simple, maybe it's not, I'm not familiar with lisp.

ghost avatar Jun 29 '21 11:06 ghost

As you already have specific Emacs version, it would be really nice if you could test if the workaround from the stackoverflow post works.

For example you can eval this code and see if it solves the problem.

(defun pomidor--read-session (preserve-timestamp?)
  "Read the saved sessions."
  (let* ((json-object-type 'plist)
         (json-array-type 'list)
         (data (json-read-file pomidor-save-session-file)))
    (if preserve-timestamp?
        data
      (-map (lambda (pomidor)
              (-map (lambda (v) (if (stringp v)
                                    (decode-time 
                                     (parse-iso8601-time-string v))
                             v))
                    pomidor))
            data))))

TatriX avatar Jun 30 '21 07:06 TatriX

Hi TatriX,

Adding decode-time does not work, but I tried the evaluations in the following order :

(parse-iso8601-time-string "1998-09-12T12:21:54-0200") -> does not work                                                                     
                                                                                                                                                              
(parse-time-string "1998-09-12T12:21:54-0200") -> gives (nil nil nil nil nil nil nil nil nil) as expected                                                              
                                                                                                                           
(parse-iso8601-time-string "1998-09-12T12:21:54-0200") -> gives coded time (13818 19266)                                                                      
                                                                                                                                                              
(decode-time (parse-iso8601-time-string "1998-09-12T12:21:54-0200")) -> (54 21 12 12 9 1998 6 t 7200) 

And this work ! So there is a weird bug solved by running parse-time-string before parse-iso-8061-time-string apparently.

ghost avatar Jul 02 '21 11:07 ghost

I don't really use history functionality. @wandersoncferreira if you could check the solution from the comment above it would be very kind of you.

TatriX avatar Jul 04 '21 08:07 TatriX