]> git.eshelyaron.com Git - emacs.git/commitdiff
(fortran-current-defun): Use save-excursion.
authorGlenn Morris <rgm@gnu.org>
Tue, 20 Aug 2002 20:39:11 +0000 (20:39 +0000)
committerGlenn Morris <rgm@gnu.org>
Tue, 20 Aug 2002 20:39:11 +0000 (20:39 +0000)
lisp/ChangeLog
lisp/progmodes/fortran.el

index 032c96bbba4b5bd484ff16d3c1d595b416ea97c2..320f14eac4fc5b950209c947d6fe54d61bf59a7c 100644 (file)
@@ -1,3 +1,7 @@
+2002-08-20  Glenn Morris  <gmorris@ast.cam.ac.uk>
+
+       * progmodes/fortran.el (fortran-current-defun): Use save-excursion.
+
 2002-08-16  Dave Love  <fx@gnu.org>
 
        * emacs-lisp/edebug.el (edebug-read-syntax-table): Use a char
index 07fffaf768fa0b4bba4f48d249006cd6dc16628e..863b71b11fd308bfd4c80f33915316e695c7d392 100644 (file)
@@ -1810,28 +1810,29 @@ Supplying prefix arg DO-SPACE prevents stripping the whitespace."
 ;; for it.
 (defun fortran-current-defun ()
   "Function to use for `add-log-current-defun-function' in Fortran mode."
-  ;; We must be inside function body for this to work.
-  (fortran-beginning-of-subprogram)
-  (let ((case-fold-search t))          ; case-insensitive
-    ;; search for fortran subprogram start
-    (if (re-search-forward
-        (concat "^[ \t]*\\(program\\|subroutine\\|function"
-                "\\|[ \ta-z0-9*()]*[ \t]+function\\|"
-                "\\(block[ \t]*data\\)\\)")
-        (save-excursion (fortran-end-of-subprogram)
-                        (point))
-        t)
-       (or (match-string-no-properties 2)
-           (progn
-             ;; move to EOL or before first left paren
-             (if (re-search-forward "[(\n]" nil t)
-                 (progn (backward-char)
-                        (skip-chars-backward " \t"))
-               (end-of-line))
-             ;; Use the name preceding that.
-             (buffer-substring-no-properties (point) (progn (backward-sexp)
-                                                            (point)))))
-      "main")))
+  (save-excursion
+    ;; We must be inside function body for this to work.
+    (fortran-beginning-of-subprogram)
+    (let ((case-fold-search t))                ; case-insensitive
+      ;; search for fortran subprogram start
+      (if (re-search-forward
+           (concat "^[ \t]*\\(program\\|subroutine\\|function"
+                   "\\|[ \ta-z0-9*()]*[ \t]+function\\|"
+                   "\\(block[ \t]*data\\)\\)")
+           (save-excursion (fortran-end-of-subprogram)
+                           (point))
+           t)
+          (or (match-string-no-properties 2)
+              (progn
+                ;; move to EOL or before first left paren
+                (if (re-search-forward "[(\n]" nil t)
+                    (progn (backward-char)
+                           (skip-chars-backward " \t"))
+                  (end-of-line))
+                ;; Use the name preceding that.
+                (buffer-substring-no-properties (point) (progn (backward-sexp)
+                                                               (point)))))
+        "main"))))
 
 (provide 'fortran)