all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dave Love <fx@gnu.org>
To: "Michael Droettboom" <mike@droettboom.com>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: python-find-imports fails on multi-line import statements
Date: Sat, 08 Sep 2007 12:54:42 +0100	[thread overview]
Message-ID: <msejh92wzh.fsf@marvin.smb.man.ac.uk> (raw)
In-Reply-To: <7b2578730709071059k1ed3a09dj26eaebc633d0b294@mail.gmail.com> (Michael Droettboom's message of "Fri\, 7 Sep 2007 13\:59\:53 -0400")

[-- Attachment #1: Type: text/plain, Size: 342 bytes --]

"Michael Droettboom" <mike@droettboom.com> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 678 bytes --]

--- 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

[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

_______________________________________________
bug-gnu-emacs mailing list
bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs

      parent reply	other threads:[~2007-09-08 11:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-07 17:59 python-find-imports fails on multi-line import statements Michael Droettboom
2007-09-08 10:05 ` Michael Droettboom
2007-09-08 11:54 ` Dave Love [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=msejh92wzh.fsf@marvin.smb.man.ac.uk \
    --to=fx@gnu.org \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=mike@droettboom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.