unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Juri Linkov <juri@linkov.net>
Cc: Eli Zaretskii <eliz@gnu.org>,
	Stefan Kangas <stefankangas@gmail.com>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: RE: [External] : Re: master 927b885 1/3: Disable filtering of commands in M-x completion
Date: Thu, 18 Feb 2021 18:24:38 +0000	[thread overview]
Message-ID: <SA2PR10MB447471D8772D96D87E45FEB2F3859@SA2PR10MB4474.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87a6s1e3a3.fsf@mail.linkov.net>

> >> > (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.

Really?  That's a horrible change in default behavior
(IMHO).  Why was that done?

And that simple `foo' definition is enough to point
to regressive behavior.  That command should just
work - across all Emacs versions.  `M-x foo' should
not raise an error suddenly in Emacs 28.  (IMHO.)

This backward-incompatible change will mean that
code such as that for the simple `foo' command will
need to bind that user option to non-nil (and binding
a user option is supposedly a no-no for vanilla Emacs).

> >> 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.

Nearly anything is possible, of course.  Once you
head down a rabbit hole like this you end up
fiddling to change/fix/adapt stuff left & right.

This ought to be a sign that we're headed in the
wrong direction.  (Yet another sign.)

> >> 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.

(Yet another sign.  Left & right...)

> >> 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'.

1. The context here was using a prefix arg for `C-h f'
and `C-h v'.

2. I mentioned that _my_ version of `describe-function'
lets a prefix arg limit candidates to commands.

3. So `C-u M-x describe-function' limits candidates to
commands.

(Similarly for `C-h v'.)

Why are you changing the subject here to invocation of
non-`describe-*' commands with `M-x'?  What's the point?

  reply	other threads:[~2021-02-18 18:24 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210217165944.26910.26583@vcs0.savannah.gnu.org>
     [not found] ` <20210217165946.030D420DFC@vcs0.savannah.gnu.org>
2021-02-17 19:27   ` master 927b885 1/3: Disable filtering of commands in M-x completion Stefan Kangas
2021-02-17 20:01     ` Juri Linkov
2021-02-17 22:18       ` [External] : " Drew Adams
2021-02-18  9:33         ` Juri Linkov
2021-02-18 16:25           ` Drew Adams
2021-02-18 17:22             ` Juri Linkov
2021-02-18 18:24               ` Drew Adams [this message]
2021-02-18 19:03                 ` Juri Linkov
2021-02-18 19:18                   ` Drew Adams
2021-02-18 19:35                 ` Eli Zaretskii
2021-02-18 19:47                   ` Drew Adams
2021-02-18 19:58                     ` Eli Zaretskii
2021-02-18 20:11                       ` Drew Adams
2021-02-18 20:22                       ` Drew Adams
2021-02-18 20:25                         ` Eli Zaretskii
2021-02-18 20:45                           ` Drew Adams
2021-02-19 13:17                             ` Eli Zaretskii
2021-02-19 17:53                               ` Drew Adams
2021-02-19 18:38                                 ` Eli Zaretskii
2021-02-18 23:15                       ` martin rudalics
2021-02-18 23:32                         ` Drew Adams
2021-02-19  8:37                           ` Eli Zaretskii
2021-02-19 17:42                             ` Drew Adams
2021-02-18 19:38                 ` Eli Zaretskii
2021-02-18 19:49                   ` Drew Adams
2021-02-18 19:58                     ` Eli Zaretskii
2021-02-18 20:26                       ` Drew Adams
2021-02-17 20:04     ` Eli Zaretskii
2021-02-17 20:31       ` Stefan Kangas
2021-02-17 20:12     ` [External] : " Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SA2PR10MB447471D8772D96D87E45FEB2F3859@SA2PR10MB4474.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=juri@linkov.net \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).