(fortran-current-defun): Use save-excursion.
This commit is contained in:
parent
5b89a8c974
commit
a245ece58a
2 changed files with 25 additions and 22 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue