emacs-devel
[Top][All Lists]
Advanced

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

Re: printing.el again


From: Vinicius Jose Latorre
Subject: Re: printing.el again
Date: Mon, 15 Nov 2004 22:55:23 -0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a4) Gecko/20040927

> > 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).

Ok.


> > > 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.

So, I'll modify to use (featurep 'xemacs).

Does the byte-compiler do constant folding optimization or it is an ad hoc
optimization?

Maybe this should be documented in Emacs Lisp Reference or in other suitable
info, probably Byte Compiler Users Guide.  Also other byte-compiler
optimizations should be documented.


Vinicius





reply via email to

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