[Top][All Lists]

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

Re: defvars at compile time

From: Kevin Rodgers
Subject: Re: defvars at compile time
Date: Thu, 16 Mar 2006 11:31:29 -0700
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Katsumi Yamaoka wrote:
In <address@hidden> Bill Wohler wrote:

Reiner Steib <address@hidden> wrote:

(let* ((load-path (image-load-path-for-library "mh-e" "mh-logo.xpm"))
      (image-load-path (cons (car load-path)
                              (when (boundp 'image-load-path)

How would you fix this, then?

   While compiling mh-folder-mode in file
     ** reference to free variable image-load-path

I usually do this:

  (when (boundp 'image-load-path)
    (symbol-value 'image-load-path))

Would using this also quiet the compiler?

(defmacro symbol-value-safe (symbol)
  "Return SYMBOL's value, but avoid signaling an error if it is void.
If SYMBOL is void, return nil."
  (let ((temp-symbol (make-symbol "temp-symbol")))
    `(let ((,temp-symbol ,symbol))
       (if (boundp ,temp-symbol)
           (symbol-value ,temp-symbol)))))

(macroexpand '(symbol-value-safe 'image-load-path))
(let ((temp-symbol (quote image-load-path)))
  (if (boundp temp-symbol) (symbol-value temp-symbol)))

Kevin Rodgers

reply via email to

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