[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: |
Fri, 12 Nov 2004 21:53:45 -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.
I don't remember the exact details, but if there was a code like:
(cond
(some-condition-A
(defun foo-A () code-for-A ))
(some-condition-B
(defun foo-A () code-for-B)))
The byte-compiler had some problems with the code above, but:
(eval-and-compile
(cond
(some-condition-A
(defun foo-A () code-for-A))
(some-condition-B
(defun foo-A () code-for-B))))
The code above works, that is, it is byte-compiled with no problem.
That's the reason why it's used eval-and-compile in printing package.
BTW, the byte-compiler now is complaining of this code:
(eval-and-compile
(cond
((eq ps-print-emacs-type 'emacs) ; GNU Emacs
(defsubst pr-region-active-p ()
(and pr-auto-region transient-mark-mode mark-active)))
((eq ps-print-emacs-type 'xemacs) ; XEmacs
(defvar zmacs-region-stays nil) ; to avoid compilation gripes
(defsubst pr-region-active-p ()
(and pr-auto-region (not zmacs-region-stays) (ps-mark-active-p))))))
(defun pr-region-test () ; only a test fun
(interactive "*")
(if (pr-region-active-p)
(message "Region active")
(message "Region not active")))
Saving the code above in test.el file and byte-compiling, the
byte-compiler says:
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
In end of data:
test.el:16:1:Warning: the function `t' is not known to be defined.
To avoid these warnings (a lot of them!), I changed some defsubst to defun.
Vinicius
Stefan wrote:
Symptoms:
(require 'printing)
cause the following error:
Debugger entered--Lisp error: (wrong-type-argument listp 3)
I've just (hopefully) checked in a fix for it.
BTW, Jose, why is the menu manipulation done in a eval-and-compile
(i.e. why do you modify the menus during byte-compilation)?
I suggest the untested patch below which removes the eval-and-compile
and which merges the XEmacs and Emacs menus.
Stefan