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.bugs Subject: bug#355: M-x should prompt with function under cursor as default Date: Thu, 05 Jun 2008 02:18:29 +0100 Message-ID: References: Reply-To: John Paul Wallington , 355@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1212763045 20412 80.91.229.12 (6 Jun 2008 14:37:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Jun 2008 14:37:25 +0000 (UTC) Cc: 355@emacsbugs.donarmstrong.com To: jidanni@jidanni.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 06 16:38:04 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K4d4g-00031K-K1 for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 Jun 2008 16:37:50 +0200 Original-Received: from localhost ([127.0.0.1]:38260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K4d3t-0002Bc-H9 for geb-bug-gnu-emacs@m.gmane.org; Fri, 06 Jun 2008 10:37:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K44Fw-0000XO-Ud for bug-gnu-emacs@gnu.org; Wed, 04 Jun 2008 21:27:08 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K44Fw-0000WG-24 for bug-gnu-emacs@gnu.org; Wed, 04 Jun 2008 21:27:08 -0400 Original-Received: from [199.232.76.173] (port=43000 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K44Fv-0000Vz-Qy for bug-gnu-emacs@gnu.org; Wed, 04 Jun 2008 21:27:07 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:40332) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K44Fv-0005aF-Bh for bug-gnu-emacs@gnu.org; Wed, 04 Jun 2008 21:27:07 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m551R5fD032373; Wed, 4 Jun 2008 18:27:05 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m551P45b031360; Wed, 4 Jun 2008 18:25:04 -0700 X-Loop: don@donarmstrong.com Resent-From: jpw@pobox.com (John Paul Wallington) Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 05 Jun 2008 01:25:04 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 355 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 355-submit@emacsbugs.donarmstrong.com id=B355.121262873130051 (code B ref 355); Thu, 05 Jun 2008 01:25:04 +0000 Original-Received: (at 355) by emacsbugs.donarmstrong.com; 5 Jun 2008 01:18:51 +0000 Original-Received: from sasl.smtp.pobox.com (a-sasl-fastnet.sasl.smtp.pobox.com [207.106.133.19]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m551IiWp030045 for <355@emacsbugs.donarmstrong.com>; Wed, 4 Jun 2008 18:18:46 -0700 Original-Received: from localhost.localdomain (localhost [127.0.0.1]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id 4F0743E3E; Wed, 4 Jun 2008 21:18:44 -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 19C033E3D; Wed, 4 Jun 2008 21:18:40 -0400 (EDT) X-URL: http://www.shootybangbang.com/ X-Attribution: JPW X-NSA-Fodder: supercomputer domestic disruption clandestine radar Ron Brown 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: (jidanni@jidanni.org's message of "Wed, 04 Jun 2008 06:53:40 +0800") User-Agent: Microsoft Gnus Express, Build 513.230 X-Pobox-Relay-ID: 57131D4C-329D-11DD-8301-F9737025C2AA-02562057!a-sasl-fastnet.pobox.com X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Resent-Date: Wed, 04 Jun 2008 21:27:08 -0400 X-Mailman-Approved-At: Fri, 06 Jun 2008 10:36:56 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:18267 Archived-At: 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