aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-05-13 16:25:13 +0000
committerRichard M. Stallman1996-05-13 16:25:13 +0000
commita0bd2457ad2557b6d3056033df97afa9dbc859a1 (patch)
tree3f79056527a6462b7d7ce3e566e30612c31e5726
parent9bf7b6aa500cc50a512770ddfd4f072aedb53cea (diff)
downloademacs-a0bd2457ad2557b6d3056033df97afa9dbc859a1.tar.gz
emacs-a0bd2457ad2557b6d3056033df97afa9dbc859a1.zip
(pascal-end-of-statement, pascal-calculate-indent):
Set parse-sexp-ignore-comments to t before parsing. (pascal-indent-case): Save position of cursor, and restores it after reindenting the code.
-rw-r--r--lisp/progmodes/pascal.el12
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/progmodes/pascal.el b/lisp/progmodes/pascal.el
index 6a3c62a22e6..2cad0a01afd 100644
--- a/lisp/progmodes/pascal.el
+++ b/lisp/progmodes/pascal.el
@@ -612,7 +612,8 @@ area. See also `pascal-comment-area'."
612(defun pascal-end-of-statement () 612(defun pascal-end-of-statement ()
613 "Move forward to end of current statement." 613 "Move forward to end of current statement."
614 (interactive) 614 (interactive)
615 (let ((nest 0) pos 615 (let ((parse-sexp-ignore-comments t)
616 (nest 0) pos
616 (regexp (concat "\\(" pascal-beg-block-re "\\)\\|\\(" 617 (regexp (concat "\\(" pascal-beg-block-re "\\)\\|\\("
617 pascal-end-block-re "\\)"))) 618 pascal-end-block-re "\\)")))
618 (if (not (looking-at "[ \t\n]")) (forward-sexp -1)) 619 (if (not (looking-at "[ \t\n]")) (forward-sexp -1))
@@ -784,7 +785,8 @@ on the line which ends a function or procedure named NAME."
784 "Calculate the indent of the current Pascal line. 785 "Calculate the indent of the current Pascal line.
785Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)." 786Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
786 (save-excursion 787 (save-excursion
787 (let* ((oldpos (point)) 788 (let* ((parse-sexp-ignore-comments t)
789 (oldpos (point))
788 (state (save-excursion (parse-partial-sexp (point-min) (point)))) 790 (state (save-excursion (parse-partial-sexp (point-min) (point))))
789 (nest 0) (par 0) (complete (looking-at "[ \t]*end\\>")) 791 (nest 0) (par 0) (complete (looking-at "[ \t]*end\\>"))
790 (elsed (looking-at "[ \t]*else\\>")) 792 (elsed (looking-at "[ \t]*else\\>"))
@@ -895,8 +897,8 @@ column number the line should be indented to."
895 897
896(defun pascal-indent-case () 898(defun pascal-indent-case ()
897 "Indent within case statements." 899 "Indent within case statements."
898 (skip-chars-forward ": \t") 900 (let ((savepos (point-marker))
899 (let ((end (prog2 901 (end (prog2
900 (end-of-line) 902 (end-of-line)
901 (point-marker) 903 (point-marker)
902 (re-search-backward "\\<case\\>" nil t))) 904 (re-search-backward "\\<case\\>" nil t)))
@@ -930,7 +932,7 @@ column number the line should be indented to."
930 (insert " ")) 932 (insert " "))
931 (setq oldpos (point)) 933 (setq oldpos (point))
932 (pascal-end-of-statement)) 934 (pascal-end-of-statement))
933 (goto-char oldpos))) 935 (goto-char savepos)))
934 936
935(defun pascal-indent-paramlist (&optional arg) 937(defun pascal-indent-paramlist (&optional arg)
936 "Indent current line in parameterlist. 938 "Indent current line in parameterlist.