Function: fortran-electric-line-number

fortran-electric-line-number is an interactive and byte-compiled function defined in fortran.el.gz.

Signature

(fortran-electric-line-number ARG)

Documentation

Self insert, but if part of a Fortran line number indent it automatically.

Auto-indent does not happen if a numeric ARG is used.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/fortran.el.gz
(defun fortran-electric-line-number (arg)
  "Self insert, but if part of a Fortran line number indent it automatically.
Auto-indent does not happen if a numeric ARG is used."
  (interactive "*P")
  (if (or arg (not fortran-electric-line-number))
      (if arg
          (self-insert-command (prefix-numeric-value arg))
        (self-insert-command 1))
    (if (or (and (= 5 (current-column))
                 (save-excursion
                   (beginning-of-line)
                    ;; In col 5 with only spaces to the left.
                   (looking-at " \\{5\\}")))
            (and (= (if indent-tabs-mode
                        fortran-minimum-statement-indent-tab
                      fortran-minimum-statement-indent-fixed) (current-column))
                 ;; In col 8 with a single tab to the left.
                 (eq ?\t (char-after (line-beginning-position)))
                 (not (or (eq last-command 'fortran-indent-line)
                          (eq last-command
                              'fortran-indent-new-line))))
            (save-excursion
              (re-search-backward "[^ \t0-9]"
                                  (line-beginning-position)
                                  t))   ; not a line number
            (looking-at "[0-9]"))       ; within a line number
        (self-insert-command (prefix-numeric-value arg))
      (skip-chars-backward " \t")
      (insert last-command-event)
      (fortran-indent-line))))