emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problems with byte-compiling defcustoms


From: klaus.berndl
Subject: problems with byte-compiling defcustoms
Date: Mon, 15 Aug 2005 06:07:11 +0200

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 via email to

[Prev in Thread] Current Thread [Next in Thread]