From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jpw@pobox.com (John Paul Wallington) Newsgroups: gmane.emacs.devel,gmane.emacs.bugs Subject: Re: bug#355: M-x should prompt with function under cursor as default Date: Thu, 05 Jun 2008 20:11:24 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1212693191 11512 80.91.229.12 (5 Jun 2008 19:13:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Jun 2008 19:13:11 +0000 (UTC) Cc: 355@emacsbugs.donarmstrong.com, bug-gnu-emacs@gnu.org, emacs-devel@gnu.org To: jidanni@jidanni.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 05 21:13:53 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K4KuD-0002zP-RF for ged-emacs-devel@m.gmane.org; Thu, 05 Jun 2008 21:13:50 +0200 Original-Received: from localhost ([127.0.0.1]:58636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K4KtQ-0007YS-V1 for ged-emacs-devel@m.gmane.org; Thu, 05 Jun 2008 15:13:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K4KtL-0007Uy-Hk for emacs-devel@gnu.org; Thu, 05 Jun 2008 15:12:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K4KtK-0007U8-Sh for emacs-devel@gnu.org; Thu, 05 Jun 2008 15:12:55 -0400 Original-Received: from [199.232.76.173] (port=41798 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K4KtJ-0007S6-Id; Thu, 05 Jun 2008 15:12:53 -0400 Original-Received: from a-sasl-fastnet.sasl.smtp.pobox.com ([207.106.133.19]:56251 helo=sasl.smtp.pobox.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K4KtJ-00025c-C6; Thu, 05 Jun 2008 15:12:53 -0400 Original-Received: from localhost.localdomain (localhost [127.0.0.1]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id 2D8915A34; Thu, 5 Jun 2008 15:11:42 -0400 (EDT) Original-Received: from mini.local (host81-158-23-41.range81-158.btcentralplus.com [81.158.23.41]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTPA id 695DD5A30; Thu, 5 Jun 2008 15:11:32 -0400 (EDT) X-URL: http://www.shootybangbang.com/ X-Attribution: JPW X-NSA-Fodder: Legion of Doom AVN halcon CBNRC Afghanistan anarchy subversive X-Face: #uahb@^mo@bA"{q'"a4y[w$n3/V:haD\; YenWcT7)kXYx3/>#[DD9ExVe}; 9FG6X`l!Dm"V peub=u!&&?}s~{TOPtGdH)KA}/qCr; d"Gr*'9_V1PE@+K'tk2/Iq@PBKtJ+]&,CP9_Fl8'*R]LCR0| 6q; Xey'`:DX+)S.]p[KP^sNe`8B\W6(Nw{o5i)y+I!h=0bU5L`Tj`~Q0!G"t(s7o7eh)J\>P>,!~/w $$jGEVa%H%8(jTv In-Reply-To: (John Paul Wallington's message of "Thu, 05 Jun 2008 02:18:29 +0100") User-Agent: Microsoft Gnus Express, Build 513.230 X-Pobox-Relay-ID: 3B457696-3333-11DD-BC02-F9737025C2AA-02562057!a-sasl-fastnet.pobox.com X-detected-kernel: by monty-python.gnu.org: Solaris 10 (beta) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:98481 gmane.emacs.bugs:18263 Archived-At: 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