* Bug in definition of org-encode-time
@ 2022-07-24 8:45 Kenneth Stuart
2022-07-24 9:41 ` Ihor Radchenko
0 siblings, 1 reply; 4+ messages in thread
From: Kenneth Stuart @ 2022-07-24 8:45 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Bug in definition of org-encode-time
2022-07-24 8:45 Bug in definition of org-encode-time Kenneth Stuart
@ 2022-07-24 9:41 ` Ihor Radchenko
2022-07-24 10:06 ` Kenneth Stuart
0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2022-07-24 9:41 UTC (permalink / raw)
To: Kenneth Stuart; +Cc: emacs-orgmode
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug in definition of org-encode-time
2022-07-24 9:41 ` Ihor Radchenko
@ 2022-07-24 10:06 ` Kenneth Stuart
2022-07-24 11:37 ` Kenneth Stuart
0 siblings, 1 reply; 4+ messages in thread
From: Kenneth Stuart @ 2022-07-24 10:06 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug in definition of org-encode-time
2022-07-24 10:06 ` Kenneth Stuart
@ 2022-07-24 11:37 ` Kenneth Stuart
0 siblings, 0 replies; 4+ messages in thread
From: Kenneth Stuart @ 2022-07-24 11:37 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
This appears to be an issue with the emacs native compiler, as using a
build without it enabled works as expected, and using a build with the
native compiler enabled but before the relevant .eln files have been
built also works as expected, once they've been built the issue
mentioned by Morgan on the 22nd is once again present.
Quote:
> When I re-evaluate the defun for `org-matcher-time' everything is happy
> again. I'm not sure what the issue is but I assume it's related to
> compilation or something.
emacs commit: 928ea0fbf13671e17c9839791163d1da056df490
I'll try reporting the issue using `report-emacs-bug`.
Best,
Ken
Kenneth Stuart <kstuart@hotmail.co.uk> writes:
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-07-24 11:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-24 8:45 Bug in definition of org-encode-time Kenneth Stuart
2022-07-24 9:41 ` Ihor Radchenko
2022-07-24 10:06 ` Kenneth Stuart
2022-07-24 11:37 ` Kenneth Stuart
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.