aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/progmodes/delphi.el39
2 files changed, 45 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 13990c03203..54b7937c859 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12010-07-15 Simon South <ssouth@localhost.localdomain>
2
3 * progmodes/delphi.el (delphi-previous-indent-of): Indent case
4 blocks within record declarations (i.e. variant parts) correctly.
5
62010-07-15 Simon South <ssouth@member.fsf.org>
7
8 * progmodes/delphi.el (delphi-token-at): Give newlines precedence
9 over literal tokens when parsing so newlines aren't "absorbed" by
10 single-line comments. Corrects the indentation of case blocks
11 that have a comment on the first line.
12
12010-07-14 Karl Fogel <kfogel@red-bean.com> 132010-07-14 Karl Fogel <kfogel@red-bean.com>
2 14
3 * bookmark.el (bookmark-load-hook): Fix doc string as suggested 15 * bookmark.el (bookmark-load-hook): Fix doc string as suggested
diff --git a/lisp/progmodes/delphi.el b/lisp/progmodes/delphi.el
index 1e5f1f506b3..2558456bc07 100644
--- a/lisp/progmodes/delphi.el
+++ b/lisp/progmodes/delphi.el
@@ -628,7 +628,9 @@ routine.")
628(defun delphi-token-at (p) 628(defun delphi-token-at (p)
629 ;; Returns the token from parsing text at point p. 629 ;; Returns the token from parsing text at point p.
630 (when (and (<= (point-min) p) (<= p (point-max))) 630 (when (and (<= (point-min) p) (<= p (point-max)))
631 (cond ((delphi-literal-token-at p)) 631 (cond ((delphi-char-token-at p ?\n 'newline))
632
633 ((delphi-literal-token-at p))
632 634
633 ((delphi-space-token-at p)) 635 ((delphi-space-token-at p))
634 636
@@ -638,7 +640,6 @@ routine.")
638 ((delphi-char-token-at p ?\) 'close-group)) 640 ((delphi-char-token-at p ?\) 'close-group))
639 ((delphi-char-token-at p ?\[ 'open-group)) 641 ((delphi-char-token-at p ?\[ 'open-group))
640 ((delphi-char-token-at p ?\] 'close-group)) 642 ((delphi-char-token-at p ?\] 'close-group))
641 ((delphi-char-token-at p ?\n 'newline))
642 ((delphi-char-token-at p ?\; 'semicolon)) 643 ((delphi-char-token-at p ?\; 'semicolon))
643 ((delphi-char-token-at p ?. 'dot)) 644 ((delphi-char-token-at p ?. 'dot))
644 ((delphi-char-token-at p ?, 'comma)) 645 ((delphi-char-token-at p ?, 'comma))
@@ -888,7 +889,24 @@ non-delphi buffer. Set to nil in a delphi buffer. To override, just do:
888 (setq token (delphi-block-start token))) 889 (setq token (delphi-block-start token)))
889 890
890 ;; Regular block start found. 891 ;; Regular block start found.
891 ((delphi-is token-kind delphi-block-statements) (throw 'done token)) 892 ((delphi-is token-kind delphi-block-statements)
893 (throw 'done
894 ;; As a special case, when a "case" block appears
895 ;; within a record declaration (to denote a variant
896 ;; part), the record declaration should be considered
897 ;; the enclosing block.
898 (if (eq 'case token-kind)
899 (let ((enclosing-token
900 (delphi-block-start token
901 'stop-on-class)))
902 (if
903 (eq 'record
904 (delphi-token-kind enclosing-token))
905 (if stop-on-class
906 enclosing-token
907 (delphi-previous-token enclosing-token))
908 token))
909 token)))
892 910
893 ;; A class/record start also begins a block. 911 ;; A class/record start also begins a block.
894 ((delphi-composite-type-start token last-token) 912 ((delphi-composite-type-start token last-token)
@@ -1058,6 +1076,7 @@ non-delphi buffer. Set to nil in a delphi buffer. To override, just do:
1058 (token-kind nil) 1076 (token-kind nil)
1059 (from-kind (delphi-token-kind from-token)) 1077 (from-kind (delphi-token-kind from-token))
1060 (last-colon nil) 1078 (last-colon nil)
1079 (last-of nil)
1061 (last-token nil)) 1080 (last-token nil))
1062 (catch 'done 1081 (catch 'done
1063 (while token 1082 (while token
@@ -1101,9 +1120,17 @@ non-delphi buffer. Set to nil in a delphi buffer. To override, just do:
1101 ;; Ignore whitespace. 1120 ;; Ignore whitespace.
1102 ((delphi-is token-kind delphi-whitespace)) 1121 ((delphi-is token-kind delphi-whitespace))
1103 1122
1104 ;; Remember any ':' we encounter, since that affects how we indent to 1123 ;; Remember any "of" we encounter, since that affects how we
1105 ;; a case statement. 1124 ;; indent to a case statement within a record declaration
1106 ((eq 'colon token-kind) (setq last-colon token)) 1125 ;; (i.e. a variant part).
1126 ((eq 'of token-kind)
1127 (setq last-of token))
1128
1129 ;; Remember any ':' we encounter (until we reach an "of"),
1130 ;; since that affects how we indent to case statements in
1131 ;; general.
1132 ((eq 'colon token-kind)
1133 (unless last-of (setq last-colon token)))
1107 1134
1108 ;; A case statement delimits a previous statement. We indent labels 1135 ;; A case statement delimits a previous statement. We indent labels
1109 ;; specially. 1136 ;; specially.