How can I store the selected value in a let variable when using completing-read ?

(let ( (selc '("Lower-Skeleton" "Upper-Skeleton")) )
  (completing-read "Vista: " selc nil t "Upper-Skeleton")
  • The question isn't clear. There's no let in the question, other than in the title. And it's unclear what you mean by a "selected value".
    – Drew
    Commented Jun 27, 2023 at 22:08
  • completing-read will direct the user to make a selection. The user selection will then be used at a later stage, so I need to store the selected value.
    – Dilna
    Commented Jun 27, 2023 at 22:15
  • Tag selection is about selecting text (e.g. an active region).
    – Drew
    Commented Jun 28, 2023 at 1:08

1 Answer 1


You use setq just like with any other variable:

   (let (foo)
       (setq foo (completing-read ....))
       ;; do something with `foo'

foo's scope is limited to the body of the let form: it's a local variable. Other than that, it's just like any other variable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.