Re: Emacs users: feedback on diffs between python-mode.el and python.el?
Sebastian Wiesner a écrit : At Thu, 16 Oct 2008 18:21:38 +0200 wrote Bruno Desthuilliers <[EMAIL PROTECTED]>: It doesn't look like there's any way to browse the subversion any more, though. Doh :( Is there any way to get this version then ??? svn co https://python-mode.svn.sourceforge.net/svnroot/python-mode/trunk/ python-mode done !-) Ok. I obviously misunderstood Carl - I thought he meant the repository wasn't accessible anymore. Thanks Carl and Sebastian. -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
Damien Wyart wrote: * Carl Banks <[EMAIL PROTECTED]> in comp.lang.python: The python-mode.el on Subversion (python-mode's Subversion on source forge, not the ancient version of python-mode in the Python repository) has a fix for this issue. It doesn't look like there's any way to browse the subversion any more, though. The viewvc interface is still there: http://svn.sourceforge.net/viewvc/python-mode/trunk/python-mode/ I thought python-mode had moved to launchpad under bzr: https://code.launchpad.net/python-mode. Darren -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
Alberto Griggio <[EMAIL PROTECTED]> writes: > Hello, > >> I second Bruno's points, the older python-mode.el is much >> better, > > I agree too. I can't really say what's missing from python.el, but I'm > much more comfortable with python-mode.el. The triple-quote highlight is > better in python.el, but I was successful in porting it to > python-mode.el as well. Unfortunately, I don't have a clean diff, as I > did some other tweaks... Many thanks for this suggestion. Now python-mode.el works like a charm. So many years of frustration. ;-) I just downloaded python-mode.el from svn: http://svn.sourceforge.net/viewvc/python-mode/trunk/python-mode/ and applied this patch (code taken from python.el): --- python-mode.el.org 2008-10-17 21:20:29.0 +0200 +++ python-mode.el 2008-10-17 21:23:13.0 +0200 @@ -500,6 +500,63 @@ '("XXX\\|TODO\\|FIXME" 0 py-XXX-tag-face t) )) "Additional expressions to highlight in Python mode.") + +(defconst python-font-lock-syntactic-keywords + ;; Make outer chars of matching triple-quote sequences into generic + ;; string delimiters. Fixme: Is there a better way? + `((,(rx (or line-start buffer-start + (not (syntax escape))); avoid escaped leading quote + (group (optional (any "uUrR"))) ; prefix gets syntax property + (optional (any "rR")) ; possible second prefix + (group (syntax string-quote)) ; maybe gets property + (backref 2) ; per first quote + (group (backref 2))); maybe gets property + (1 (python-quote-syntax 1)) + (2 (python-quote-syntax 2)) + (3 (python-quote-syntax 3) + +(defun python-quote-syntax (n) + "Put `syntax-table' property correctly on triple quote. +Used for syntactic keywords. N is the match number (1, 2 or 3)." + ;; Given a triple quote, we have to check the context to know + ;; whether this is an opening or closing triple or whether it's + ;; quoted anyhow, and should be ignored. (For that we need to do + ;; the same job as `syntax-ppss' to be correct and it seems to be OK + ;; to use it here despite initial worries.) We also have to sort + ;; out a possible prefix -- well, we don't _have_ to, but I think it + ;; should be treated as part of the string. + + ;; Test cases: + ;; ur"""ar""" x='"' # """ + ;; x = ''' """ ' a + ;; ''' + ;; x '"""' x """ \ x + ;; Fixme: "" goes wrong (due to syntax-ppss not getting the string + ;; fence context). + (save-excursion +(goto-char (match-beginning 0)) +(cond + ;; Consider property for the last char if in a fenced string. + ((= n 3) + (let ((syntax (syntax-ppss))) + (when (eq t (nth 3 syntax)) ; after unclosed fence + (goto-char (nth 8 syntax)); fence position + (skip-chars-forward "uUrR") ; skip any prefix + ;; Is it a matching sequence? + (if (eq (char-after) (char-after (match-beginning 2))) + (eval-when-compile (string-to-syntax "|")) + ;; Consider property for initial char, accounting for prefixes. + ((or (and (= n 2) ; leading quote (not prefix) + (= (match-beginning 1) (match-end 1))) ; prefix is null + (and (= n 1) ; prefix + (/= (match-beginning 1) (match-end 1 ; non-empty + (unless (nth 3 (syntax-ppss)) +(eval-when-compile (string-to-syntax "|" + ;; Otherwise (we're in a non-matching string) the property is + ;; nil, which is OK. + ))) + + (put 'python-mode 'font-lock-defaults '(python-font-lock-keywords)) ;; have to bind py-file-queue before installing the kill-emacs-hook @@ -1189,7 +1246,10 @@ (setq major-mode 'python-mode mode-name "Python" local-abbrev-table python-mode-abbrev-table - font-lock-defaults '(python-font-lock-keywords) +font-lock-defaults'(python-font-lock-keywords nil nil nil nil +(font-lock-syntactic-keywords + . python-font-lock-syntactic-keywords)) + paragraph-separate "^[ \t]*$" paragraph-start "^[ \t]*$" require-final-newline t -- Regards, Rob -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
Alberto Griggio <[EMAIL PROTECTED]> writes: > Hello, > >> I second Bruno's points, the older python-mode.el is much >> better, > > I agree too. I can't really say what's missing from python.el, but I'm > much more comfortable with python-mode.el. The triple-quote highlight is > better in python.el, but I was successful in porting it to > python-mode.el as well. Unfortunately, I don't have a clean diff, as I > did some other tweaks... Many thanks for this suggestion. Now python-mode.el works like a charm. So many years of frustration. :-) I just downloaded python-mode.el from svn: http://svn.sourceforge.net/viewvc/python-mode/trunk/python-mode/ and applied this patch (code taken from python.el): --- python-mode.el.org 2008-10-17 21:20:29.0 +0200 +++ python-mode.el 2008-10-17 21:23:13.0 +0200 @@ -500,6 +500,63 @@ '("XXX\\|TODO\\|FIXME" 0 py-XXX-tag-face t) )) "Additional expressions to highlight in Python mode.") + +(defconst python-font-lock-syntactic-keywords + ;; Make outer chars of matching triple-quote sequences into generic + ;; string delimiters. Fixme: Is there a better way? + `((,(rx (or line-start buffer-start + (not (syntax escape))); avoid escaped leading quote + (group (optional (any "uUrR"))) ; prefix gets syntax property + (optional (any "rR")) ; possible second prefix + (group (syntax string-quote)) ; maybe gets property + (backref 2) ; per first quote + (group (backref 2))); maybe gets property + (1 (python-quote-syntax 1)) + (2 (python-quote-syntax 2)) + (3 (python-quote-syntax 3) + +(defun python-quote-syntax (n) + "Put `syntax-table' property correctly on triple quote. +Used for syntactic keywords. N is the match number (1, 2 or 3)." + ;; Given a triple quote, we have to check the context to know + ;; whether this is an opening or closing triple or whether it's + ;; quoted anyhow, and should be ignored. (For that we need to do + ;; the same job as `syntax-ppss' to be correct and it seems to be OK + ;; to use it here despite initial worries.) We also have to sort + ;; out a possible prefix -- well, we don't _have_ to, but I think it + ;; should be treated as part of the string. + + ;; Test cases: + ;; ur"""ar""" x='"' # """ + ;; x = ''' """ ' a + ;; ''' + ;; x '"""' x """ \ x + ;; Fixme: "" goes wrong (due to syntax-ppss not getting the string + ;; fence context). + (save-excursion +(goto-char (match-beginning 0)) +(cond + ;; Consider property for the last char if in a fenced string. + ((= n 3) + (let ((syntax (syntax-ppss))) + (when (eq t (nth 3 syntax)) ; after unclosed fence + (goto-char (nth 8 syntax)); fence position + (skip-chars-forward "uUrR") ; skip any prefix + ;; Is it a matching sequence? + (if (eq (char-after) (char-after (match-beginning 2))) + (eval-when-compile (string-to-syntax "|")) + ;; Consider property for initial char, accounting for prefixes. + ((or (and (= n 2) ; leading quote (not prefix) + (= (match-beginning 1) (match-end 1))) ; prefix is null + (and (= n 1) ; prefix + (/= (match-beginning 1) (match-end 1 ; non-empty + (unless (nth 3 (syntax-ppss)) +(eval-when-compile (string-to-syntax "|" + ;; Otherwise (we're in a non-matching string) the property is + ;; nil, which is OK. + ))) + + (put 'python-mode 'font-lock-defaults '(python-font-lock-keywords)) ;; have to bind py-file-queue before installing the kill-emacs-hook @@ -1189,7 +1246,10 @@ (setq major-mode 'python-mode mode-name "Python" local-abbrev-table python-mode-abbrev-table - font-lock-defaults '(python-font-lock-keywords) +font-lock-defaults'(python-font-lock-keywords nil nil nil nil +(font-lock-syntactic-keywords + . python-font-lock-syntactic-keywords)) + paragraph-separate "^[ \t]*$" paragraph-start "^[ \t]*$" require-final-newline t -- Regards, Rob -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
On Oct 17, 4:25 am, Damien Wyart <[EMAIL PROTECTED]> wrote: > * Carl Banks <[EMAIL PROTECTED]> in comp.lang.python: > > > The python-mode.el on Subversion (python-mode's Subversion on source > > forge, not the ancient version of python-mode in the Python > > repository) has a fix for this issue. It doesn't look like there's any > > way to browse the subversion any more, though. > > The viewvc interface is still > there:http://svn.sourceforge.net/viewvc/python-mode/trunk/python-mode/ Well, there's no obvious way to find the respository aside from knowing the URI. Anyway, yes the patch was applied as revision 425. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
At Thu, 16 Oct 2008 18:21:38 +0200 wrote Bruno Desthuilliers <[EMAIL PROTECTED]>: >> It doesn't look like there's >> any way to browse the subversion any more, though. > > Doh :( > > Is there any way to get this version then ??? svn co https://python-mode.svn.sourceforge.net/svnroot/python-mode/trunk/ python-mode -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
* Carl Banks <[EMAIL PROTECTED]> in comp.lang.python: > The python-mode.el on Subversion (python-mode's Subversion on source > forge, not the ancient version of python-mode in the Python > repository) has a fix for this issue. Btw, I have not found a reference to this fix in the subversion history. Are you sure it has been applied? I wonder if this patch is not only in the Patch tracker. -- DW -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
* Carl Banks <[EMAIL PROTECTED]> in comp.lang.python: > The python-mode.el on Subversion (python-mode's Subversion on source > forge, not the ancient version of python-mode in the Python > repository) has a fix for this issue. It doesn't look like there's any > way to browse the subversion any more, though. The viewvc interface is still there: http://svn.sourceforge.net/viewvc/python-mode/trunk/python-mode/ -- DW -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
[EMAIL PROTECTED] wrote: > If you're an Emacs user who has used both python-mode.el (the python mode > code distributed with Python and XEmacs) and python.el (the python mode code > distributed with GNU Emacs), I'd like to get your impressions on how they > compare and where you feel the bugs lie. I'm nominally one of the > python-mode.el maintainers (though not very active) but have never tried the > GNU python.el. One of the two modes (if memory serves, python.el) has an annoying bug/feature where indent-region is essentially implemented as "hit tab once on every line in the region". Of course, this frequently does the wrong thing as "tab" has to guess the right indentation in cases where there are multiple possibilities. So this frequently messes up the semantics of the code. This is the main reason why I always use the other mode (if memory serves, python-mode.el) these days, which keeps the logical structure of the code intact with indent-region. I frequently use (setq py-indent-offset 4) + indent-region to reformat my old code which used 2-space indents, so this is a feature that is important to me. Malte -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
On Oct 16, 12:21 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Carl Banks a écrit : > > > On Oct 14, 1:05 pm, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > >> - a slightly less but still annoying problem (I wouldn't > > call it a bug) > >> is the handling of indentation for nested litteral dicts/lists/tuples. > > > The python-mode.el on Subversion (python-mode's Subversion on source > > forge, not the ancient version of python-mode in the Python > > repository) has a fix for this issue. > > Great !-) > > > It doesn't look like there's > > any way to browse the subversion any more, though. > > Doh :( > > Is there any way to get this version then ??? You could download and apply the patch yourself: https://sourceforge.net/tracker/index.php?func=detail&aid=1588272&group_id=86916&atid=581351 http://tinyurl.com/4x3uvh Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
rustom a écrit : (snip) I am interested in knowing which mode supports better the use of pdb inside emacs? Since you mention this, I think I remember having a couple issues here with python-mode.el - but that was a long time ago, and I usually don't use pdb within the emacs-python-shell (most of the time when I have to drop to pdb, it's for Zope or Django related stuff that requires too much environment settings to make pdb-inside-emacs a viable solution). -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
Carl Banks a écrit : On Oct 14, 1:05 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: - a slightly less but still annoying problem (I wouldn't call it a bug) is the handling of indentation for nested litteral dicts/lists/tuples. The python-mode.el on Subversion (python-mode's Subversion on source forge, not the ancient version of python-mode in the Python repository) has a fix for this issue. Great !-) It doesn't look like there's any way to browse the subversion any more, though. Doh :( Is there any way to get this version then ??? -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
On Oct 14, 1:05 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > - a slightly less but still annoying problem (I wouldn't call it a bug) > is the handling of indentation for nested litteral dicts/lists/tuples. The python-mode.el on Subversion (python-mode's Subversion on source forge, not the ancient version of python-mode in the Python repository) has a fix for this issue. It doesn't look like there's any way to browse the subversion any more, though. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
Hello, > I second Bruno's points, the older python-mode.el is much > better, I agree too. I can't really say what's missing from python.el, but I'm much more comfortable with python-mode.el. The triple-quote highlight is better in python.el, but I was successful in porting it to python-mode.el as well. Unfortunately, I don't have a clean diff, as I did some other tweaks... Alberto -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
In message <[EMAIL PROTECTED]>, rustom wrote: > Reminds me of a funny story about one of our university profs. > At a time when we used DOS and unix (on terminals) he got a very high > end SGI workstation. > And promptly shouted at the sysads because he could not see his > C:> > prompt. The joke was on them, of course. To be fair, SGI did try to oblige, with a short-lived, ill-fated foray into Dimdows NT workstations. Probably hastened their end... -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
On Oct 16, 12:54 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Lawrence D'Oliveiro a écrit : > > > I find Emacs modes just too confusing. I do all my editing in fundamental > > mode. > > Sounds like buying a cray supercomputer to end up doing computation by > hand... Reminds me of a funny story about one of our university profs. At a time when we used DOS and unix (on terminals) he got a very high end SGI workstation. And promptly shouted at the sysads because he could not see his C:> prompt. -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
On Oct 16, 8:37 am, Michele Simionato <[EMAIL PROTECTED]> wrote: > On Oct 14, 7:37 pm, [EMAIL PROTECTED] wrote: > > > If you're an Emacs user who has used both python-mode.el (the python mode > > code distributed with Python and XEmacs) and python.el (the python mode code > > distributed with GNU Emacs), I'd like to get your impressions on how they > > compare and where you feel the bugs lie. I'm nominally one of the > > python-mode.el maintainers (though not very active) but have never tried the > > GNU python.el. > > > Thanks, > > > -- > > Skip Montanaro - [EMAIL PROTECTED] -http://www.webfast.com/~skip/ > > I second Bruno's points, the older python-mode.el is much > better, also because of the included class browser, which > is missing in python.el. python.el seems to be integrated > with pymacs out of the box, but I do not use it so I cannot say for > sure if it works well or no. I am interested in knowing which mode supports better the use of pdb inside emacs? Is it python-mode? -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
On Oct 14, 7:37 pm, [EMAIL PROTECTED] wrote: > If you're an Emacs user who has used both python-mode.el (the python mode > code distributed with Python and XEmacs) and python.el (the python mode code > distributed with GNU Emacs), I'd like to get your impressions on how they > compare and where you feel the bugs lie. I'm nominally one of the > python-mode.el maintainers (though not very active) but have never tried the > GNU python.el. > > Thanks, > > -- > Skip Montanaro - [EMAIL PROTECTED] -http://www.webfast.com/~skip/ I second Bruno's points, the older python-mode.el is much better, also because of the included class browser, which is missing in python.el. python.el seems to be integrated with pymacs out of the box, but I do not use it so I cannot say for sure if it works well or no. -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
Paul Rubin a écrit : [EMAIL PROTECTED] writes: If you're an Emacs user who has used both python-mode.el (the python mode code distributed with Python and XEmacs) and python.el (the python mode code distributed with GNU Emacs), I'd like to get your impressions on how they compare and where you feel the bugs lie. I'm not sure which is which--there is one that I'm used to from older systems, and one on newer systems (Ubuntu Hardy) that gratutiously broke features that I'm used to. I haven't gotten around to investigating but will try to do so. Main thing I know is that C-c ! used to make a new Python subwindow and now it doesn't, which is bad. The first one is python-mode.el, the second one is python.el -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
Lawrence D'Oliveiro a écrit : In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: If you're an Emacs user who has used both python-mode.el (the python mode code distributed with Python and XEmacs) and python.el (the python mode code distributed with GNU Emacs), I'd like to get your impressions on how they compare ... I find Emacs modes just too confusing. I do all my editing in fundamental mode. Sounds like buying a cray supercomputer to end up doing computation by hand... -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > If you're an Emacs user who has used both python-mode.el (the python mode > code distributed with Python and XEmacs) and python.el (the python mode > code distributed with GNU Emacs), I'd like to get your impressions on how > they compare ... I find Emacs modes just too confusing. I do all my editing in fundamental mode. -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
Paul> Main thing I know is that C-c ! used to make a new Python Paul> subwindow and now it doesn't, which is bad. That's probably the newer FSF version, python.el. Someone else complained that it didn't do Python interpreters. Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
[EMAIL PROTECTED] writes: > If you're an Emacs user who has used both python-mode.el (the python mode > code distributed with Python and XEmacs) and python.el (the python mode code > distributed with GNU Emacs), I'd like to get your impressions on how they > compare and where you feel the bugs lie. I'm not sure which is which--there is one that I'm used to from older systems, and one on newer systems (Ubuntu Hardy) that gratutiously broke features that I'm used to. I haven't gotten around to investigating but will try to do so. Main thing I know is that C-c ! used to make a new Python subwindow and now it doesn't, which is bad. -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
Bruno Desthuilliers schrieb: [EMAIL PROTECTED] a écrit : If you're an Emacs user who has used both python-mode.el (the python mode code distributed with Python and XEmacs) and python.el (the python mode code distributed with GNU Emacs), I'd like to get your impressions on how they compare and where you feel the bugs lie. I'm nominally one of the python-mode.el maintainers (though not very active) but have never tried the GNU python.el. Hi Skip. I stumbled on python.el last year and very very *very* quickly replaced it with my good old python-mode.el. The first and foremost reason being, IIRC, the lack of proper support for working with the embedded interactive interpreter (one killer-feature of python-mode). Honnestly, I don't think I've used python.el more than five minutes (not having C-c ! and C-c C-c working as expected being a definitive show-stopper for me), so I can't say much more about python.el. wrt/ python-mode.el: - the most annoying bug is syntax coloration of triple-quoted strings, that doesn't correctly handles quotes within the triple-quoted part. - a slightly less but still annoying problem (I wouldn't call it a bug) is the handling of indentation for nested litteral dicts/lists/tuples. I second these two points. On the python-mode.el-ML there was a patch for the triple-quote problem, but I couldn't apply it due to rejected hunks. Didn't investigate that. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Emacs users: feedback on diffs between python-mode.el and python.el?
[EMAIL PROTECTED] a écrit : If you're an Emacs user who has used both python-mode.el (the python mode code distributed with Python and XEmacs) and python.el (the python mode code distributed with GNU Emacs), I'd like to get your impressions on how they compare and where you feel the bugs lie. I'm nominally one of the python-mode.el maintainers (though not very active) but have never tried the GNU python.el. Hi Skip. I stumbled on python.el last year and very very *very* quickly replaced it with my good old python-mode.el. The first and foremost reason being, IIRC, the lack of proper support for working with the embedded interactive interpreter (one killer-feature of python-mode). Honnestly, I don't think I've used python.el more than five minutes (not having C-c ! and C-c C-c working as expected being a definitive show-stopper for me), so I can't say much more about python.el. wrt/ python-mode.el: - the most annoying bug is syntax coloration of triple-quoted strings, that doesn't correctly handles quotes within the triple-quoted part. - a slightly less but still annoying problem (I wouldn't call it a bug) is the handling of indentation for nested litteral dicts/lists/tuples. Note that I don't even know if python.el does a better job here. If no one provides more feedback on it, let me know and I'll give it a closer look. HTH -- http://mail.python.org/mailman/listinfo/python-list
Emacs users: feedback on diffs between python-mode.el and python.el?
If you're an Emacs user who has used both python-mode.el (the python mode code distributed with Python and XEmacs) and python.el (the python mode code distributed with GNU Emacs), I'd like to get your impressions on how they compare and where you feel the bugs lie. I'm nominally one of the python-mode.el maintainers (though not very active) but have never tried the GNU python.el. Thanks, -- Skip Montanaro - [EMAIL PROTECTED] - http://www.webfast.com/~skip/ -- http://mail.python.org/mailman/listinfo/python-list