* Re: master 9291e73 02/12: Add new 'declare' forms for command completion predicates
[not found] ` <20210214131502.DADCE20DFB@vcs0.savannah.gnu.org>
@ 2021-02-20 19:30 ` Basil L. Contovounesios
2021-02-21 13:15 ` Lars Ingebrigtsen
0 siblings, 1 reply; 7+ messages in thread
From: Basil L. Contovounesios @ 2021-02-20 19:30 UTC (permalink / raw)
To: emacs-devel; +Cc: Lars Ingebrigtsen
[-- Attachment #1: Type: text/plain, Size: 644 bytes --]
larsi@gnus.org (Lars Ingebrigtsen) writes:
> branch: master
> commit 9291e7316f98ab0858b323f72047ffd5a23d9ac9
> Author: Lars Ingebrigtsen <larsi@gnus.org>
> Commit: Lars Ingebrigtsen <larsi@gnus.org>
>
> Add new 'declare' forms for command completion predicates
[...]
> +(defalias 'byte-run--set-completion
> + #'(lambda (f _args val)
> + (list 'function-put (list 'quote f)
> + ''completion-predicate val)))
This is the only declare form property that doesn't quote its value,
resulting in forms like (declare (completion 'foo)) rather than the more
conventional (declare (completion foo)). How's the following fix?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Function-quote-completion-property-of-declare-form.patch --]
[-- Type: text/x-diff, Size: 1054 bytes --]
From 3a93eb1c161c4a50b942aaabff450422b8a63679 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@tcd.ie>
Date: Sat, 20 Feb 2021 18:55:12 +0000
Subject: [PATCH] Function-quote completion property of declare form
* lisp/emacs-lisp/byte-run.el (byte-run--set-completion): Quote with
'function' for syntactical consistency with other declare form
properties. This allows writing (declare (completion foo)) instead
of (declare (completion 'foo)).
---
lisp/emacs-lisp/byte-run.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index afe94bb035..6451d7fb62 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -149,7 +149,7 @@ 'byte-run--set-indent
(defalias 'byte-run--set-completion
#'(lambda (f _args val)
(list 'function-put (list 'quote f)
- ''completion-predicate val)))
+ ''completion-predicate (list 'function val))))
(defalias 'byte-run--set-modes
#'(lambda (f _args &rest val)
--
2.30.0
[-- Attachment #3: Type: text/plain, Size: 20 bytes --]
Thanks,
--
Basil
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: master 9291e73 02/12: Add new 'declare' forms for command completion predicates
2021-02-20 19:30 ` master 9291e73 02/12: Add new 'declare' forms for command completion predicates Basil L. Contovounesios
@ 2021-02-21 13:15 ` Lars Ingebrigtsen
2021-02-21 14:11 ` Basil L. Contovounesios
0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-21 13:15 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: emacs-devel
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
> This is the only declare form property that doesn't quote its value,
> resulting in forms like (declare (completion 'foo)) rather than the more
> conventional (declare (completion foo)). How's the following fix?
But you can say
(declare (completion (lambda (...) ...)))
So it's a list of functions, not a list of symbols...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 9291e73 02/12: Add new 'declare' forms for command completion predicates
2021-02-21 13:15 ` Lars Ingebrigtsen
@ 2021-02-21 14:11 ` Basil L. Contovounesios
2021-02-21 15:54 ` Lars Ingebrigtsen
0 siblings, 1 reply; 7+ messages in thread
From: Basil L. Contovounesios @ 2021-02-21 14:11 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel
Lars Ingebrigtsen <larsi@gnus.org> writes:
> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
>> This is the only declare form property that doesn't quote its value,
>> resulting in forms like (declare (completion 'foo)) rather than the more
>> conventional (declare (completion foo)). How's the following fix?
>
> But you can say
>
> (declare (completion (lambda (...) ...)))
Which my patch will turn into (function (lambda (...) ...)), which is
still correct and should be equivalent.
> So it's a list of functions, not a list of symbols...
What is a list? The completion-predicate property takes on a single
value satisfying functionp.
Both lambdas and symbols can be functions; my patch treats both equally,
so I see it as the correct treatment of this declare form property. If
you don't, then please elaborate on why not.
Thanks,
--
Basil
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 9291e73 02/12: Add new 'declare' forms for command completion predicates
2021-02-21 14:11 ` Basil L. Contovounesios
@ 2021-02-21 15:54 ` Lars Ingebrigtsen
2021-02-21 16:13 ` Basil L. Contovounesios
0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-21 15:54 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: emacs-devel
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
>> But you can say
>>
>> (declare (completion (lambda (...) ...)))
>
> Which my patch will turn into (function (lambda (...) ...)), which is
> still correct and should be equivalent.
Sure, but it's a bit redundant.
>> So it's a list of functions, not a list of symbols...
>
> What is a list? The completion-predicate property takes on a single
> value satisfying functionp.
Sorry, I meant a single function.
What I expect to see people actually doing here is
(declare (completion #'foo))
or if it's a lambda, that Emacs will eventually byte-compile it before
sticking it into the plist.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 9291e73 02/12: Add new 'declare' forms for command completion predicates
2021-02-21 15:54 ` Lars Ingebrigtsen
@ 2021-02-21 16:13 ` Basil L. Contovounesios
2021-02-21 18:30 ` Lars Ingebrigtsen
0 siblings, 1 reply; 7+ messages in thread
From: Basil L. Contovounesios @ 2021-02-21 16:13 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel
Lars Ingebrigtsen <larsi@gnus.org> writes:
> What I expect to see people actually doing here is
>
> (declare (completion #'foo))
Why should explicit #'-quoting be needed for (declare (completion foo))
when it's not needed for any other declare form property, including the
new and related 'modes' property:
(declare (modes foo))
(declare (gv-setter foo))
(declare (gv-expander foo))
(declare (obsolete foo ...))
(declare (interactive-only foo))
(declare (compiler-macro foo))
(declare (indent foo))
How is (declare (completion ...)) any different to these?
> or if it's a lambda, that Emacs will eventually byte-compile it before
> sticking it into the plist.
Does the proposed patch stop that from happening?
--
Basil
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 9291e73 02/12: Add new 'declare' forms for command completion predicates
2021-02-21 16:13 ` Basil L. Contovounesios
@ 2021-02-21 18:30 ` Lars Ingebrigtsen
2021-02-26 11:34 ` Basil L. Contovounesios
0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-21 18:30 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: emacs-devel
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
> Why should explicit #'-quoting be needed for (declare (completion foo))
> when it's not needed for any other declare form property, including the
> new and related 'modes' property:
>
> (declare (modes foo))
> (declare (gv-setter foo))
> (declare (gv-expander foo))
> (declare (obsolete foo ...))
> (declare (interactive-only foo))
> (declare (compiler-macro foo))
> (declare (indent foo))
>
> How is (declare (completion ...)) any different to these?
Most of those refer to symbols (or numbers), so #'-ing is irrelevant.
But gv-setter (for one) does refer to a function, so there's precedence
for using symbols instead of functions here indeed.
Anybody else have an opinion?
>> or if it's a lambda, that Emacs will eventually byte-compile it before
>> sticking it into the plist.
>
> Does the proposed patch stop that from happening?
Not at all. I just wanted to mention it.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 9291e73 02/12: Add new 'declare' forms for command completion predicates
2021-02-21 18:30 ` Lars Ingebrigtsen
@ 2021-02-26 11:34 ` Basil L. Contovounesios
0 siblings, 0 replies; 7+ messages in thread
From: Basil L. Contovounesios @ 2021-02-26 11:34 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel
Lars Ingebrigtsen <larsi@gnus.org> writes:
> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
>> Why should explicit #'-quoting be needed for (declare (completion foo))
>> when it's not needed for any other declare form property, including the
>> new and related 'modes' property:
>>
>> (declare (modes foo))
>> (declare (gv-setter foo))
>> (declare (gv-expander foo))
>> (declare (obsolete foo ...))
>> (declare (interactive-only foo))
>> (declare (compiler-macro foo))
>> (declare (indent foo))
>>
>> How is (declare (completion ...)) any different to these?
>
> Most of those refer to symbols (or numbers), so #'-ing is irrelevant.
> But gv-setter (for one) does refer to a function, so there's precedence
> for using symbols instead of functions here indeed.
>
> Anybody else have an opinion?
It seems there were no objections, so I applied the patch.
Function-quote completion property of declare form
752278834b 2021-02-26 11:26:22 +0000
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=752278834b3d317a65135cdaa392b0468ce7372c
Thanks,
--
Basil
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-02-26 11:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20210214131500.30678.63538@vcs0.savannah.gnu.org>
[not found] ` <20210214131502.DADCE20DFB@vcs0.savannah.gnu.org>
2021-02-20 19:30 ` master 9291e73 02/12: Add new 'declare' forms for command completion predicates Basil L. Contovounesios
2021-02-21 13:15 ` Lars Ingebrigtsen
2021-02-21 14:11 ` Basil L. Contovounesios
2021-02-21 15:54 ` Lars Ingebrigtsen
2021-02-21 16:13 ` Basil L. Contovounesios
2021-02-21 18:30 ` Lars Ingebrigtsen
2021-02-26 11:34 ` Basil L. Contovounesios
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).