all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Spencer Baugh <sbaugh@janestreet.com>
Cc: dmitry@gutov.dev, 68514@debbugs.gnu.org, Juri Linkov <juri@linkov.net>
Subject: 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	[thread overview]
Message-ID: <jwvil3r26ry.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <ier7ck73mih.fsf@janestreet.com> (Spencer Baugh's message of "Wed, 17 Jan 2024 12:20:06 -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))






  reply	other threads:[~2024-01-17 17:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 17:06 bug#68514: 30.0.50; minibuffer-choose-completion + elisp-c-a-p delete next sexp when completing after open paren Spencer Baugh
2024-01-16 17:28 ` Dmitry Gutov
2024-01-16 17:39 ` Juri Linkov
2024-01-16 19:43   ` Spencer Baugh
2024-01-17 16:37     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-17 17:20       ` Spencer Baugh
2024-01-17 17:53         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-01-17 18:10           ` Spencer Baugh
2024-01-17 19:03             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-18 19:05           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-17 16:42     ` Juri Linkov
2024-01-17 17:22       ` Spencer Baugh
2024-01-17 17:44         ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvil3r26ry.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=68514@debbugs.gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=juri@linkov.net \
    --cc=monnier@iro.umontreal.ca \
    --cc=sbaugh@janestreet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.