Mercurial > emacs
changeset 46979:0ea82abe061c
(fortran-current-defun): Use save-excursion.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 20 Aug 2002 20:31:26 +0000 |
parents | b2363b1b2b31 |
children | af664b6daba2 |
files | lisp/progmodes/fortran.el |
diffstat | 1 files changed, 23 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/fortran.el Tue Aug 20 20:23:25 2002 +0000 +++ b/lisp/progmodes/fortran.el Tue Aug 20 20:31:26 2002 +0000 @@ -1820,28 +1820,29 @@ ;; 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)