unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Limit what M-x TAB lists?
@ 2013-12-26 14:18 Lars Ingebrigtsen
  2013-12-26 14:58 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Lars Ingebrigtsen @ 2013-12-26 14:18 UTC (permalink / raw)
  To: emacs-devel

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/




^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-01-18 17:43 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-26 14:18 Limit what M-x TAB lists? Lars Ingebrigtsen
2013-12-26 14:58 ` 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

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