[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r100825: Merge fixes to indentation o
From: |
Simon South |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r100825: Merge fixes to indentation of case statements, variant parts in record |
Date: |
Thu, 15 Jul 2010 10:21:47 -0400 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 100825 [merge]
committer: Simon South <address@hidden>
branch nick: trunk
timestamp: Thu 2010-07-15 10:21:47 -0400
message:
Merge fixes to indentation of case statements, variant parts in record
declarations.
modified:
lisp/ChangeLog
lisp/progmodes/delphi.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2010-07-14 19:09:28 +0000
+++ b/lisp/ChangeLog 2010-07-15 03:12:37 +0000
@@ -1,3 +1,15 @@
+2010-07-15 Simon South <address@hidden>
+
+ * progmodes/delphi.el (delphi-previous-indent-of): Indent case
+ blocks within record declarations (i.e. variant parts) correctly.
+
+2010-07-15 Simon South <address@hidden>
+
+ * progmodes/delphi.el (delphi-token-at): Give newlines precedence
+ over literal tokens when parsing so newlines aren't "absorbed" by
+ single-line comments. Corrects the indentation of case blocks
+ that have a comment on the first line.
+
2010-07-14 Karl Fogel <address@hidden>
* bookmark.el (bookmark-load-hook): Fix doc string as suggested
=== modified file 'lisp/progmodes/delphi.el'
--- a/lisp/progmodes/delphi.el 2010-01-14 18:37:23 +0000
+++ b/lisp/progmodes/delphi.el 2010-07-15 03:12:37 +0000
@@ -628,7 +628,9 @@
(defun delphi-token-at (p)
;; Returns the token from parsing text at point p.
(when (and (<= (point-min) p) (<= p (point-max)))
- (cond ((delphi-literal-token-at p))
+ (cond ((delphi-char-token-at p ?\n 'newline))
+
+ ((delphi-literal-token-at p))
((delphi-space-token-at p))
@@ -638,7 +640,6 @@
((delphi-char-token-at p ?\) 'close-group))
((delphi-char-token-at p ?\[ 'open-group))
((delphi-char-token-at p ?\] 'close-group))
- ((delphi-char-token-at p ?\n 'newline))
((delphi-char-token-at p ?\; 'semicolon))
((delphi-char-token-at p ?. 'dot))
((delphi-char-token-at p ?, 'comma))
@@ -888,7 +889,24 @@
(setq token (delphi-block-start token)))
;; Regular block start found.
- ((delphi-is token-kind delphi-block-statements) (throw 'done token))
+ ((delphi-is token-kind delphi-block-statements)
+ (throw 'done
+ ;; As a special case, when a "case" block appears
+ ;; within a record declaration (to denote a variant
+ ;; part), the record declaration should be considered
+ ;; the enclosing block.
+ (if (eq 'case token-kind)
+ (let ((enclosing-token
+ (delphi-block-start token
+ 'stop-on-class)))
+ (if
+ (eq 'record
+ (delphi-token-kind enclosing-token))
+ (if stop-on-class
+ enclosing-token
+ (delphi-previous-token enclosing-token))
+ token))
+ token)))
;; A class/record start also begins a block.
((delphi-composite-type-start token last-token)
@@ -1058,6 +1076,7 @@
(token-kind nil)
(from-kind (delphi-token-kind from-token))
(last-colon nil)
+ (last-of nil)
(last-token nil))
(catch 'done
(while token
@@ -1101,9 +1120,17 @@
;; Ignore whitespace.
((delphi-is token-kind delphi-whitespace))
- ;; Remember any ':' we encounter, since that affects how we indent to
- ;; a case statement.
- ((eq 'colon token-kind) (setq last-colon token))
+ ;; Remember any "of" we encounter, since that affects how we
+ ;; indent to a case statement within a record declaration
+ ;; (i.e. a variant part).
+ ((eq 'of token-kind)
+ (setq last-of token))
+
+ ;; Remember any ':' we encounter (until we reach an "of"),
+ ;; since that affects how we indent to case statements in
+ ;; general.
+ ((eq 'colon token-kind)
+ (unless last-of (setq last-colon token)))
;; A case statement delimits a previous statement. We indent labels
;; specially.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r100825: Merge fixes to indentation of case statements, variant parts in record,
Simon South <=