1
votes

I have a skeleton defined like this:

(define-skeleton hello-skeleton
  "Write a greeting"
  "Name: "
  "Hello " str "!")

When I run it with M-x all is well. The minibuffer displays "Name: ", and if I type in "abc" I end up with "Hello abc!". Awesome.

Then I evaluate this:

(define-abbrev text-mode-abbrev-table "hello" "" 'hello-skeleton)

Now, in a buffer with text-mode and abbrev-mode activated, typing "hello" [ENTER] does cause the minibuffer to come alive and display "Name: " again, but this time everything I type in is reversed. Every character I type in the minibuffer pushes the previous character one step to the right and the caret doesn't move.

So if I type "abc" I get "cba" in the minbuffer, and if I press [ENTER] I get "Hello cba!" in the buffer.

I suspected I had some junk in my init-file but I see this behavior even if I start emacs with -q.

What's going on here, why is it doing that?

Using: GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601) of 2013-03-17 on MARVIN. Windows 7 Home Prem.

Update 2014-08-23:

I can reproduce the bug with version 24.1.1 of the Emacs Windows binaries (http://ftp.gnu.org/pub/gnu/emacs/windows/), but not with 23.4.1.

I tried replacing the abbrev-mode and skeleton .el and .elc files in the buggy version (24.1.1) with the ones in the bug-free version (23.4.1) but the problem did not go away. I guess something else changed between those releases that the abbrev-mode/skeleton combo does not take into account..?

Suggestions?

1
Works fine for me (same Emacs version; Linux). Also, just in case, maybe check out yasnippet as an alternative to skeletons. - Dan
I can reproduce this also. Emacs 24.3.1 on Linux. - zck

1 Answers

0
votes

I found a way that gets the job done:

If I press [SPACE] instead of [ENTER] after the trigger-word ("hello" in my example) then I no longer see the strange reversed minibuffer input behavior.

It's confusing because [ENTER] worked just fine in 23.4.1. Then in 24.1.1 there's this weird behavior. My guess is that the Windows line break characters (CR and LF) confuses Emacs 24.

I realise I haven't found an answer to my question, technically speaking, but this is good enough for me.