diff options
| author | Glenn Morris | 2002-08-20 20:32:45 +0000 |
|---|---|---|
| committer | Glenn Morris | 2002-08-20 20:32:45 +0000 |
| commit | a245ece58aa1149645bce53dd1afdf4487e2c8b4 (patch) | |
| tree | 0bad0d8fa9cb2e9c21a33d7c9f1ee9ef0827780a | |
| parent | 5b89a8c974074c13e762c39575fa75733a00f769 (diff) | |
| download | emacs-a245ece58aa1149645bce53dd1afdf4487e2c8b4.tar.gz emacs-a245ece58aa1149645bce53dd1afdf4487e2c8b4.zip | |
(fortran-current-defun): Use save-excursion.
| -rw-r--r-- | lisp/ChangeLog | 2 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | 2002-08-20 Glenn Morris <gmorris@ast.cam.ac.uk> | 1 | 2002-08-20 Glenn Morris <gmorris@ast.cam.ac.uk> |
| 2 | 2 | ||
| 3 | * progmodes/fortran.el (fortran-current-defun): Use save-excursion. | ||
| 4 | |||
| 3 | * imenu.el (imenu--generic-function): Use mapc. | 5 | * imenu.el (imenu--generic-function): Use mapc. |
| 4 | 6 | ||
| 5 | 2002-08-20 Richard M. Stallman <rms@gnu.org> | 7 | 2002-08-20 Richard M. Stallman <rms@gnu.org> |
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." | |||
| 1820 | ;; for it. | 1820 | ;; for it. |
| 1821 | (defun fortran-current-defun () | 1821 | (defun fortran-current-defun () |
| 1822 | "Function to use for `add-log-current-defun-function' in Fortran mode." | 1822 | "Function to use for `add-log-current-defun-function' in Fortran mode." |
| 1823 | ;; We must be inside function body for this to work. | 1823 | (save-excursion |
| 1824 | (fortran-beginning-of-subprogram) | 1824 | ;; We must be inside function body for this to work. |
| 1825 | (let ((case-fold-search t)) ; case-insensitive | 1825 | (fortran-beginning-of-subprogram) |
| 1826 | ;; search for fortran subprogram start | 1826 | (let ((case-fold-search t)) ; case-insensitive |
| 1827 | (if (re-search-forward | 1827 | ;; search for fortran subprogram start |
| 1828 | (concat "^[ \t]*\\(program\\|subroutine\\|function" | 1828 | (if (re-search-forward |
| 1829 | "\\|[ \ta-z0-9*()]*[ \t]+function\\|" | 1829 | (concat "^[ \t]*\\(program\\|subroutine\\|function" |
| 1830 | "\\(block[ \t]*data\\)\\)") | 1830 | "\\|[ \ta-z0-9*()]*[ \t]+function\\|" |
| 1831 | (save-excursion (fortran-end-of-subprogram) | 1831 | "\\(block[ \t]*data\\)\\)") |
| 1832 | (point)) | 1832 | (save-excursion (fortran-end-of-subprogram) |
| 1833 | t) | 1833 | (point)) |
| 1834 | (or (match-string-no-properties 2) | 1834 | t) |
| 1835 | (progn | 1835 | (or (match-string-no-properties 2) |
| 1836 | ;; move to EOL or before first left paren | 1836 | (progn |
| 1837 | (if (re-search-forward "[(\n]" nil t) | 1837 | ;; move to EOL or before first left paren |
| 1838 | (progn (backward-char) | 1838 | (if (re-search-forward "[(\n]" nil t) |
| 1839 | (skip-chars-backward " \t")) | 1839 | (progn (backward-char) |
| 1840 | (end-of-line)) | 1840 | (skip-chars-backward " \t")) |
| 1841 | ;; Use the name preceding that. | 1841 | (end-of-line)) |
| 1842 | (buffer-substring-no-properties (point) (progn (backward-sexp) | 1842 | ;; Use the name preceding that. |
| 1843 | (point))))) | 1843 | (buffer-substring-no-properties (point) (progn (backward-sexp) |
| 1844 | "main"))) | 1844 | (point))))) |
| 1845 | "main")))) | ||
| 1845 | 1846 | ||
| 1846 | (provide 'fortran) | 1847 | (provide 'fortran) |
| 1847 | 1848 | ||