emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printing.el again


From: Stefan Monnier
Subject: Re: printing.el again
Date: Mon, 15 Nov 2004 15:47:27 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

> Ok, but a very long time ago there was a recommendation to do not use cl
> package when writing code in Emacs Lisp.
> Is that recommendation no more valid?

CL functions should indeed not be used by packages distributed with Emacs.
OTOH, CL macros (such as `push', `flet', ...) can be used just fine (just
don't forget to put a (eval-when-compile (require 'cl)) at the top of your
file).

>> BTW, if you use (featurep 'xemacs) for the test, Emacs-21 will optimize
>> the test away (since the resulting elc file can't be run on XEmacs
>> anyway).  Here it doesn't really matter, but it is sometimes very handy
>> since it ends up getting rid of spurious warnings about
>> XEmacs-specific code.

> Well, so:

> A) (cond ((eq ps-print-emacs-type 'xemacs) ...)
>          (t ...))

> B) (cond ((featurep 'xemacs) ...)
>          (t ...))

> Are you saying that A and B above are treated differently by the
> byte-compiler??

Yes.

The byte-compiler will not optimize away the `eq' test because it considers
that the user might change ps-print-emacs-type at any time.  OTOH the
byte-compiler knows that since the code it generates doesn't work under
XEmacs, (featurep 'xemacs) will always return nil.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]