emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111280: * progmodes/python.el (py


From: Fabián Ezequiel Gallina
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r111280: * progmodes/python.el (python-indent-context): Fix
Date: Tue, 19 Feb 2013 00:18:32 -0300
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111280
committer: Fabián Ezequiel Gallina <address@hidden>
branch nick: emacs-24
timestamp: Tue 2013-02-19 00:18:32 -0300
message:
  * progmodes/python.el (python-indent-context): Fix
  python-info-line-ends-backslash-p call.
  (python-info-line-ends-backslash-p)
  (python-info-beginning-of-backslash): Respect line-number
  argument.
  (python-info-current-line-comment-p): Fix behavior when not at
  beginning-of-line.
  (python-util-position): Remove function.
  (python-util-goto-line): New function.
modified:
  lisp/ChangeLog
  lisp/progmodes/python.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-02-18 19:13:21 +0000
+++ b/lisp/ChangeLog    2013-02-19 03:18:32 +0000
@@ -1,3 +1,15 @@
+2013-02-19  Fabián Ezequiel Gallina  <address@hidden>
+
+       * progmodes/python.el (python-indent-context): Fix
+       python-info-line-ends-backslash-p call.
+       (python-info-line-ends-backslash-p)
+       (python-info-beginning-of-backslash): Respect line-number
+       argument.
+       (python-info-current-line-comment-p): Fix behavior when not at
+       beginning-of-line.
+       (python-util-position): Remove function.
+       (python-util-goto-line): New function.
+
 2013-02-18  Michael Albinus  <address@hidden>
 
        * eshell/em-unix.el (eshell/su): Require tramp.

=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el  2013-02-14 00:42:11 +0000
+++ b/lisp/progmodes/python.el  2013-02-19 03:18:32 +0000
@@ -698,10 +698,9 @@
         ;; After backslash
         ((setq start (when (not (or (python-syntax-context 'string ppss)
                                     (python-syntax-context 'comment ppss)))
-                       (let ((line-beg-pos (line-beginning-position)))
-                         (when (python-info-line-ends-backslash-p
-                                (1- line-beg-pos))
-                           (- line-beg-pos 2)))))
+                       (let ((line-beg-pos (line-number-at-pos)))
+                         (python-info-line-ends-backslash-p
+                          (1- line-beg-pos)))))
          'after-backslash)
         ;; After beginning of block
         ((setq start (save-excursion
@@ -3105,7 +3104,7 @@
     (save-restriction
       (widen)
       (when line-number
-        (goto-char line-number))
+        (python-util-goto-line line-number))
       (while (and (not (eobp))
                   (goto-char (line-end-position))
                   (python-syntax-context 'paren)
@@ -3121,7 +3120,7 @@
     (save-restriction
       (widen)
       (when line-number
-        (goto-char line-number))
+        (python-util-goto-line line-number))
       (when (python-info-line-ends-backslash-p)
         (while (save-excursion
                  (goto-char (line-beginning-position))
@@ -3200,7 +3199,9 @@
 
 (defun python-info-current-line-comment-p ()
   "Check if current line is a comment line."
-  (char-equal (or (char-after (+ (point) (current-indentation))) ?_) ?#))
+  (char-equal
+   (or (char-after (+ (line-beginning-position) (current-indentation))) ?_)
+   ?#))
 
 (defun python-info-current-line-empty-p ()
   "Check if current line is empty, ignoring whitespace."
@@ -3215,12 +3216,10 @@
 
 ;;; Utility functions
 
-(defun python-util-position (item seq)
-  "Find the first occurrence of ITEM in SEQ.
-Return the index of the matching item, or nil if not found."
-  (let ((member-result (member item seq)))
-    (when member-result
-      (- (length seq) (length member-result)))))
+(defun python-util-goto-line (line-number)
+  "Move point to LINE-NUMBER."
+  (goto-char (point-min))
+  (forward-line (1- line-number)))
 
 ;; Stolen from org-mode
 (defun python-util-clone-local-variables (from-buffer &optional regexp)


reply via email to

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