fortran insert continuation symbol (ampersand &) that match both fixed and free format.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun fortran-insert-f90-continuation () | |
"Insert continuation symbol (ampersand &) that match both fixed and | |
free format. | |
If the inserted ampersand is the first non-blank character, just | |
insert it, otherwise, insert it at column 72 (zero-based index) | |
and insert another ampersand at column 6 on next line. | |
Also indent next line if `electric-indent-mode` is on." | |
(interactive) | |
(let ((beg (line-beginning-position)) | |
(end (point))) | |
(setq s (buffer-substring-no-properties beg end)) | |
(if (string-match "^[ \t]*$" s) | |
(insert "&") | |
(progn | |
(insert "\n &") | |
(previous-line) | |
(move-to-column 72 t) | |
(insert "&") | |
(next-line))) | |
(when electric-indent-mode | |
(indent-for-tab-command)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment