* bug#73330: 31.0.50; Incorrect completions for 'cond' clauses
@ 2024-09-18 12:36 Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-19 10:07 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-18 12:36 UTC (permalink / raw)
To: 73330
Hi,
1. emacs -Q
2. Insert "(cond (current-p
3. Hit M-TAB to complete
We're completing a symbol in the condition of a cond clause, so it is
expected to be completed as a variable, to current-prefix-argument.
However, Emacs mistakenly thinks that we're completing a function name,
and completes to current-bidi-paragraph-direction.
Thanks,
Eshel
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#73330: 31.0.50; Incorrect completions for 'cond' clauses
2024-09-18 12:36 bug#73330: 31.0.50; Incorrect completions for 'cond' clauses Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-19 10:07 ` Eli Zaretskii
2024-09-19 12:25 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2024-09-19 10:07 UTC (permalink / raw)
To: Eshel Yaron; +Cc: 73330
> Date: Wed, 18 Sep 2024 14:36:18 +0200
> From: Eshel Yaron via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> 1. emacs -Q
> 2. Insert "(cond (current-p
> 3. Hit M-TAB to complete
>
> We're completing a symbol in the condition of a cond clause, so it is
> expected to be completed as a variable, to current-prefix-argument.
> However, Emacs mistakenly thinks that we're completing a function name,
> and completes to current-bidi-paragraph-direction.
Thanks. Does the patch below give good results?
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 9bf6f92..2471296 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -784,13 +784,14 @@ elisp-completion-at-point
(list t (elisp--completion-local-symbols)
:predicate (lambda (sym)
(get sym 'error-conditions))))
- ((and (or ?\( 'let 'let*)
+ ((and (or ?\( 'let 'let* 'cond 'cond* 'bind*)
(guard (save-excursion
(goto-char (1- beg))
(when (eq parent ?\()
(up-list -1))
(forward-symbol -1)
- (looking-at "\\_<let\\*?\\_>"))))
+ (looking-at
+ "\\_<\\(let\\|cond\\|bind\\*\\)\\*?\\_>"))))
(list t (elisp--completion-local-symbols)
:predicate #'elisp--shorthand-aware-boundp
:company-kind (lambda (_) 'variable)
^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#73330: 31.0.50; Incorrect completions for 'cond' clauses
2024-09-19 10:07 ` Eli Zaretskii
@ 2024-09-19 12:25 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-19 13:15 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-19 12:25 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 73330
Eli Zaretskii <eliz@gnu.org> writes:
>> Date: Wed, 18 Sep 2024 14:36:18 +0200
>> From: Eshel Yaron via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>
>> 1. emacs -Q
>> 2. Insert "(cond (current-p
>> 3. Hit M-TAB to complete
>>
>> We're completing a symbol in the condition of a cond clause, so it is
>> expected to be completed as a variable, to current-prefix-argument.
>> However, Emacs mistakenly thinks that we're completing a function name,
>> and completes to current-bidi-paragraph-direction.
>
> Thanks. Does the patch below give good results?
It helps, but also seems to cause a regression. With this change I get:
1. emacs -Q
2. Insert "(cond ((current-p"
^note the additional parenthesis
3. Hit M-TAB to complete
This shows an opposite bug: Emacs should complete function names (and
without the change, it does), but with the change we now get variable
name completion.
Thanks,
Eshel
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#73330: 31.0.50; Incorrect completions for 'cond' clauses
2024-09-19 12:25 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-19 13:15 ` Eli Zaretskii
2024-09-19 14:33 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-19 14:33 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 2 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-09-19 13:15 UTC (permalink / raw)
To: Eshel Yaron; +Cc: 73330
> From: Eshel Yaron <me@eshelyaron.com>
> Cc: 73330@debbugs.gnu.org
> Date: Thu, 19 Sep 2024 14:25:13 +0200
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> Date: Wed, 18 Sep 2024 14:36:18 +0200
> >> From: Eshel Yaron via "Bug reports for GNU Emacs,
> >> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> >>
> >> 1. emacs -Q
> >> 2. Insert "(cond (current-p
> >> 3. Hit M-TAB to complete
> >>
> >> We're completing a symbol in the condition of a cond clause, so it is
> >> expected to be completed as a variable, to current-prefix-argument.
> >> However, Emacs mistakenly thinks that we're completing a function name,
> >> and completes to current-bidi-paragraph-direction.
> >
> > Thanks. Does the patch below give good results?
>
> It helps
Does "helps" mean the original scenario is fixed? or are there any
leftovers in that scenario?
> but also seems to cause a regression. With this change I get:
>
> 1. emacs -Q
> 2. Insert "(cond ((current-p"
> ^note the additional parenthesis
> 3. Hit M-TAB to complete
>
> This shows an opposite bug: Emacs should complete function names (and
> without the change, it does), but with the change we now get variable
> name completion.
How about the patch below?
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 9bf6f92..63bd685 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -784,13 +784,18 @@ elisp-completion-at-point
(list t (elisp--completion-local-symbols)
:predicate (lambda (sym)
(get sym 'error-conditions))))
- ((and (or ?\( 'let 'let*)
+ ((and (or ?\( 'let 'let* 'cond 'cond* 'bind*)
(guard (save-excursion
(goto-char (1- beg))
(when (eq parent ?\()
(up-list -1))
(forward-symbol -1)
- (looking-at "\\_<let\\*?\\_>"))))
+ (or
+ (looking-at
+ "\\_<\\(let\\*?\\|bind\\*\\)\\_>")
+ (and (not (eq parent ?\())
+ (looking-at
+ "\\_<cond\\*?\\_>"))))))
(list t (elisp--completion-local-symbols)
:predicate #'elisp--shorthand-aware-boundp
:company-kind (lambda (_) 'variable)
^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#73330: 31.0.50; Incorrect completions for 'cond' clauses
2024-09-19 13:15 ` Eli Zaretskii
@ 2024-09-19 14:33 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-19 14:33 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 0 replies; 7+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-19 14:33 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 73330
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Eshel Yaron <me@eshelyaron.com>
>> Cc: 73330@debbugs.gnu.org
>> Date: Thu, 19 Sep 2024 14:25:13 +0200
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> >> Date: Wed, 18 Sep 2024 14:36:18 +0200
>> >> From: Eshel Yaron via "Bug reports for GNU Emacs,
>> >> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> >>
>> >> 1. emacs -Q
>> >> 2. Insert "(cond (current-p
>> >> 3. Hit M-TAB to complete
>> >>
>> >> We're completing a symbol in the condition of a cond clause, so it is
>> >> expected to be completed as a variable, to current-prefix-argument.
>> >> However, Emacs mistakenly thinks that we're completing a function name,
>> >> and completes to current-bidi-paragraph-direction.
>> >
>> > Thanks. Does the patch below give good results?
>>
>> It helps
>
> Does "helps" mean the original scenario is fixed? or are there any
> leftovers in that scenario?
Yes, it fixed the original scenario.
>> but also seems to cause a regression. With this change I get:
>>
>> 1. emacs -Q
>> 2. Insert "(cond ((current-p"
>> ^note the additional parenthesis
>> 3. Hit M-TAB to complete
>>
>> This shows an opposite bug: Emacs should complete function names (and
>> without the change, it does), but with the change we now get variable
>> name completion.
>
> How about the patch below?
That works well in both the original scenario and the modified one.
Thank!
Eshel
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#73330: 31.0.50; Incorrect completions for 'cond' clauses
2024-09-19 13:15 ` Eli Zaretskii
2024-09-19 14:33 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-19 14:33 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-19 16:38 ` Eli Zaretskii
1 sibling, 1 reply; 7+ messages in thread
From: Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-09-19 14:33 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 73330
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Eshel Yaron <me@eshelyaron.com>
>> Cc: 73330@debbugs.gnu.org
>> Date: Thu, 19 Sep 2024 14:25:13 +0200
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> >> Date: Wed, 18 Sep 2024 14:36:18 +0200
>> >> From: Eshel Yaron via "Bug reports for GNU Emacs,
>> >> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> >>
>> >> 1. emacs -Q
>> >> 2. Insert "(cond (current-p
>> >> 3. Hit M-TAB to complete
>> >>
>> >> We're completing a symbol in the condition of a cond clause, so it is
>> >> expected to be completed as a variable, to current-prefix-argument.
>> >> However, Emacs mistakenly thinks that we're completing a function name,
>> >> and completes to current-bidi-paragraph-direction.
>> >
>> > Thanks. Does the patch below give good results?
>>
>> It helps
>
> Does "helps" mean the original scenario is fixed? or are there any
> leftovers in that scenario?
Yes, it fixed the original scenario.
>> but also seems to cause a regression. With this change I get:
>>
>> 1. emacs -Q
>> 2. Insert "(cond ((current-p"
>> ^note the additional parenthesis
>> 3. Hit M-TAB to complete
>>
>> This shows an opposite bug: Emacs should complete function names (and
>> without the change, it does), but with the change we now get variable
>> name completion.
>
> How about the patch below?
That works well in both the original scenario and the modified one.
Thanks!
Eshel
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#73330: 31.0.50; Incorrect completions for 'cond' clauses
2024-09-19 14:33 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-09-19 16:38 ` Eli Zaretskii
0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-09-19 16:38 UTC (permalink / raw)
To: Eshel Yaron; +Cc: 73330-done
> From: Eshel Yaron <me@eshelyaron.com>
> Cc: 73330@debbugs.gnu.org
> Date: Thu, 19 Sep 2024 16:33:11 +0200
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > Does "helps" mean the original scenario is fixed? or are there any
> > leftovers in that scenario?
>
> Yes, it fixed the original scenario.
>
> >> but also seems to cause a regression. With this change I get:
> >>
> >> 1. emacs -Q
> >> 2. Insert "(cond ((current-p"
> >> ^note the additional parenthesis
> >> 3. Hit M-TAB to complete
> >>
> >> This shows an opposite bug: Emacs should complete function names (and
> >> without the change, it does), but with the change we now get variable
> >> name completion.
> >
> > How about the patch below?
>
> That works well in both the original scenario and the modified one.
Thanks, installed on master, and closing the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-09-19 16:38 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-18 12:36 bug#73330: 31.0.50; Incorrect completions for 'cond' clauses Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-19 10:07 ` Eli Zaretskii
2024-09-19 12:25 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-19 13:15 ` Eli Zaretskii
2024-09-19 14:33 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-19 14:33 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-19 16:38 ` 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.