# HG changeset patch # User Richard M. Stallman # Date 762637284 0 # Node ID 40e4038bd544597c75f36c6186b7bd26482df97f # Parent 34d9a0aa80d19e1b2c88c5d10fb751d94271789e (pascal-calculate-indent): Fixed indentation bug in for-loops, with-structures and else-structures. (pascal-noindent-re): Add `else'. diff -r 34d9a0aa80d1 -r 40e4038bd544 lisp/progmodes/pascal.el --- a/lisp/progmodes/pascal.el Wed Mar 02 16:55:16 1994 +0000 +++ b/lisp/progmodes/pascal.el Wed Mar 02 19:41:24 1994 +0000 @@ -113,7 +113,7 @@ (defconst pascal-declaration-re "\\<\\(const\\|label\\|type\\|var\\)\\>") (defconst pascal-defun-re "\\<\\(function\\|procedure\\|program\\)\\>") (defconst pascal-sub-block-re "\\<\\(if\\|else\\|for\\|while\\|with\\)\\>") -(defconst pascal-noindent-re "\\<\\(begin\\|end\\|until\\)\\>") +(defconst pascal-noindent-re "\\<\\(begin\\|end\\|until\\|else\\)\\>") (defconst pascal-nosemi-re "\\<\\(begin\\|repeat\\|then\\|do\\|else\\)\\>") (defconst pascal-autoindent-lines-re "\\<\\(label\\|var\\|type\\|const\\|until\\|end\\|begin\\|repeat\\|else\\)\\>") @@ -668,7 +668,8 @@ (save-excursion (let* ((oldpos (point)) (state (save-excursion (parse-partial-sexp (point-min) (point)))) - (nest 0) (par 0) (complete nil) (blocked nil) + (nest 0) (par 0) (complete nil) + (elsed (looking-at "[ \t]*else\\>")) (type (catch 'nesting ;; Check if inside a string, comment or parenthesis (cond ((nth 3 state) (throw 'nesting 'string)) @@ -683,15 +684,16 @@ (looking-at pascal-beg-block-re) (if (= nest 0) (cond ((looking-at "case\\>") - (setq blocked t) (throw 'nesting 'case)) ((looking-at "record\\>") (throw 'nesting 'declaration)) - (t (setq blocked t) - (throw 'nesting 'block))) + (t (throw 'nesting 'block))) (setq nest (1- nest)))) (;--Nest block inwards (looking-at pascal-end-block-re) + (if (and (looking-at "end\\s ") + elsed (not complete)) + (throw 'nesting 'block)) (setq complete t nest (1+ nest))) (;--Defun (or parameter list) @@ -710,11 +712,10 @@ (throw 'nesting 'paramlist))))) (;--Declaration part (looking-at pascal-declaration-re) - (if (or blocked - (save-excursion - (goto-char oldpos) - (forward-line -1) - (looking-at "^[ \t]*$"))) + (if (save-excursion + (goto-char oldpos) + (forward-line -1) + (looking-at "^[ \t]*$")) (throw 'nesting 'unknown) (throw 'nesting 'declaration))) (;--If, else or while statement