Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
503b2e87
Commit
503b2e87
authored
Oct 08, 1995
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Barry's version 2.30; some chages for triple quotes
parent
53f4524a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
146 additions
and
122 deletions
+146
-122
Misc/python-mode-old.el
Misc/python-mode-old.el
+146
-122
No files found.
Misc/python-mode-old.el
View file @
503b2e87
...
...
@@ -6,8 +6,8 @@
;; 1992-1994 Tim Peters
;; Maintainer: python-mode@python.org
;; Created: Feb 1992
;; Version: 2.
26
;; Last Modified: 1995/0
7/05 23:26:15
;; Version: 2.
30
;; Last Modified: 1995/0
9/19 20:01:42
;; Keywords: python editing language major-mode
;; This software is provided as-is, without express or implied
...
...
@@ -70,7 +70,7 @@
;; LCD Archive Entry:
;; python-mode|Barry A. Warsaw|python-mode@python.org
;; |Major mode for editing Python programs
;; |1995/0
7/05 23:26:15|2.26
|
;; |1995/0
9/19 20:01:42|2.30
|
;;; Code:
...
...
@@ -86,6 +86,12 @@
Note that `\\[py-guess-indent-offset]' can usually guess a good value
when you're editing someone else's Python code."
)
(
defvar
py-align-multiline-strings-p
t
"*Flag describing how multiline triple quoted strings are aligned.
When this flag is non-nil, continuation lines are lined up under the
preceding line's indentation. When this flag is nil, continuation
lines are aligned to column zero."
)
(
defvar
py-block-comment-prefix
"##"
"*String used by `py-comment-region' to comment out a block of code.
This should follow the convention for non-indenting comment lines so
...
...
@@ -407,6 +413,9 @@ py-beep-if-tab-change\tring the bell if tab-width is changed"
mode-name
"Python"
local-abbrev-table
python-mode-abbrev-table
)
(
use-local-map
py-mode-map
)
;; Emacs 19 requires this
(
if
(
or
py-this-is-lucid-emacs-p
py-this-is-emacs-19-p
)
(
setq
comment-multi-line
nil
))
;; BAW -- style...
(
mapcar
(
function
(
lambda
(
x
)
(
make-local-variable
(
car
x
))
...
...
@@ -468,9 +477,17 @@ py-beep-if-tab-change\tring the bell if tab-width is changed"
(
defun
py-electric-colon
(
arg
)
"Insert a colon.
In certain cases the line is outdented appropriately. If a numeric
argument is provided, that many colons are inserted non-electrically."
argument is provided, that many colons are inserted non-electrically.
Electric behavior is inhibited inside a string or comment."
(
interactive
"P"
)
(
self-insert-command
(
prefix-numeric-value
arg
))
;; are we in a string or comment?
(
if
(
save-excursion
(
let
((
pps
(
parse-partial-sexp
(
save-excursion
(
beginning-of-python-def-or-class
)
(
point
))
(
point
))))
(
not
(
or
(
nth
3
pps
)
(
nth
4
pps
)))))
(
save-excursion
(
let
((
here
(
point
))
(
outdent
0
)
...
...
@@ -492,7 +509,7 @@ argument is provided, that many colons are inserted non-electrically."
(
beginning-of-line
)
(
delete-horizontal-space
)
(
indent-to
(
-
indent
outdent
))
))))
)
))))
(
defun
py-indent-right
(
arg
)
"Indent the line by one `py-indent-offset' level.
...
...
@@ -782,8 +799,22 @@ the new line indented."
(
defun
py-compute-indentation
()
(
save-excursion
(
let
((
pps
(
parse-partial-sexp
(
save-excursion
(
beginning-of-python-def-or-class
)
(
point
))
(
point
))))
(
beginning-of-line
)
(
cond
;; are we inside a string or comment?
((
or
(
nth
3
pps
)
(
nth
4
pps
))
(
save-excursion
(
if
(
not
py-align-multiline-strings-p
)
0
;; skip back over blank & non-indenting comment lines
;; note: will skip a blank or non-indenting comment line
;; that happens to be a continuation line too
(
re-search-backward
"^[ \t]*\\([^ \t\n#]\\|#[ \t\n]\\)"
nil
'move
)
(
back-to-indentation
)
(
current-column
))))
;; are we on a continuation line?
((
py-continuation-line-p
)
(
let
((
startpos
(
point
))
...
...
@@ -850,34 +881,27 @@ the new line indented."
;; not on a continuation line
;; if at start of restriction, or on a non-indenting comment line,
;;
assume they intended whatever's there
;; if at start of restriction, or on a non-indenting comment
;; line,
assume they intended whatever's there
((
or
(
bobp
)
(
looking-at
"[ \t]*#[^ \t\n]"
))
(
current-indentation
))
;; else indentation based on that of the statement that precedes
;; us; use the first line of that statement to establish the base,
;; in case the user forced a non-std indentation for the
;;
continuation lines (if any)
;; else indentation based on that of the statement that
;; precedes us; use the first line of that statement to
;; establish the base, in case the user forced a non-std
;; indentation for the
continuation lines (if any)
(
t
;; skip back over blank & non-indenting comment lines
;; note:
will skip a blank or non-indenting comment line that
;; skip back over blank & non-indenting comment lines note:
;;
will skip a blank or non-indenting comment line that
;; happens to be a continuation line too
(
re-search-backward
"^[ \t]*\\([^ \t\n#]\\|#[ \t\n]\\)"
nil
'move
)
(
re-search-backward
"^[ \t]*\\([^ \t\n#]\\|#[ \t\n]\\)"
nil
'move
)
;; if we landed inside a string, go to the beginning of that
;; string. this handles triple quoted, multi-line spanning
;; strings.
(
let
((
state
(
parse-partial-sexp
(
save-excursion
(
beginning-of-python-def-or-class
)
(
point
))
(
point
))))
(
if
(
nth
3
state
)
(
goto-char
(
nth
2
state
))))
(
py-goto-initial-line
)
(
if
(
py-statement-opens-block-p
)
(
+
(
current-indentation
)
py-indent-offset
)
(
current-indentation
))))))
(
current-indentation
)
))))))
(
defun
py-guess-indent-offset
(
&optional
global
)
"Guess a good value for, and change, `py-indent-offset'.
...
...
@@ -1964,7 +1988,7 @@ local bindings to py-newline-and-indent."))
(
setq
zmacs-region-stays
t
)))
(
defconst
py-version
"2.
26
"
(
defconst
py-version
"2.
30
"
"`python-mode' version number."
)
(
defconst
py-help-address
"python-mode@python.org"
"Address accepting submission of bug reports."
)
...
...
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