From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#5364: 23.1.91; execute-extended-command should do like FFAP Date: Thu, 14 Jan 2010 23:07:16 +0200 Organization: JURTA Message-ID: <87ska8jszf.fsf@mail.jurta.org> References: <87my0hgy29.fsf@jidanni.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1263503976 1520 80.91.229.12 (14 Jan 2010 21:19:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Jan 2010 21:19:36 +0000 (UTC) Cc: 5364@debbugs.gnu.org, jidanni@jidanni.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 14 22:19:28 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NVX6E-0005y9-QJ for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Jan 2010 22:19:27 +0100 Original-Received: from localhost ([127.0.0.1]:41265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NVX6F-0008RW-0t for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Jan 2010 16:19:27 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NVX6A-0008QH-Jb for bug-gnu-emacs@gnu.org; Thu, 14 Jan 2010 16:19:22 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NVX65-0008OY-Vp for bug-gnu-emacs@gnu.org; Thu, 14 Jan 2010 16:19:22 -0500 Original-Received: from [199.232.76.173] (port=38254 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NVX65-0008OV-T4 for bug-gnu-emacs@gnu.org; Thu, 14 Jan 2010 16:19:17 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50496) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NVX65-0007NX-MN for bug-gnu-emacs@gnu.org; Thu, 14 Jan 2010 16:19:17 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NVX2w-0006w7-A4; Thu, 14 Jan 2010 16:16:02 -0500 X-Loop: bug-gnu-emacs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Jan 2010 21:16:02 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: followup 5364 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 5364-submit@debbugs.gnu.org id=B5364.126350375626644 (code B ref 5364); Thu, 14 Jan 2010 21:16:02 +0000 Original-Received: (at 5364) by debbugs.gnu.org; 14 Jan 2010 21:15:56 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NVX2o-0006vf-3l for submit@debbugs.gnu.org; Thu, 14 Jan 2010 16:15:54 -0500 Original-Received: from smtp-out3.starman.ee ([85.253.0.5] helo=mx1.starman.ee) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NVX2l-0006vT-MI for 5364@debbugs.gnu.org; Thu, 14 Jan 2010 16:15:52 -0500 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Original-Received: from mail.starman.ee (85.253.48.2.cable.starman.ee [85.253.48.2]) by mx1.starman.ee (Postfix) with ESMTP id 898433F4102; Thu, 14 Jan 2010 23:15:41 +0200 (EET) In-Reply-To: (Stefan Monnier's message of "Thu, 14 Jan 2010 10:12:33 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (x86_64-pc-linux-gnu) X-Spam-Score: -3.6 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list X-Spam-Score: -3.6 (---) Resent-Date: Thu, 14 Jan 2010 16:16:02 -0500 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:34333 Archived-At: > Single examples of "text at point" don't help me understand why this > happens *repeatedly*. If you could describe where those chunks of text > come from and why you end up using them in M-x, maybe that would help. After this bug report, I started to notice that most often I want to put a command name at point to the M-x minibuffer is when I'm looking at a new package and trying out its commands. > It's bad to have a default in the prompt which is almost always not the > one you want. People will soon send bug reports about "M-x chooses dumb > defaults". I agree that a default should not be in the prompt of M-x. > In the pretest code, we've solved this problem by making M-n bring up > the "file at point" if you have ffap loaded (IIUC). This should work > with all file-reading commands, contrary to FFAP itself which only > works for the commands it redefined. > So after C-x i, try M-n. We could do the same for M-x to let M-n to bring up the command at point. This single default value will replace the current list of useless default values reported in bug#5214. The following patch closes both bug#5364 and bug#5214. For bug#5364 it adds the command at point when typing `M-x M-n' (but not to the prompt of M-x). For bug#5214 it removes a list of confusing random values for `M-x M-n M-n'. I know that relying on the `minibuffer-history-variable' being equal to `extended-command-history' is not a clean solution, but it works, and currently I see no other way to achieve the same result. === modified file 'lisp/simple.el' --- lisp/simple.el 2010-01-13 08:35:10 +0000 +++ lisp/simple.el 2010-01-14 21:07:12 +0000 @@ -1375,9 +1375,13 @@ (defun minibuffer-default-add-completion (all (all-completions "" minibuffer-completion-table minibuffer-completion-predicate))) - (if (listp def) - (append def all) - (cons def (delete def all))))) + (if (eq minibuffer-history-variable 'extended-command-history) + (with-current-buffer (window-buffer (minibuffer-selected-window)) + (and (function-called-at-point) + (format "%S" (function-called-at-point)))) + (if (listp def) + (append def all) + (cons def (delete def all)))))) (defun goto-history-element (nabs) "Puts element of the minibuffer history in the minibuffer. -- Juri Linkov http://www.jurta.org/emacs/