GNU bug report logs - #68514
30.0.50; minibuffer-choose-completion + elisp-c-a-p delete next sexp when completing after open paren

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Tue, 16 Jan 2024 17:07:01 UTC

Severity: normal

Found in version 30.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: dmitry <at> gutov.dev, 68514 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#68514: 30.0.50; minibuffer-choose-completion + elisp-c-a-p
 delete next sexp when completing after open paren
Date: Wed, 17 Jan 2024 12:53:39 -0500
> This prevents completion from happening at all when point is right after
> an open paren and right before whitespace, which currently works, though
> it has this bug.

It "works" only in the sense that it shows completions, but the set of
possible completions is arguably too large (or small, depending on your
`completion-styles`) to be very useful, and the rest of the behavior is
broken because when you choose a completion it deletes the subsequent
sexp (because it's actually not completing on "" but on " <SEXP>").

> That doesn't seem like an improvement, and also it
> reverts 0db2126d7176b0bd1b13d4b0d1cd958c8cf55714 which explicitly did
> the opposite.

Then maybe...


        Stefan


diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 00910fb67c7..da0cb96e1cf 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -657,12 +657,13 @@ elisp-completion-at-point
 		    (save-excursion
 		      (backward-sexp 1)
 		      (skip-chars-forward "`',‘#")
-		      (point))
+		      (min (point) pos))
 		  (scan-error pos)))
 	   (end
-	    (unless (or (eq beg (point-max))
-			(member (char-syntax (char-after beg))
-                                '(?\" ?\()))
+	    (cond
+	     ((and (< beg (point-max))
+		   (memq (char-syntax (char-after beg))
+		                   '(?w ?\\ ?_)))
 	      (condition-case nil
 		  (save-excursion
 		    (goto-char beg)
@@ -670,7 +671,11 @@ elisp-completion-at-point
                     (skip-chars-backward "'’")
 		    (when (>= (point) pos)
 		      (point)))
-		(scan-error pos))))
+		(scan-error pos)))
+             ((or (>= beg (point-max))
+                  (memq (char-syntax (char-after beg))
+		        '(?\) ?\s)))
+              beg)))
            ;; t if in function position.
            (funpos (eq (char-before beg) ?\())
            (quoted (elisp--form-quoted-p beg))





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

Previous Next


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