unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: <klaus.berndl@sdm.de>
Subject: problems with byte-compiling defcustoms
Date: Mon, 15 Aug 2005 06:07:11 +0200	[thread overview]
Message-ID: <A47B192B0358794C958615D788BF7FB7EDB472@mucmail1.sdm.de> (raw)

Hi all,
 
please take a look at the following short elisp-example:
 

(eval-when-compile
  (require 'cl))

(defcustom ecb-wget-setup (cons (if (fboundp 'executable-find)
                                    (executable-find "wget")
                                  "wget")
                                (case system-type
                                  (cygwin32 'cygwin)
                                  (windows-nt (if (getenv "CYGWIN")
                                                  'cygwin
                                                'windows))
                                  (otherwise 'other)))
  "*Configuration for the wget-utility."
  :group 'ecb-download
  :type '(cons (file :tag "wget binary" :value "wget")
               (choice :tag "Path type" :menu-tag "Path type"
                       (const :tag "Windows" :value windows)
                       (const :tag "Cygwin" :value cygwin)
                       (const :tag "Other" :value other))))

(defvar ecb-wget-setup-defvar (cons (if (fboundp 'executable-find)
                                    (executable-find "wget")
                                  "wget")
                                (case system-type
                                  (cygwin32 'cygwin)
                                  (windows-nt (if (getenv "CYGWIN")
                                                  'cygwin
                                                'windows))
                                  (otherwise 'other)))
  "Same as `ecb-wget-setup' but defined with `defvar'.")

(provide 'defcustom-test)
 
IMO this should load 'cl when byte-compiling and so resolving the
`case'- macro in the initial-value of the defcustom?!
 
But appearantly it doesn't:

My guess is that cl gets loaded when i byte-compile this example-code,
but the code in defcustom somehow does not get byte-compiled.
If you load the resulting elc file in your editor (i.e.
C-x C-f defcustom-test.elc), you'll see that the defcustom statement
for ecb-wget-setup still contains "(case ...".
But if you replace the defcustom with defvar, the `case' will
be replaced by some byte code (see `ecb-wget-setup-defvar').

The coding conventions of Emacs tell me that i only should load
cl at byte-compile-time. Well, i did this - see code above.
But cause of this defcustom-behavior the resulting elc-file is not
loadable - always an error like "...case is not a defined function..."

Is this a bug or how i can avoid this?

Thanks for your help,
Klaus

                 reply	other threads:[~2005-08-15  4:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=A47B192B0358794C958615D788BF7FB7EDB472@mucmail1.sdm.de \
    --to=klaus.berndl@sdm.de \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).