unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: bug#355: M-x should prompt with function under cursor as default
       [not found] ` <m1abi01xy2.fsf@pobox.com>
@ 2008-06-05 19:11   ` John Paul Wallington
  2008-06-05 21:15     ` John Paul Wallington
  0 siblings, 1 reply; 5+ messages in thread
From: John Paul Wallington @ 2008-06-05 19:11 UTC (permalink / raw)
  To: jidanni; +Cc: 355, bug-gnu-emacs, emacs-devel

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@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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bug#355: M-x should prompt with function under cursor as default
  2008-06-05 19:11   ` bug#355: M-x should prompt with function under cursor as default John Paul Wallington
@ 2008-06-05 21:15     ` John Paul Wallington
  0 siblings, 0 replies; 5+ messages in thread
From: John Paul Wallington @ 2008-06-05 21:15 UTC (permalink / raw)
  To: emacs-devel; +Cc: 355, bug-gnu-emacs, jidanni

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 :)





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bug#355: M-x should prompt with function under cursor as default
       [not found] <mailman.12758.1212763022.18990.bug-gnu-emacs@gnu.org>
@ 2008-06-06 17:43 ` jidanni
  2008-06-06 18:18   ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: jidanni @ 2008-06-06 17:43 UTC (permalink / raw)
  To: jpw, drew.adams; +Cc: 355, emacs-devel

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.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bug#355: M-x should prompt with function under cursor as default
  2008-06-06 17:43 ` jidanni
@ 2008-06-06 18:18   ` Stefan Monnier
  2008-06-06 18:37     ` jidanni
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2008-06-06 18:18 UTC (permalink / raw)
  To: jidanni; +Cc: 355, emacs-devel, drew.adams, jpw

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




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: bug#355: M-x should prompt with function under cursor as default
  2008-06-06 18:18   ` Stefan Monnier
@ 2008-06-06 18:37     ` jidanni
  0 siblings, 0 replies; 5+ messages in thread
From: jidanni @ 2008-06-06 18:37 UTC (permalink / raw)
  To: monnier; +Cc: 355, emacs-devel

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.




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-06-06 18:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.12639.1212534433.18990.bug-gnu-emacs@gnu.org>
     [not found] ` <m1abi01xy2.fsf@pobox.com>
2008-06-05 19:11   ` bug#355: M-x should prompt with function under cursor as default 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:37     ` jidanni

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).