Re: Setting user defined alist - dedicated or defcustom implementation
Heime <[email protected]>
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <W5O_XjF5WfyBdZ0fgX1HQV63osM21xoS139RhrQrL22I7UTWfzQILjzinIiAu5oXb_iYLoZ4jMD0pCYe4_Hls3D6gXoKPueyDowoeAAbHpg=@protonmail.com> |
Perhaps I can get some ideas from frame-parameters taken from set-frame-parameter or similar. But quite unsure about the user input interactive part. On Tuesday, August 4th, 2026 at 10:09 AM, Heime <[email protected]> wrote: > This command allows the user to input an alist of the form (NAME . VALUE). > > But it assumes that the value which is assigned to the named parameter is always a number. > > I would like to generalise this function, perhaps check value to decide what to do with it. Ideally it would allow for any lisp expression as one can do when calling it programmatically in elisp code. > > As example, one could set > > (setq params > (dentex-alist '((minibuffer . t)(width . 80)(height . 80)))) > > > Have thought about the possibility of using customize-set-variable > and customize-set-value. Would they prompt differently based on > the :type of the variable when defined through defcustom? > > (defun dentex-alist (params) > "Define frame parameters PARAMS, as list of cons cells in the form > (NAME . VALUE)." > > (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))) > > ;; ----------------------------------------------------------------- > ;; Return control parameter alist > params) > > > > > > >