[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/progmodes/f90.el
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/progmodes/f90.el |
Date: |
Mon, 29 Apr 2002 18:55:10 -0400 |
Index: emacs/lisp/progmodes/f90.el
diff -c emacs/lisp/progmodes/f90.el:1.42 emacs/lisp/progmodes/f90.el:1.43
*** emacs/lisp/progmodes/f90.el:1.42 Sun Apr 28 19:36:08 2002
--- emacs/lisp/progmodes/f90.el Mon Apr 29 18:55:10 2002
***************
*** 396,403 ****
(defvar f90-mode-syntax-table nil
"Syntax table in use in F90 mode buffers.")
! (if f90-mode-syntax-table
! ()
(setq f90-mode-syntax-table (make-syntax-table))
(modify-syntax-entry ?\! "<" f90-mode-syntax-table) ; beg. comment
(modify-syntax-entry ?\n ">" f90-mode-syntax-table) ; end comment
--- 396,402 ----
(defvar f90-mode-syntax-table nil
"Syntax table in use in F90 mode buffers.")
! (unless f90-mode-syntax-table
(setq f90-mode-syntax-table (make-syntax-table))
(modify-syntax-entry ?\! "<" f90-mode-syntax-table) ; beg. comment
(modify-syntax-entry ?\n ">" f90-mode-syntax-table) ; end comment
***************
*** 417,424 ****
(defvar f90-mode-map ()
"Keymap used in F90 mode.")
! (if f90-mode-map
! ()
(setq f90-mode-map (make-sparse-keymap))
(define-key f90-mode-map "`" 'f90-abbrev-start)
(define-key f90-mode-map "\C-c;" 'f90-comment-region)
--- 416,422 ----
(defvar f90-mode-map ()
"Keymap used in F90 mode.")
! (unless f90-mode-map
(setq f90-mode-map (make-sparse-keymap))
(define-key f90-mode-map "`" 'f90-abbrev-start)
(define-key f90-mode-map "\C-c;" 'f90-comment-region)
***************
*** 680,687 ****
;; abbrevs have generally two letters, except standard types `c, `i, `r, `t
(defvar f90-mode-abbrev-table nil)
! (if f90-mode-abbrev-table
! ()
(let ((ac abbrevs-changed))
(define-abbrev-table 'f90-mode-abbrev-table ())
(define-abbrev f90-mode-abbrev-table "`al" "allocate" nil 0 t)
--- 678,684 ----
;; abbrevs have generally two letters, except standard types `c, `i, `r, `t
(defvar f90-mode-abbrev-table nil)
! (unless f90-mode-abbrev-table
(let ((ac abbrevs-changed))
(define-abbrev-table 'f90-mode-abbrev-table ())
(define-abbrev f90-mode-abbrev-table "`al" "allocate" nil 0 t)
***************
*** 854,859 ****
--- 851,859 ----
;; inline-functions
(defsubst f90-in-string ()
+ "Return non-nil if point is inside a string.
+ Checks from point-min, or f90-cache-position, if that is non-nil
+ and lies before point."
(let ((beg-pnt
(if (and f90-cache-position (> (point) f90-cache-position))
f90-cache-position
***************
*** 861,866 ****
--- 861,869 ----
(nth 3 (parse-partial-sexp beg-pnt (point)))))
(defsubst f90-in-comment ()
+ "Return non-nil if point is inside a comment.
+ Checks from point-min, or f90-cache-position, if that is non-nil
+ and lies before point."
(let ((beg-pnt
(if (and f90-cache-position (> (point) f90-cache-position))
f90-cache-position
***************
*** 868,873 ****
--- 871,879 ----
(nth 4 (parse-partial-sexp beg-pnt (point)))))
(defsubst f90-line-continued ()
+ "Return t if the current line is a continued one.
+ This includes comment lines embedded in continued lines, but
+ not the last line of a continued statement."
(save-excursion
(beginning-of-line)
(while (and (looking-at "[ \t]*\\(!\\|$\\)") (zerop (forward-line -1))))
***************
*** 887,902 ****
(defsubst f90-indent-to (col &optional no-line-number)
"Indent current line to column COL.
! If optional argument NO-LINE-NUMBER is nil, jump over a possible line-number."
(beginning-of-line)
(if (not no-line-number)
(skip-chars-forward " \t0-9"))
(delete-horizontal-space)
(if (zerop (current-column))
(indent-to col)
! (indent-to col 1)))
(defsubst f90-get-present-comment-type ()
(save-excursion
(let ((type nil) (eol (line-end-position)))
(when (f90-in-comment)
--- 893,911 ----
(defsubst f90-indent-to (col &optional no-line-number)
"Indent current line to column COL.
! If optional argument NO-LINE-NUMBER is nil, jump over a possible
! line-number before indenting."
(beginning-of-line)
(if (not no-line-number)
(skip-chars-forward " \t0-9"))
(delete-horizontal-space)
(if (zerop (current-column))
(indent-to col)
! (indent-to col 1))) ; leave >= 1 space after line number
(defsubst f90-get-present-comment-type ()
+ "If point lies within a comment, return the string starting the comment.
+ For example, \"!\" or \"!!\"."
(save-excursion
(let ((type nil) (eol (line-end-position)))
(when (f90-in-comment)
***************
*** 917,924 ****
;; expression. Therefore, the next 2 functions are longer than necessary.
(defsubst f90-looking-at-do ()
! "Return (\"do\" name) if a do statement starts after point.
! Name is nil if the statement has no label."
(if (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\\(do\\)\\>")
(let (label
(struct (match-string 3)))
--- 926,933 ----
;; expression. Therefore, the next 2 functions are longer than necessary.
(defsubst f90-looking-at-do ()
! "Return (\"do\" NAME) if a do statement starts after point.
! NAME is nil if the statement has no label."
(if (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\\(do\\)\\>")
(let (label
(struct (match-string 3)))
***************
*** 927,935 ****
(list struct label))))
(defsubst f90-looking-at-select-case ()
! "Return (\"select\" name) if a select-case statement starts after point.
! Name is nil if the statement has no label."
! (if (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\\(select\\)[ \t]*case[
\t]*(")
(let (label
(struct (match-string 3)))
(if (looking-at "\\(\\sw+\\)[ \t]*\:")
--- 936,945 ----
(list struct label))))
(defsubst f90-looking-at-select-case ()
! "Return (\"select\" NAME) if a select-case statement starts after point.
! NAME is nil if the statement has no label."
! (if (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\
! \\(select\\)[ \t]*case[ \t]*(")
(let (label
(struct (match-string 3)))
(if (looking-at "\\(\\sw+\\)[ \t]*\:")
***************
*** 937,944 ****
(list struct label))))
(defsubst f90-looking-at-if-then ()
! "Return (\"if\" name) if an if () then statement starts after point.
! Name is nil if the statement has no label."
(save-excursion
(let (struct (label nil))
(when (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\\(if\\)\\>")
--- 947,954 ----
(list struct label))))
(defsubst f90-looking-at-if-then ()
! "Return (\"if\" NAME) if an if () then statement starts after point.
! NAME is nil if the statement has no label."
(save-excursion
(let (struct (label nil))
(when (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\\(if\\)\\>")
***************
*** 956,964 ****
(list struct label))))))
(defsubst f90-looking-at-where-or-forall ()
! "Return (kind name) if a where or forall block starts after point.
! Name is nil if the statement has no label."
! (if (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\\(where\\|forall\\)[
\t]*(.*)[ \t]*\\(!\\|$\\)")
(let (label
(struct (match-string 3)))
(if (looking-at "\\(\\sw+\\)[ \t]*\:")
--- 966,975 ----
(list struct label))))))
(defsubst f90-looking-at-where-or-forall ()
! "Return (KIND NAME) if a where or forall block starts after point.
! NAME is nil if the statement has no label."
! (if (looking-at "\\(\\(\\sw+\\)[ \t]*\:\\)?[ \t]*\
! \\(where\\|forall\\)[ \t]*(.*)[ \t]*\\(!\\|$\\)")
(let (label
(struct (match-string 3)))
(if (looking-at "\\(\\sw+\\)[ \t]*\:")
***************
*** 966,973 ****
(list struct label))))
(defsubst f90-looking-at-type-like ()
! "Return (kind name) at the start of a type/interface/block-data block.
! Name is non-nil only for type."
(cond
((looking-at f90-type-def-re)
(list (match-string 1) (match-string 4)))
--- 977,984 ----
(list struct label))))
(defsubst f90-looking-at-type-like ()
! "Return (KIND NAME) if a type/interface/block-data block starts after point.
! NAME is non-nil only for type."
(cond
((looking-at f90-type-def-re)
(list (match-string 1) (match-string 4)))
***************
*** 975,981 ****
(list (match-string 1) nil))))
(defsubst f90-looking-at-program-block-start ()
! "Return (kind name) if a program block with name name starts after point."
(cond
((looking-at "\\(program\\)[ \t]+\\(\\sw+\\)\\>")
(list (match-string 1) (match-string 2)))
--- 986,992 ----
(list (match-string 1) nil))))
(defsubst f90-looking-at-program-block-start ()
! "Return (KIND NAME) if a program block with name NAME starts after point."
(cond
((looking-at "\\(program\\)[ \t]+\\(\\sw+\\)\\>")
(list (match-string 1) (match-string 2)))
***************
*** 983,993 ****
(looking-at "\\(module\\)[ \t]+\\(\\sw+\\)\\>"))
(list (match-string 1) (match-string 2)))
((and (not (looking-at "end[ \t]*\\(function\\|subroutine\\)"))
! (looking-at "[^!'\"\&\n]*\\(function\\|subroutine\\)[
\t]+\\(\\sw+\\)"))
(list (match-string 1) (match-string 2)))))
(defsubst f90-looking-at-program-block-end ()
! "Return list of type and name of end of block."
(if (looking-at (concat "end[ \t]*" f90-blocks-re
"?\\([ \t]+\\(\\sw+\\)\\)?\\>"))
(list (match-string 1) (match-string 3))))
--- 994,1005 ----
(looking-at "\\(module\\)[ \t]+\\(\\sw+\\)\\>"))
(list (match-string 1) (match-string 2)))
((and (not (looking-at "end[ \t]*\\(function\\|subroutine\\)"))
! (looking-at "[^!'\"\&\n]*\\(function\\|subroutine\\)\
! [ \t]+\\(\\sw+\\)"))
(list (match-string 1) (match-string 2)))))
(defsubst f90-looking-at-program-block-end ()
! "Return (KIND NAME) if a block with name NAME ends after point."
(if (looking-at (concat "end[ \t]*" f90-blocks-re
"?\\([ \t]+\\(\\sw+\\)\\)?\\>"))
(list (match-string 1) (match-string 3))))
***************
*** 1007,1013 ****
(max (if (bolp) 0 (1+ (current-column))) comment-column))))
(defsubst f90-present-statement-cont ()
! "Return continuation properties of present statement."
(let (pcont cont)
(save-excursion
(setq pcont (if (f90-previous-statement) (f90-line-continued) nil)))
--- 1019,1031 ----
(max (if (bolp) 0 (1+ (current-column))) comment-column))))
(defsubst f90-present-statement-cont ()
! "Return continuation properties of present statement.
! Possible return values are:
! single - statement is not continued.
! begin - current line is the first in a continued statement.
! end - current line is the last in a continued statement
! middle - current line is neither first nor last in a continued statement.
! Comment lines embedded amongst continued lines return 'middle."
(let (pcont cont)
(save-excursion
(setq pcont (if (f90-previous-statement) (f90-line-continued) nil)))
***************
*** 1019,1032 ****
(t (error)))))
(defsubst f90-indent-line-no ()
! (if f90-leave-line-no
! ()
! (if (and (not (zerop (skip-chars-forward " \t")))
! (looking-at "[0-9]"))
! (delete-horizontal-space)))
(skip-chars-forward " \t0-9"))
(defsubst f90-no-block-limit ()
(let ((eol (line-end-position)))
(save-excursion
(not (or (looking-at "end")
--- 1037,1053 ----
(t (error)))))
(defsubst f90-indent-line-no ()
! "If `f90-leave-line-no' is nil, left-justify a line number.
! Leaves point at the first non-blank character after the line number.
! Call from beginning of line."
! (if (and (null f90-leave-line-no) (looking-at "[ \t]+[0-9]"))
! (delete-horizontal-space))
(skip-chars-forward " \t0-9"))
(defsubst f90-no-block-limit ()
+ "Return nil if point is at the edge of a code block.
+ Searches line forward for \"function\" or \"subroutine\",
+ if all else fails."
(let ((eol (line-end-position)))
(save-excursion
(not (or (looking-at "end")
***************
*** 1039,1057 ****
(re-search-forward "\\(function\\|subroutine\\)" eol t))))))
(defsubst f90-update-line ()
! (let (bol eol)
! (when f90-auto-keyword-case
! (setq bol (line-beginning-position)
! eol (line-end-position))
! (if f90-auto-keyword-case
! (f90-change-keywords f90-auto-keyword-case bol eol)))))
(defun f90-electric-insert ()
! "Call `f90-do-auto-fill' at each operator insertion."
(interactive)
(self-insert-command 1)
! (f90-update-line)
! (if auto-fill-function (f90-do-auto-fill)))
(defun f90-get-correct-indent ()
"Get correct indent for a line starting with line number.
--- 1060,1077 ----
(re-search-forward "\\(function\\|subroutine\\)" eol t))))))
(defsubst f90-update-line ()
! "Change case of current line as per `f90-auto-keyword-case'."
! (if f90-auto-keyword-case
! (f90-change-keywords f90-auto-keyword-case
! (line-beginning-position) (line-end-position))))
(defun f90-electric-insert ()
! "Change keyword case and auto-fill line as operators are inserted."
(interactive)
(self-insert-command 1)
! (if auto-fill-function (f90-do-auto-fill) ; also updates line
! (f90-update-line)))
!
(defun f90-get-correct-indent ()
"Get correct indent for a line starting with line number.
***************
*** 1241,1248 ****
(defun f90-comment-region (beg-region end-region)
"Comment/uncomment every line in the region.
! Insert f90-comment-region at the beginning of every line in the region
! or, if already present, remove it."
(interactive "*r")
(let ((end (make-marker)))
(set-marker end end-region)
--- 1261,1268 ----
(defun f90-comment-region (beg-region end-region)
"Comment/uncomment every line in the region.
! Insert the variable `f90-comment-region' at the start of every line
! in the region, or, if already present, remove it."
(interactive "*r")
(let ((end (make-marker)))
(set-marker end end-region)
***************
*** 1281,1288 ****
;; position after the indentation. Else stay at same point in text.
(if (< (point) (marker-position pos))
(goto-char (marker-position pos)))
! (if (not no-update) (f90-update-line))
! (if auto-fill-function (f90-do-auto-fill))
(set-marker pos nil)))
(defun f90-indent-new-line ()
--- 1301,1309 ----
;; position after the indentation. Else stay at same point in text.
(if (< (point) (marker-position pos))
(goto-char (marker-position pos)))
! (if auto-fill-function
! (f90-do-auto-fill) ; also updates line
! (if (not no-update) (f90-update-line)))
(set-marker pos nil)))
(defun f90-indent-new-line ()
***************
*** 1351,1357 ****
(+ ind-curr f90-continuation-indent))))
(f90-indent-to (+ ind-curr f90-continuation-indent) 'no-line-no)))
;; process all following lines
! (while (and (zerop (forward-line 1)) (< (point) end-region-mark))
(beginning-of-line)
(f90-indent-line-no)
(setq f90-cache-position (point))
--- 1372,1378 ----
(+ ind-curr f90-continuation-indent))))
(f90-indent-to (+ ind-curr f90-continuation-indent) 'no-line-no)))
;; process all following lines
! (while (and (zerop (forward-line 1)) (< (point) end-region-mark))
(beginning-of-line)
(f90-indent-line-no)
(setq f90-cache-position (point))
***************
*** 1458,1464 ****
(forward-char)))))
(defun f90-do-auto-fill ()
! "Break line if non-white characters beyond `fill-column'. Also, update
line."
(interactive)
;; Break the line before or after the last delimiter (non-word char) if
;; position is beyond fill-column.
--- 1479,1486 ----
(forward-char)))))
(defun f90-do-auto-fill ()
! "Break line if non-white characters beyond `fill-column'.
! Update keyword case first."
(interactive)
;; Break the line before or after the last delimiter (non-word char) if
;; position is beyond fill-column.
***************
*** 1499,1505 ****
t))))
(defun f90-fill-region (beg-region end-region)
! "Fill every line in region by forward parsing. Join lines if possible."
(interactive "*r")
(let ((end-region-mark (make-marker))
(f90-smart-end nil) (f90-auto-keyword-case nil) (go-on t)
--- 1521,1527 ----
t))))
(defun f90-fill-region (beg-region end-region)
! "Fill every line in region by forward parsing. Join lines if possible."
(interactive "*r")
(let ((end-region-mark (make-marker))
(f90-smart-end nil) (f90-auto-keyword-case nil) (go-on t)
- [Emacs-diffs] Changes to emacs/lisp/progmodes/f90.el, Stefan Monnier, 2002/04/02
- [Emacs-diffs] Changes to emacs/lisp/progmodes/f90.el, Stefan Monnier, 2002/04/02
- [Emacs-diffs] Changes to emacs/lisp/progmodes/f90.el, Eli Zaretskii, 2002/04/19
- [Emacs-diffs] Changes to emacs/lisp/progmodes/f90.el, Glenn Morris, 2002/04/24
- [Emacs-diffs] Changes to emacs/lisp/progmodes/f90.el, Glenn Morris, 2002/04/24
- [Emacs-diffs] Changes to emacs/lisp/progmodes/f90.el, Glenn Morris, 2002/04/25
- [Emacs-diffs] Changes to emacs/lisp/progmodes/f90.el, Glenn Morris, 2002/04/28
- [Emacs-diffs] Changes to emacs/lisp/progmodes/f90.el, Glenn Morris, 2002/04/28
- [Emacs-diffs] Changes to emacs/lisp/progmodes/f90.el, Glenn Morris, 2002/04/28
- [Emacs-diffs] Changes to emacs/lisp/progmodes/f90.el, Glenn Morris, 2002/04/28
- [Emacs-diffs] Changes to emacs/lisp/progmodes/f90.el,
Glenn Morris <=
- [Emacs-diffs] Changes to emacs/lisp/progmodes/f90.el, Glenn Morris, 2002/04/29