emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [External] : Re: master 927b885 1/3: Disable filtering of commands i


From: Juri Linkov
Subject: Re: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion
Date: Thu, 18 Feb 2021 11:33:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> Also maybe a key to toggle filtering in the already active completion
>> (and a key to toggle sorting).
>
> For filtering, why toggle instead of cycle, or
> completion-choose a sort order?  I.e., why allow
> for only two choices?

I agree, cycling is better.

>> I'd like also to suggest to filter out
>> commands having "r" in their interactive specs - they signal
>> an error when the region is not active, so no need to show them.
>
> Are you sure they raise an error?
>
> (defun foo (&optional beg end)
>   (interactive "r")
>   (message "FOO"))

Yes, I'm sure.  'M-x foo RET' without an active region raises an error:

  command-execute: The mark is not active now

> I also think it's misleading to base filtering on
> an `interactive' form that uses a string.  That's
> inherently fragile/limiting.  It won't apply to a
> form that evaluates a sexp to provide the args.
> The resulting incoherence will confuse users.

This means that more complex interactive specs need
manual tagging using a new tag:

  (declare (predicate (use-region-p)))

>> Also filter out commands with "*" in read-only buffers.
>
> Same problem.  Relying on a string arg to `interactive'
> is not a great idea, I think.

Same tag:

  (declare (predicate (not buffer-read-only)))

>> `describe-command' is a very good idea for searching
>> and discovering commands.
>
> I mentioned that I defined that long ago.  But I'll
> also mention that `describe-function' with a prefix
> arg already gives you that behavior.  Oops!  Nope,
> that too is something I defined long ago in
> `help-fns+.el'.
>
> Similarly, I defined `describe-option', and a prefix
> arg to (my definition of) `describe-variable' limits
> choices to user options (like `describe-option').

Using a prefix arg for 'C-h f' and 'C-h v' to limit the list
of completions would be nice.

But I guess M-x can't use a prefix arg to limit completions?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]