From: Tim Landscheidt <tim@tim-landscheidt.de>
To: 38427@debbugs.gnu.org
Subject: bug#38427: 26.2; skeleton-insert does not set str consistently
Date: Fri, 29 Nov 2019 15:59:41 +0000 [thread overview]
Message-ID: <87r21qzn9u.fsf@passepartout.tim-landscheidt.de> (raw)
Given (A):
| (let
| ((somevalues '(("a" . "123") ("b" . "456"))))
| (skeleton-insert
| '("Prompt: "
| (cdr (assoc str somevalues)) | str ?\n)))
Emacs asks for input with "Prompt: " and with "a" given, it
outputs "a" instead of the expected "123".
However, with (B):
| (let
| ((somevalues '(("a" . "123") ("b" . "456"))))
| (skeleton-insert
| '("Prompt: "
| str ?\n
| (cdr (assoc str somevalues)) | str ?\n)))
and input "a", it outputs "a" and then "123".
This appears to be due to str being set on the first use on
its own and being:
| (setq str (skeleton-read (quote "Prompt: ") nil nil))
before that (which is not a key in somevalues).
This is probably best shown by (C):
| (let
| ((somevalues '(("a" . "123") ("b" . "456"))))
| (skeleton-insert
| '("Prompt: "
| (cdr (assoc str somevalues)) | "nothing" ?\n)))
which immediately outputs "nothing", without prompting the
user.
This might be a case of PEBKAC, but to me it feels "unnatu-
ral" that removing "str ?\n" from (B) to (A) does not only
remove the line from the output, but changes the meaning of
the skeleton altogether.
(In my use case, I could work around that by outputting str
in a comment, and in general one could probable just add
some dummy like "str (delete-backward-char (length str))",
but this feels very hackish and brittle.)
next reply other threads:[~2019-11-29 15:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-29 15:59 Tim Landscheidt [this message]
2020-11-01 14:45 ` bug#38427: 26.2; skeleton-insert does not set str consistently Lars Ingebrigtsen
2020-11-01 20:23 ` Jean Louis
2020-12-09 15:14 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r21qzn9u.fsf@passepartout.tim-landscheidt.de \
--to=tim@tim-landscheidt.de \
--cc=38427@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.