From: Juri Linkov <juri@jurta.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 5364@debbugs.gnu.org, jidanni@jidanni.org
Subject: bug#5364: 23.1.91; execute-extended-command should do like FFAP
Date: Thu, 14 Jan 2010 23:07:16 +0200 [thread overview]
Message-ID: <87ska8jszf.fsf@mail.jurta.org> (raw)
In-Reply-To: <jwveils3esk.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 14 Jan 2010 10:12:33 -0500")
> 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/
next prev parent reply other threads:[~2010-01-14 21:07 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-12 12:52 bug#5364: 23.1.91; execute-extended-command should do like FFAP jidanni
2010-01-12 20:54 ` Juri Linkov
2010-01-12 22:46 ` jidanni
2010-01-13 0:32 ` Juri Linkov
2010-01-13 1:17 ` jidanni
2010-01-13 1:21 ` Stefan Monnier
2010-01-13 2:00 ` jidanni
2010-01-13 4:12 ` Stefan Monnier
2010-01-14 3:33 ` jidanni
2010-01-14 15:12 ` Stefan Monnier
2010-01-14 21:07 ` Juri Linkov [this message]
2010-01-14 22:40 ` Stefan Monnier
2010-01-15 1:12 ` Juri Linkov
2010-01-15 2:20 ` Stefan Monnier
2010-01-15 3:06 ` Chong Yidong
2010-01-15 7:49 ` Stefan Monnier
2010-01-15 9:19 ` Juri Linkov
2010-08-22 23:32 ` Juri Linkov
2010-01-13 7:26 ` Jan D.
2010-01-14 5:29 ` jidanni
2010-01-14 21:01 ` Juri Linkov
2010-01-15 3:04 ` jidanni
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=87ska8jszf.fsf@mail.jurta.org \
--to=juri@jurta.org \
--cc=5364@debbugs.gnu.org \
--cc=jidanni@jidanni.org \
--cc=monnier@iro.umontreal.ca \
/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.