0

I can use completing-read to choose from several items like this:

(completing-read
 "Complete a foo: "
 '(("apple" 1) ("barfoo" 2) ("elk" 3) ("foobar2" 4)) ;; collection of choices
 nil t )

But the example below does not show the value of buffer-file-name as one of the choices:

(completing-read
 "Complete a foo: "
 '(((buffer-file-name) 1) ("barfoo" 2) ("elk" 3) ("foobar2" 4)) ;; collection of choices
 nil t )

How can I include buffer-file-name as one of the choices?

Kevin Wright
  • 359
  • 1
  • 16
  • 2
    Quoting prevents evaluation. Use backquote, not quote, and use comma for the sexp you want evaluated inside the backquoted sexp: `(buffer-file-name)`. – Drew Jan 27 '20 at 20:09
  • Translation for non-experts: Use `((( and then ,(buffer-file-name). – Kevin Wright Jan 28 '20 at 21:21

0 Answers0