Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
9274e2d0
Kaydet (Commit)
9274e2d0
authored
Nis 26, 1994
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Improved guesswork by Tim for continuations where the open bracket
is the last thing on the line.
üst
0ec5c5dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
36 deletions
+26
-36
python-mode-old.el
Misc/python-mode-old.el
+26
-36
No files found.
Misc/python-mode-old.el
Dosyayı görüntüle @
9274e2d0
;;; Major mode for editing Python programs, version 1.08a
y
;;; Major mode for editing Python programs, version 1.08a
z
;; by: Tim Peters <tim@ksr.com>
;; by: Tim Peters <tim@ksr.com>
;; after an original idea by: Michael A. Guravage
;; after an original idea by: Michael A. Guravage
;;
;;
...
@@ -514,33 +514,25 @@ the new line indented."
...
@@ -514,33 +514,25 @@ the new line indented."
endpos
searching
found
)
endpos
searching
found
)
(
if
open-bracket-pos
(
if
open-bracket-pos
(
progn
(
progn
;; if preceding line in same structure, presumably the
;; align with first item in list; else a normal
;; user already has an indentation they like for this
;; indent beyond the line with the open bracket
;; structure, so just copy it
(
goto-char
(
1+
open-bracket-pos
))
; just beyond bracket
(
forward-line
-1
)
;; is the first list item on the same line?
(
while
(
looking-at
"[ \t]*[#\n]"
)
(
skip-chars-forward
" \t"
)
(
forward-line
-1
))
; ignore noise lines
(
if
(
null
(
memq
(
following-char
)
'
(
?\n
?#
?\\
)))
(
if
(
eq
open-bracket-pos
(
py-nesting-level
))
; yes, so line up with it
(
current-indentation
)
(
current-column
)
;; else copy the indentation of the first item (if
;; first list item on another line, or doesn't exist yet
;; any) in this structure
(
forward-line
1
)
(
goto-char
startpos
)
(
while
(
and
(
<
(
point
)
startpos
)
(
condition-case
nil
(
looking-at
"[ \t]*[#\n\\\\]"
))
; skip noise
(
progn
(
backward-list
)
(
setq
found
t
))
(
forward-line
1
))
(
error
nil
))
; no preceding item
(
if
(
<
(
point
)
startpos
)
(
goto-char
(
1+
open-bracket-pos
))
; just beyond bracket
;; again mimic the first list item
(
if
found
(
current-indentation
)
(
progn
;; else they're about to enter the first item
(
while
(
looking-at
"[ \t]*[#\n\\\\]"
)
(
goto-char
open-bracket-pos
)
(
forward-line
1
))
(
+
(
current-indentation
)
py-indent-offset
))))
(
skip-chars-forward
" \t"
)
(
current-column
))
;; else to first real character (not whitespace or
;; comment hash) after open bracket; if none, to
;; 1 beyond the open bracket
(
and
(
looking-at
"[ \t]*[^ \t\n#]"
)
(
goto-char
(
1-
(
match-end
0
))))
(
current-column
))))
;; else on backslash continuation line
;; else on backslash continuation line
(
forward-line
-1
)
(
forward-line
-1
)
...
@@ -569,7 +561,7 @@ the new line indented."
...
@@ -569,7 +561,7 @@ the new line indented."
(
setq
searching
nil
)
; done searching in any case
(
setq
searching
nil
)
; done searching in any case
(
setq
found
(
setq
found
(
not
(
or
(
not
(
or
(
eq
(
char-after
(
point
)
)
?=
)
(
eq
(
following-char
)
?=
)
(
memq
(
char-after
(
-
(
point
)
2
))
(
memq
(
char-after
(
-
(
point
)
2
))
'
(
?<
?>
?!
)))))))))
'
(
?<
?>
?!
)))))))))
(
if
(
or
(
not
found
)
; not an assignment
(
if
(
or
(
not
found
)
; not an assignment
...
@@ -1318,13 +1310,11 @@ mode will strive to indent later lines of the statement in the same way.
...
@@ -1318,13 +1310,11 @@ mode will strive to indent later lines of the statement in the same way.
If a line is a continuation line by virtue of being in an unclosed
If a line is a continuation line by virtue of being in an unclosed
paren/bracket/brace structure (`list', for short), the suggested
paren/bracket/brace structure (`list', for short), the suggested
indentation depends on whether the current line will contain the first
indentation depends on whether the current line contains the first item
item in the list. If it is the first item, it's indented to line up with
in the list. If it does, it's indented py-indent-offset columns beyond
the first non-whitespace and non-comment character following the list's
the indentation of the line containing the open bracket. If you don't
opening bracket; if no such character exists, it's indented to one column
like that, change it by hand. The remaining items in the list will mimic
beyond the opening bracket. If you don't like that, change it by hand.
whatever indentation you give to the first item.
The remaining items in the list will mimic whatever indentation you gave
to the first item.
If a line is a continuation line because the line preceding it ends with
If a line is a continuation line because the line preceding it ends with
a backslash, the third and following lines of the statement inherit their
a backslash, the third and following lines of the statement inherit their
...
...
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