[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#355: M-x should prompt with function under cursor as default

From: John Paul Wallington
Subject: bug#355: M-x should prompt with function under cursor as default
Date: Thu, 05 Jun 2008 20:11:24 +0100
User-agent: Microsoft Gnus Express, Build 513.230

I neglected to CC: bug-gnu-emacs in my original reply.  Do the Emacs
developers think that this feature is worth adding ?

I wrote:

> address@hidden 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,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]