unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <jmbarranquero@laley.wke.es>
Subject: Re: [Suggestion] New function `emacs-version>='
Date: Mon, 05 May 2003 15:20:52 +0200	[thread overview]
Message-ID: <20030505150352.2D00.JMBARRANQUERO@laley.wke.es> (raw)
In-Reply-To: <67B8CED503F3D511BB9F0008C75DAD66054855CB@dewdfx17>


> One should not use tests like the ones above indirectly:
> 
>   - test for the `display' property:
> 
>     CORRECT: (emacs-version>= X Y)
>     WRONG:   (fboundp 'some-function-introduced-with-X.Y)
> 
>   - test for some bug fix
> 
>     CORRECT: (emacs-version>= X Y)
>     WRONG:   (fboundp 'some-function-introduced-with-X.Y)

This may surprise you, but I agree that the tests you've labeled WRONG
are, in fact, wrong :-)

What I'm not so sure about is that emacs-version>= is the CORRECT test 
(I agree with the "featurep 'xemacs" test too).

OTOH, I don't have a better answer. Any one we include is going to be of
little help with pre-21.4 Emacsen. Perhaps we need a `fixes' list, à la
`features', where people would put info about difficult-to-test changes
on interfaces (only half joking here).

> For example, XEmacs' `directory-files' has an optional 5th arg
> FILES-ONLY.  If I test
> 
>    (condition-case nil
>        (directory-files some-dir nil nil nil t)
>      (error (..EMACS-CODE...)))
> 
> this would fail if Emacs introduces a 5th arg with a different
> semantics.  In other words, such a test is only correct if you know that
> Emacs will define a 5th arg with the same semantics as XEmacs (or will
> never define a 5th arg, but you'll never know that).  If this is not the
> case, it is better to use
> 
>    (if (featurep 'xemacs)
>        (directory-files some-dir nil nil nil t)
>      (..EMACS-CODE...))

I agree wholeheartedly, and in fact I don't remember arguing against
that kind of test. Anything that can be checked with featurep or other
existence predicates probably should be. My `ignore-errors' example was
for a change between Emacs versions (I know too well, as I was the one
who introduced the MODIFIER argument to `windmove-default-keybindings').

> This is also very dangerous.  E.g., if you want to test whether your
> Emacs distinguishes between buffer with unibyte and some with multi-byte
> chars, you might want to test
> 
>    (boundp 'enable-multibyte-characters)
> 
> Unfortunately, this doesn't work since XEmacs defines this variable as a
> compatiblitiy variable (but it doesn't define `set-buffer-multibyte',
> but who knows whether XEmacs will define this function as a
> compatiblitiy function in the future?).

Ok, but something of this size should be marked as a feature somehow.

> I must say I don't really care too much if I miss a fix in some
> temporary development branch.

Sure, but I was talking specifically of cases where an Emacs version is
released with a fix/feature that afterwards is discarded because the
trunk release contains a better fix/feature (I wouldn't be surprised if
that happens for mule-related things).

And don't forget that 21.2, a bugfix-only release, has been around for a
year, so "temporary" is a relative term.

> [1] Yes, I read Juanmas "often", but I didn't argue against all
> `fboundp' tests either...

Fair enough ;-)

All in all, if people feels that emacs-version>= is going to ease life for
elisp developers, who am I to oppose... :-)

                                                                Juanma



P.S.: Sorry for excesive quoting in this message. I didn't want to take
out too much context.

  reply	other threads:[~2003-05-05 13:20 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-02 19:55 [Suggestion] New function `emacs-version>=' Wedler, Christoph
2003-05-02 21:00 ` Juanma Barranquero
2003-05-02 21:14   ` Stefan Monnier
2003-05-02 21:35     ` Juanma Barranquero
2003-05-03 11:12       ` Ehud Karni
2003-05-03 13:54         ` Juanma Barranquero
2003-05-03 16:08           ` Stephen J. Turnbull
2003-05-04 19:15             ` Juanma Barranquero
2003-05-06 11:05               ` Stephen J. Turnbull
2003-05-04 13:04           ` Richard Stallman
2003-05-03 17:48     ` Reiner Steib
2003-05-03 18:42       ` Stefan Monnier
2003-05-05 13:47         ` sort-coding-systems in 21.3 and RC branch (was: New function `emacs-version>=') Reiner Steib
2003-05-06  7:08           ` Kenichi Handa
2003-05-02 21:16 ` [Suggestion] New function `emacs-version>=' Thien-Thi Nguyen
2003-05-04 13:03 ` Richard Stallman
2003-05-05 12:52   ` Wedler, Christoph
2003-05-05 13:20     ` Juanma Barranquero [this message]
2003-05-05 19:11     ` Richard Stallman
2003-05-05 21:59     ` Luc Teirlinck
2003-05-06 23:42 ` Istvan Marko
  -- strict thread matches above, loose matches on Subject: below --
2003-05-06 11:10 Wedler, Christoph
2003-05-06 21:45 ` Luc Teirlinck
2003-05-07 11:51 ` Richard Stallman
2003-05-07 12:11 Wedler, Christoph
2003-05-07 12:46 ` Luc Teirlinck
2003-05-09 11:19 ` Richard Stallman

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=20030505150352.2D00.JMBARRANQUERO@laley.wke.es \
    --to=jmbarranquero@laley.wke.es \
    /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).