unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: eval-when-compile help?
Date: Tue, 5 Oct 2021 19:22:50 +0300	[thread overview]
Message-ID: <c9a816f4-b1ff-f005-c7b1-d0ed1f4701fb@yandex.ru> (raw)
In-Reply-To: <jwv1r4zh5zy.fsf-monnier+emacs@gnu.org>

On 05.10.2021 18:05, Stefan Monnier wrote:
>> So I suppose this is the final form:
>>
>> (eval-and-compile
>>    (when (version< emacs-version "28")
>>      (require 'eieio)
>>
>>      (with-no-warnings
>>        (defclass xref-location () ()
>>          :documentation "(Obsolete) location represents a position in a file
>>         or buffer."))))
> 
> Better use `with-suppressed-warnings` than `with-no-warnings` (or at
> least add a comment explaining what warning you're silencing).

with-suppressed-warnings was added in 27, and xref.el is still targeting 
26+. A comment sounds fine.

> BTW, maybe a better option is to use a macro like:
> 
>      (defmacro if-when-compile (test then else)
>        (if (eval test t) then else))
> 
> and then do
> 
>      (if-when-compile (version< emacs-version "28")
>          (progn
>            (require 'eieio)
>            
>            (defclass xref-location () ()
>              :documentation
>              "(Obsolete) location represents a position in a file or buffer.")))

That gives me

   Wrong number of arguments: (3 . 3), 2

What would I put in the 'else' branch anyway?



  reply	other threads:[~2021-10-05 16:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05  3:01 eval-when-compile help? Dmitry Gutov
2021-10-05 12:19 ` Stefan Monnier
2021-10-05 14:16   ` Dmitry Gutov
2021-10-05 15:05     ` Stefan Monnier
2021-10-05 16:22       ` Dmitry Gutov [this message]
2021-10-05 19:53         ` Stefan Monnier

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=c9a816f4-b1ff-f005-c7b1-d0ed1f4701fb@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.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).