0

If I try to set up a buffer with just one integer widget, I have a very hard time editing the field. The initial value seems stuck there and, if I try to edit it away I get a End of file during parsing error (obviously generated in the guts of the widget library or below).

Any idea about what is going on and how to make the integer widget do "the obvious", I suppose by changing the field keymap?

This is for Emacs 25.x to 28.x. The code for the widget is below; you can uncomment the :value initialization just to see what happens. Set it up in the usual way.

        (widget-create 'integer
             :help-echo "Enter an integer..."
             ;; :value  " "
             :notify
             (lambda (w &rest ws)
               (ignore ws)
               (message "WIFT: %s" (widget-value w)))
             :size 4
           )
  • If you type a number after you get the EOF, it seems to go through: not sure what that means, but it may be a clue – NickD May 29 '23 at 17:47
  • Nope. It just gets stuck again in a strange way. Eventually you may force it to accept something, but the field gets screwed up and the :notify does not get properly called. – Marco Antoniotti May 30 '23 at 06:32
  • 1
    Found the bug. It is a problem in the `:value-to-external` functions in the in `sexp` and `restricted-sexp` widgets (the `number` widget must also be fixed). The library `:value-to-external` functions eventually do a `(read value)` where `value` is the widget value; alas, `value` can be `""` if you edit the field in a pretty standard way, causing the traditional minor demons to fly out of the nose, as a 'End of file during parsing' error gets signaled. Specializing the widget fixes the problem, but a good solution need some work. I will open an issue on the Emacs repo. – Marco Antoniotti May 31 '23 at 17:54

0 Answers0