Re: User parameter collection and assignment
[email protected] Sun, 02 Aug 2026 20:48:01 -0400
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <[email protected]> |
Heime <[email protected]> writes: > Have made this generic function for users to fill an alist > of parameters. > > Then I made the command galaxiakos-frame-config to call the generic > function and try to populate the global variable I want - for instance > galaxiakos-frame-prms. > Here are four enumerated expressions based on your expressions that could do what you appear to want. It assumes that the =E2=80=98value=E2=80=99 which is assigned to the named parameter is always a number. If that is not true, then you would need to add conditional code that would check =E2=80=98value=E2=80=99 to decide what to do with (convert it to a number or leave it unchanged, and so on). ;;; 1. (defun galaxiakos-alist-config (params) "Query the user for named parameter/value pairs, PARAMS. Return these pairs as an association list." (interactive (list (let ((name "-") (value nil) (result nil)) (while (not (string-empty-p name)) (setq name (read-string "Parameter Name (leave empty to finish): ")) (unless (string-empty-p name) (setq value (string-to-number (read-string (format "Value for %s: " name)))) (push (cons (intern name) value) result))) result))) params) ;;; 2. (defvar galaxiakos-frame-prms nil "An association list of parameter/value pairs.") ;;; 3. (defun galaxiakos-frame-config () "Set the value of =E2=80=98galaxiakos-frame-prms=E2=80=99 to an associati= on list of parameter/value pairs that are provided by the user." (interactive) (setq galaxiakos-frame-prms (call-interactively 'galaxiakos-alist-config))) ;;; 4. (make-frame galaxiakos-frame-prms) --=20 The lyf so short, the craft so long to lerne. - Geoffrey Chaucer, The Parliament of Birds.