From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: writing Python in Emacs Date: Sun, 20 Jan 2008 11:28:21 -0800 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1200858284 23037 80.91.229.12 (20 Jan 2008 19:44:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Jan 2008 19:44:44 +0000 (UTC) To: Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jan 20 20:45:03 2008 Return-path: Envelope-to: geh-help-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 1JGg6I-00082t-AQ for geh-help-gnu-emacs@m.gmane.org; Sun, 20 Jan 2008 20:45:02 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JGg5s-00024M-VZ for geh-help-gnu-emacs@m.gmane.org; Sun, 20 Jan 2008 14:44:37 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JGg5Z-00021n-5U for help-gnu-emacs@gnu.org; Sun, 20 Jan 2008 14:44:17 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JGg5Y-000200-EG for help-gnu-emacs@gnu.org; Sun, 20 Jan 2008 14:44:16 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JGg5X-0001zO-Lm for help-gnu-emacs@gnu.org; Sun, 20 Jan 2008 14:44:15 -0500 Original-Received: from rgminet01.oracle.com ([148.87.113.118]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JGg5X-0005Tn-An for help-gnu-emacs@gnu.org; Sun, 20 Jan 2008 14:44:15 -0500 Original-Received: from rgmgw1.us.oracle.com (rgmgw1.us.oracle.com [138.1.186.110]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id m0KJiCcG011132 for ; Sun, 20 Jan 2008 12:44:12 -0700 Original-Received: from acsmt351.oracle.com (acsmt351.oracle.com [141.146.40.151]) by rgmgw1.us.oracle.com (Switch-3.2.4/Switch-3.2.4) with ESMTP id m0KIZUNs032154 for ; Sun, 20 Jan 2008 12:44:12 -0700 Original-Received: from dhcp-amer-csvpn-gw1-141-144-64-234.vpn.oracle.com by acsmt350.oracle.com with ESMTP id 3526839611200857290; Sun, 20 Jan 2008 11:28:10 -0800 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: Importance: Normal X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:50835 Archived-At: > >> I need the following features: > >> 1) Tab completion, ideally Slime like. That is, when there's not > >> enough letters to unambiguously complete a symbol, I want it to > >> show a buffer (w/o taking the focus) w/ the possible > >> completions. > > > I use hippie expand (M-/) to cycle through possible completions. > > Also known as dabbrev-expand, and tied to Ctrl-TAB. `hippie-expand' and `dabbrev-expand' are different. And neither is bound to C-TAB (by default), AFAIK. `hippie-expand' is not bound to any keys by default, but people often bind it to M-/. See node Hippie Expand in the Emacs manual. > I like it *a lot*, and I like it even more because it *isn't* Python > aware. I can use the same function no matter what I am typing, often > with files noone would dream of writing a mode for. > >> In an ideal world, it would be able to complete fo.ba to > >> foo.bar. I imagine this would require quite tight Emacs-Python > >> integration. You can use `C-M-/', bound to `dabbrev-completion', to use completion instead of cycling to choose one of several matches. However, in vanilla Emacs, this is only prefix completion. If you use Icicles, then `C-M-/' is enhanced to give you apropos completion, in addition to prefix completion. That is, what you type can match a regexp (e.g. substring), not just a prefix. So, for example, you could complete fo.ba or fo.*ba or f.*b or oba or bar to foobar. Icicles also lets you cycle among your input matches. You can access them in any order, and you need not run through each match while cycling - you can access individual matches directly. http://www.emacswiki.org/cgi-bin/wiki/Icicles_-_Completion_in_Other_Buffers# DynamicAbbreviation > >> 4) (optional) I would like to see the definition of a function > >> function or class by hitting M-. on its name. (I understand that > >> this may be impossible for methods, as Emacs would have to > >> automagically infer the type of the object). > > > > This is just an emacs tag file need. Have you googled for > > something like emacs tags python? > > Tags works fine, or at least as well as can be expected. I use the > 'etags' which comes with 'ctags', apparently. Tags are always a good solution. One of the best things Emacs has ever offered the world, and available from its birth. Another approach, which has advantages and disadvantages, is to use Imenu. (This assumes that Python mode is Imenu-aware.) If you use Icicles, then you can use C-' (`icicle-imenu') to browse any definitions that Imenu can recognize, cycling among those that match your input (regexp) or accessing them directly. You can do this across any number of files or buffers at once. This is a great way to bounce around among definitions. The definitions act as completion candidates. *Completions* is dynamically updated to show you those that match your current input. http://www.emacswiki.org/cgi-bin/wiki/Icicles_-_Other_Search_Commands#Icicle sImenu Again, this assumes that Python mode is Imenu-aware. Dunno if it is. If not, you can make it aware by defining the appropriate regexps. HTH.