Function: fortran-current-defun

fortran-current-defun is a byte-compiled function defined in fortran.el.gz.

Signature

(fortran-current-defun)

Documentation

Function to use for add-log-current-defun-function in Fortran mode.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/fortran.el.gz
;; This code used to live in add-log.el, but this is a better place for it.
(defun fortran-current-defun ()
  "Function to use for `add-log-current-defun-function' in Fortran mode."
  (save-excursion
    ;; We must be inside function body for this to work.
    (fortran-beginning-of-subprogram)
    (let ((case-fold-search t))
      ;; Search for fortran subprogram start.
      (if (re-search-forward
           fortran-start-prog-re
           (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"))))