From: jpw@pobox.com (John Paul Wallington)
To: jidanni@jidanni.org
Cc: 355@emacsbugs.donarmstrong.com
Subject: bug#355: M-x should prompt with function under cursor as default
Date: Thu, 05 Jun 2008 02:18:29 +0100 [thread overview]
Message-ID: <m1abi01xy2.fsf@pobox.com> (raw)
In-Reply-To: <mailman.12639.1212534433.18990.bug-gnu-emacs@gnu.org> (jidanni@jidanni.org's message of "Wed, 04 Jun 2008 06:53:40 +0800")
jidanni@jidanni.org writes:
> So I put the cursor upon the word customize-apropos-options and typed M-x,
> and would you believe I had to help emacs figure out what I wanted to do,
> which was of course to type M-x customize-apropos-options.
> (Yes, with the assistance of TAB.)
>
> Compare C-h f (describe-function) with the cursor in that position. It
> knows what to do: prompt with what it finds under the cursor.
Hm. That's an interesting idea.
> P.S., I cannot help with patches because I am too busy reporting bugs
> I encounter in the surface interface, which I am much better at doing
> than coding. Each person has things they are better at doing.
Well, a patch follows. If you could test it, I would be interested to
see whether you liked it in regular use. I'll test it for a while too.
--- keyboard.c.~1.959.~ 2008-06-02 22:07:24.000000000 +0100
+++ keyboard.c 2008-06-05 02:04:13.000000000 +0100
@@ -10451,6 +10451,7 @@
Lisp_Object prefixarg;
{
Lisp_Object function;
+ Lisp_Object symatpt;
char buf[40];
int saved_last_point_position;
Lisp_Object saved_keys, saved_last_point_position_buffer;
@@ -10491,9 +10492,16 @@
restricting to the set of all defined commands. Don't provide
any initial input. Save the command read on the extended-command
history list. */
+
+ symatpt = call0 (intern ("function-called-at-point"));
+ symatpt = (NILP (call1 (Qcommandp, symatpt))) ? Qnil : symatpt;
+
+ if (!NILP (symatpt))
+ symatpt = SYMBOL_NAME (symatpt);
+
function = Fcompleting_read (build_string (buf),
Vobarray, Qcommandp,
- Qt, Qnil, Qextended_command_history, Qnil,
+ Qt, symatpt, Qextended_command_history, Qnil,
Qnil);
#ifdef HAVE_WINDOW_SYSTEM
next parent reply other threads:[~2008-06-05 1:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.12639.1212534433.18990.bug-gnu-emacs@gnu.org>
2008-06-05 1:18 ` John Paul Wallington [this message]
2008-06-05 17:58 ` bug#355: M-x should prompt with function under cursor as default jidanni
2008-06-05 18:55 ` Stefan Monnier
2008-06-05 19:11 ` John Paul Wallington
2008-06-05 21:15 ` John Paul Wallington
[not found] <mailman.12758.1212763022.18990.bug-gnu-emacs@gnu.org>
2008-06-06 17:43 ` jidanni
2008-06-06 18:18 ` Stefan Monnier
2008-06-06 18:18 ` Stefan Monnier
2008-06-06 18:37 ` jidanni
2008-06-06 18:37 ` jidanni
2008-06-06 17:43 ` jidanni
2008-06-03 22:53 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=m1abi01xy2.fsf@pobox.com \
--to=jpw@pobox.com \
--cc=355@emacsbugs.donarmstrong.com \
--cc=jidanni@jidanni.org \
/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.