/[emacs]/emacs/lisp/progmodes/fortran.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/fortran.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.102 by gm, Sat Apr 12 15:44:59 2003 UTC revision 1.103 by gm, Sun Apr 13 13:09:24 2003 UTC
# Line 1008  Directive lines are treated as comments. Line 1008  Directive lines are treated as comments.
1008      (while (and (setq not-first-statement (= (forward-line -1) 0))      (while (and (setq not-first-statement (= (forward-line -1) 0))
1009                  (or (looking-at fortran-comment-line-start-skip)                  (or (looking-at fortran-comment-line-start-skip)
1010                      (looking-at fortran-directive-re)                      (looking-at fortran-directive-re)
1011                        (looking-at
1012                         (concat "[ \t]*"
1013                                 (regexp-quote fortran-continuation-string)))
1014                      (looking-at "[ \t]*$\\| \\{5\\}[^ 0\n]\\|\t[1-9]")                      (looking-at "[ \t]*$\\| \\{5\\}[^ 0\n]\\|\t[1-9]")
1015                      (looking-at (concat "[ \t]*" comment-start-skip)))))                      (looking-at (concat "[ \t]*" comment-start-skip)))))
1016      (cond ((and continue-test      (cond ((and continue-test
# Line 1329  Return point or nil." Line 1332  Return point or nil."
1332        (setq first-statement (fortran-previous-statement))        (setq first-statement (fortran-previous-statement))
1333        (if first-statement        (if first-statement
1334            (setq icol fortran-minimum-statement-indent)            (setq icol fortran-minimum-statement-indent)
1335          (progn          (if (= (point) (point-min))
1336            (if (= (point) (point-min))              (setq icol fortran-minimum-statement-indent)
1337                (setq icol fortran-minimum-statement-indent)            (setq icol (fortran-current-line-indentation)))
1338              (setq icol (fortran-current-line-indentation)))          (skip-chars-forward " \t0-9")
1339            (skip-chars-forward " \t0-9")          (cond ((looking-at "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?if[ \t]*(")
1340            (cond ((looking-at "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?if[ \t]*(")                 (if (or (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t_$(=a-z0-9]")
1341                   (if (or (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t_$(=a-z0-9]")                         (let (then-test) ;multi-line if-then
1342                           (let (then-test)       ;multi-line if-then                           (while (and (= (forward-line 1) 0)
1343                             (while (and (= (forward-line 1) 0)                                       ;;search forward for then
1344                                         ;;search forward for then                                       (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")
1345                                         (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")                                       (not (setq then-test
1346                                         (not (setq then-test                                                  (looking-at
1347                                                    (looking-at                                                   ".*then\\b[ \t]\
                                                    ".*then\\b[ \t]\  
1348  *[^ \t_$(=a-z0-9]")))))  *[^ \t_$(=a-z0-9]")))))
1349                             then-test))                           then-test))
1350                       (setq icol (+ icol fortran-if-indent))))                     (setq icol (+ icol fortran-if-indent))))
1351                  ((looking-at "else\\(if\\)?\\b")                ((looking-at "else\\(if\\)?\\b")
1352                   (setq icol (+ icol fortran-if-indent)))                 (setq icol (+ icol fortran-if-indent)))
1353                  ((looking-at "select[ \t]*case[ \t](.*)")                ((looking-at "select[ \t]*case[ \t](.*)")
1354                   (setq icol (+ icol fortran-if-indent)))                 (setq icol (+ icol fortran-if-indent)))
1355                  ((looking-at "case[ \t]*(.*)")                ((looking-at "case[ \t]*(.*)")
1356                   (setq icol (+ icol fortran-if-indent)))                 (setq icol (+ icol fortran-if-indent)))
1357                  ((looking-at "case[ \t]*default\\b")                ((looking-at "case[ \t]*default\\b")
1358                   (setq icol (+ icol fortran-if-indent)))                 (setq icol (+ icol fortran-if-indent)))
1359                  ((looking-at "\\(otherwise\\|else[ \t]*where\\)\\b")                ((looking-at "\\(otherwise\\|else[ \t]*where\\)\\b")
1360                   (setq icol (+ icol fortran-if-indent)))                 (setq icol (+ icol fortran-if-indent)))
1361                  ((looking-at "where[ \t]*(.*)[ \t]*\n")                ((looking-at "where[ \t]*(.*)[ \t]*\n")
1362                   (setq icol (+ icol fortran-if-indent)))                 (setq icol (+ icol fortran-if-indent)))
1363                  ((looking-at "do\\b")                ((looking-at "do\\b")
1364                   (setq icol (+ icol fortran-do-indent)))                 (setq icol (+ icol fortran-do-indent)))
1365                  ((looking-at                ((looking-at
1366                    "\\(structure\\|union\\|map\\|interface\\)\                  "\\(structure\\|union\\|map\\|interface\\)\
1367  \\b[ \t]*[^ \t=(a-z]")  \\b[ \t]*[^ \t=(a-z]")
1368                   (setq icol (+ icol fortran-structure-indent)))                 (setq icol (+ icol fortran-structure-indent)))
1369                  ((and (looking-at fortran-end-prog-re1)                ((and (looking-at fortran-end-prog-re1)
1370                        (fortran-check-end-prog-re))                      (fortran-check-end-prog-re))
1371                   ;; Previous END resets indent to minimum                 ;; Previous END resets indent to minimum
1372                   (setq icol fortran-minimum-statement-indent))))))                 (setq icol fortran-minimum-statement-indent)))))
1373      (save-excursion      (save-excursion
1374        (beginning-of-line)        (beginning-of-line)
1375        (cond ((looking-at "[ \t]*$"))        (cond ((looking-at "[ \t]*$"))
# Line 1381  Return point or nil." Line 1383  Return point or nil."
1383                      (setq icol (+ fortran-minimum-statement-indent                      (setq icol (+ fortran-minimum-statement-indent
1384                                    fortran-comment-line-extra-indent))))                                    fortran-comment-line-extra-indent))))
1385               (setq fortran-minimum-statement-indent 0))               (setq fortran-minimum-statement-indent 0))
1386              ((or (looking-at (concat "[ \t]*"              ((or (looking-at (concat "[ \t]*"
1387                                       (regexp-quote                                       (regexp-quote
1388                                        fortran-continuation-string)))                                        fortran-continuation-string)))
1389                   (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]"))                   (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]"))
1390               (setq icol (+ icol fortran-continuation-indent)))               (skip-chars-forward " \t")
1391                 ;; Do not introduce extra whitespace into a broken string.
1392                 (setq icol
1393                       (if (fortran-is-in-string-p (point))
1394                           6
1395                         (+ icol fortran-continuation-indent))))
1396              (first-statement)              (first-statement)
1397              ((and fortran-check-all-num-for-matching-do              ((and fortran-check-all-num-for-matching-do
1398                    (looking-at "[ \t]*[0-9]+")                    (looking-at "[ \t]*[0-9]+")
# Line 1639  If ALL is nil, only match comments that Line 1646  If ALL is nil, only match comments that
1646           (quote           (quote
1647            (save-excursion            (save-excursion
1648              (goto-char bol)              (goto-char bol)
1649              (if (looking-at fortran-comment-line-start-skip)              ;; OK to break quotes on comment lines.
1650                  nil                     ; OK to break quotes on comment lines.              (unless (looking-at fortran-comment-line-start-skip)
1651                  (let (fcpoint start)
1652                (move-to-column fill-column)                (move-to-column fill-column)
1653                (if (fortran-is-in-string-p (point))                (when (fortran-is-in-string-p (setq fcpoint (point)))
1654                    (save-excursion (re-search-backward "\\S\"\\s\"\\S\"" bol t)                  (save-excursion
1655                                    (if fortran-break-before-delimiters                    (re-search-backward "\\S\"\\s\"\\S\"" bol t)
1656                                        (point)                    (setq start
1657                                      (1+ (point))))))))                          (if fortran-break-before-delimiters
1658                                (point)
1659                              (1+ (point)))))
1660                    (if (re-search-forward "\\S\"\\s\"\\S\"" eol t)
1661                        (backward-char 2))
1662                    ;; If the current string is longer than 72 - 6 chars,
1663                    ;; break it at the fill column (else infinite loop).
1664                    (if (> (- (point) start)
1665                           (- fill-column 6 fortran-continuation-indent))
1666                        fcpoint
1667                      start))))))
1668           ;; decide where to split the line. If a position for a quoted           ;; decide where to split the line. If a position for a quoted
1669           ;; string was found above then use that, else break the line           ;; string was found above then use that, else break the line
1670           ;; before the last delimiter.           ;; before the last delimiter.
# Line 1660  If ALL is nil, only match comments that Line 1678  If ALL is nil, only match comments that
1678  ;;;              (if fortran-break-before-delimiters  ;;;              (if fortran-break-before-delimiters
1679  ;;;                  "^ \t\n,'+-/*=" "^ \t\n,'+-/*=)")  ;;;                  "^ \t\n,'+-/*=" "^ \t\n,'+-/*=)")
1680                   )                   )
1681                  (if (<= (point) (1+ bos))                  (when (<= (point) (1+ bos))
1682                      (progn                    (move-to-column (1+ fill-column))
1683                        (move-to-column (1+ fill-column))                    ;;what is this doing???
1684                        ;;what is this doing???                    (or (re-search-forward "[\t\n,'+-/*)=]" eol t)
1685                        (if (not (re-search-forward "[\t\n,'+-/*)=]" eol t))                        (goto-char bol)))
                           (goto-char bol))))  
1686                  (if (bolp)                  (if (bolp)
1687                      (re-search-forward "[ \t]" opoint t)                      (re-search-forward "[ \t]" opoint t)
1688                    (backward-char)                    (backward-char)

Legend:
Removed from v.1.102  
changed lines
  Added in v.1.103

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26