all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>
Subject: Byte compiling and declarations inside if or when
Date: Tue, 28 Dec 2004 13:57:15 +0100	[thread overview]
Message-ID: <005f01c4ecdc$ca0768e0$0200a8c0@sedrcw11488> (raw)

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

             reply	other threads:[~2004-12-28 12:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-28 12:57 Lennart Borgman [this message]
2004-12-28 17:24 ` Byte compiling and declarations inside if or when Lennart Borgman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='005f01c4ecdc$ca0768e0$0200a8c0@sedrcw11488' \
    --to=lennart.borgman.073@student.lu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.