unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* What is the type of user input?
@ 2004-10-27 10:51 Hattuari
  2004-10-27 20:36 ` Kevin Rodgers
  0 siblings, 1 reply; 6+ messages in thread
From: Hattuari @ 2004-10-27 10:51 UTC (permalink / raw)


The following code demonstrates the problem I'm having:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; create a property list and use it to map long strings
;; to short strings
(setq paste-gl-type-map ())

(setq paste-gl-type-map (plist-put paste-gl-type-map 'GLbyte     'b))
(setq paste-gl-type-map (plist-put paste-gl-type-map 'GLshort    's))
(setq paste-gl-type-map (plist-put paste-gl-type-map 'GLint      'i))

;;...

(plist-get paste-gl-type-map 'GLbyte) ;; test function call


(defun paste-gl-array(gl-type gl-components gl-vector)
  "Map OpenGL types to corresponding sufixes.(GL\'type\' )"
  (interactive "sType: \nnNumber 1 to 4: \nsVector: ")
  (message " gl-type=%s, gl-components=%d, gl-vector=%s , suffix=%s"
           gl-type gl-components gl-vector
           (plist-get paste-gl-type-map gl-type))
  
  )
;; end of application code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

When I use the code by first `M-x eval-buffer' and then `M-x
paste-gl-array<RET>GLbyte<RET>4<RET>v<RET>', the result is a message
displayed in the echo area as follows:

gl-type=GLbyte, gl-components=4, gl-vector=v , suffix=nil

Notice that gl-type is displayed with the value I entered in the minibuffer
when it is passed to the first %s in the message string.  It seems not to
be treated as a string when passed to plist-get, hence the 'suffix=nil'.

OTOH, when I evaluate this expression in an emacs-lisp buffer
(paste-gl-array 'GLbyte 4 'v), I see the following in the echo area:

gl-type=GLbyte, gl-components=4, gl-vector=v , suffix=b

That is the desired result.  Why is this not the result of calling the
function as an interactive command as described above?

I will continue to look for an answer in the documentation, but any help
from someone who knows the answer would be appreciated.
-- 
p->m == (*p).m == p[0].m

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-10-29 10:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-27 10:51 What is the type of user input? Hattuari
2004-10-27 20:36 ` Kevin Rodgers
2004-10-28 12:34   ` Hattuari
2004-10-28 16:40     ` Kevin Rodgers
2004-10-29  5:54       ` Hattuari
2004-10-29 10:28         ` Johan Bockgård

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