GNU bug report logs - #38427
26.2; skeleton-insert does not set str consistently

Previous Next

Package: emacs;

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.

Full log


View this message in rfc822 format

From: Jean Louis <bugs <at> gnu.support>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 38427 <at> debbugs.gnu.org, Tim Landscheidt <tim <at> tim-landscheidt.de>
Subject: bug#38427: 26.2; skeleton-insert does not set str consistently
Date: Sun, 1 Nov 2020 23:23:29 +0300
* 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.




This bug report was last modified 4 years and 165 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.