[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in definition of org-encode-time
From: |
Kenneth Stuart |
Subject: |
Re: Bug in definition of org-encode-time |
Date: |
Sun, 24 Jul 2022 11:06:56 +0100 |
User-agent: |
mu4e 1.8.5; emacs 29.0.50 |
Yes, you're right I should have looked more closely, I also see 'Morgan
Smith' has already raised the issue more clearly.
Please ignore the noise ;)
Ihor Radchenko <yantar92@gmail.com> writes:
> Kenneth Stuart <kstuart@hotmail.co.uk> writes:
>
>> 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.
>
> Are you sure?
>
>> #+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
>
> This is equivalent to
>
> (if condition
> (defmacro ...)
> ;; else
> (if another-condition
> (defmacro ...)
> ;; else
> (defmacro)))
>
> Best,
> Ihor