unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* problems with byte-compiling defcustoms
@ 2005-08-15  4:07 klaus.berndl
  0 siblings, 0 replies; only message in thread
From: klaus.berndl @ 2005-08-15  4:07 UTC (permalink / 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-08-15  4:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-15  4:07 problems with byte-compiling defcustoms klaus.berndl

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).