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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 355 in the body.
You can then email your comments to 355 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#355; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to jidanni <at> jidanni.org:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: jidanni <at> jidanni.org
To: bug-gnu-emacs <at> gnu.org
Subject: M-x should prompt with function under cursor as default
Date: Wed, 04 Jun 2008 06:53:40 +0800
Today I was reading a message where this guy said
> FWIW, there are also `customize-apropos' and `customize-apropos-options'.
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.

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.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#355; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to jpw <at> pobox.com (John Paul Wallington):
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #10 received at 355 <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
Subject: Re: bug#355: M-x should prompt with function under cursor as default
Date: Thu, 05 Jun 2008 02:18:29 +0100
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




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#355; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to jidanni <at> jidanni.org:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: jidanni <at> jidanni.org
To: jpw <at> pobox.com
Cc: 355 <at> debbugs.gnu.org
Subject: Re: bug#355: M-x should prompt with function under cursor as default
Date: Fri, 06 Jun 2008 01:58:34 +0800
JPW> patch follows.  If you could test it
JPW> --- keyboard.c
                 ^^thank you but in my "apt-get install emacs" world I
don't brush with .c's, and in fact have barely the brains to test
.el's. So thank you anyway and I'm sure your fix works. OK, bye.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#355; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: jidanni <at> jidanni.org
Cc: 355 <at> debbugs.gnu.org, jpw <at> pobox.com
Subject: Re: bug#355: M-x should prompt with function under cursor as default
Date: Thu, 05 Jun 2008 14:55:58 -0400
tag 355 +wontfix

JPW> patch follows.  If you could test it
JPW> --- keyboard.c
>                  ^^thank you but in my "apt-get install emacs" world I
> don't brush with .c's, and in fact have barely the brains to test
> .el's. So thank you anyway and I'm sure your fix works. OK, bye.

In any case, I don't think the functionality you're asking makes much
sense: it is rather rare to do a M-x where the command you want to run
happens to be under point.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#355; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to jpw <at> pobox.com (John Paul Wallington):
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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






Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#355; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to jpw <at> pobox.com (John Paul Wallington):
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#355; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to John Paul Wallington <jpw <at> pobox.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: John Paul Wallington <jpw <at> pobox.com>
To: emacs-devel <at> gnu.org
Cc: jidanni <at> jidanni.org, 355 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#355: M-x should prompt with function under cursor as default
Date: Thu, 5 Jun 2008 22:15:04 +0100
On 5 Jun 2008, at 20:11, John Paul Wallington wrote:

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

Ooops, I missed Stef's reply to the BTS saying no.  Fair enough :)






Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#355; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to John Paul Wallington <jpw <at> pobox.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#355; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to jidanni <at> jidanni.org:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: jidanni <at> jidanni.org
To: jpw <at> pobox.com, drew.adams <at> oracle.com
Cc: 355 <at> debbugs.gnu.org, emacs-devel <at> gnu.org
Subject: Re: bug#355: M-x should prompt with function under cursor as default
Date: Sat, 07 Jun 2008 01:43:37 +0800
JPW> Do the Emacs developers think that this feature is worth adding ?
JPW> Ooops, I missed Stef's reply to the BTS saying no.  Fair enough :)

SM> In any case, I don't think the functionality you're asking makes much
SM> sense: it is rather rare to do a M-x where the command you want to run
SM> happens to be under point.
Just as often as C-h f and C-h v for me at least.

And why not upgrade the sensitivity of C-h v and C-h f and also make
their prompting default behavior unified with M-x. Incorporating the
John Paul Wallington bug #355 and Drew Adams bug #371 patches would be
a big step in that direction.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#355; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: jidanni <at> jidanni.org
Cc: jpw <at> pobox.com, drew.adams <at> oracle.com, 355 <at> debbugs.gnu.org,
        emacs-devel <at> gnu.org
Subject: Re: bug#355: M-x should prompt with function under cursor as default
Date: Fri, 06 Jun 2008 14:18:33 -0400
JPW> Do the Emacs developers think that this feature is worth adding ?
JPW> Ooops, I missed Stef's reply to the BTS saying no.  Fair enough :)

SM> In any case, I don't think the functionality you're asking makes much
SM> sense: it is rather rare to do a M-x where the command you want to run
SM> happens to be under point.
> Just as often as C-h f and C-h v for me at least.

And how often is that?

For me, C-h f on the function at point is the most common use of
C-h f (I'm looking at a piece of Elisp code and want to know what the
function does).

I have a hard time believe that you often do M-x <FUN> where <FUN> is
the function at point.  Please give me scenarios,


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#355; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to jidanni <at> jidanni.org:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

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

From: jidanni <at> jidanni.org
To: monnier <at> iro.umontreal.ca
Cc: 355 <at> debbugs.gnu.org, emacs-devel <at> gnu.org
Subject: Re: bug#355: M-x should prompt with function under cursor as default
Date: Sat, 07 Jun 2008 02:37:29 +0800
One puts the cursor on the name of a function, learns about it with
C-h f, and if what one reads sounds good, gives it a roll (a trial)
with M-x,  Except no... this (M-x) time we have to type its name in
even though we are sitting on top of it, because...

SM> And how often is that?

OK, only half the functions I read about sound good enough to use M-x on.




Tags added: wontfix Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> emacsbugs.donarmstrong.com. (Tue, 10 Jun 2008 19:45:06 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 20 Jan 2010 20:43:01 GMT) Full text and rfc822 format available.

Merged 355 5364. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 20 Jan 2010 20:43:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 20 Sep 2010 11:24:03 GMT) Full text and rfc822 format available.

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

Previous Next


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