From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Limit what M-x TAB lists? Date: Fri, 27 Dec 2013 16:29:13 +0900 Message-ID: <8738len452.fsf@uwakimon.sk.tsukuba.ac.jp> References: <87bo03itkn.fsf@building.gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Trace: ger.gmane.org 1388129436 26386 80.91.229.3 (27 Dec 2013 07:30:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Dec 2013 07:30:36 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 27 08:30:42 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VwRsW-00033R-Fp for ged-emacs-devel@m.gmane.org; Fri, 27 Dec 2013 08:30:40 +0100 Original-Received: from localhost ([::1]:48202 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwRsV-0004g3-Vk for ged-emacs-devel@m.gmane.org; Fri, 27 Dec 2013 02:30:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwRsM-0004fv-Fv for emacs-devel@gnu.org; Fri, 27 Dec 2013 02:30:37 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwRsE-0001z9-TT for emacs-devel@gnu.org; Fri, 27 Dec 2013 02:30:30 -0500 Original-Received: from mgmt2.sk.tsukuba.ac.jp ([130.158.97.224]:36106) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwRsE-0001cR-Ig for emacs-devel@gnu.org; Fri, 27 Dec 2013 02:30:22 -0500 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mgmt2.sk.tsukuba.ac.jp (Postfix) with ESMTP id 5DFC99707DD; Fri, 27 Dec 2013 16:29:13 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id 515321A2793; Fri, 27 Dec 2013 16:29:13 +0900 (JST) In-Reply-To: <87bo03itkn.fsf@building.gnus.org> X-Mailer: VM undefined under 21.5 (beta34) "kale" 2a0f42961ed4 XEmacs Lucid (x86_64-unknown-linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 130.158.97.224 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:166911 Archived-At: Lars Ingebrigtsen writes: > 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 vc-default-... vc-delete-file vc-diff vc-dir vc-dir-... is simple to compute algorithmically (string processing). It doesn't do what you want, obviously, but it sure reduces the visual clutter. Another algorithmic approach would be to mark each symbol defined in a keymap with the property 'completion-keymap and the keymap (list of keymaps). If none of the keymaps in which a symbol is defined are currently active, filter the symbol out. Heck, maybe the property is a premature optimization; perhaps which keymaps bind the function and whether they are active can be done sufficiently quickly.