From: Glenn Morris Date: Tue, 20 Aug 2002 20:39:11 +0000 (+0000) Subject: (fortran-current-defun): Use save-excursion. X-Git-Tag: emacs-pretest-21.2.91~107 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3a143c2f1c26057604c680e1efbd2b3059d171a6;p=emacs.git (fortran-current-defun): Use save-excursion. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 032c96bbba4..320f14eac4f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2002-08-20 Glenn Morris + + * progmodes/fortran.el (fortran-current-defun): Use save-excursion. + 2002-08-16 Dave Love * emacs-lisp/edebug.el (edebug-read-syntax-table): Use a char diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el index 07fffaf768f..863b71b11fd 100644 --- a/lisp/progmodes/fortran.el +++ b/lisp/progmodes/fortran.el @@ -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)