Subject: Re: bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode

From: Eli Zaretskii <[email-masked]>
Date: Sat, 23 Apr 2022 14:28:05 +0300

> From: Cyril Arnould <[email-masked]>
> Date: Sat, 23 Apr 2022 09:47:03 +0000
> 
> This bug has been around forever, it just never occurred to me to file
> a report for it. To reproduce the error:
> 
> 1. Open an empty .vhd file
> 2. Enable vhdl-stutter-mode (C-c RET C-s)
> 3. With Num Lock on, press the kp-decimal key.
> 
> Instead of it printing a dot, I receive the following error message:
> 
> funcall-interactively: Wrong type argument: number-or-marker-p,
> kp-decimal
> 
> If vhdl-stutter-mode is off, the key will print a dot as expected. As a
> workaround, I have remapped [kp-decimal] to [?.] in my .emacs file.

Does the patch below give good results?

Stefan, is this too kludgey? if so, is there a more elegant way?

diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index 642aad5..76eb801 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -8785,7 +8785,13 @@ vhdl-electric-comma
 (defun vhdl-electric-period (count) "`..' --> ` => '"
   (interactive "p")
   (if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
-      (cond ((= (preceding-char) vhdl-last-input-event)
+      (cond ((or (and (integerp vhdl-last-input-event)
+                      (= (preceding-char) vhdl-last-input-event))
+                 (and (eq vhdl-last-input-event 'kp-decimal)
+                      (equal (lookup-key local-function-key-map
+                                         (vector vhdl-last-input-event))
+                             [?.])
+                      (= (preceding-char) ?.)))
 	     (progn (delete-char -1)
 		    (unless (eq (preceding-char) ? ) (insert " "))
 		    (insert "=> ")))