all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
@ 2022-04-23  9:47 Cyril Arnould
  2022-04-23 11:28 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Cyril Arnould @ 2022-04-23  9:47 UTC (permalink / raw)
  To: 55079

[-- Attachment #1: Type: text/plain, Size: 4671 bytes --]

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))

[-- Attachment #2: Type: text/html, Size: 9043 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
  2022-04-23  9:47 bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode Cyril Arnould
@ 2022-04-23 11:28 ` Eli Zaretskii
  2022-04-23 12:57   ` bug#55079: AW: " Cyril Arnould
  2022-04-23 20:21   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2022-04-23 11:28 UTC (permalink / raw)
  To: Cyril Arnould, Stefan Monnier; +Cc: 55079

> From: Cyril Arnould <cyril.arnould@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 "=> ")))





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#55079: AW: bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
  2022-04-23 11:28 ` Eli Zaretskii
@ 2022-04-23 12:57   ` Cyril Arnould
  2022-04-23 13:15     ` Eli Zaretskii
  2022-04-23 20:21   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 10+ messages in thread
From: Cyril Arnould @ 2022-04-23 12:57 UTC (permalink / raw)
  To: Eli Zaretskii, Stefan Monnier; +Cc: 55079@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 980 bytes --]

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 :)

[-- Attachment #2: Type: text/html, Size: 3360 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
  2022-04-23 12:57   ` bug#55079: AW: " Cyril Arnould
@ 2022-04-23 13:15     ` Eli Zaretskii
  2022-04-23 13:27       ` bug#55079: AW: " Cyril Arnould
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2022-04-23 13:15 UTC (permalink / raw)
  To: Cyril Arnould; +Cc: 55079, monnier

> From: Cyril Arnould <cyril.arnould@outlook.com>
> CC: "55079@debbugs.gnu.org" <55079@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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#55079: AW: bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
  2022-04-23 13:15     ` Eli Zaretskii
@ 2022-04-23 13:27       ` Cyril Arnould
  0 siblings, 0 replies; 10+ messages in thread
From: Cyril Arnould @ 2022-04-23 13:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 55079@debbugs.gnu.org, monnier@iro.umontreal.ca

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1594 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
  2022-04-23 11:28 ` Eli Zaretskii
  2022-04-23 12:57   ` bug#55079: AW: " Cyril Arnould
@ 2022-04-23 20:21   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-04-23 22:22     ` bug#55079: AW: " Cyril Arnould
  2022-04-24  5:18     ` Eli Zaretskii
  1 sibling, 2 replies; 10+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-04-23 20:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Reto Zimmermann, 55079, Cyril Arnould

[ 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






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#55079: AW: bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
  2022-04-23 20:21   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-04-23 22:22     ` Cyril Arnould
  2022-04-24  5:18     ` Eli Zaretskii
  1 sibling, 0 replies; 10+ messages in thread
From: Cyril Arnould @ 2022-04-23 22:22 UTC (permalink / raw)
  To: Stefan Monnier, Eli Zaretskii; +Cc: Reto Zimmermann, 55079@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 183 bytes --]

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 `?\(`.

[-- Attachment #2: Type: text/html, Size: 1395 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
  2022-04-23 20:21   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-04-23 22:22     ` bug#55079: AW: " Cyril Arnould
@ 2022-04-24  5:18     ` Eli Zaretskii
  2022-04-24 20:17       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2022-04-24  5:18 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: reto, 55079, cyril.arnould

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Reto Zimmermann <reto@gnu.org>, Cyril Arnould
>  <cyril.arnould@outlook.com>,  55079@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?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
  2022-04-24  5:18     ` Eli Zaretskii
@ 2022-04-24 20:17       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-04-30  7:12         ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-04-24 20:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: reto, 55079, cyril.arnould

> 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






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode
  2022-04-24 20:17       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-04-30  7:12         ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2022-04-30  7:12 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: reto, 55079-done, cyril.arnould

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: reto@gnu.org,  cyril.arnould@outlook.com,  55079@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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-04-30  7:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-23  9:47 bug#55079: 28.1; kp-decimal not working in vhdl-stutter-mode Cyril Arnould
2022-04-23 11:28 ` Eli Zaretskii
2022-04-23 12:57   ` bug#55079: AW: " Cyril Arnould
2022-04-23 13:15     ` Eli Zaretskii
2022-04-23 13:27       ` bug#55079: AW: " Cyril Arnould
2022-04-23 20:21   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-23 22:22     ` bug#55079: AW: " Cyril Arnould
2022-04-24  5:18     ` Eli Zaretskii
2022-04-24 20:17       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-30  7:12         ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.