emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kenneth Stuart <kstuart@hotmail.co.uk>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug in definition of org-encode-time
Date: Sun, 24 Jul 2022 11:06:56 +0100	[thread overview]
Message-ID: <PAXP251MB04700B5731052384D6B5CFFFEC929@PAXP251MB0470.EURP251.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <87y1widf0h.fsf@localhost>

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



  reply	other threads:[~2022-07-24 10:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-07-24 11:37     ` Kenneth Stuart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PAXP251MB04700B5731052384D6B5CFFFEC929@PAXP251MB0470.EURP251.PROD.OUTLOOK.COM \
    --to=kstuart@hotmail.co.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).