GNU bug report logs - #5364
23.1.91; execute-extended-command should do like FFAP

Previous Next

Package: emacs;

Reported by: jidanni <at> jidanni.org

Date: Tue, 12 Jan 2010 13:06:01 UTC

Severity: wishlist

Tags: wontfix

Merged with 355

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> jurta.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 5364 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: bug#5364: 23.1.91; execute-extended-command should do like FFAP
Date: Thu, 14 Jan 2010 23:07:16 +0200
> 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/




This bug report was last modified 14 years and 274 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.