bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: python-find-imports fails on multi-line import statements


From: Dave Love
Subject: Re: python-find-imports fails on multi-line import statements
Date: Sat, 08 Sep 2007 12:54:42 +0100
User-agent: Gnus/5.1008 (Gnus v5.10.8)

"Michael Droettboom" <address@hidden> writes:

> I imagine this can be fixed by tinkering with the regular
> expressions/filtering in python-find-imports, but I'm not much of an
> emacs lisp hacker.

Yes, I was sloppy.  Thanks.  It's fixed in
http://www.loveshack.ukfsn.org/emacs/python-21.el.  Perhaps this will
apply to your version:

--- python-21.el        2007/08/30 22:22:45     1.47
+++ python-21.el        2007/09/08 11:44:55     1.48
@@ -1935,9 +1935,13 @@
        (goto-char (point-min))
        (while (re-search-forward "^import\\>\\|^from\\>" nil t)
          (unless (syntax-ppss-context (syntax-ppss))
-           (push (buffer-substring (line-beginning-position)
-                                   (line-beginning-position 2))
-                 lines)))
+           (let ((start (line-beginning-position)))
+             ;; Skip over continued lines.
+             (while (and (eq ?\\ (char-before (line-end-position)))
+                         (= 0 (forward-line 1)))
+               t)
+             (push (buffer-substring start (line-beginning-position 2))
+                   lines))))
        (setq python-imports
              (if lines
                  (apply #'concat

reply via email to

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