Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8787377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:52:35+00:00 2026-06-13T21:52:35+00:00

I think I followed the example literally, but it doesn’t work. If I use

  • 0

I think I followed the example literally, but it doesn’t work. If I use defimage macro, the image descriptor isn’t created, but when I use create-image will all the same arguments it does. Below is what I tried:

(defimage test ((:type png :file "/home/wvxvw/Projects/haxe-mode/trunk/ede/etc/images/interface.png")))
test                                    ; nil
(defimage test (:type png :file "/home/wvxvw/Projects/haxe-mode/trunk/ede/etc/images/interface.png"))
test                                    ; nil
(insert-image test)                     ; error
(setq test (create-image "/home/wvxvw/Projects/haxe-mode/trunk/ede/etc/images/interface.png" 'png nil))
(image :type png :file "/home/wvxvw/Projects/haxe-mode/trunk/ede/etc/images/interface.png")
(insert-image test)                     ; shows image

Any hints?

EDIT:

While the code above should illustrate the problem, the actual code that I’m trying to run is a bit more involved. Posting it just in case:

(require 'cl)

(defvar haxe-images-dir
  (concat (file-name-directory load-file-name) "etc/images/"))

(defmacro haxe-define-images (images)
  (append
   '(progn)
   (loop for image in images
         collect
         `(defimage ,(intern (concat "haxe-" image "-icon"))
            ((:type png :file
                    (concat haxe-images-dir ,(concat image ".png"))))))))

(haxe-define-images
 ("private" "public" "static" "instance" "inline"
  "volatile" "variable" "class" "interface" "macro"
  "enum" "deftype" "function"))

EDIT2:

This is how it finally works. Perhaps I had some parts of the code compiled and thus loaded from a different place or some such mystery…

(require 'cl)
(require 'haxe-project)

(defmacro haxe-define-images (images)
  (append
   `(progn)
   (loop for image in images
         with images-root = (concat haxe-install-dir "etc/images/")
         collect
         `(defimage ,(intern (concat "haxe-" image "-icon"))
            ((:type png :file
                    ,(concat images-root image ".png")))))))

(haxe-define-images 
 ("private" "public" "static" "instance" "inline"
  "volatile" "variable" "class" "interface" "macro"
  "enum" "deftype" "function"))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:52:36+00:00Added an answer on June 13, 2026 at 9:52 pm

    It’s a feature of defimage and other def- forms that they only set the variable if it is not already set. From the documentation for defvar:

    The defvar special form is similar to setq in that it sets the value of a variable. It is unlike setq in two ways: first, it only sets the value of the variable if the variable does not already have a value. If the variable already has a value, defvar does not override the existing value. Second, […]

    So I presume that you already have assigned something to test, so the defimage form does nothing. If you are in the process of editing the code, you can force a def- form to be evaluated by putting point on the form, and using the command eval-defun (C-M-x).

    Note that you should use defimage only for declaring a global variable. For other cases (where you are going to be using the image locally), use find-image instead.


    In your updated code, your macro haxe-define-images fails to evaluate the expression (concat haxe-images-dir ...). You can see this by expanding the macro:

     ELISP> (print (macroexpand-all '(haxe-define-images ("foo"))))
     (progn (defvar haxe-address-icon (find-image (quote ((:type png :file (concat haxe-images-dir "address.png"))))) nil))
    

    This won’t work because the concat is inside quote and so is not evaluated. You need to write something like this instead:

    (defmacro haxe-define-images (images)
      (append
       '(progn)
       (loop for image in images
             collect
             `(defimage ,(intern (concat "haxe-" image "-icon"))
                ((:type png :file
                        ,(concat haxe-images-dir image ".png")))))))
    

    (If you actually intend to delay evaluation of haxe-images-dir then the macro will need to be more complex than this, but I’m sure you can figure it out from here.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use https://github.com/chrisbanes/Android-PullToRefresh/ . I followed the example but got the error
I've followed the Album example that was created for the new ZF2 tutorial. For
I recently followed some instructions with RVM to install ruby-debug and I think it
Think about the following: Your ISP offers you a dynamic ip-address (for example 123.123.123.123).
I think I have a basic understanding of this, but am hoping that someone
I followed an example in Charles Petzold's book Programming Windows. That example shows the
I'm trying to use hibernate with spring 3 mvc but at the moment I
I am trying to follow this example from MSDN: http://msdn.microsoft.com/en-us/library/a1hetckb.aspx I think i'm doing
I'v followed the following example , and it works like charm: CKeditor for jquery
You may think this question is like this question asked on StackOverflow earlier. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.