From a245ece58aa1149645bce53dd1afdf4487e2c8b4 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 20 Aug 2002 20:32:45 +0000 Subject: [PATCH] (fortran-current-defun): Use save-excursion. --- lisp/ChangeLog | 2 ++ lisp/progmodes/fortran.el | 45 +++++++++++++++++++++++---------------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4f25704b27e..325bc0a2e20 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2002-08-20 Glenn Morris + * progmodes/fortran.el (fortran-current-defun): Use save-excursion. + * imenu.el (imenu--generic-function): Use mapc. 2002-08-20 Richard M. Stallman diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el index 7f17de99c45..6d40fe154d2 100644 --- a/lisp/progmodes/fortran.el +++ b/lisp/progmodes/fortran.el @@ -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) -- 2.11.4.GIT