From andreas.roehler at online.de Mon Sep 1 18:02:47 2014 From: andreas.roehler at online.de (=?ISO-8859-1?Q?Andreas_R=F6hler?=) Date: Mon, 01 Sep 2014 18:02:47 +0200 Subject: [Python-mode] Completion of symbols defined in current buffer Message-ID: <540498A7.7070209@online.de> Hi Barry, being inclined to drop that feature https://bugs.launchpad.net/python-mode/+bug/1001328 Emacs provides dabbrev-expand, which is Python-agnostic but fairly effectiv. Otherwise the buffers content needs to be evaluated - with means, it must be correct already. WDYT? Andreas From barry at python.org Mon Sep 1 18:16:57 2014 From: barry at python.org (Barry Warsaw) Date: Mon, 1 Sep 2014 12:16:57 -0400 Subject: [Python-mode] Completion of symbols defined in current buffer In-Reply-To: <540498A7.7070209@online.de> References: <540498A7.7070209@online.de> Message-ID: <20140901121657.5127bf16@anarchist.wooz.org> On Sep 01, 2014, at 06:02 PM, Andreas R?hler wrote: >being inclined to drop that feature > >https://bugs.launchpad.net/python-mode/+bug/1001328 > >Emacs provides dabbrev-expand, which is Python-agnostic but fairly effectiv. >Otherwise the buffers content needs to be evaluated - with means, it must be >correct already. I'm probably not qualified to say whether the feature should be kept or not, since I use dabbrev exclusively. Cheers, -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From urs.fleisch at gmail.com Mon Sep 1 21:24:39 2014 From: urs.fleisch at gmail.com (Urs Fleisch) Date: Mon, 1 Sep 2014 21:24:39 +0200 Subject: [Python-mode] Completion of symbols defined in current buffer In-Reply-To: <20140901121657.5127bf16@anarchist.wooz.org> References: <540498A7.7070209@online.de> <20140901121657.5127bf16@anarchist.wooz.org> Message-ID: <20140901212439.68da54dc@pristina> Hi Andreas, Barry, Hi Emacs-Pythonistas, >>being inclined to drop that feature >> >>https://bugs.launchpad.net/python-mode/+bug/1001328 >> >>Emacs provides dabbrev-expand, which is Python-agnostic but fairly >>effectiv. Otherwise the buffers content needs to be evaluated - with >>means, it must be correct already. > >I'm probably not qualified to say whether the feature should be kept >or not, since I use dabbrev exclusively. Since I have contributed quite some code for Python code completion in Emacs, I feel a bit concerned by this question, so let me say a few things about the current state of completion. It's been two years ago when I contributed my completion code, but still, it is quite hard to get a working Emacs-Python-Environment having code completion. I think that a novice (or non-expert) user will have problems getting it working. Theoretically it could be quite easy, just create a ~/.emacs.d/init.el file with the following contents: (require 'pymacs) (setq py-load-pymacs-p t) (require 'auto-complete-config) (ac-config-default) This is for code completing with an auto-complete pop-up-menu. If you prefer a less obtrusive completion using only the TAB key (as I do), then use these lines: (require 'pymacs) (setq py-load-pymacs-p t) (setq py-complete-function 'py-complete-completion-at-point) (setq py-complete-set-keymap-p t) So far so good. However, the problem is, that you must have at least pymacs 0.25, which is unfortunately not part of Ubuntu 14.04 (to name a popular distribution). In this case, you'll have to get pymacs 0.25 (and emacsen-common) from the upcoming Ubuntu 14.10. So with a standard Ubuntu 14.04 LTS installation, it will not work. Let's hope that things improve with Ubuntu 14.10, then users will at least have all preconditions for a working code completion. However, I think that it will be still too hard for the normal user to make it work. Why not have a simple configuration option, which will allow users to enable code completion by a simple mouse click? Such a function should set up all variables and check if the required packages are available and warn the user if not. I must admit that I do not use the Emacs package management (ELPA), I would rather rely on the packages of my Linux distribution, but maybe ELPA could be helpful to get all those prerequisites. Regards, Urs From andreas.roehler at online.de Tue Sep 2 07:58:41 2014 From: andreas.roehler at online.de (=?ISO-8859-1?Q?Andreas_R=F6hler?=) Date: Tue, 02 Sep 2014 07:58:41 +0200 Subject: [Python-mode] Completion of symbols defined in current buffer In-Reply-To: <20140901212439.68da54dc@pristina> References: <540498A7.7070209@online.de> <20140901121657.5127bf16@anarchist.wooz.org> <20140901212439.68da54dc@pristina> Message-ID: <54055C91.9060106@online.de> On 01.09.2014 21:24, Urs Fleisch wrote: > Hi Andreas, Barry, > Hi Emacs-Pythonistas, > >>> being inclined to drop that feature >>> >>> https://bugs.launchpad.net/python-mode/+bug/1001328 >>> >>> Emacs provides dabbrev-expand, which is Python-agnostic but fairly >>> effectiv. Otherwise the buffers content needs to be evaluated - with >>> means, it must be correct already. >> >> I'm probably not qualified to say whether the feature should be kept >> or not, since I use dabbrev exclusively. > > Since I have contributed quite some code for Python code completion in > Emacs, I feel a bit concerned by this question, so let me say a few > things about the current state of completion. > > It's been two years ago when I contributed my completion code, but > still, it is quite hard to get a working Emacs-Python-Environment > having code completion. I think that a novice (or non-expert) user will > have problems getting it working. Theoretically it could be quite easy, > just create a ~/.emacs.d/init.el file with the following contents: > > (require 'pymacs) > (setq py-load-pymacs-p t) > (require 'auto-complete-config) > (ac-config-default) > > This is for code completing with an auto-complete pop-up-menu. If you > prefer a less obtrusive completion using only the TAB key (as I do), > then use these lines: > > (require 'pymacs) > (setq py-load-pymacs-p t) > (setq py-complete-function 'py-complete-completion-at-point) > (setq py-complete-set-keymap-p t) > > So far so good. However, the problem is, that you must have at least > pymacs 0.25, which is unfortunately not part of Ubuntu 14.04 (to name a > popular distribution). In this case, you'll have to get pymacs 0.25 (and > emacsen-common) from the upcoming Ubuntu 14.10. So with a standard > Ubuntu 14.04 LTS installation, it will not work. Let's hope that things > improve with Ubuntu 14.10, then users will at least have all > preconditions for a working code completion. > > However, I think that it will be still too hard for the normal user to > make it work. Why not have a simple configuration option, which will > allow users to enable code completion by a simple mouse click? Such a > function should set up all variables and check if the required packages > are available and warn the user if not. I must admit that I do not use > the Emacs package management (ELPA), I would rather rely on the > packages of my Linux distribution, but maybe ELPA could be helpful to > get all those prerequisites. > > Regards, > Urs > Hi Urs, yes, works great for me. Just a remark: `py-load-pymacs-p' addresses Pymacs-files inlined by python-mode, not a Pymacs installed by running `make'. Loading both, might result in an version-conflict. So in case of running an make'd Pymacs, `py-load-pymacs-p' should be nil, the default. Instead user must follow the install hints delivered with Pymacs-package. Best, Andreas From andreas.roehler at online.de Tue Sep 2 08:11:37 2014 From: andreas.roehler at online.de (=?ISO-8859-1?Q?Andreas_R=F6hler?=) Date: Tue, 02 Sep 2014 08:11:37 +0200 Subject: [Python-mode] Completion of symbols defined in current buffer In-Reply-To: <54055C91.9060106@online.de> References: <540498A7.7070209@online.de> <20140901121657.5127bf16@anarchist.wooz.org> <20140901212439.68da54dc@pristina> <54055C91.9060106@online.de> Message-ID: <54055F99.9050904@online.de> > Just a remark: `py-load-pymacs-p' addresses Pymacs-files inlined by python-mode, not a Pymacs installed by running `make'. > To be precise: an inlined Pymacs is shipped with lp:python-mode/components-python-mode but was removed from trunk. While contributed files providing completion as mentioned here are provided by trunk also. From andreas.roehler at online.de Tue Sep 30 08:51:00 2014 From: andreas.roehler at online.de (=?UTF-8?B?QW5kcmVhcyBSw7ZobGVy?=) Date: Tue, 30 Sep 2014 08:51:00 +0200 Subject: [Python-mode] [Bug 1375122] Re: py-indent-line behavior from 6.1.1 In-Reply-To: <20140929210222.32318.33669.malone@gac.canonical.com> References: <20140929054925.4798.37734.malonedeb@wampee.canonical.com> <20140929210222.32318.33669.malone@gac.canonical.com> Message-ID: <542A52D4.2030503@online.de> On 29.09.2014 23:02, Jonathan C. Dodd wrote: > Unfortunately, C-j is only possible from the previous line, and I tend > to jump around the code quite a bit. When I come back wanting to e. g. > insert a new line into a matrix, I have to either go to the line before > the one I have inserted and press C-j from there, or press TAB > repeatedly and align the remainder with spaces. This is completely > unintuitive and inconsistent relative to other modes (c++-mode, js-mode, > emacs-lisp-mode etc etc, which all move cursor to rightmost sane > indentation when pressing TAB). Seeing you point. However, the way it behaves now is the default for years. May change the behaviour so jumps to outmost with first TAB, stepping backwards afterwards. Or have another boolean and customization? Barry, WDYT? Will cc it to python-mode mailing-list.