unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: jpw@pobox.com (John Paul Wallington)
To: jidanni@jidanni.org
Cc: 355@emacsbugs.donarmstrong.com, bug-gnu-emacs@gnu.org,
	emacs-devel@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	[thread overview]
Message-ID: <m18wxjitnn.fsf@pobox.com> (raw)
In-Reply-To: <m1abi01xy2.fsf@pobox.com> (John Paul Wallington's message of "Thu, 05 Jun 2008 02:18:29 +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@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





  parent reply	other threads:[~2008-06-05 19:11 UTC|newest]

Thread overview: 9+ 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 ` bug#355: M-x should prompt with function under cursor as default John Paul Wallington
2008-06-05 17:58   ` jidanni
2008-06-05 18:55     ` Stefan Monnier
2008-06-05 19:11   ` John Paul Wallington [this message]
2008-06-05 21:15     ` John Paul Wallington
     [not found] <jwvbq2eton6.fsf-monnier+emacsbugreports@gnu.org>
2008-06-06 18:37 ` jidanni
     [not found] <mailman.12758.1212763022.18990.bug-gnu-emacs@gnu.org>
2008-06-06 17:43 ` jidanni
     [not found] ` <87wsl2pigm.fsf@jidanni.org>
2008-06-06 18:18   ` Stefan Monnier
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m18wxjitnn.fsf@pobox.com \
    --to=jpw@pobox.com \
    --cc=355@emacsbugs.donarmstrong.com \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=emacs-devel@gnu.org \
    --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 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).