[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 19:22:12 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
>> > (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 don't see that in Emacs 27.1 or prior (with
> `emacs -Q'). Is this perhaps new for 28?
> If so, why would we do that?
It raises an error because the value of
mark-even-if-inactive was changed to nil,
so the region exists only when explicitly activated.
>> This means that more complex interactive specs
>> need manual tagging using a new tag:
>> (declare (predicate (use-region-p)))
>
> But even that won't handle arbitrary `interactive'
> sexps, right?
`declare' could use the same logic used in `interactive'
that detects region boundaries.
>> Same tag:
>> (declare (predicate (not buffer-read-only)))
>
> And what about commands that might be usable
> interactively, but whose `interactive' spec
> doesn't encapsulate all that's involved? In that
> case, manual addition of a declaration will need
> to look into the logic of the command body as
> well. (Admittedly, such commands are uncommon.)
Yes, here it should share the same logic as well.
>> 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?
>
> Why do you think so? `C-u M-x describe-function TAB'
> (with my definition from `help-fns+.el') shows only
> commands as candidates.
The docstring of `execute-extended-command' says:
To pass a prefix argument to the command you are invoking,
give a prefix argument to ‘execute-extended-command’.
And indeed `C-u M-x forward-char RET' moves 4 chars forwards.
So you can't use `C-u M-x TAB' to limit the number of completions.
Maybe then use another prefix like `C-x', i.e. `C-x M-x'?
This is similar to how `C-x M-:' combines the prefix `C-x'
to run `repeat-complex-command'.
- Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Stefan Kangas, 2021/02/17
- Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Eli Zaretskii, 2021/02/17
- RE: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Drew Adams, 2021/02/17
- Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Juri Linkov, 2021/02/17
- RE: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Drew Adams, 2021/02/17
- Re: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Juri Linkov, 2021/02/18
- RE: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Drew Adams, 2021/02/18
- Re: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion,
Juri Linkov <=
- RE: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Drew Adams, 2021/02/18
- Re: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Juri Linkov, 2021/02/18
- RE: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Drew Adams, 2021/02/18
- Re: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Eli Zaretskii, 2021/02/18
- RE: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Drew Adams, 2021/02/18
- Re: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Eli Zaretskii, 2021/02/18
- RE: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Drew Adams, 2021/02/18
- RE: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Drew Adams, 2021/02/18
- Re: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Eli Zaretskii, 2021/02/18
- RE: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion, Drew Adams, 2021/02/18