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

index 4f25704b27e2d8c2b46628e5abfdfc868d748d9d..325bc0a2e20e84bff7094891a43854b782a7d77b 100644 (file)
@@ -1,5 +1,7 @@
 2002-08-20  Glenn Morris  <gmorris@ast.cam.ac.uk>
 
+       * progmodes/fortran.el (fortran-current-defun): Use save-excursion.
+
        * imenu.el (imenu--generic-function): Use mapc.
 
 2002-08-20  Richard M. Stallman  <rms@gnu.org>
index 7f17de99c45cad208745b9e3049908c42d3a0445..6d40fe154d22a5b9e21d0f33773cee4f64f77b79 100644 (file)
@@ -1820,28 +1820,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)