emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r111281: * progmodes/python.el


From: Fabián Ezequiel Gallina
Subject: Re: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r111281: * progmodes/python.el (python-info-current-defun): Fix failed
Date: Wed, 20 Feb 2013 02:24:31 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130109 Thunderbird/17.0.2

On 02/19/2013 06:37 PM, Stefan Monnier wrote:
-                             (python-nav-end-of-defun)
+                             (save-match-data
+                               ;; FIXME: avoid cluttering match-data
+                               ;; where's not wanted.
+                               (python-nav-end-of-defun))
                               (+ (point)
                                  (if (>= (current-indentation) min-indent)
                                      (1+ (current-indentation))
I suspect this is not The Right Place for the save-match-data, since we
should not assume that current-indentation won't also mess up the
match-data.


         Stefan

FWIW this very small change corrected the python-info-current-defun behavior and was able to pass the test suite I've been working on. So far my local test/automated/python-tests.el is covering indentation, movement and python-info-* functions completely. Would it be OK to introduce these tests into the emacs-24 branch?

Now, I certainly wasn't expecting current-indentation could change match-data (could it?). If so, I feel that functions not expected[0] to mess with match-data should at least document it.

In this regard, I have a change in the works that will cause python.el to stop messing with match-data so much (use of looking-at-p instead of looking-at and such), and document those functions that are intended to. If everyone agrees I could get this to the emacs-24 branch.

[0] By "functions not expected[0] to mess with match-data" I mean functions that are not receiving a regexp as argument.


Regards,
Fabián



reply via email to

[Prev in Thread] Current Thread [Next in Thread]