unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to fix/work around "first" skeleton evaluation of str in expressions?
@ 2022-08-02 21:36 Tim Landscheidt
  0 siblings, 0 replies; only message in thread
From: Tim Landscheidt @ 2022-08-02 21:36 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

given the example:

| (let
|     ((v '(("a" . "b"))))
|   (skeleton-insert `((completing-read "Input: " ',v)
|                      "str = " str ?\n
|                      "Output: " (cdr (assoc str ',v)) | str ?\n)))

when entering/choosing "a" at prompt, the output is:

| str = a
| Output: b

When entering "not-a", the output is:

| str = not-a
| Output: not-a

Everything is working as expected.  Now if the first line of
the skeleton is removed:

| (let
|     ((v '(("a" . "b"))))
|   (skeleton-insert `((completing-read "Input: " ',v)
|                      "Output: " (cdr (assoc str ',v)) | str ?\n)))

the output when entering "a" is:

| Output: a

The same happens if (completing-read "Input: " ',v) is re-
placed by a simple "Input: ".

skeleton-insert's documentation says:

| […]                             The following local variables are
| available:

|         str     first time: read a string according to INTERACTOR
|                 then: insert previously read string once more
| […]

so I can imagine that skeleton-insert gets confused by str
being first used inside an expression.

But what is the proper way to reliably use it "there"?

TIA,
Tim




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-02 21:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-02 21:36 How to fix/work around "first" skeleton evaluation of str in expressions? Tim Landscheidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).