From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Lennart Borgman" Newsgroups: gmane.emacs.devel Subject: Byte compiling and declarations inside if or when Date: Tue, 28 Dec 2004 13:57:15 +0100 Message-ID: <005f01c4ecdc$ca0768e0$0200a8c0@sedrcw11488> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1104238812 16146 80.91.229.6 (28 Dec 2004 13:00:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 28 Dec 2004 13:00:12 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 28 14:00:07 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CjGxL-0003IB-00 for ; Tue, 28 Dec 2004 14:00:07 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CjH8B-0003Vm-NN for ged-emacs-devel@m.gmane.org; Tue, 28 Dec 2004 08:11:19 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CjH7I-0003S8-4z for emacs-devel@gnu.org; Tue, 28 Dec 2004 08:10:24 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CjH7G-0003RZ-Ql for emacs-devel@gnu.org; Tue, 28 Dec 2004 08:10:23 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CjH7G-0003R7-JQ for emacs-devel@gnu.org; Tue, 28 Dec 2004 08:10:22 -0500 Original-Received: from [81.228.10.108] (helo=av9-1-sn4.m-sp.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CjGv1-0003Mc-40 for emacs-devel@gnu.org; Tue, 28 Dec 2004 07:57:43 -0500 Original-Received: by av9-1-sn4.m-sp.skanova.net (Postfix, from userid 502) id 7539537F2B; Tue, 28 Dec 2004 13:57:42 +0100 (CET) Original-Received: from smtp2-2-sn4.m-sp.skanova.net (smtp2-2-sn4.m-sp.skanova.net [81.228.10.182]) by av9-1-sn4.m-sp.skanova.net (Postfix) with ESMTP id 6616537F0F for ; Tue, 28 Dec 2004 13:57:42 +0100 (CET) Original-Received: from sedrcw11488 (t5o58p108.telia.com [195.67.196.108]) by smtp2-2-sn4.m-sp.skanova.net (Postfix) with SMTP id 8F00D37E52 for ; Tue, 28 Dec 2004 13:57:41 +0100 (CET) Original-To: "Emacs Devel" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1409 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:31526 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:31526 I do not know whether this is the right place to ask this question but I suspect it is so I will try. Please just tell me where to find the answer if this is not the right place! I am trying to rewrite some code so that it can be byte compiled (with byte-compile-file). My first example is just a simple test (partly riped from sys.el): ** w32-sys.el: (eval-and-compile (defvar w32-system (memq system-type '(emx win32 w32 mswindows ms-dos windows-nt)) "*Non-nil means Emacs is running on Windows 9x/NT." ) ) Is this the way it should be done if I want to byte-compile-file this file? My second example is a bit more complicated and uses the first example. I have something like this in another source file: (require 'w32-sys) (eval-and-compile (when w32-system (defun w32-integ-dired-execute(verb &optional show-flag) "Call ShellExecute with current file from dired." (let ((file-name (dired-get-filename))) (w32-shell-execute-with-msg verb file-name nil show-flag))) )) I have put an eval-and-compile around the when clause but I do not know if this is the way to do it. My goal is just that I want w32-integ-dired-execute to be defined in the .elc-file if this is a "w32-system", otherwise not. The code should also work if the .el source file is loaded instead. (Please forget that you may not find this example very realistic.) Is this the way to do it? - Lennart