changeset 22682:c283610d2a74

(pascal-insert-block): Fixed space-deletion bug in front of the "begin" string. (pascal-beg-of-defun): Used to locate the beginning of a function incorrectly when a function contained several begin-end blocks. Fixed.
author Richard M. Stallman <rms@gnu.org>
date Fri, 03 Jul 1998 20:10:32 +0000
parents 127d903d615a
children 0941a5743283
files lisp/progmodes/pascal.el
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/pascal.el	Fri Jul 03 20:01:02 1998 +0000
+++ b/lisp/progmodes/pascal.el	Fri Jul 03 20:10:32 1998 +0000
@@ -1,6 +1,6 @@
 ;;; pascal.el --- major mode for editing pascal source in Emacs
 
-;; Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 95, 96, 97, 1998 Free Software Foundation, Inc.
 
 ;; Author: Espen Skoglund <espensk@stud.cs.uit.no>
 ;; Keywords: languages
@@ -481,11 +481,10 @@
 (defun pascal-insert-block ()
   "Insert Pascal begin ... end; block in the code with right indentation."
   (interactive)
-  (pascal-indent-line)
   (insert "begin")
   (electric-pascal-terminate-line)
   (save-excursion
-    (electric-pascal-terminate-line)
+    (newline)
     (insert "end;")
     (beginning-of-line)
     (pascal-indent-line)))
@@ -610,7 +609,7 @@
 		   (setq func (1+ func)))
 	       (setq nest (1- nest)))
 	      ((match-end 3)                       ; function|procedure
-	       (if (= 0 func)
+	       (if (or (> nest 0) (= 0 func))
 		   (throw 'found t)
 		 (setq func (1- func)))))))
     nil))