unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#47652: 28.0.50; completion-at-point fails in verilog-mode
@ 2021-04-08  4:13 Simon McFarlane
  2021-04-09  4:04 ` Simon McFarlane
  0 siblings, 1 reply; 3+ messages in thread
From: Simon McFarlane @ 2021-04-08  4:13 UTC (permalink / raw)
  To: 47652

M-x completion-at-point throws a failed assertion in

verilog-mode. After some digging I believe this is because

verilog-toggle-completions is missing a save-excursion somewhere. Sadly

I'm not a true Emacs guru so I couldn't figure out exactly where.


completion-in-region: Assertion failed: (<= start (point)), #<marker at 14 in *new*>, 12



This is reproducible with a very simple verilog file consisting of only

"module test();".



This is very similar to bug #41740 reported by Shinichi Sakata.



In GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.28, cairo version 1.17.4)

  of 2021-04-06 built on 120af952437f

Repository revision: 8c80289348aa95884bb9263a643e3f873ed4bfda

Repository branch: pgtk-nativecomp

Windowing system distributor 'System Description: Arch Linux



Configured using:

  'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib

  --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games

  --with-sound=alsa --with-modules --with-x-toolkit=gtk3 --with-cairo

  --with-xwidgets --with-native-compilation --with-pgtk

  --without-compress-install --without-gconf --without-gsettings

  --without-m17n-flt --enable-autodepend --enable-link-time-optimization

  CC=/usr/bin/clang 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe

  -fno-plt -g -flto'

  LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now

  CPPFLAGS=-D_FORTIFY_SOURCE=2 'CPP=/usr/bin/clang -E''



Configured features:

ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON LCMS2

LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER

PGTK PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XIM XWIDGETS GTK3

ZLIB



Important settings:

   value of $LANG: en_US.UTF-8

   value of $XMODIFIERS: @im=fcitx

   locale-coding-system: utf-8-unix



Major mode: Verilog



Minor modes in effect:

   tooltip-mode: t

   global-eldoc-mode: t

   electric-indent-mode: t

   mouse-wheel-mode: t

   tool-bar-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

   line-number-mode: t

   transient-mark-mode: t



Load-path shadows:

None found.



Features:

(shadow sort mail-extr cl-print debug backtrace find-func cus-edit pp

wid-edit cus-start cus-load thingatpt help-fns radix-tree help-mode

emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa

derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode

mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader

sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils

time-date verilog-mode compile text-property-search comint ansi-color

ring diff company edmacro kmacro pcase easy-mmode 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 cl-seq eieio eieio-core cl-macs eieio-loaddefs

password-cache json subr-x map url-vars seq byte-opt gv bytecomp

byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc electric

uniquify ediff-hook vc-hooks lisp-float-type mwheel term/pgtk-win

pgtk-win term/common-win tool-bar dnd fontset image regexp-opt fringe

tabulated-list replace newcomment text-mode elisp-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 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 xwidget-internal dbusbind

inotify dynamic-setting font-render-setting cairo move-toolbar gtk

x-toolkit pgtk lcms2 multi-tty make-network-process nativecomp emacs)



Memory information:

((conses 16 142467 8669)

  (symbols 48 12266 0)

  (strings 32 36962 2160)

  (string-bytes 1 1193201)

  (vectors 16 20597)

  (vector-slots 8 396489 15323)

  (floats 8 55 22)

  (intervals 56 1040 0)

  (buffers 992 16))






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

* bug#47652: 28.0.50; completion-at-point fails in verilog-mode
  2021-04-08  4:13 bug#47652: 28.0.50; completion-at-point fails in verilog-mode Simon McFarlane
@ 2021-04-09  4:04 ` Simon McFarlane
  2021-04-12  9:46   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Simon McFarlane @ 2021-04-09  4:04 UTC (permalink / raw)
  To: 47652

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

Hi,

After a very pleasant evening with Edebug (seriously, debugging Emacs is such a smooth experience) I found what I believe to be the culprit and have attached a patch that fixes the issue for me. This is my first time contributing to Emacs so I apologize if I've violated the mailing list convention or etiquette.

Happy to make adjustments if my patch isn't quite right.

Thanks,
Simon

[-- Attachment #2: 0001-verilog-mode-add-save-excursion-to-fix-completion-at.patch --]
[-- Type: text/x-patch, Size: 2223 bytes --]

From 5f80b93f0456a94efc9cf027b5f920cb63e13f38 Mon Sep 17 00:00:00 2001
From: Simon McFarlane <sm@desu.ne.jp>
Date: Thu, 8 Apr 2021 20:57:53 -0700
Subject: [PATCH] verilog-mode: add save-excursion to fix completion-at-word
 mangling cursor

---
 lisp/progmodes/verilog-mode.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index a7f72950b1..bc4f101c0a 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -7630,27 +7630,27 @@ nil otherwise."
       (let ((state (car (verilog-calculate-indent))))
 	(cond ((eq state 'defun)
 	       (save-excursion (verilog-var-completion))
-	       (verilog-func-completion 'module)
+	       (save-excursion (verilog-func-completion 'module))
 	       (verilog-keyword-completion verilog-defun-keywords))
 
 	      ((eq state 'behavioral)
 	       (save-excursion (verilog-var-completion))
-	       (verilog-func-completion 'module)
+	       (save-excursion (verilog-func-completion 'module))
 	       (verilog-keyword-completion verilog-defun-keywords))
 
 	      ((eq state 'block)
 	       (save-excursion (verilog-var-completion))
-	       (verilog-func-completion 'tf)
+	       (save-excursion (verilog-func-completion 'tf))
 	       (verilog-keyword-completion verilog-block-keywords))
 
 	      ((eq state 'case)
 	       (save-excursion (verilog-var-completion))
-	       (verilog-func-completion 'tf)
+	       (save-excursion (verilog-func-completion 'tf))
 	       (verilog-keyword-completion verilog-case-keywords))
 
 	      ((eq state 'tf)
 	       (save-excursion (verilog-var-completion))
-	       (verilog-func-completion 'tf)
+	       (save-excursion (verilog-func-completion 'tf))
 	       (verilog-keyword-completion verilog-tf-keywords))
 
 	      ((eq state 'cpp)
@@ -7662,7 +7662,7 @@ nil otherwise."
 
 	      (t;--Anywhere else
 	       (save-excursion (verilog-var-completion))
-	       (verilog-func-completion 'both)
+	       (save-excursion (verilog-func-completion 'both))
 	       (verilog-keyword-completion verilog-separator-keywords))))
 
       ;; Now we have built a list of all matches. Give response to caller
-- 
2.31.1


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

* bug#47652: 28.0.50; completion-at-point fails in verilog-mode
  2021-04-09  4:04 ` Simon McFarlane
@ 2021-04-12  9:46   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-04-12  9:46 UTC (permalink / raw)
  To: Simon McFarlane; +Cc: 47652

Simon McFarlane <sm@desu.ne.jp> writes:

> After a very pleasant evening with Edebug (seriously, debugging Emacs
> is such a smooth experience) I found what I believe to be the culprit
> and have attached a patch that fixes the issue for me. This is my
> first time contributing to Emacs so I apologize if I've violated the
> mailing list convention or etiquette.

It's a perfect bug report.  :-)

> Happy to make adjustments if my patch isn't quite right.

[...]

> -	       (verilog-func-completion 'module)
> +	       (save-excursion (verilog-func-completion 'module))

I used your general idea here, but I moved the save-excursion into the
function instead of wrapping the call sites in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2021-04-12  9:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08  4:13 bug#47652: 28.0.50; completion-at-point fails in verilog-mode Simon McFarlane
2021-04-09  4:04 ` Simon McFarlane
2021-04-12  9:46   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).