GNU bug report logs - #355
M-x should prompt with function under cursor as default

Previous Next

Package: emacs;

Reported by: jidanni <at> jidanni.org

Date: Tue, 3 Jun 2008 23:00:02 UTC

Severity: wishlist

Tags: wontfix

Merged with 5364

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

Bug is archived. No further changes may be made.

Full log


Message #25 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: jpw <at> pobox.com (John Paul Wallington)
To: jidanni <at> jidanni.org
Cc: 355 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org, emacs-devel <at> gnu.org
Subject: Re: bug#355: M-x should prompt with function under cursor as default
Date: Thu, 05 Jun 2008 20:11:24 +0100
I neglected to CC: bug-gnu-emacs in my original reply.  Do the Emacs
developers think that this feature is worth adding ?

I wrote:

> jidanni <at> 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






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.