aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-04-07 17:14:44 +0000
committerRichard M. Stallman1994-04-07 17:14:44 +0000
commit947388af39d4f788d8fbcd440cfd42130c3305b1 (patch)
tree8287f3fb6cda208248ab62deb643e152102e72d3
parentbd4a38e57543738d5adbacb67a17cbc66c4ef910 (diff)
downloademacs-947388af39d4f788d8fbcd440cfd42130c3305b1.tar.gz
emacs-947388af39d4f788d8fbcd440cfd42130c3305b1.zip
(fortran-blink-matching-do): New function,
basically copied from fortran-blink-matching-if. (fortran-indent-line): Call it. (fortran-mode): Doc mod.
-rw-r--r--lisp/progmodes/fortran.el44
1 files changed, 42 insertions, 2 deletions
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el
index c04e1eeb768..462f38b29b4 100644
--- a/lisp/progmodes/fortran.el
+++ b/lisp/progmodes/fortran.el
@@ -111,7 +111,8 @@ Normally a space.")
111 "*Non-nil causes all numbered lines to be treated as possible DO loop ends.") 111 "*Non-nil causes all numbered lines to be treated as possible DO loop ends.")
112 112
113(defvar fortran-blink-matching-if nil 113(defvar fortran-blink-matching-if nil
114 "*From a Fortran ENDIF statement, blink the matching IF statement.") 114 "*From a Fortran ENDIF statement, blink the matching IF statement.
115Also, from an ENDDO statement, blink on matching DO [WHILE] statement.")
115 116
116(defvar fortran-continuation-string "$" 117(defvar fortran-continuation-string "$"
117 "*Single-character string used for Fortran continuation lines. 118 "*Single-character string used for Fortran continuation lines.
@@ -326,6 +327,7 @@ Variables controlling indentation style and extra features:
326 statements. (default nil) 327 statements. (default nil)
327 fortran-blink-matching-if 328 fortran-blink-matching-if
328 From a Fortran ENDIF statement, blink the matching IF statement. 329 From a Fortran ENDIF statement, blink the matching IF statement.
330 Also, from an ENDDO statement, blink on matching DO [WHILE] statement.
329 (default nil) 331 (default nil)
330 fortran-continuation-string 332 fortran-continuation-string
331 Single-character string to be inserted in column 5 of a continuation 333 Single-character string to be inserted in column 5 of a continuation
@@ -726,6 +728,42 @@ non-comment Fortran statement in the file, and nil otherwise."
726 (goto-char matching-if) 728 (goto-char matching-if)
727 (sit-for 1) 729 (sit-for 1)
728 (goto-char endif-point)))))) 730 (goto-char endif-point))))))
731
732(defun fortran-blink-matching-do ()
733 ;; From a Fortran ENDDO statement, blink on the matching DO or DO WHILE
734 ;; statement. This is basically copied from fortran-blink-matching-if.
735 (let ((count 1) (top-of-window (window-start)) matching-do
736 (enddo-point (point)) message)
737 (if (save-excursion (beginning-of-line)
738 (skip-chars-forward " \t0-9")
739 (looking-at "end[ \t]*do\\b"))
740 (progn
741 (save-excursion
742 (while (and (not (= count 0))
743 (not (eq (fortran-previous-statement)
744 'first-statement))
745 (not (looking-at
746 "^[ \t0-9]*end\\b[ \t]*[^ \t=(a-z]")))
747 ; Keep local to subprogram
748 (skip-chars-forward " \t0-9")
749 (cond ((looking-at "do[ \t]+")
750 (setq count (- count 1)))
751 ((looking-at "end[ \t]*do\\b")
752 (setq count (+ count 1)))))
753 (if (not (= count 0))
754 (setq message "No matching do.")
755 (if (< (point) top-of-window)
756 (setq message (concat "Matches " (buffer-substring
757 (progn (beginning-of-line)
758 (point))
759 (progn (end-of-line)
760 (point)))))
761 (setq matching-do (point)))))
762 (if message
763 (message "%s" message)
764 (goto-char matching-do)
765 (sit-for 1)
766 (goto-char enddo-point))))))
729 767
730(defun fortran-indent-line () 768(defun fortran-indent-line ()
731 "Indents current Fortran line based on its contents and on previous lines." 769 "Indents current Fortran line based on its contents and on previous lines."
@@ -750,7 +788,9 @@ non-comment Fortran statement in the file, and nil otherwise."
750 (end-of-line) 788 (end-of-line)
751 (fortran-do-auto-fill))) 789 (fortran-do-auto-fill)))
752 (if fortran-blink-matching-if 790 (if fortran-blink-matching-if
753 (fortran-blink-matching-if)))) 791 (progn
792 (fortran-blink-matching-if)
793 (fortran-blink-matching-do)))))
754 794
755(defun fortran-indent-new-line () 795(defun fortran-indent-new-line ()
756 "Reindent the current Fortran line, insert a newline and indent the newline. 796 "Reindent the current Fortran line, insert a newline and indent the newline.