emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in definition of org-encode-time


From: Kenneth Stuart
Subject: Bug in definition of org-encode-time
Date: Sun, 24 Jul 2022 09:45:31 +0100
User-agent: mu4e 1.8.5; emacs 29.0.50

Hello,

Macro `org-encode-time` (lisp/org-macs.el +1395) does not get defined
for emacs >= 27.1 as the top level if statement is missing its ELSE clause.

#+begin_src elisp
(if (version< emacs-version "27.1")
    (defmacro org-encode-time (&rest time)
      (if (cdr time)
          `(encode-time ,@time)
        `(apply #'encode-time ,@time)))
  (if (ignore-errors (with-no-warnings (encode-time '(0 0 0 1 1 1971))))
      (defmacro org-encode-time (&rest time)
        (pcase (length time) ; Emacs-29 since d75e2c12eb
          (1 `(encode-time ,@time))
          ((or 6 9) `(encode-time (list ,@time)))
          (_ (error "`org-encode-time' may be called with 1, 6, or 9 arguments 
but %d given"
                    (length time)))))
    (defmacro org-encode-time (&rest time)
      (pcase (length time)
        (1 `(encode-time ,@time))
        (6 `(encode-time (list ,@time nil -1 nil)))
        (9 `(encode-time (list ,@time)))
        (_ (error "`org-encode-time' may be called with 1, 6, or 9 arguments 
but %d given"
                  (length time)))))) //MISSING ELSE//)
#+end_src

I'm assuming it should be:

#+begin_src diff
  diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 5931dd260..bbdacbdf8 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -1403,14 +1403,14 @@ nil, just return 0."
           (1 `(encode-time ,@time))
           ((or 6 9) `(encode-time (list ,@time)))
           (_ (error "`org-encode-time' may be called with 1, 6, or 9 arguments 
but %d given"
-                    (length time)))))
-    (defmacro org-encode-time (&rest time)
+                    (length time))))))
+  (defmacro org-encode-time (&rest time)
       (pcase (length time)
         (1 `(encode-time ,@time))
         (6 `(encode-time (list ,@time nil -1 nil)))
         (9 `(encode-time (list ,@time)))
         (_ (error "`org-encode-time' may be called with 1, 6, or 9 arguments 
but %d given"
-                  (length time)))))))
+                  (length time))))))
 (put 'org-encode-time 'function-documentation
      "Compatibility and convenience helper for `encode-time'.
 May be called with 9 components list (SECONDS ... YEAR IGNORED DST ZONE)
#+end_src

regards
Ken



reply via email to

[Prev in Thread] Current Thread [Next in Thread]