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
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 #17 received at 68514 <at> debbugs.gnu.org (full text, mbox):
> If point is already at the start of a sexp (e.g. immediately after an
> open paren) then backward-sexp will not move point and the beginning
> of the completion region would (correctly) be the original point.
>
> forward-sexp, in this case, will move over the next sexp after point
> and include it in the completion region, even if it's a string or
> list.
The fact that it did not move point is not really the problem.
The problem is that point may be just before something like whitespace,
so the
(member (char-syntax (char-after beg))
'(?\" ?\())
doesn't notice that `forward-sexp` will actually jump over a list or
some other such uncompletable sexp.
I suggest the patch below instead (which also uses `min` to try to make
sure we don't return a BEG..END which doesn't contain point).
Stefan
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 00910fb67c7..60d58191175 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -657,12 +657,12 @@ 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))
- '(?\" ?\()))
+ (unless (or (>= beg (point-max))
+ (not (memq (char-syntax (char-after beg))
+ '(?w ?\\ ?_))))
(condition-case nil
(save-excursion
(goto-char beg)
This bug report was last modified 1 year and 125 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.