aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2003-04-16 11:10:03 +0000
committerGlenn Morris2003-04-16 11:10:03 +0000
commit0a39a75cc43ff41c6d85cf1d9fbcb0784d80f9eb (patch)
tree7e6f9b349ec4ed5f0757c1897be340fcfce22090
parent748dd5a8afe96f03066ebba52509c9a1775c720d (diff)
downloademacs-0a39a75cc43ff41c6d85cf1d9fbcb0784d80f9eb.tar.gz
emacs-0a39a75cc43ff41c6d85cf1d9fbcb0784d80f9eb.zip
Comment changes.
(fortran-column-ruler): Minor doc change.
-rw-r--r--lisp/ChangeLog14
-rw-r--r--lisp/progmodes/fortran.el75
2 files changed, 50 insertions, 39 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3e5bb84a0cf..155c4751e00 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
12003-04-16 Glenn Morris <gmorris@ast.cam.ac.uk>
2
3 * progmodes/f90.el (f90-indent-to, f90-indent-line-no)
4 (f90-no-block-limit, f90-end-of-block, f90-beginning-of-block)
5 (f90-comment-region, f90-indent-line, f90-indent-region)
6 (f90-find-breakpoint, f90-block-match): Trivial simplifications.
7 (f90-looking-at-do, f90-looking-at-select-case)
8 (f90-looking-at-if-then, f90-looking-at-where-or-forall): Drop
9 XEmacs 19 support and simplify.
10 (f90-indent-new-line): No need for case-fold-search. Simplify.
11 (f90-fill-region): Make marker nil when done. Simplify.
12
13 * progmodes/fortran.el (fortran-column-ruler): Minor doc change.
14
12003-04-16 Richard M. Stallman <rms@gnu.org> 152003-04-16 Richard M. Stallman <rms@gnu.org>
2 16
3 * man.el (Man-follow-manual-reference): Don't require match 17 * man.el (Man-follow-manual-reference): Don't require match
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el
index e158304b416..654477c247e 100644
--- a/lisp/progmodes/fortran.el
+++ b/lisp/progmodes/fortran.el
@@ -700,8 +700,7 @@ the value of `comment-column' (leaving at least one space after code)."
700 (if (looking-at fortran-comment-line-start-skip) 0 700 (if (looking-at fortran-comment-line-start-skip) 0
701 (save-excursion 701 (save-excursion
702 (skip-chars-backward " \t") 702 (skip-chars-backward " \t")
703 (max (1+ (current-column)) 703 (max (1+ (current-column)) comment-column))))
704 comment-column))))
705 704
706(defun fortran-indent-comment () 705(defun fortran-indent-comment ()
707 "Align or create comment on current line. 706 "Align or create comment on current line.
@@ -754,14 +753,14 @@ With non-nil ARG, uncomments the region."
754 (goto-char beg-region) 753 (goto-char beg-region)
755 (beginning-of-line) 754 (beginning-of-line)
756 (if arg 755 (if arg
757 (let ((com (regexp-quote fortran-comment-region))) ;uncomment region 756 (let ((com (regexp-quote fortran-comment-region))) ; uncomment
758 (if (looking-at com) 757 (if (looking-at com)
759 (delete-region (point) (match-end 0))) 758 (delete-region (point) (match-end 0)))
760 (while (and (zerop (forward-line 1)) 759 (while (and (zerop (forward-line 1))
761 (< (point) end-region-mark)) 760 (< (point) end-region-mark))
762 (if (looking-at com) 761 (if (looking-at com)
763 (delete-region (point) (match-end 0))))) 762 (delete-region (point) (match-end 0)))))
764 (insert fortran-comment-region) ;comment the region 763 (insert fortran-comment-region) ; comment
765 (while (and (zerop (forward-line 1)) 764 (while (and (zerop (forward-line 1))
766 (< (point) end-region-mark)) 765 (< (point) end-region-mark))
767 (insert fortran-comment-region))) 766 (insert fortran-comment-region)))
@@ -777,7 +776,7 @@ Any other key combination is executed normally."
777 (let (c) 776 (let (c)
778 (insert last-command-char) 777 (insert last-command-char)
779 (if (and abbrev-mode 778 (if (and abbrev-mode
780 (or (eq (setq c (read-event)) ??) ;insert char if not equal to `?' 779 (or (eq (setq c (read-event)) ??) ; insert char if not `?'
781 (eq c help-char))) 780 (eq c help-char)))
782 (fortran-abbrev-help) 781 (fortran-abbrev-help)
783 (setq unread-command-events (list c))))) 782 (setq unread-command-events (list c)))))
@@ -802,9 +801,9 @@ Any other key combination is executed normally."
802 801
803(defun fortran-column-ruler () 802(defun fortran-column-ruler ()
804 "Insert a column ruler momentarily above current line, till next keystroke. 803 "Insert a column ruler momentarily above current line, till next keystroke.
805The ruler is defined by the value of `fortran-column-ruler-fixed' when in fixed 804The ruler is defined by the value of `fortran-column-ruler-fixed' in fixed
806format mode, and `fortran-column-ruler-tab' when in TAB format mode. 805format mode, and `fortran-column-ruler-tab' in TAB format mode.
807The key typed is executed unless it is SPC." 806The next key typed is executed unless it is SPC."
808 (interactive) 807 (interactive)
809 (momentary-string-display 808 (momentary-string-display
810 (if indent-tabs-mode 809 (if indent-tabs-mode
@@ -865,8 +864,8 @@ See also `fortran-window-create'."
865 (insert ?\n (match-string 0)) 864 (insert ?\n (match-string 0))
866 (if indent-tabs-mode 865 (if indent-tabs-mode
867 (insert ?\n ?\t (fortran-numerical-continuation-char)) 866 (insert ?\n ?\t (fortran-numerical-continuation-char))
868 (insert "\n " fortran-continuation-string))) ; Space after \n important 867 (insert "\n " fortran-continuation-string))) ; space after \n important
869 (fortran-indent-line)) ; when the cont string is C, c or *. 868 (fortran-indent-line)) ; when cont string is C, c or *
870 869
871(defun fortran-remove-continuation () 870(defun fortran-remove-continuation ()
872 "Delete any Fortran continuation characters at point. 871 "Delete any Fortran continuation characters at point.
@@ -936,7 +935,6 @@ Auto-indent does not happen if a numeric ARG is used."
936 (fortran-indent-line)))) 935 (fortran-indent-line))))
937 936
938 937
939
940(defun fortran-check-end-prog-re () 938(defun fortran-check-end-prog-re ()
941 "Check a preliminary match against `fortran-end-prog-re'." 939 "Check a preliminary match against `fortran-end-prog-re'."
942 ;; Having got a possible match for the subprogram end, we need a 940 ;; Having got a possible match for the subprogram end, we need a
@@ -1093,7 +1091,7 @@ Return point or nil."
1093 (let ((count 1)) 1091 (let ((count 1))
1094 (while (and (not (zerop count)) 1092 (while (and (not (zerop count))
1095 (not (eq (fortran-next-statement) 'last-statement)) 1093 (not (eq (fortran-next-statement) 'last-statement))
1096 ;; Keep local to subprogram 1094 ;; Keep local to subprogram.
1097 (not (and (looking-at fortran-end-prog-re) 1095 (not (and (looking-at fortran-end-prog-re)
1098 (fortran-check-end-prog-re)))) 1096 (fortran-check-end-prog-re))))
1099 (skip-chars-forward " \t0-9") 1097 (skip-chars-forward " \t0-9")
@@ -1122,7 +1120,7 @@ Return point or nil. Ignores labelled DO loops (ie DO 10 ... 10 CONTINUE)."
1122 (let ((count 1)) 1120 (let ((count 1))
1123 (while (and (not (zerop count)) 1121 (while (and (not (zerop count))
1124 (not (eq (fortran-previous-statement) 'first-statement)) 1122 (not (eq (fortran-previous-statement) 'first-statement))
1125 ;; Keep local to subprogram 1123 ;; Keep local to subprogram.
1126 (not (and (looking-at fortran-end-prog-re) 1124 (not (and (looking-at fortran-end-prog-re)
1127 (fortran-check-end-prog-re)))) 1125 (fortran-check-end-prog-re))))
1128 (skip-chars-forward " \t0-9") 1126 (skip-chars-forward " \t0-9")
@@ -1173,7 +1171,7 @@ Return point or nil."
1173 (save-excursion 1171 (save-excursion
1174 (if (or 1172 (if (or
1175 (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]") 1173 (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]")
1176 (let (then-test) ; Multi-line if-then. 1174 (let (then-test) ; multi-line if-then
1177 (while 1175 (while
1178 (and 1176 (and
1179 (zerop (forward-line 1)) 1177 (zerop (forward-line 1))
@@ -1232,7 +1230,7 @@ Return point or nil."
1232 (save-excursion 1230 (save-excursion
1233 (if (or 1231 (if (or
1234 (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]") 1232 (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]")
1235 (let (then-test) ; Multi-line if-then. 1233 (let (then-test) ; multi-line if-then
1236 (while 1234 (while
1237 (and 1235 (and
1238 (zerop (forward-line 1)) 1236 (zerop (forward-line 1))
@@ -1327,9 +1325,9 @@ Return point or nil."
1327 (skip-chars-forward " \t0-9") 1325 (skip-chars-forward " \t0-9")
1328 (cond ((looking-at "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?if[ \t]*(") 1326 (cond ((looking-at "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?if[ \t]*(")
1329 (if (or (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t_$(=a-z0-9]") 1327 (if (or (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t_$(=a-z0-9]")
1330 (let (then-test) ;multi-line if-then 1328 (let (then-test) ; multi-line if-then
1331 (while (and (zerop (forward-line 1)) 1329 (while (and (zerop (forward-line 1))
1332 ;;search forward for then 1330 ;; Search forward for then.
1333 (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]") 1331 (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")
1334 (not (setq then-test 1332 (not (setq then-test
1335 (looking-at 1333 (looking-at
@@ -1357,7 +1355,7 @@ Return point or nil."
1357 (setq icol (+ icol fortran-structure-indent))) 1355 (setq icol (+ icol fortran-structure-indent)))
1358 ((and (looking-at fortran-end-prog-re1) 1356 ((and (looking-at fortran-end-prog-re1)
1359 (fortran-check-end-prog-re)) 1357 (fortran-check-end-prog-re))
1360 ;; Previous END resets indent to minimum 1358 ;; Previous END resets indent to minimum.
1361 (setq icol fortran-minimum-statement-indent))))) 1359 (setq icol fortran-minimum-statement-indent)))))
1362 (save-excursion 1360 (save-excursion
1363 (beginning-of-line) 1361 (beginning-of-line)
@@ -1470,8 +1468,8 @@ notes: 1) A non-zero/non-blank character in column 5 indicates a continuation
1470 (insert ?\t (fortran-numerical-continuation-char) 1)) 1468 (insert ?\t (fortran-numerical-continuation-char) 1))
1471 (forward-char 6)) 1469 (forward-char 6))
1472 (delete-horizontal-space) 1470 (delete-horizontal-space)
1473 ;; Put line number in columns 0-4 1471 ;; Put line number in columns 0-4, or
1474 ;; or put continuation character in column 5. 1472 ;; continuation character in column 5.
1475 (cond ((eobp)) 1473 (cond ((eobp))
1476 ((looking-at (regexp-quote fortran-continuation-string)) 1474 ((looking-at (regexp-quote fortran-continuation-string))
1477 (if indent-tabs-mode 1475 (if indent-tabs-mode
@@ -1521,7 +1519,7 @@ Otherwise return nil."
1521 (beginning-of-line) 1519 (beginning-of-line)
1522 (when (looking-at "[ \t]*[0-9]+") 1520 (when (looking-at "[ \t]*[0-9]+")
1523 (skip-chars-forward " \t") 1521 (skip-chars-forward " \t")
1524 (skip-chars-forward "0") ;skip past leading zeros 1522 (skip-chars-forward "0") ; skip past leading zeros
1525 (setq charnum 1523 (setq charnum
1526 (buffer-substring (point) (progn 1524 (buffer-substring (point) (progn
1527 (skip-chars-forward "0-9") 1525 (skip-chars-forward "0-9")
@@ -1573,18 +1571,17 @@ If ALL is nil, only match comments that start in column > 0."
1573 ((save-excursion ; comment lines too 1571 ((save-excursion ; comment lines too
1574 (beginning-of-line) 1572 (beginning-of-line)
1575 (looking-at fortran-comment-line-start-skip)) nil) 1573 (looking-at fortran-comment-line-start-skip)) nil)
1576 (t (let (;; ok, serious now. Init some local vars: 1574 (t (let ((parse-state '(0 nil nil nil nil nil 0))
1577 (parse-state '(0 nil nil nil nil nil 0))
1578 (quoted-comment-start (if comment-start 1575 (quoted-comment-start (if comment-start
1579 (regexp-quote comment-start))) 1576 (regexp-quote comment-start)))
1580 (not-done t) 1577 (not-done t)
1581 parse-limit end-of-line) 1578 parse-limit end-of-line)
1582 ;; move to start of current statement 1579 ;; Move to start of current statement.
1583 (fortran-next-statement) 1580 (fortran-next-statement)
1584 (fortran-previous-statement) 1581 (fortran-previous-statement)
1585 ;; now parse up to WHERE 1582 ;; Now parse up to WHERE.
1586 (while not-done 1583 (while not-done
1587 (if (or ;; skip to next line if: 1584 (if (or ;; Skip to next line if:
1588 ;; - comment line? 1585 ;; - comment line?
1589 (looking-at fortran-comment-line-start-skip) 1586 (looking-at fortran-comment-line-start-skip)
1590 ;; - at end of line? 1587 ;; - at end of line?
@@ -1597,29 +1594,29 @@ If ALL is nil, only match comments that start in column > 0."
1597 (if (> (forward-line) 0) 1594 (if (> (forward-line) 0)
1598 (setq not-done nil)) 1595 (setq not-done nil))
1599 ;; else: 1596 ;; else:
1600 ;; if we are at beginning of code line, skip any 1597 ;; If we are at beginning of code line, skip any
1601 ;; whitespace, labels and tab continuation markers. 1598 ;; whitespace, labels and tab continuation markers.
1602 (if (bolp) (skip-chars-forward " \t0-9")) 1599 (if (bolp) (skip-chars-forward " \t0-9"))
1603 ;; if we are in column <= 5 now, check for continuation char 1600 ;; If we are in column <= 5 now, check for continuation char.
1604 (cond ((= 5 (current-column)) (forward-char 1)) 1601 (cond ((= 5 (current-column)) (forward-char 1))
1605 ((and (< (current-column) 5) 1602 ((and (< (current-column) 5)
1606 (equal fortran-continuation-string 1603 (equal fortran-continuation-string
1607 (char-to-string (following-char))) 1604 (char-to-string (following-char)))
1608 (forward-char 1)))) 1605 (forward-char 1))))
1609 ;; find out parse-limit from here 1606 ;; Find out parse-limit from here.
1610 (setq end-of-line (line-end-position)) 1607 (setq end-of-line (line-end-position))
1611 (setq parse-limit (min where end-of-line)) 1608 (setq parse-limit (min where end-of-line))
1612 ;; parse max up to comment-start, if non-nil and in current line 1609 ;; Parse max up to comment-start, if non-nil and in current line.
1613 (if comment-start 1610 (if comment-start
1614 (save-excursion 1611 (save-excursion
1615 (if (re-search-forward quoted-comment-start end-of-line t) 1612 (if (re-search-forward quoted-comment-start end-of-line t)
1616 (setq parse-limit (min (point) parse-limit))))) 1613 (setq parse-limit (min (point) parse-limit)))))
1617 ;; now parse if still in limits 1614 ;; Now parse if still in limits.
1618 (if (< (point) where) 1615 (if (< (point) where)
1619 (setq parse-state (parse-partial-sexp 1616 (setq parse-state (parse-partial-sexp
1620 (point) parse-limit nil nil parse-state)) 1617 (point) parse-limit nil nil parse-state))
1621 (setq not-done nil)))) 1618 (setq not-done nil))))
1622 ;; result is 1619 ;; Result.
1623 (nth 3 parse-state)))))) 1620 (nth 3 parse-state))))))
1624 1621
1625;; From old version. 1622;; From old version.
@@ -1670,7 +1667,7 @@ If ALL is nil, only match comments that start in column > 0."
1670 ) 1667 )
1671 (when (<= (point) (1+ bos)) 1668 (when (<= (point) (1+ bos))
1672 (move-to-column (1+ fill-column)) 1669 (move-to-column (1+ fill-column))
1673 ;;what is this doing??? 1670 ;; What is this doing???
1674 (or (re-search-forward "[\t\n,'+-/*)=]" eol t) 1671 (or (re-search-forward "[\t\n,'+-/*)=]" eol t)
1675 (goto-char bol))) 1672 (goto-char bol)))
1676 (if (bolp) 1673 (if (bolp)
@@ -1682,12 +1679,12 @@ If ALL is nil, only match comments that start in column > 0."
1682 (if fortran-break-before-delimiters 1679 (if fortran-break-before-delimiters
1683 (point) 1680 (point)
1684 (1+ (point))))))) 1681 (1+ (point)))))))
1685 ;; if we are in an in-line comment, don't break unless the 1682 ;; If we are in an in-line comment, don't break unless the
1686 ;; line of code is longer than it should be. Otherwise 1683 ;; line of code is longer than it should be. Otherwise
1687 ;; break the line at the column computed above. 1684 ;; break the line at the column computed above.
1688 ;; 1685 ;;
1689 ;; Need to use fortran-find-comment-start-skip to make sure that quoted !'s 1686 ;; Need to use fortran-find-comment-start-skip to make sure that
1690 ;; don't prevent a break. 1687 ;; quoted !'s don't prevent a break.
1691 (when (and (save-excursion 1688 (when (and (save-excursion
1692 (beginning-of-line) 1689 (beginning-of-line)
1693 (if (not (fortran-find-comment-start-skip)) 1690 (if (not (fortran-find-comment-start-skip))
@@ -1716,7 +1713,7 @@ If ALL is nil, only match comments that start in column > 0."
1716 (if (fortran-find-comment-start-skip) 1713 (if (fortran-find-comment-start-skip)
1717 (delete-and-extract-region 1714 (delete-and-extract-region
1718 (match-beginning 0) (line-end-position)))))) 1715 (match-beginning 0) (line-end-position))))))
1719 ;; Forward line 1 really needs to go to next non white line 1716 ;; Forward line 1 really needs to go to next non white line.
1720 (if (save-excursion (forward-line) 1717 (if (save-excursion (forward-line)
1721 (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")) 1718 (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]"))
1722 (progn 1719 (progn
@@ -1806,7 +1803,7 @@ Supplying prefix arg DO-SPACE prevents stripping the whitespace."
1806 ;; We must be inside function body for this to work. 1803 ;; We must be inside function body for this to work.
1807 (fortran-beginning-of-subprogram) 1804 (fortran-beginning-of-subprogram)
1808 (let ((case-fold-search t)) ; case-insensitive 1805 (let ((case-fold-search t)) ; case-insensitive
1809 ;; search for fortran subprogram start 1806 ;; Search for fortran subprogram start.
1810 (if (re-search-forward 1807 (if (re-search-forward
1811 (concat "^[ \t]*\\(program\\|subroutine\\|function" 1808 (concat "^[ \t]*\\(program\\|subroutine\\|function"
1812 "\\|[ \ta-z0-9*()]*[ \t]+function\\|" 1809 "\\|[ \ta-z0-9*()]*[ \t]+function\\|"
@@ -1816,7 +1813,7 @@ Supplying prefix arg DO-SPACE prevents stripping the whitespace."
1816 t) 1813 t)
1817 (or (match-string-no-properties 2) 1814 (or (match-string-no-properties 2)
1818 (progn 1815 (progn
1819 ;; move to EOL or before first left paren 1816 ;; Move to EOL or before first left paren.
1820 (if (re-search-forward "[(\n]" nil t) 1817 (if (re-search-forward "[(\n]" nil t)
1821 (progn (backward-char) 1818 (progn (backward-char)
1822 (skip-chars-backward " \t")) 1819 (skip-chars-backward " \t"))