GNU bug report logs - #55079
28.1; kp-decimal not working in vhdl-stutter-mode

Previous Next

Package: emacs;

Reported by: Cyril Arnould <cyril.arnould <at> outlook.com>

Date: Sat, 23 Apr 2022 09:53:01 UTC

Severity: normal

Tags: moreinfo

Found in version 28.1

Done: Eli Zaretskii <eliz <at> gnu.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 55079 in the body.
You can then email your comments to 55079 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55079; Package emacs. (Sat, 23 Apr 2022 09:53:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Cyril Arnould <cyril.arnould <at> outlook.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 23 Apr 2022 09:53:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Cyril Arnould <cyril.arnould <at> outlook.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 28.1; kp-decimal not working in vhdl-stutter-mode
Date: Sat, 23 Apr 2022 09:47:03 +0000
[Message part 1 (text/plain, inline)]
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.


In GNU Emacs 28.1 (build 2, x86_64-w64-mingw32)
of 2022-04-09 built on fv-az449-585
Repository revision: 04afff7cc015bc553c5f7abe57d6b6b23448bbea
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 10.0.19044
System Description: Microsoft Windows 10 Pro (v10.0.2009.19044.1645)

Configured using:
'configure --prefix=/mingw64 --build=x86_64-w64-mingw32 --with-modules
--without-dbus --without-compress-install --with-native-compilation
'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe'
CPPFLAGS=-D__USE_MINGW_ANSI_STDIO=1 LDFLAGS=-pipe'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LIBXML2 MODULES NATIVE_COMP NOTIFY
W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XPM
ZLIB

Important settings:
  value of $LANG: en_GB
  locale-coding-system: cp1252

Major mode: VHDL/es

Minor modes in effect:
  vhdl-stutter-mode: t
  vhdl-electric-mode: t
  override-global-mode: t
  delete-selection-mode: t
  global-display-line-numbers-mode: t
  display-line-numbers-mode: t
  cua-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail vc-dispatcher vc-svn vhdl-mode
hippie-exp multi-scratch use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
use-package-core info tar-mode arc-mode archive-mode easy-mmode
find-func autoload radix-tree lisp-mnt mm-archive message dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 gnus-util
rmail rmail-loaddefs time-date mailabbrev gmm-utils mailheader mm-decode
mm-bodies mm-encode mail-utils gnutls network-stream url-http mail-parse
rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm rmc
puny url-cache url-auth epg-config finder-inf package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap url-handlers url-parse auth-source eieio
eieio-core eieio-loaddefs password-cache json map url-vars rng-nxml
rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util
rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-enc
xmltok sgml-mode facemenu dom hideshow edmacro kmacro server delsel grep
compile text-property-search comint ansi-color ring display-line-numbers
cua-base comp comp-cstr warnings subr-x rx cl-seq cl-macs cl-extra
help-mode seq byte-opt gv cl-loaddefs cl-lib bytecomp byte-compile cconv
cus-load iso-transl tooltip eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table
term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads w32notify w32 multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 422527 250994)
(symbols 48 20856 41)
(strings 32 129405 84278)
(string-bytes 1 3374750)
(vectors 16 38824)
(vector-slots 8 679546 1037538)
(floats 8 89 927)
(intervals 56 649 151)
(buffers 992 16))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55079; Package emacs. (Sat, 23 Apr 2022 11:29:01 GMT) Full text and rfc822 format available.

Message #8 received at 55079 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Cyril Arnould <cyril.arnould <at> outlook.com>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 55079 <at> debbugs.gnu.org
Subject: Re: bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
Date: Sat, 23 Apr 2022 14:28:05 +0300
> From: Cyril Arnould <cyril.arnould <at> outlook.com>
> 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 "=> ")))




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 23 Apr 2022 12:36:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55079; Package emacs. (Sat, 23 Apr 2022 12:58:02 GMT) Full text and rfc822 format available.

Message #13 received at 55079 <at> debbugs.gnu.org (full text, mbox):

From: Cyril Arnould <cyril.arnould <at> outlook.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: "55079 <at> debbugs.gnu.org" <55079 <at> debbugs.gnu.org>
Subject: AW: bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
Date: Sat, 23 Apr 2022 12:57:36 +0000
[Message part 1 (text/plain, inline)]
I don’t regularly use git, for some reason I can’t apply the patch?

$ git apply Eli2.patch
error: patch failed: lisp/progmodes/vhdl-mode.el:8785
error: lisp/progmodes/vhdl-mode.el: patch does not apply

$ git apply --reject --whitespace=fix Eli2.patch
Checking patch lisp/progmodes/vhdl-mode.el...
error: while searching for:
(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)
             (progn (delete-char -1)
                    (unless (eq (preceding-char) ? ) (insert " "))
                    (insert "=> ")))

error: patch failed: lisp/progmodes/vhdl-mode.el:8785
Applying patch lisp/progmodes/vhdl-mode.el with 1 reject...
Rejected hunk #1.

I’ve tried both the emacs-28.1 branch as well as the master branch, am I missing something?

Anyway, when I edited the code manually it seems to work fine :)
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55079; Package emacs. (Sat, 23 Apr 2022 13:16:02 GMT) Full text and rfc822 format available.

Message #16 received at 55079 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Cyril Arnould <cyril.arnould <at> outlook.com>
Cc: 55079 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
Date: Sat, 23 Apr 2022 16:15:06 +0300
> From: Cyril Arnould <cyril.arnould <at> outlook.com>
> CC: "55079 <at> debbugs.gnu.org" <55079 <at> debbugs.gnu.org>
> Date: Sat, 23 Apr 2022 12:57:36 +0000
> 
> I’ve tried both the emacs-28.1 branch as well as the master branch, am I missing something?

Sorry, I don't know.  I produced that from the master branch with
"git diff".

> Anyway, when I edited the code manually it seems to work fine :)

Thanks for testing.  I will wait for Stefan and other to comment on
the fix before I decide whether to install it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55079; Package emacs. (Sat, 23 Apr 2022 13:28:01 GMT) Full text and rfc822 format available.

Message #19 received at 55079 <at> debbugs.gnu.org (full text, mbox):

From: Cyril Arnould <cyril.arnould <at> outlook.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "55079 <at> debbugs.gnu.org" <55079 <at> debbugs.gnu.org>,
 "monnier <at> iro.umontreal.ca" <monnier <at> iro.umontreal.ca>
Subject: AW: bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
Date: Sat, 23 Apr 2022 13:27:15 +0000
[Message part 1 (text/plain, inline)]
I think it was some whitespace issue when copy-pasting from my mail Client.
When I copied it from the GNU Website instead it worked.

Perfect, I’ll continue testing whatever ends up in the emacs-28.1 branch (or the
master branch if you don’t update that anymore).
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55079; Package emacs. (Sat, 23 Apr 2022 20:22:01 GMT) Full text and rfc822 format available.

Message #22 received at 55079 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Reto Zimmermann <reto <at> gnu.org>, 55079 <at> debbugs.gnu.org,
 Cyril Arnould <cyril.arnould <at> outlook.com>
Subject: Re: bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
Date: Sat, 23 Apr 2022 16:21:42 -0400
[ Adding Reto to the Cc:  ]

> -      (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) ?.)))

It does sound pretty kludgey.
How 'bout just replacing `vhdl-last-input-event` with `?\.`, since the
function's name says that this is for period anyway (and the subsequent
`insert-char` inserts a `?\.` regardless of `vhdl-last-input-event`)?


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55079; Package emacs. (Sat, 23 Apr 2022 22:24:01 GMT) Full text and rfc822 format available.

Message #25 received at 55079 <at> debbugs.gnu.org (full text, mbox):

From: Cyril Arnould <cyril.arnould <at> outlook.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>, Eli Zaretskii <eliz <at> gnu.org>
Cc: Reto Zimmermann <reto <at> gnu.org>,
 "55079 <at> debbugs.gnu.org" <55079 <at> debbugs.gnu.org>
Subject: AW: bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
Date: Sat, 23 Apr 2022 22:22:54 +0000
[Message part 1 (text/plain, inline)]
Just tested it, that works as well. It seems to me like a similar solution is
already in place in other stutter mode functions, e.g. in vhdl-electric-open-bracket
there’s a `?\(`.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55079; Package emacs. (Sun, 24 Apr 2022 05:20:01 GMT) Full text and rfc822 format available.

Message #28 received at 55079 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: reto <at> gnu.org, 55079 <at> debbugs.gnu.org, cyril.arnould <at> outlook.com
Subject: Re: bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
Date: Sun, 24 Apr 2022 08:18:28 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Reto Zimmermann <reto <at> gnu.org>, Cyril Arnould
>  <cyril.arnould <at> outlook.com>,  55079 <at> debbugs.gnu.org
> Date: Sat, 23 Apr 2022 16:21:42 -0400
> 
> [ Adding Reto to the Cc:  ]
> 
> > -      (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) ?.)))
> 
> It does sound pretty kludgey.
> How 'bout just replacing `vhdl-last-input-event` with `?\.`, since the
> function's name says that this is for period anyway (and the subsequent
> `insert-char` inserts a `?\.` regardless of `vhdl-last-input-event`)?

Replacing with '?.' where? everywhere?  IOW, making the code assume
that this command can only be bound to '.'?  Or did you mean something
else?

My feeling of a kludge was not about that, it was about the way I make
sure that kp-decimal is remapped to '.'.  Do we have some nicer, more
general facilities for that?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55079; Package emacs. (Sun, 24 Apr 2022 20:18:02 GMT) Full text and rfc822 format available.

Message #31 received at 55079 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: reto <at> gnu.org, 55079 <at> debbugs.gnu.org, cyril.arnould <at> outlook.com
Subject: Re: bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
Date: Sun, 24 Apr 2022 16:17:37 -0400
> My feeling of a kludge was not about that, it was about the way I make
> sure that kp-decimal is remapped to '.'.  Do we have some nicer, more
> general facilities for that?

Maybe we can use something like

    (eq (preceding-char)
        (aref (this-command-keys) 0))


-- Stefan





Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 30 Apr 2022 07:13:02 GMT) Full text and rfc822 format available.

Notification sent to Cyril Arnould <cyril.arnould <at> outlook.com>:
bug acknowledged by developer. (Sat, 30 Apr 2022 07:13:02 GMT) Full text and rfc822 format available.

Message #36 received at 55079-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: reto <at> gnu.org, 55079-done <at> debbugs.gnu.org, cyril.arnould <at> outlook.com
Subject: Re: bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
Date: Sat, 30 Apr 2022 10:12:10 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: reto <at> gnu.org,  cyril.arnould <at> outlook.com,  55079 <at> debbugs.gnu.org
> Date: Sun, 24 Apr 2022 16:17:37 -0400
> 
> > My feeling of a kludge was not about that, it was about the way I make
> > sure that kp-decimal is remapped to '.'.  Do we have some nicer, more
> > general facilities for that?
> 
> Maybe we can use something like
> 
>     (eq (preceding-char)
>         (aref (this-command-keys) 0))

Thanks, this works.

I've installed this change, and I'm closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 28 May 2022 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 305 days ago.

Previous Next


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