[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: require printing causes an error
From: |
Vinicius Jose Latorre |
Subject: |
Re: require printing causes an error |
Date: |
Sun, 14 Nov 2004 02:18:51 -0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a4) Gecko/20040927 |
Hi Stefan,
> >The menu manipulation (and other code) is done in a eval-and-compile to
> > avoid some compilations gripes.
>
> Then I suggest to not use eval-and-compile there. It may not cause
serious
> problems in practice, but it causes byte-compilation of the file to have
> undesriable side effects (to the Emacs process from which you
byte-compile
> the file). This is more undesirable than some spurious harmless
warnings.
Well, the byte-compiler said as warning, but the code byte-compiled
didn't run
properly. So, I thought it was a byte-compiler problem.
> BTW if you want to remove warnings for code like
>
> (cond
> (some-condition-A
> (defun foo-A () code-for-A ))
> (t
> (defun foo-A () code-for-B)))
>
> Then you could use
>
> (defalias 'foo-A
> (cond
> (some-condition-A
> (lambda () code-for-A ))
> (t
> (lambda () code-for-B))))
>
> This makes it obvious to the byte-compiler that `foo-A' will be defined.
> Admittedly, the byte-compiler only started to recognize the above
form a few
> days ago.
Good! :)
Is this new form recognized by Emacs 20 byte-compiler?
Humm, I'll try to use the above form. If I'll use it, I'll have to create
printing v6.9 that will run only in Emacs 21, and v6.8.3 will be the last
printing version for Emacs 20. I'll think about this.
BTW, is there some section in Emacs Lisp Reference that talk about
conditional
byte-compilation (how to do, tips, problems & solutions, faq, etc.)?
The other form used in printing package is:
(cond
(some-condition-A
(defun foo-A () code-for-A ))
(some-condition-B
(defvar var-B some-default-B)
(defun foo-A () code-for-B)))
Maybe it should be:
(cond
(some-condition-A
(defun foo-A () code-for-A ))
(some-condition-B
(defvar var-B some-default-B)
(defun foo-A () code-for-B))
(t
(error)))
> > In pr-region-test:
> > test.el:13:4:Warning: attempt to inline `t' before it was defined
> > test.el:14:4:Warning: `t' called as a function
>
> This was a bug in the byte-compiler which should be fixed now.
Yes, now it's working!
> > To avoid these warnings (a lot of them!), I changed some defsubst
to defun.
>
> Well, I think changing them to defun was a good thing in itself since
these
> functions probably do not have a significant impact on performance (they
> aren't used inside a loop, for one).
Well, indeed.
Thanks,
Vinicius