python.el: Handle tabs in python-indent-dedent-line.

Fixes: debbugs:19730

* lisp/progmodes/python.el (python-indent-dedent-line): Fixes for
indentation with tabs.  Thanks to <dale@codefu.org>.

* test/automated/python-tests.el
(python-indent-dedent-line-backspace-2)
(python-indent-dedent-line-backspace-3): New tests.
parent 41c3b924
2015-01-30 Fabián Ezequiel Gallina <fgallina@gnu.org>
python.el: Handle tabs in python-indent-dedent-line.
* progmodes/python.el (python-indent-dedent-line): Fixes for
indentation with tabs. Thanks to <dale@codefu.org> (Bug#19730).
2015-01-30 Fabián Ezequiel Gallina <fgallina@gnu.org>
* progmodes/python.el (python-indent-context): Respect user
......
......@@ -1067,9 +1067,7 @@ indentation levels from right to left."
(interactive "*")
(when (and (not (bolp))
(not (python-syntax-comment-or-string-p))
(= (+ (line-beginning-position)
(current-indentation))
(point)))
(= (current-indentation) (current-column)))
(python-indent-line t)
t))
......
2015-01-30 Fabián Ezequiel Gallina <fgallina@gnu.org>
* automated/python-tests.el
(python-indent-dedent-line-backspace-2)
(python-indent-dedent-line-backspace-3): New tests.
2015-01-30 Fabián Ezequiel Gallina <fgallina@gnu.org>
* automated/python-tests.el (python-indent-pep8-1)
......
......@@ -2127,6 +2127,55 @@ if True:
(call-interactively #'python-indent-dedent-line-backspace)
(should (zerop (current-indentation)))))
(ert-deftest python-indent-dedent-line-backspace-2 ()
"Check de-indentation with tabs. Bug#19730."
(let ((tab-width 8))
(python-tests-with-temp-buffer
"
if x:
\tabcdefg
"
(python-tests-look-at "abcdefg")
(goto-char (line-end-position))
(call-interactively #'python-indent-dedent-line-backspace)
(should
(string= (buffer-substring-no-properties
(line-beginning-position) (line-end-position))
"\tabcdef")))))
(ert-deftest python-indent-dedent-line-backspace-3 ()
"Paranoid check of de-indentation with tabs. Bug#19730."
(let ((tab-width 8))
(python-tests-with-temp-buffer
"
if x:
\tif y:
\t abcdefg
"
(python-tests-look-at "abcdefg")
(goto-char (line-end-position))
(call-interactively #'python-indent-dedent-line-backspace)
(should
(string= (buffer-substring-no-properties
(line-beginning-position) (line-end-position))
"\t abcdef"))
(back-to-indentation)
(call-interactively #'python-indent-dedent-line-backspace)
(should
(string= (buffer-substring-no-properties
(line-beginning-position) (line-end-position))
"\tabcdef"))
(call-interactively #'python-indent-dedent-line-backspace)
(should
(string= (buffer-substring-no-properties
(line-beginning-position) (line-end-position))
" abcdef"))
(call-interactively #'python-indent-dedent-line-backspace)
(should
(string= (buffer-substring-no-properties
(line-beginning-position) (line-end-position))
"abcdef")))))
;;; Shell integration
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment