Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
433af0a0
Commit
433af0a0
authored
Dec 27, 2014
by
Fabián Ezequiel Gallina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* lisp/progmodes/python.el (python-shell-buffer-substring): Handle
cornercase when region sent starts at point-min.
parent
a5f38fa1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
10 deletions
+39
-10
lisp/ChangeLog
lisp/ChangeLog
+5
-0
lisp/progmodes/python.el
lisp/progmodes/python.el
+9
-10
test/ChangeLog
test/ChangeLog
+4
-0
test/automated/python-tests.el
test/automated/python-tests.el
+21
-0
No files found.
lisp/ChangeLog
View file @
433af0a0
2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
* progmodes/python.el (python-shell-buffer-substring): Handle
cornercase when region sent starts at point-min.
2014-12-27 Eli Zaretskii <eliz@gnu.org>
* language/misc-lang.el (composition-function-table): Add Syriac
...
...
lisp/progmodes/python.el
View file @
433af0a0
...
...
@@ -2523,17 +2523,16 @@ the python shell:
4. Wraps indented regions under an \"if True:\" block so the
interpreter evaluates them correctly."
(
let*
((
substring
(
buffer-substring-no-properties
start
end
))
(
buffer-substring-p
(
save-restriction
(
widen
)
(
not
(
equal
(
list
(
point-min
)
(
point-max
))
(
list
start
end
)))))
(
starts-at-point-min-p
(
save-restriction
(
widen
)
(
=
(
point-min
)
start
)))
(
encoding
(
python-info-encoding
))
(
fillstr
(
concat
(
when
buffer-substring-p
(
format
"# -*- coding: %s -*-\n"
encoding
)
)
(
make-string
(
-
(
line-number-at-pos
start
)
(
if
buffer-substring-p
2
1
)
)
?\n
)))
(
fillstr
(
when
(
not
starts-at-point-min-p
)
(
concat
(
format
"# -*- coding: %s -*-\n"
encoding
)
(
make-string
;; Substract 2 because of the coding cookie.
(
-
(
line-number-at-pos
start
)
2
)
?\n
)))
)
(
toplevel-block-p
(
save-excursion
(
goto-char
start
)
(
or
(
zerop
(
line-number-at-pos
start
))
...
...
test/ChangeLog
View file @
433af0a0
2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
(python-shell-buffer-substring-9): New test.
2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org>
* automated/python-tests.el (python-shell-buffer-substring-1)
...
...
test/automated/python-tests.el
View file @
433af0a0
...
...
@@ -2651,6 +2651,27 @@ class Foo(models.Model):
pass
"))))
(ert-deftest python-shell-buffer-substring-9 ()
"
Check
substring
starting
from
`
point-min
'.
"
(python-tests-with-temp-buffer
"
#
coding:
utf-8
class
Foo
(
models.Model
)
:
pass
class
Bar
(
models.Model
)
:
pass
"
(should (string= (python-shell-buffer-substring
(point-min)
(python-tests-look-at "
class
Bar
(
models.Model
)
:
"))
"
#
coding:
utf-8
class
Foo
(
models.Model
)
:
pass
"))))
;;; Shell completion
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment