Setting user defined alist - dedicated or defcustom implementation

Heime <[email protected]> Mon, 03 Aug 2026 22:07:55 +0000
Newsgroups gmane.emacs.help
Message-ID <qtOEugeThXCil4mCrQu-GeN-NT1mPRC0DUFZJ7z53sai3HBmZjRPFYbQPwrHUruFtNqZMPk7QuzLAx1tADfdk8jM_zHRg_t3f2aBnP5M0BM=@protonmail.com>
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 a=
lways a number.

I would like to generalise this function, perhaps check value to decide wha=
t 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=20
  (dentex-alist '((minibuffer . t)(width . 80)(height . 80))))


Have thought about the possibility of using customize-set-variable=20
and customize-set-value.  Would they prompt differently based on=20
the :type of the variable when defined through defcustom?=20

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