all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: emacs-devel@gnu.org
Subject: Limit what M-x TAB lists?
Date: Thu, 26 Dec 2013 15:18:48 +0100	[thread overview]
Message-ID: <87bo03itkn.fsf@building.gnus.org> (raw)

Here's today's unrealistic idea: Wouldn't it be nice if `M-x fooTAB' was
more useful?

For instance, if I type `M-x vc-dTAB' in this buffer, I get the
following: 

Possible completions are:
vc-default-check-headers 	vc-default-mark-resolved
vc-default-revision-completion-table 	vc-delete-file
vc-diff 	vc-dir
vc-dir-delete-file 	vc-dir-find-file
vc-dir-find-file-other-window 	vc-dir-hide-state
vc-dir-hide-up-to-date 	vc-dir-ignore
vc-dir-isearch 	vc-dir-isearch-regexp
vc-dir-kill-dir-status-process 	vc-dir-kill-line
vc-dir-mark 	vc-dir-mark-all-files
vc-dir-menu 	vc-dir-mode
vc-dir-next-directory 	vc-dir-next-line
vc-dir-previous-directory 	vc-dir-previous-line
vc-dir-query-replace-regexp 	vc-dir-refresh
vc-dir-search 	vc-dir-show-fileentry
vc-dir-toggle-mark 	vc-dir-unmark
vc-dir-unmark-all-files 	vc-dir-unmark-file-up

Out of all this, I think there's two actual commands I can use here --
the rest are just commands bound to keystrokes in VC mode.

It would be really nice for discoverability if only those two applicable
commands were listed.

And it doesn't really seem unachievable.  There's oodles of ways of
achieving this that would require more or less work.

1) Just make M-x list ;;;###autoloaded functions.

That would require us adding those cookies to more functions, though.

2) New form like (command-interactive 'vc-mode "p")

This would say "this command is only valid in VC mode buffers", so it
would not be listed by M-x in other modes.  This would be pretty
flexible, but would be a lot of code churn.  But it wouldn't require a
global Armageddon date, but one could add this at leisure, and M-x would
gradually become nicer.

3) New form like (global-interactive "p")

Kinda like the opposite of 2), but here we mark commands as being
global.  It would be less churn, but be more Armageddon-ey.  Unless we
add cookies per file that says that "this file is now new-style".  Kinda
like

(pragma (local-interactive 'vc-mode))

at the start or something.

The added bonus of both 2) and 3) might be that commands would refuse to
run unless called in the right mode buffers.  Which might mean fewer bug
reports down the line.

There's a bunch of commands (like `quit-window') that apply to many
(special) modes, but we could figure something out for those, too...

(Oops.  I almost ran `M-x quit-window' in this buffer.  I wonder what
would have happened...)

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




             reply	other threads:[~2013-12-26 14:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-26 14:18 Lars Ingebrigtsen [this message]
2013-12-26 14:58 ` Limit what M-x TAB lists? Stefan Monnier
2013-12-26 15:24   ` Lars Ingebrigtsen
2013-12-26 16:03     ` Óscar Fuentes
2013-12-26 16:09       ` Lars Ingebrigtsen
2013-12-26 17:50         ` Stefan Monnier
2013-12-26 18:03           ` Lars Ingebrigtsen
2013-12-27  1:41             ` Lars Ingebrigtsen
2014-01-03 18:00               ` Ted Zlatanov
2014-01-06 15:47             ` Davis Herring
2014-01-18 17:43               ` Lars Ingebrigtsen
2013-12-26 17:50 ` Tom
2014-01-11 21:07   ` Nix
2014-01-11 23:38     ` Drew Adams
2013-12-27  7:29 ` Stephen J. Turnbull

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

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

  git send-email \
    --in-reply-to=87bo03itkn.fsf@building.gnus.org \
    --to=larsi@gnus.org \
    --cc=emacs-devel@gnu.org \
    /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 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.