aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el25
1 files changed, 12 insertions, 13 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index eadb06fa61e..da56fe70329 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -708,10 +708,9 @@ START is the buffer position where the sexp starts."
708 ;; After backslash 708 ;; After backslash
709 ((setq start (when (not (or (python-syntax-context 'string ppss) 709 ((setq start (when (not (or (python-syntax-context 'string ppss)
710 (python-syntax-context 'comment ppss))) 710 (python-syntax-context 'comment ppss)))
711 (let ((line-beg-pos (line-beginning-position))) 711 (let ((line-beg-pos (line-number-at-pos)))
712 (when (python-info-line-ends-backslash-p 712 (python-info-line-ends-backslash-p
713 (1- line-beg-pos)) 713 (1- line-beg-pos)))))
714 (- line-beg-pos 2)))))
715 'after-backslash) 714 'after-backslash)
716 ;; After beginning of block 715 ;; After beginning of block
717 ((setq start (save-excursion 716 ((setq start (save-excursion
@@ -3115,7 +3114,7 @@ With optional argument LINE-NUMBER, check that line instead."
3115 (save-restriction 3114 (save-restriction
3116 (widen) 3115 (widen)
3117 (when line-number 3116 (when line-number
3118 (goto-char line-number)) 3117 (python-util-goto-line line-number))
3119 (while (and (not (eobp)) 3118 (while (and (not (eobp))
3120 (goto-char (line-end-position)) 3119 (goto-char (line-end-position))
3121 (python-syntax-context 'paren) 3120 (python-syntax-context 'paren)
@@ -3131,7 +3130,7 @@ Optional argument LINE-NUMBER forces the line number to check against."
3131 (save-restriction 3130 (save-restriction
3132 (widen) 3131 (widen)
3133 (when line-number 3132 (when line-number
3134 (goto-char line-number)) 3133 (python-util-goto-line line-number))
3135 (when (python-info-line-ends-backslash-p) 3134 (when (python-info-line-ends-backslash-p)
3136 (while (save-excursion 3135 (while (save-excursion
3137 (goto-char (line-beginning-position)) 3136 (goto-char (line-beginning-position))
@@ -3210,7 +3209,9 @@ operator."
3210 3209
3211(defun python-info-current-line-comment-p () 3210(defun python-info-current-line-comment-p ()
3212 "Check if current line is a comment line." 3211 "Check if current line is a comment line."
3213 (char-equal (or (char-after (+ (point) (current-indentation))) ?_) ?#)) 3212 (char-equal
3213 (or (char-after (+ (line-beginning-position) (current-indentation))) ?_)
3214 ?#))
3214 3215
3215(defun python-info-current-line-empty-p () 3216(defun python-info-current-line-empty-p ()
3216 "Check if current line is empty, ignoring whitespace." 3217 "Check if current line is empty, ignoring whitespace."
@@ -3225,12 +3226,10 @@ operator."
3225 3226
3226;;; Utility functions 3227;;; Utility functions
3227 3228
3228(defun python-util-position (item seq) 3229(defun python-util-goto-line (line-number)
3229 "Find the first occurrence of ITEM in SEQ. 3230 "Move point to LINE-NUMBER."
3230Return the index of the matching item, or nil if not found." 3231 (goto-char (point-min))
3231 (let ((member-result (member item seq))) 3232 (forward-line (1- line-number)))
3232 (when member-result
3233 (- (length seq) (length member-result)))))
3234 3233
3235;; Stolen from org-mode 3234;; Stolen from org-mode
3236(defun python-util-clone-local-variables (from-buffer &optional regexp) 3235(defun python-util-clone-local-variables (from-buffer &optional regexp)