|
| From: | Decebal |
| Subject: | Re: Something like an array (list) of a class |
| Date: | Mon, 13 Apr 2009 10:57:38 -0700 (PDT) |
| User-agent: | G2/1.0 |
I know have:
(require 'cl)
(defstruct
(ModeLine
(:constructor nil)
(:constructor new-ModeLine (type description display function))
)
(type :read-only t)
(description :read-only t)
(display :read-only t)
(function :read-only t)
)
(setq modelineArray
[
(new-ModeLine
"chars"
"Display number of chars"
"C"
'buffer-count-chars2
)
(new-ModeLine
"lines"
"Display number of lines"
"L"
'buffer-count-lines2
)
(new-ModeLine
"words"
"Display number of words"
"W"
'buffer-count-words2
)
]
)
But there are a few problems:
- I would like to have the vector modelineArray readonly. Is this
possible?
- The vector is notfilled with ModeLine objects. When executing:
(aref modelineArray 2)
I get:
(new-ModeLine "words" "Display number of words" "W" (quote buffer-
count-words2))
So I can not do something like:
(ModeLine-type (aref modelineArray 2))
What is the good way to fill the vector?
| [Prev in Thread] | Current Thread | [Next in Thread] |