At 01:55 PM 10/4/00 -0400, you wrote:
>I'm trying to modify the autogen template for generating a Get/Set pair,
>but I'm running into problems that stem from ignorance of Lisp.
>
>At my company, the coding standard dictates that member variables are
>private and are prefixed with 'm', so a variable that would normally be
>named default is named 'mDefault'. Also, arguments begin with 'a', so the
>argument to the setter would be 'aDefault' instead of 'v'.
>
>I've hacked on the function to the extent that everything works except for
>the variable name itself. The problem is in this line:
>
>(P "Variable name: " name) ";" '>'n '>'n
Why not replace this with your own function that reads a name from the
minibuffer, filters it, and returns the result, e.g.
(defun my-insert-get-set-var-name ()
(let ((name (read-from-minibuffer "Variable name: ")))
;; Save variable name for use elsewhere in template.
(tempo-remember-insertion 'name name)
;; Capitalize variable name and then prefix with m.
(concat "m" (jde-gen-init-cap name))))
You would then replace the line
(P "Variable name: " name) ";" '>'n '>'n
in the template with
(my-insert-get-set-var-name) ";" '>'n '>'n
I've not tried this so it may have bugs but I believe the general approach
is right.
- Paul
>I've surmised that the P function reads from the minibuffer and echoes
>that input to the screen, while at the same time storing the value entered
>in the variable 'name'. Everywhere else in the function I apply this:
>
>(jde-gen-init-cap (jde-gen-lookup-named 'name))
>
>to name and prepend 'm' or 'a' as appropriate to generate the correct
>code. Unfortunately, because the input from the minibuffer goes directly
>to the screen, I can't do that to the variable name when it's initially
>entered. I hacked around and tried to split up reading the input and
>printing it out into two steps, but haven't been successful.
>
>If anyone could provide a code snippet that will enable me to do this, I'd
>be much obliged.
>
>--Rafe
>
>---
>Rafe Colburn <[EMAIL PROTECTED]> |
>Development Manager, Consumer Services | web: http://www.alerts.com
>Alerts.com | phone: 919.239.2260