Re: [Python-mode] Python help buffer
2015-03-10 8:22 GMT+00:00 Andreas Röhler andreas.roeh...@online.de: On 09.03.2015 18:26, andrea crotti wrote: Hi again Andreas and all. I'm still having this issue with the documentation buffer popping up all the time.. I'm using now python-mode version: python-mode-20150221.1223/ from Melpa. So doing the dirty trick (defun py-help-at-point nil) kind of works but now causes other issues, so I'd rather just fix it once for all. I've been trying to understand how that function is triggered in the first place but can't find it, and it must be something different between Emacs 24 and Emacs 25 because it doesn't happen on the 24.. Hi Andrea, this rather indicates a bug in Emacs25. Any reason to use the bleeding edge? BTW latest pretest 24.4.91.1 runs nicely here. Cheers Well there are some nice things in Emacs25 that I like (like improved rectangular editing) but I'm also fine with Emacs 24. However it might be also a combination of changes in Emacs25 and python-mode imho, this issue has been there for a long time it sounds strange that it's just an Emacs bug.. I would report a bug to Emacs but I can't understand for the life of me how this thing is triggered in the first place, I can write an email to the mailing list there and see what they say. ___ Python-mode mailing list Python-mode@python.org https://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] Python help buffer
Hi again Andreas and all. I'm still having this issue with the documentation buffer popping up all the time.. I'm using now python-mode version: python-mode-20150221.1223/ from Melpa. So doing the dirty trick (defun py-help-at-point nil) kind of works but now causes other issues, so I'd rather just fix it once for all. I've been trying to understand how that function is triggered in the first place but can't find it, and it must be something different between Emacs 24 and Emacs 25 because it doesn't happen on the 24.. Any idea where to look for? 2015-01-07 19:48 GMT+00:00 andrea crotti andrea.crott...@gmail.com: 2015-01-07 19:40 GMT+00:00 Andreas Röhler andreas.roeh...@online.de: On 07.01.2015 18:50, andrea crotti wrote: 2015-01-07 12:33 GMT+00:00 Andreas Röhler andreas.roeh...@online.de: Hi Andrea, From Emacs -Q, loading python-mode.el by hand, does it still happen? Andreas I realised to my surprise that I was not actually using the version from ELPA but a version in my disk. Anyway I now downloaded from ELPA (marmalade) 6.13 started Emacs 25 with -Q and evaluated manually the python-mode.el buffer. It still happens, so I bet the problem is something with Emacs 25 that auto call something that didn't use to call before? It would really make sense to check with emacs -Q, load python-mode.el, open some .py file. Yes sorry maybe I was not clear, I've done exactly that and it still happens.. ___ Python-mode mailing list Python-mode@python.org https://mail.python.org/mailman/listinfo/python-mode
[Python-mode] python-components-switches?
Hi guys, I just reinstalled everything from scratch and loading python-mode gives me this error below.. The file in fact does not exist anywhere so not sure how it was working before, any idea where it should be? thanks Debugger entered--Lisp error: (file-error Cannot open load file no such file or directory python-components-switches) require(python-components-switches) eval-buffer(#buffer *load* nil /home/andrea/.emacs.d/elpa/python-mode-20150117.955/python-mode.el nil t) ; Reading at buffer position 90348 load-with-code-conversion(/home/andrea/.emacs.d/elpa/python-mode-20150117.955/python-mode.el /home/andrea/.emacs.d/elpa/python-mode-20150117.955/python-mode.el nil nil) load(python-mode) load-library(python-mode) call-interactively(load-library record nil) command-execute(load-library record) execute-extended-command(nil load-library) call-interactively(execute-extended-command nil nil) command-execute(execute-extended-command) ___ Python-mode mailing list Python-mode@python.org https://mail.python.org/mailman/listinfo/python-mode
[Python-mode] Python help buffer
Hi guys, I have a problem with Emacs 25 that does not happen with Emacs 24.4. More specifically with: - GNU Emacs 25.0.50.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F34)) of 2014-11-15 on builder10-9.porkrind.org - Python mode: 6.1.3 So in short with Emacs 25 the *Python Help* buffer keeps coming up, whenever the cursor stays for more than a second on something. I digged a bit and it seems to come from the py-help-at-point function, can't understand why it does not happen with Emacs 24.4. I thought it was related to Eldoc but that's also disabled so it's not the case, and I can't find any variable to customize to disable that once for all.. I guess it's just something changed in Emacs 25 but can't find out what :/ Any idea? Doing a (defun py-help-at-point nil) works of course but it's not the desired solution since it's still useful sometimes. Thanks a lot ___ Python-mode mailing list Python-mode@python.org https://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] Python help buffer
2015-01-07 19:40 GMT+00:00 Andreas Röhler andreas.roeh...@online.de: On 07.01.2015 18:50, andrea crotti wrote: 2015-01-07 12:33 GMT+00:00 Andreas Röhler andreas.roeh...@online.de: Hi Andrea, From Emacs -Q, loading python-mode.el by hand, does it still happen? Andreas I realised to my surprise that I was not actually using the version from ELPA but a version in my disk. Anyway I now downloaded from ELPA (marmalade) 6.13 started Emacs 25 with -Q and evaluated manually the python-mode.el buffer. It still happens, so I bet the problem is something with Emacs 25 that auto call something that didn't use to call before? It would really make sense to check with emacs -Q, load python-mode.el, open some .py file. Yes sorry maybe I was not clear, I've done exactly that and it still happens.. ___ Python-mode mailing list Python-mode@python.org https://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] Python help buffer
2015-01-07 12:33 GMT+00:00 Andreas Röhler andreas.roeh...@online.de: Hi Andrea, From Emacs -Q, loading python-mode.el by hand, does it still happen? Andreas I realised to my surprise that I was not actually using the version from ELPA but a version in my disk. Anyway I now downloaded from ELPA (marmalade) 6.13 started Emacs 25 with -Q and evaluated manually the python-mode.el buffer. It still happens, so I bet the problem is something with Emacs 25 that auto call something that didn't use to call before? ___ Python-mode mailing list Python-mode@python.org https://mail.python.org/mailman/listinfo/python-mode
[Python-mode] smart-operator-mode
I just uploaded from bazaar and checking all the new great things, and I think I encountered a very small bug: (defun py-toggle-smart-operator (optional arg) If `py-smart-operator-mode-p' should be on or off. Returns value of `py-smart-operator-mode-p' switched to. (interactive) (let ((arg (or arg (if py-smart-operator-mode-p -1 1 (if ( 0 arg) (progn (setq py-smart-operator-mode-p t) (py-smart-operator-mode 1)) (setq py-smart-operator-mode-p nil) (py-smart-operator-mode -1)) (when (interactive-p) (message py-smart-operator-mode: %s py-smart-operator-mode-p)) py-smart-operator-mode-p)) Because py-smart-operator-mode is not defined anywhere.. is that right? thanks for the great work! ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] smart-operator-mode
On 08/21/2012 08:49 PM, Andrea Crotti wrote: I just uploaded from bazaar and checking all the new great things, and I think I encountered a very small bug: (defun py-toggle-smart-operator (optional arg) If `py-smart-operator-mode-p' should be on or off. Returns value of `py-smart-operator-mode-p' switched to. (interactive) (let ((arg (or arg (if py-smart-operator-mode-p -1 1 (if ( 0 arg) (progn (setq py-smart-operator-mode-p t) (py-smart-operator-mode 1)) (setq py-smart-operator-mode-p nil) (py-smart-operator-mode -1)) (when (interactive-p) (message py-smart-operator-mode: %s py-smart-operator-mode-p)) py-smart-operator-mode-p)) Because py-smart-operator-mode is not defined anywhere.. is that right? thanks for the great work! Sorry I found out how to use it, it's in extensions.. The a line in the README explaining how to use the extensions might be enough, thanks! ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
[Python-mode] coverage and tests
So one thing which would be awesome to have is the ability to see which lines are not tested while I'm writing my code... There is already an extension here but I could not get it working https://github.com/mattharrison/pycoverage.el At the moment what I do is simply to to set in .dir-locals.el the compile-command that I want to run, but then I always have to check the html page to see the report.. (python-mode (compile-command . nosetests -sv --with-cov --cov-report=html)) Anyone else interested? Maybe we can get the pycoverage working and integrate it? ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] huge files
On 02/15/2012 08:34 AM, Andreas Röhler wrote: think it's basically historical. People interested in developing/understanding might check out and use the components branch https://code.launchpad.net/~a-roehler/python-mode/components-python-mode I'm doing all my developing and Python editing there. It's sometimes ahead several days, if new features are introduced. But the same tests are run before commits, so a possible loss in stability is mince. BTW in future we could create a declared stable branch of components and make two tarballs for release. CC to Barry for this question. Andreas Ah i see interesting, so you did already this split.. Well I think that only one file might be easier to deploy, but the average Emacs user should not really have problems in untarring a tar and change the load path, right? And the thing is that if I checkout the bzr repo I would expect that I see the same structure that the devs are actually seeing, otherwise it's also harder to apply patches directly reported from others for example. So a big +1 in a declared stable branch of components :) ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] huge files
On 02/15/2012 03:08 PM, François Pinard wrote: It's easier to share and install. A bit, not by much, nowadays. Splitting might be a trigger towards a more formal installation procedure. But it would not alleviate the need for some good, or at least reasonable documentation. Splitting could also give to some the feeling that it replaces documentation. So I fear a bit that energies might be dispersed away from the real thing to do. I don't think that the single file should disappear, what I just would like is that if I'm downloading from bazaar I see all the components, which is also how Andreas is actually working. It's still easy to produce one single file for deployment, if that turns out to be better. And really, 10k lines of code is not good, in any language, because it's impossible just have a look at the file and understand (even very approximatively) what is going on. ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
[Python-mode] huge files
It looks like it's a common problem in the Elisp world, but I was wondering is it normal to have huge source files. python-mode.el is 10k lines now, which for me causes two problems: - it's hard to even know the various functionalities - it's hard to manage the file I see various things that could be very easily splitted - virtualenv - ipython - pdbtrack (maybe) - defcustom-defvar (or maybe better by topic taking the variables together) and probably more. Since it doesn't do any difference in terms of performance and it's much less intimidating to try to grasp, is there a reason to keep all in one big file? ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
[Python-mode] using python parser
I just had the following (maybe stupid) idea. One of the great things about python is that it exposes the parsing completely in the standard library, with the module tokenize. Now would not it be possible to write a simple tokenizer that takes a python file and returns a nice structured format of the same, that python-mode can interpret to colorize/manage the code? For example import sys def fun(a): .. might become (very roughly) builtinimport/builtin namename/name builtindef/builtin namefun/nameop(/opparametera/parameter... This would make it work automatically with every possible python version, and remove the necessity of rewriting the parser in elisp. Does it make any sense? If yes I can write a blueprint maybe, and actually I could implement something myself, at least on the python side I have some experience in the area. ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] using python parser
On 12/21/2011 08:03 PM, Andrea Crotti wrote: I just had the following (maybe stupid) idea. One of the great things about python is that it exposes the parsing completely in the standard library, with the module tokenize. Now would not it be possible to write a simple tokenizer that takes a python file and returns a nice structured format of the same, that python-mode can interpret to colorize/manage the code? For example import sys def fun(a): .. might become (very roughly) builtinimport/builtin namename/name builtindef/builtin namefun/nameop(/opparametera/parameter... This would make it work automatically with every possible python version, and remove the necessity of rewriting the parser in elisp. Does it make any sense? If yes I can write a blueprint maybe, and actually I could implement something myself, at least on the python side I have some experience in the area. One possible drawback now that I tought a bit better is that this thing should run in background continuosly, because I would actually edit the file and expect that everything gets correctly interpreted. But if maybe we can limit to some areas then it might not be so bad.. And also Pymacs might help in this case, but I'm not sure we should rely on Pymacs even for the parsing. Mm there would be great advantages but is probably not so easy.. ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] paredit-like mode
On 12/01/2011 11:18 AM, Andreas Röhler wrote: good idea, think some of them exists already resp. isn't far away. as paredit offers a lot, some code example before - after might help implementing it. Will make a Blueprint meanwhile for the matter. Andreas Thanks, first I thought we could use paredit itself customizing its behaviour, but looking at the code there isn't even one defcustom, which makes me think that its behaviour is not really customizable. There are many examples in other code (cc-mode for example), in general using the abbrev-table might be easy, but maybe not so flexible. For things like I use yasnippet actually, but for opening / closing brackets is not ideal.. ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] completion in shell
On 11/25/2011 01:31 PM, Andreas Röhler wrote: Indeed, that's a different case. Checking with current trunk just committed don't see it. Could you try again? Should it still happen, please make a report a the tracker. Thanks, Andreas That was fixed thanks a lot, but now I'm afraid that py-execute-buffer is not working anymore. It doesn't create anymore a new buffer with the execution buffer as it was doing before.. ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] completion in shell
Ok thanks, the problems was there also from Emacs -Q, but after I've updated again it works now... It does not work, however, the completion in the shell with py-shell-completion, is that normal or should I report it? ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
[Python-mode] paredit-like mode
I like paredit-mode when I write in elisp, but unfortunately for python is not perfect, is there anything similiar we could use for python mode? Thanks, Andrea ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] completion in shell
On 11/25/2011 07:36 AM, Andreas Röhler wrote: which isn't that bad. that was fixed here https://bugs.launchpad.net/python-mode/+bug/328836 and seems broken recently again. Presently shell completion should work at least from within after M-y ipython Maybe I was not clear, the py-shell-complete binding is not in my python shell, but in my bash shell, started with M-x shell, that's why I think is strange.. ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
[Python-mode] completion in shell
Since some time my shell completion stopped working, only today I digged to see what's going on, and I found that tab is bound to: tab py-shell-complete But why is that? Emacs -Q doesn't show this behaviour, but looking in python-mode code I don't see how it could happen, any idea? ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] emacs
On 10/28/2011 03:25 AM, Rinu Boney wrote: I Would Love to Know How To Set Up Emacs As A Python Code Editing Environment Using python-mode.el. I Have No Experience in Emacs. Can U Help or Point Out Something That Can Help Me ? Thanks. I've never seem someone capitalising every word :D In German they capitalise every noun, that I thought was the maximum, or maybe is your current editor? To start - download emacs - fire up and follow the tutorial ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
[Python-mode] py-execute-buffer and CWD
While trying to run a script and there is already another *Python* buffer open for another directory, running the script normally fails if there are some relative file paths. Apparently the CWD in the *Python* buffer remains the old one, and thus it makes sense that Python can't resolve relative paths. I tried to add this line in py-execute-buffer but without success, any help? (cd (file-name-directory (buffer-file-name py-master-file))) ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] py-execute-buffer and CWD
On 11/01/2011 08:53 PM, Andreas Röhler wrote: cd is a shell command you can't mix that into Emacs Lisp. BTW ipython shell would understand cd it, but that's another item. Maybe give a example, what you trying to do, so we can look how to solve that task. BTW answered here, as you are not indicating a bug as thought at first glance. My mistake... Mm I don't think so: cd is an interactive compiled Lisp function in `files.el'. And anyway, I think is quite a bug, because if I run a python script I should expect that it runs in the same current directory... ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] py-execute-buffer and CWD
So from my understading the problem is that if there is another *Python* buffer around, it will just be used without changing the current directory. Apparently my attempt to cd didn't have any effect, so maybe we need to pass the path of the master py file to the real execute function, does it make sense? Another partially unrelated thing, I noticed the two following: (defun py-execute-buffer-no-switch (optional async) Like `py-execute-buffer', but ignores setting of `py-shell-switch-buffers-on-execute', output-buffer will being switched to. (defun py-execute-buffer-switch (optional async) Like `py-execute-buffer', but ignores setting of `py-shell-switch-buffers-on-execute', output-buffer will being switched to. Which - are different functions but with the same docstring - are never called from anywhere and not bound to any keys.. So are they useful at all maybe? ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] Identifying which mode is running?
On 09/27/2011 07:33 PM, James Hartley wrote: I have python-mode 5.2.0 installed on Emacs 23.3.1. Is there a way to determine what version of python-mode is currently installed? I'm looking at 6.0.2 would like to verify. Thanks. C-h v py-version should do what you want... Or if you want to make sure that you're actually using it I normally do C-h c C-c (to see what mode I'm actually using), then you can C-h f function and jump to the file that you're actually using. Otherwise maybe faster just do C-h m and you get info on the current mode you're using. ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
[Python-mode] py-execute-buffer and swap buffers
This is something I noticed since some time. I have the latest bzr python-mode (but also before it was like this) and emacs GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.5) When I have only two buffers open, one with the source and the other one with the output, pressing C-c C-c (py-execute-buffer) swaps the two buffers every time, which is extremely annoying... Am I the only one seeing this? ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
Re: [Python-mode] Error during indentation
Andreas Röhler andreas.roeh...@online.de writes: Hi Andrea, thanks. Have some idea meanwhile wherefrom these bug. It's in the line above, resp. it's receiving function. Ironically you get this bug, because syntax setting is OK now with Emacs 24. AFAIS bug results, because the delimiting char of a triple-quoted-string is no longer of 7, string quote, but of 15, generic string. syntax-ppss and friends than don't send the delimiting char as integer, but `t'. The receiving functions refuses correctly to make a string from: wrong-type-argument integerp t) With some luck I'll send a fix next days... Andreas Thanks very good I'll be glad to try the fix then :) Actually the workaround is not so bad, it's enough to write 4 spaces by hand, but it would be good to get fixed also for the future emacs24 (which by the way is very stable and looks faster). ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
[Python-mode] Error during indentation
I get a strange error when I have a situation like this: --8---cut here---start-8--- 1 class Foo(object): 2 3 Some doc 4 5 --8---cut here---end---8--- if I go to line 5 and press tab I get the error as below, using: GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.22.0) of 2011-03-04 and python-mode from bzr (can I get automatically the revision from emacs?) --8---cut here---start-8--- Debugger entered--Lisp error: (wrong-type-argument integerp t) make-string(1 t) py-goto-beginning-of-tqs(t) py-compute-indentation(t) py-indent-line() indent-for-tab-command(nil) call-interactively(indent-for-tab-command) (progn (setq this-command command) (call-interactively command)) (if (and (commandp command) (not (string-match yas/expand (symbol-name command (progn (setq this-command command) (call-interactively command))) (when (and (commandp command) (not (string-match yas/expand (symbol-name command (setq this-command command) (call-interactively command)) (let* ((yas/minor-mode nil) (yas/direct-keymaps nil) (keys-1 (this-command-keys-vector)) (keys-2 (and yas/trigger-key from-trigger-key-p (stringp yas/trigger-key) (read-kbd-macro yas/trigger-key))) (command-1 (and keys-1 (key-binding keys-1))) (command-2 (and keys-2 (key-binding keys-2))) (command (or (and (symbolp command-1) (not (string-match yas/expand (symbol-name command-1))) command-1) (and (symbolp command-2) command-2 (when (and (commandp command) (not (string-match yas/expand (symbol-name command (setq this-command command) (call-interactively command))) (cond ((eq yas/fallback-behavior (quote return-nil)) nil) ((eq yas/fallback-behavior (quote call-other-command)) (let* ((yas/minor-mode nil) (yas/direct-keymaps nil) (keys-1 (this-command-keys-vector)) (keys-2 (and yas/trigger-key from-trigger-key-p (stringp yas/trigger-key) (read-kbd-macro yas/trigger-key))) (command-1 (and keys-1 (key-binding keys-1))) (command-2 (and keys-2 (key-binding keys-2))) (command (or (and (symbolp command-1) (not ...) command-1) (and (symbolp command-2) command-2 (when (and (commandp command) (not (string-match yas/expand (symbol-name command (setq this-command command) (call-interactively command ((and (listp yas/fallback-behavior) (cdr yas/fallback-behavior) (eq (quote apply) (car yas/fallback-behavior))) (if (cddr yas/fallback-behavior) (apply (cadr yas/fallback-behavior) (cddr yas/fallback-behavior)) (when (commandp (cadr yas/fallback-behavior)) (setq this-command (cadr yas/fallback-behavior)) (call-interactively (cadr yas/fall back-behavior) (t nil)) yas/fallback(trigger-key) (if (and templates-and-pos (first templates-and-pos)) (yas/expand-or-prompt-for-template (first templates-and-pos) (second templates-and-pos) (third templates-and-pos)) (yas/fallback (quote trigger-key))) (let (templates-and-pos) (unless (and yas/expand-only-for-last-commands (not (member last-command yas/expand-only-for-last-commands))) (setq templates-and-pos (if field (save-restriction (narrow-to-region (yas/field-start field) (yas/field-end field)) (yas/current-key)) (yas/current-key (if (and templates-and-pos (first templates-and-pos)) (yas/expand-or-prompt-for-template (first templates-and-pos) (second templates-and-pos) (third templates-and-pos)) (yas/fallback (quote trigger-key yas/expand() call-interactively(yas/expand nil nil) --8---cut here---end---8--- ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode
[Python-mode] highlight bug?
Before I wasn't sure if it was an old bug, but today I got the last revision from bzr and I see the same. Function and variable names containing reserved keywords are not highlighted correctly. For example in def generate_random_tuple() tuple is colored as it was the tuple function call... Anyone else seeing this? By the way I've seen many comments about it but I never really understood, why this python-mode is not included in emacs instead of the crappy default one? ___ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode