GNU bug report logs -
#38427
26.2; skeleton-insert does not set str consistently
Previous Next
Reported by: Tim Landscheidt <tim <at> tim-landscheidt.de>
Date: Fri, 29 Nov 2019 16:00:02 UTC
Severity: normal
Tags: moreinfo
Found in version 26.2
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38427 in the body.
You can then email your comments to 38427 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#38427
; Package
emacs
.
(Fri, 29 Nov 2019 16:00:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Tim Landscheidt <tim <at> tim-landscheidt.de>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 29 Nov 2019 16:00:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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.)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#38427
; Package
emacs
.
(Sun, 01 Nov 2020 14:46:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 38427 <at> debbugs.gnu.org (full text, mbox):
Tim Landscheidt <tim <at> tim-landscheidt.de> writes:
> 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".
Evaluating that form gives me:
Debugger entered--Lisp error: (void-variable somevalues)
(assoc str somevalues)
(cdr (assoc str somevalues))
eval((cdr (assoc str somevalues)))
skeleton-internal-1((cdr (assoc str somevalues)) nil nil)
I'm not at all familiar with how skeleton works, but a test case that
works would help when trying to debug. :-)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) moreinfo.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 01 Nov 2020 14:46:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#38427
; Package
emacs
.
(Sun, 01 Nov 2020 20:24:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 38427 <at> debbugs.gnu.org (full text, mbox):
* Lars Ingebrigtsen <larsi <at> gnus.org> [2020-11-01 17:48]:
> Tim Landscheidt <tim <at> tim-landscheidt.de> writes:
>
> > 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".
>
> Evaluating that form gives me:
>
> Debugger entered--Lisp error: (void-variable somevalues)
> (assoc str somevalues)
> (cdr (assoc str somevalues))
> eval((cdr (assoc str somevalues)))
> skeleton-internal-1((cdr (assoc str somevalues)) nil nil)
>
> I'm not at all familiar with how skeleton works, but a test case that
> works would help when trying to debug. :-)
I am using skeletong often. And I was of opinion it was made to create
M-x interactive functions as skeletons to quickly insert such snippets
or interactive templates:
(define-skeleton dear-friend
"Start a letter"
nil
"Dear " (setq name (skeleton-read "Name: ")) ",
Thank you for your feedback.
" _ "
Greetings,
Joe
")
This gives me M-x dear-friend
If there is region marked the _ will replace it with region. It is
very handy.
Tim, I suggest that you define skeleton that works by
`define-skeleton' and then try using it in a function. On the other
hand using skeletons in function somehow beats their purpose.
(let ((somevalues '(("a" . "123") ("b" . "456"))))
(skeleton-insert
'(nil (setq str (skeleton-read "Var: "))
(cdr (assoc str somevalues)) | str ?\n)))
Does that work?
I have no idea what | means here.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#38427
; Package
emacs
.
(Wed, 09 Dec 2020 15:15:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 38427 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Evaluating that form gives me:
>
> Debugger entered--Lisp error: (void-variable somevalues)
> (assoc str somevalues)
> (cdr (assoc str somevalues))
> eval((cdr (assoc str somevalues)))
> skeleton-internal-1((cdr (assoc str somevalues)) nil nil)
>
> I'm not at all familiar with how skeleton works, but a test case that
> works would help when trying to debug. :-)
More information was requested, but no response was given within a
month, so I'm closing this bug report. If progress can be made,
please respond to this email and we'll reopen the bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug closed, send any further explanations to
38427 <at> debbugs.gnu.org and Tim Landscheidt <tim <at> tim-landscheidt.de>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Wed, 09 Dec 2020 15:15:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 07 Jan 2021 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 107 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.