470 |
["Indent Region" f90-indent-region mark-active] |
["Indent Region" f90-indent-region mark-active] |
471 |
["Fill Region" f90-fill-region mark-active] |
["Fill Region" f90-fill-region mark-active] |
472 |
"--" |
"--" |
473 |
["Break Line at Point" f90-break-line t] |
["Break Line at Point" f90-break-line t] |
474 |
["Join with Next Line" f90-join-lines t] |
["Join with Previous Line" f90-join-lines t] |
475 |
["Insert Block End" f90-insert-end t] |
["Insert Block End" f90-insert-end t] |
476 |
"--" |
"--" |
477 |
("Highlighting" |
("Highlighting" |
478 |
["Toggle font-lock-mode" font-lock-mode :selected font-lock-mode |
["Toggle font-lock-mode" font-lock-mode :selected font-lock-mode |
1534 |
(goto-char pos-mark) |
(goto-char pos-mark) |
1535 |
(set-marker pos-mark nil))))) |
(set-marker pos-mark nil))))) |
1536 |
|
|
1537 |
|
(defun f90-join-lines (&optional arg) |
1538 |
(defun f90-join-lines () |
"Join current line to previous, fix whitespace, continuation, comments. |
1539 |
"Join present line with next line, if this line ends with \&." |
With an argument, join current line to following line. |
1540 |
(interactive) |
Like `join-line', but handles F90 syntax." |
1541 |
(let (pos (oldpos (point))) |
(interactive "*P") |
1542 |
(end-of-line) |
(beginning-of-line) |
1543 |
|
(if arg (forward-line 1)) |
1544 |
|
(when (eq (preceding-char) ?\n) |
1545 |
|
(skip-chars-forward " \t") |
1546 |
|
(if (looking-at "\&") (delete-char 1)) |
1547 |
|
(beginning-of-line) |
1548 |
|
(delete-region (point) (1- (point))) |
1549 |
(skip-chars-backward " \t") |
(skip-chars-backward " \t") |
1550 |
(when (= (preceding-char) ?&) |
(and (eq (preceding-char) ?&) (delete-char -1)) |
1551 |
(delete-char -1) |
(and (f90-in-comment) |
1552 |
(setq pos (point)) |
(looking-at "[ \t]*!+") |
1553 |
(forward-line 1) |
(replace-match "")) |
1554 |
(skip-chars-forward " \t") |
(or (f90-in-string) |
1555 |
(if (looking-at "\&") (delete-char 1)) |
(fixup-whitespace)))) |
|
(delete-region pos (point)) |
|
|
(unless (f90-in-string) |
|
|
(delete-horizontal-space) |
|
|
(insert " ")) |
|
|
(if (and auto-fill-function |
|
|
(> (line-end-position) fill-column)) |
|
|
(f90-do-auto-fill)) |
|
|
(goto-char oldpos) |
|
|
t))) ; return t if joined something |
|
1556 |
|
|
1557 |
(defun f90-fill-region (beg-region end-region) |
(defun f90-fill-region (beg-region end-region) |
1558 |
"Fill every line in region by forward parsing. Join lines if possible." |
"Fill every line in region by forward parsing. Join lines if possible." |
1564 |
(goto-char beg-region) |
(goto-char beg-region) |
1565 |
(while go-on |
(while go-on |
1566 |
;; Join as much as possible. |
;; Join as much as possible. |
1567 |
(while (f90-join-lines)) |
(while (progn |
1568 |
|
(end-of-line) |
1569 |
|
(skip-chars-backward " \t") |
1570 |
|
(eq (preceding-char) ?&)) |
1571 |
|
(f90-join-lines 'forward)) |
1572 |
;; Chop the line if necessary. |
;; Chop the line if necessary. |
1573 |
(while (> (save-excursion (end-of-line) (current-column)) |
(while (> (save-excursion (end-of-line) (current-column)) |
1574 |
fill-column) |
fill-column) |