aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2002-04-24 22:06:03 +0000
committerGlenn Morris2002-04-24 22:06:03 +0000
commit6734e165bfd040282ed2882674ab26984e6aae25 (patch)
tree07cab0a9c3afb27b4758d0654b3531ccdac6c9eb
parent8cab3b9aae967fed0786c2c0fd62630530fa4ea1 (diff)
downloademacs-6734e165bfd040282ed2882674ab26984e6aae25.tar.gz
emacs-6734e165bfd040282ed2882674ab26984e6aae25.zip
(f90-get-beg-of-line): Removed and replaced with line-beginning-position.
(f90-get-end-of-line): Removed and replaced with line-end-position. (f90-current-indentation): current-column was superfluous, removed. (f90-match-piece): Removed and replaced with match-string. (f90-get-present-comment-type): Use match-string rather than buffer-substring. (f90-match-end): Use line-beginning-position, line-end-position rather than beginning-of-line, end-of-line.
-rw-r--r--lisp/progmodes/f90.el69
1 files changed, 29 insertions, 40 deletions
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index dd7fc86b3a5..a70e4e759c7 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -852,12 +852,6 @@ with no args, if that value is non-nil."
852 (setq f90-startup-message nil)) 852 (setq f90-startup-message nil))
853 853
854;; inline-functions 854;; inline-functions
855(defsubst f90-get-beg-of-line ()
856 (save-excursion (beginning-of-line) (point)))
857
858(defsubst f90-get-end-of-line ()
859 (save-excursion (end-of-line) (point)))
860
861(defsubst f90-in-string () 855(defsubst f90-in-string ()
862 (let ((beg-pnt 856 (let ((beg-pnt
863 (if (and f90-cache-position (> (point) f90-cache-position)) 857 (if (and f90-cache-position (> (point) f90-cache-position))
@@ -874,9 +868,9 @@ with no args, if that value is non-nil."
874 868
875(defsubst f90-line-continued () 869(defsubst f90-line-continued ()
876 (save-excursion 870 (save-excursion
877 (beginning-of-line) 871 (beginning-of-line)
878 (while (and (looking-at "[ \t]*\\(!\\|$\\)") (zerop (forward-line -1)))) 872 (while (and (looking-at "[ \t]*\\(!\\|$\\)") (zerop (forward-line -1))))
879 (let ((bol (f90-get-beg-of-line))) 873 (let ((bol (line-beginning-position)))
880 (end-of-line) 874 (end-of-line)
881 (while (f90-in-comment) 875 (while (f90-in-comment)
882 (search-backward "!" bol) 876 (search-backward "!" bol)
@@ -888,8 +882,7 @@ with no args, if that value is non-nil."
888 "Return indentation of current line. 882 "Return indentation of current line.
889Line-numbers are considered whitespace characters." 883Line-numbers are considered whitespace characters."
890 (save-excursion 884 (save-excursion
891 (beginning-of-line) (skip-chars-forward " \t0-9") 885 (beginning-of-line) (skip-chars-forward " \t0-9")))
892 (current-column)))
893 886
894(defsubst f90-indent-to (col &optional no-line-number) 887(defsubst f90-indent-to (col &optional no-line-number)
895 "Indent current line to column COL. 888 "Indent current line to column COL.
@@ -902,20 +895,16 @@ If no-line-number nil, jump over a possible line-number."
902 (indent-to col) 895 (indent-to col)
903 (indent-to col 1))) 896 (indent-to col 1)))
904 897
905(defsubst f90-match-piece (arg)
906 (if (match-beginning arg)
907 (buffer-substring (match-beginning arg) (match-end arg))))
908
909(defsubst f90-get-present-comment-type () 898(defsubst f90-get-present-comment-type ()
910 (save-excursion 899 (save-excursion
911 (let ((type nil) (eol (f90-get-end-of-line))) 900 (let ((type nil) (eol (line-end-position)))
912 (if (f90-in-comment) 901 (if (f90-in-comment)
913 (progn 902 (progn
914 (beginning-of-line) 903 (beginning-of-line)
915 (re-search-forward "[!]+" eol) 904 (re-search-forward "[!]+" eol)
916 (while (f90-in-string) 905 (while (f90-in-string)
917 (re-search-forward "[!]+" eol)) 906 (re-search-forward "[!]+" eol))
918 (setq type (buffer-substring (match-beginning 0) (match-end 0))))) 907 (setq type (match-string 0))))
919 type))) 908 type)))
920 909
921(defsubst f90-equal-symbols (a b) 910(defsubst f90-equal-symbols (a b)
@@ -932,9 +921,9 @@ If no-line-number nil, jump over a possible line-number."
932Name is nil if the statement has no label." 921Name is nil if the statement has no label."
933 (if (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\\(do\\)\\>") 922 (if (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\\(do\\)\\>")
934 (let (label 923 (let (label
935 (struct (f90-match-piece 3))) 924 (struct (match-string 3)))
936 (if (looking-at "\\(\\sw+\\)[ \t]*\:") 925 (if (looking-at "\\(\\sw+\\)[ \t]*\:")
937 (setq label (f90-match-piece 1))) 926 (setq label (match-string 1)))
938 (list struct label)))) 927 (list struct label))))
939 928
940(defsubst f90-looking-at-select-case () 929(defsubst f90-looking-at-select-case ()
@@ -942,9 +931,9 @@ Name is nil if the statement has no label."
942Name is nil if the statement has no label." 931Name is nil if the statement has no label."
943 (if (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\\(select\\)[ \t]*case[ \t]*(") 932 (if (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\\(select\\)[ \t]*case[ \t]*(")
944 (let (label 933 (let (label
945 (struct (f90-match-piece 3))) 934 (struct (match-string 3)))
946 (if (looking-at "\\(\\sw+\\)[ \t]*\:") 935 (if (looking-at "\\(\\sw+\\)[ \t]*\:")
947 (setq label (f90-match-piece 1))) 936 (setq label (match-string 1)))
948 (list struct label)))) 937 (list struct label))))
949 938
950(defsubst f90-looking-at-if-then () 939(defsubst f90-looking-at-if-then ()
@@ -954,9 +943,9 @@ Name is nil if the statement has no label."
954 (let (struct (label nil)) 943 (let (struct (label nil))
955 (if (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\\(if\\)\\>") 944 (if (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\\(if\\)\\>")
956 (progn 945 (progn
957 (setq struct (f90-match-piece 3)) 946 (setq struct (match-string 3))
958 (if (looking-at "\\(\\sw+\\)[ \t]*\:") 947 (if (looking-at "\\(\\sw+\\)[ \t]*\:")
959 (setq label (f90-match-piece 1))) 948 (setq label (match-string 1)))
960 (let ((pos (scan-lists (point) 1 0))) 949 (let ((pos (scan-lists (point) 1 0)))
961 (and pos (goto-char pos))) 950 (and pos (goto-char pos)))
962 (skip-chars-forward " \t") 951 (skip-chars-forward " \t")
@@ -973,9 +962,9 @@ Name is nil if the statement has no label."
973Name is nil if the statement has no label." 962Name is nil if the statement has no label."
974 (if (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\\(where\\|forall\\)[ \t]*(.*)[ \t]*\\(!\\|$\\)") 963 (if (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\\(where\\|forall\\)[ \t]*(.*)[ \t]*\\(!\\|$\\)")
975 (let (label 964 (let (label
976 (struct (f90-match-piece 3))) 965 (struct (match-string 3)))
977 (if (looking-at "\\(\\sw+\\)[ \t]*\:") 966 (if (looking-at "\\(\\sw+\\)[ \t]*\:")
978 (setq label (f90-match-piece 1))) 967 (setq label (match-string 1)))
979 (list struct label)))) 968 (list struct label))))
980 969
981(defsubst f90-looking-at-type-like () 970(defsubst f90-looking-at-type-like ()
@@ -983,27 +972,27 @@ Name is nil if the statement has no label."
983Name is non-nil only for type." 972Name is non-nil only for type."
984 (cond 973 (cond
985 ((looking-at f90-type-def-re) 974 ((looking-at f90-type-def-re)
986 (list (f90-match-piece 1) (f90-match-piece 4))) 975 (list (match-string 1) (match-string 4)))
987 ((looking-at "\\(interface\\|block[\t]*data\\)\\>") 976 ((looking-at "\\(interface\\|block[\t]*data\\)\\>")
988 (list (f90-match-piece 1) nil)))) 977 (list (match-string 1) nil))))
989 978
990(defsubst f90-looking-at-program-block-start () 979(defsubst f90-looking-at-program-block-start ()
991 "Return (kind name) if a program block with name name starts after point." 980 "Return (kind name) if a program block with name name starts after point."
992 (cond 981 (cond
993 ((looking-at "\\(program\\)[ \t]+\\(\\sw+\\)\\>") 982 ((looking-at "\\(program\\)[ \t]+\\(\\sw+\\)\\>")
994 (list (f90-match-piece 1) (f90-match-piece 2))) 983 (list (match-string 1) (match-string 2)))
995 ((and (not (looking-at "module[ \t]*procedure\\>")) 984 ((and (not (looking-at "module[ \t]*procedure\\>"))
996 (looking-at "\\(module\\)[ \t]+\\(\\sw+\\)\\>")) 985 (looking-at "\\(module\\)[ \t]+\\(\\sw+\\)\\>"))
997 (list (f90-match-piece 1) (f90-match-piece 2))) 986 (list (match-string 1) (match-string 2)))
998 ((and (not (looking-at "end[ \t]*\\(function\\|subroutine\\)")) 987 ((and (not (looking-at "end[ \t]*\\(function\\|subroutine\\)"))
999 (looking-at "[^!'\"\&\n]*\\(function\\|subroutine\\)[ \t]+\\(\\sw+\\)")) 988 (looking-at "[^!'\"\&\n]*\\(function\\|subroutine\\)[ \t]+\\(\\sw+\\)"))
1000 (list (f90-match-piece 1) (f90-match-piece 2))))) 989 (list (match-string 1) (match-string 2)))))
1001 990
1002(defsubst f90-looking-at-program-block-end () 991(defsubst f90-looking-at-program-block-end ()
1003 "Return list of type and name of end of block." 992 "Return list of type and name of end of block."
1004 (if (looking-at (concat "end[ \t]*" f90-blocks-re 993 (if (looking-at (concat "end[ \t]*" f90-blocks-re
1005 "?\\([ \t]+\\(\\sw+\\)\\)?\\>")) 994 "?\\([ \t]+\\(\\sw+\\)\\)?\\>"))
1006 (list (f90-match-piece 1) (f90-match-piece 3)))) 995 (list (match-string 1) (match-string 3))))
1007 996
1008(defsubst f90-comment-indent () 997(defsubst f90-comment-indent ()
1009 (cond ((looking-at "!!!") 0) 998 (cond ((looking-at "!!!") 0)
@@ -1040,7 +1029,7 @@ Name is non-nil only for type."
1040 (skip-chars-forward " \t0-9")) 1029 (skip-chars-forward " \t0-9"))
1041 1030
1042(defsubst f90-no-block-limit () 1031(defsubst f90-no-block-limit ()
1043 (let ((eol (f90-get-end-of-line))) 1032 (let ((eol (line-end-position)))
1044 (save-excursion 1033 (save-excursion
1045 (not (or (looking-at "end") 1034 (not (or (looking-at "end")
1046 (looking-at "\\(do\\|if\\|else\\(if\\|where\\)?\ 1035 (looking-at "\\(do\\|if\\|else\\(if\\|where\\)?\
@@ -1054,8 +1043,8 @@ block[ \t]*data\\)\\>")
1054(defsubst f90-update-line () 1043(defsubst f90-update-line ()
1055 (let (bol eol) 1044 (let (bol eol)
1056 (if f90-auto-keyword-case 1045 (if f90-auto-keyword-case
1057 (progn (setq bol (f90-get-beg-of-line) 1046 (progn (setq bol (line-beginning-position)
1058 eol (f90-get-end-of-line)) 1047 eol (line-end-position))
1059 (if f90-auto-keyword-case 1048 (if f90-auto-keyword-case
1060 (f90-change-keywords f90-auto-keyword-case bol eol)))))) 1049 (f90-change-keywords f90-auto-keyword-case bol eol))))))
1061 1050
@@ -1069,7 +1058,7 @@ block[ \t]*data\\)\\>")
1069(defun f90-get-correct-indent () 1058(defun f90-get-correct-indent ()
1070 "Get correct indent for a line starting with line number. 1059 "Get correct indent for a line starting with line number.
1071Does not check type and subprogram indentation." 1060Does not check type and subprogram indentation."
1072 (let ((epnt (f90-get-end-of-line)) icol cont) 1061 (let ((epnt (line-end-position)) icol cont)
1073 (save-excursion 1062 (save-excursion
1074 (while (and (f90-previous-statement) 1063 (while (and (f90-previous-statement)
1075 (or (progn 1064 (or (progn
@@ -1079,7 +1068,7 @@ Does not check type and subprogram indentation."
1079 (setq icol (current-indentation)) 1068 (setq icol (current-indentation))
1080 (beginning-of-line) 1069 (beginning-of-line)
1081 (if (re-search-forward "\\(if\\|do\\|select\\|where\\|forall\\)" 1070 (if (re-search-forward "\\(if\\|do\\|select\\|where\\|forall\\)"
1082 (f90-get-end-of-line) t) 1071 (line-end-position) t)
1083 (progn 1072 (progn
1084 (beginning-of-line) (skip-chars-forward " \t") 1073 (beginning-of-line) (skip-chars-forward " \t")
1085 (cond ((f90-looking-at-do) 1074 (cond ((f90-looking-at-do)
@@ -1445,7 +1434,7 @@ If run in the middle of a line, the line is not broken."
1445 1434
1446(defun f90-find-breakpoint () 1435(defun f90-find-breakpoint ()
1447 "From fill-column, search backward for break-delimiter." 1436 "From fill-column, search backward for break-delimiter."
1448 (let ((bol (f90-get-beg-of-line))) 1437 (let ((bol (line-beginning-position)))
1449 (re-search-backward f90-break-delimiters bol) 1438 (re-search-backward f90-break-delimiters bol)
1450 (if f90-break-before-delimiters 1439 (if f90-break-before-delimiters
1451 (progn (backward-char) 1440 (progn (backward-char)
@@ -1523,7 +1512,7 @@ If run in the middle of a line, the line is not broken."
1523(defun f90-block-match (beg-block beg-name end-block end-name) 1512(defun f90-block-match (beg-block beg-name end-block end-name)
1524 "Match end-struct with beg-struct and complete end-block if possible. 1513 "Match end-struct with beg-struct and complete end-block if possible.
1525Leave point at the end of line." 1514Leave point at the end of line."
1526 (search-forward "end" (f90-get-end-of-line)) 1515 (search-forward "end" (line-end-position))
1527 (catch 'no-match 1516 (catch 'no-match
1528 (if (not (f90-equal-symbols beg-block end-block)) 1517 (if (not (f90-equal-symbols beg-block end-block))
1529 (if end-block 1518 (if end-block
@@ -1595,8 +1584,8 @@ Leave point at the end of line."
1595 (message "Matches %s: %s" 1584 (message "Matches %s: %s"
1596 (what-line) 1585 (what-line)
1597 (buffer-substring 1586 (buffer-substring
1598 (progn (beginning-of-line) (point)) 1587 (line-beginning-position)
1599 (progn (end-of-line) (point)))) 1588 (line-end-position)))
1600 (sit-for 1))) 1589 (sit-for 1)))
1601 (setq beg-block (car matching-beg)) 1590 (setq beg-block (car matching-beg))
1602 (setq beg-name (car (cdr matching-beg))) 1591 (setq beg-name (car (cdr matching-beg)))