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

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

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

revision 1.30.14.1 by fx, Tue Dec 18 15:19:04 2001 UTC revision 1.30.14.2 by gm, Mon May 27 21:07:49 2002 UTC
# Line 3  Line 3 
3  ;; Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.  ;; Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
4    
5  ;; Author: Torbj\"orn Einarsson <Torbjorn.Einarsson@era.ericsson.se>  ;; Author: Torbj\"orn Einarsson <Torbjorn.Einarsson@era.ericsson.se>
6  ;; Maintainer: Dave Love <fx@gnu.org>  ;; Maintainer: Glenn Morris <gmorris@ast.cam.ac.uk>
7  ;; Keywords: fortran, f90, languages  ;; Keywords: fortran, f90, languages
8    
9  ;; This file is part of GNU Emacs.  ;; This file is part of GNU Emacs.
# Line 89  Line 89 
89  ;;                        f90-smart-end 'blink  ;;                        f90-smart-end 'blink
90  ;;                        f90-auto-keyword-case nil  ;;                        f90-auto-keyword-case nil
91  ;;                        f90-leave-line-no  nil  ;;                        f90-leave-line-no  nil
 ;;                        f90-startup-message t  
92  ;;                        indent-tabs-mode nil  ;;                        indent-tabs-mode nil
93  ;;                        f90-font-lock-keywords f90-font-lock-keywords-2  ;;                        f90-font-lock-keywords f90-font-lock-keywords-2
94  ;;                  )  ;;                  )
# Line 230  whether to blink the matching beginning. Line 229  whether to blink the matching beginning.
229    :type 'boolean    :type 'boolean
230    :group 'f90)    :group 'f90)
231    
 (defcustom f90-startup-message t  
   "*Non-nil displays a startup message when F90 mode is first called."  
   :type 'boolean  
   :group 'f90)  
   
232  (defconst f90-keywords-re  (defconst f90-keywords-re
233    ;;("allocate" "allocatable" "assign" "assignment" "backspace" "block"    ;;("allocate" "allocatable" "assign" "assignment" "backspace" "block"
234    ;;"call" "case" "character" "close" "common" "complex" "contains"    ;;"call" "case" "character" "close" "common" "complex" "contains"
# Line 364  whether to blink the matching beginning. Line 358  whether to blink the matching beginning.
358    
359  (defvar f90-font-lock-keywords-1  (defvar f90-font-lock-keywords-1
360    (list    (list
361       ;; Special highlighting of "module procedure foo-list"
362       '("\\<\\(module[ \t]*procedure\\)\\>" (1 font-lock-keyword-face))
363     '("\\<\\(end[ \t]*\\(program\\|module\\|function\\|subroutine\\|type\\)\\)\\>[ \t]*\\(\\sw+\\)?"     '("\\<\\(end[ \t]*\\(program\\|module\\|function\\|subroutine\\|type\\)\\)\\>[ \t]*\\(\\sw+\\)?"
364       (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t))       (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t))
365     '("\\<\\(program\\|call\\|module\\|subroutine\\|function\\|use\\)\\>[ \t]*\\(\\sw+\\)?"     '("\\<\\(program\\|type\\|call\\|module\\|subroutine\\|function\\|use\\)\\>[ \t]*\\(\\sw+\\)?"
366       (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))       (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))
    ;; Special highlighting of "module procedure foo-list"  
    '("\\<\\(module[ \t]*procedure\\)\\>" (1 font-lock-keyword-face t))  
367     ;; Highlight definition of new type     ;; Highlight definition of new type
368     '("\\<\\(type\\)[ \t]*\\(.*::[ \t]*\\|[ \t]+\\)\\(\\sw+\\)"  ;;;   '("\\<\\(type\\)[ \t]*\\(.*::[ \t]*\\|[ \t]+\\)\\(\\sw+\\)"
369       (1 font-lock-keyword-face) (3 font-lock-function-name-face))  ;;;     (1 font-lock-keyword-face) (3 font-lock-function-name-face))
370     "\\<\\(\\(end[ \t]*\\)?\\(interface\\|block[ \t]*data\\)\\|contains\\)\\>")     "\\<\\(\\(end[ \t]*\\)?\\(interface\\|block[ \t]*data\\)\\|contains\\)\\>")
371    "This does fairly subdued highlighting of comments and function calls.")    "This does fairly subdued highlighting of comments and function calls.")
372    
# Line 381  whether to blink the matching beginning. Line 375  whether to blink the matching beginning.
375        (list        (list
376         ;; Variable declarations (avoid the real function call)         ;; Variable declarations (avoid the real function call)
377         '("^[ \t0-9]*\\(real\\|integer\\|c\\(haracter\\|omplex\\)\\|logical\\|type[ \t]*(\\sw+)\\)\\(.*::\\|[ \t]*(.*)\\)?\\([^!\n]*\\)"         '("^[ \t0-9]*\\(real\\|integer\\|c\\(haracter\\|omplex\\)\\|logical\\|type[ \t]*(\\sw+)\\)\\(.*::\\|[ \t]*(.*)\\)?\\([^!\n]*\\)"
378           (1 font-lock-type-face) (4 font-lock-variable-name-face))           (1 font-lock-type-face t) (4 font-lock-variable-name-face))
379         ;; do, if, select, where, and forall constructs         ;; do, if, select, where, and forall constructs
380         '("\\<\\(end[ \t]*\\(do\\|if\\|select\\|forall\\|where\\)\\)\\>\\([ \t]+\\(\\sw+\\)\\)?"         '("\\<\\(end[ \t]*\\(do\\|if\\|select\\|forall\\|where\\)\\)\\>\\([ \t]+\\(\\sw+\\)\\)?"
381           (1 font-lock-keyword-face) (3 font-lock-constant-face nil t))           (1 font-lock-keyword-face) (3 font-lock-constant-face nil t))
# Line 406  whether to blink the matching beginning. Line 400  whether to blink the matching beginning.
400     (list     (list
401      f90-keywords-level-3-re      f90-keywords-level-3-re
402      f90-operators-re      f90-operators-re
403      (list f90-procedures-re '(1 font-lock-keyword-face t))      (list f90-procedures-re '(1 font-lock-keyword-face keep))
404     "\\<real\\>"                 ; Avoid overwriting real defs.     "\\<real\\>"                 ; Avoid overwriting real defs.
405     ))     ))
406    "Highlights all F90 keywords and intrinsic procedures.")    "Highlights all F90 keywords and intrinsic procedures.")
# Line 830  Variables controlling indentation style Line 824  Variables controlling indentation style
824      The possibilities are 'downcase-word, 'upcase-word, 'capitalize-word.      The possibilities are 'downcase-word, 'upcase-word, 'capitalize-word.
825   f90-leave-line-no   f90-leave-line-no
826      Do not left-justify line numbers. (default nil)      Do not left-justify line numbers. (default nil)
  f90-startup-message  
     Set to nil to inhibit message first time F90 mode is used. (default t)  
827   f90-keywords-re   f90-keywords-re
828      List of keywords used for highlighting/upcase-keywords etc.      List of keywords used for highlighting/upcase-keywords etc.
829    
# Line 885  with no args, if that value is non-nil." Line 877  with no args, if that value is non-nil."
877    (setq imenu-generic-expression f90-imenu-generic-expression)    (setq imenu-generic-expression f90-imenu-generic-expression)
878    (set (make-local-variable 'add-log-current-defun-function)    (set (make-local-variable 'add-log-current-defun-function)
879         #'f90-current-defun)         #'f90-current-defun)
880    (run-hooks 'f90-mode-hook)    (run-hooks 'f90-mode-hook))
 ;;   (if f90-startup-message  
 ;;       (message "Emacs F90 mode; please report bugs to %s" bug-f90-mode))  
   (setq f90-startup-message nil))  
881    
882  ;; inline-functions  ;; inline-functions
883  (defsubst f90-get-beg-of-line ()  (defsubst f90-get-beg-of-line ()
# Line 913  with no args, if that value is non-nil." Line 902  with no args, if that value is non-nil."
902    
903  (defsubst f90-line-continued ()  (defsubst f90-line-continued ()
904    (save-excursion    (save-excursion
905        (beginning-of-line)
906        (while (and (looking-at "[ \t]*\\(!\\|$\\)") (zerop (forward-line -1))))
907      (let ((bol (f90-get-beg-of-line)))      (let ((bol (f90-get-beg-of-line)))
908        (end-of-line)        (end-of-line)
909        (while (f90-in-comment)        (while (f90-in-comment)
# Line 1033  Name is non-nil only for type." Line 1024  Name is non-nil only for type."
1024           (looking-at "\\(module\\)[ \t]+\\(\\sw+\\)\\>"))           (looking-at "\\(module\\)[ \t]+\\(\\sw+\\)\\>"))
1025      (list (f90-match-piece 1) (f90-match-piece 2)))      (list (f90-match-piece 1) (f90-match-piece 2)))
1026     ((and (not (looking-at "end[ \t]*\\(function\\|subroutine\\)"))     ((and (not (looking-at "end[ \t]*\\(function\\|subroutine\\)"))
1027           (looking-at "[^!\"\&\n]*\\(function\\|subroutine\\)[ \t]+\\(\\sw+\\)"))           (looking-at "[^!'\"\&\n]*\\(function\\|subroutine\\)[ \t]+\\(\\sw+\\)"))
1028      (list (f90-match-piece 1) (f90-match-piece 2)))))      (list (f90-match-piece 1) (f90-match-piece 2)))))
1029    
1030  (defsubst f90-looking-at-program-block-end ()  (defsubst f90-looking-at-program-block-end ()
# Line 1331  If run in the middle of a line, the line Line 1322  If run in the middle of a line, the line
1322      (if abbrev-mode (expand-abbrev))      (if abbrev-mode (expand-abbrev))
1323      (beginning-of-line)                 ; Reindent where likely to be needed.      (beginning-of-line)                 ; Reindent where likely to be needed.
1324      (f90-indent-line-no)      (f90-indent-line-no)
1325      (if (or (looking-at "\\(end\\|else\\|!\\)"))      (f90-indent-line 'no-update)
         (f90-indent-line 'no-update))  
1326      (end-of-line)      (end-of-line)
1327      (delete-horizontal-space)           ;Destroy trailing whitespace      (delete-horizontal-space)           ;Destroy trailing whitespace
1328      (setq string (f90-in-string))      (setq string (f90-in-string))
# Line 1384  If run in the middle of a line, the line Line 1374  If run in the middle of a line, the line
1374      (if struct (setq block-list (cons struct block-list)))      (if struct (setq block-list (cons struct block-list)))
1375      (while (and (f90-line-continued) (zerop (forward-line 1))      (while (and (f90-line-continued) (zerop (forward-line 1))
1376                  (< (point) end-region-mark))                  (< (point) end-region-mark))
1377        (if (not (zerop (- (current-indentation)        (if (looking-at "[ \t]*!")
1378                           (+ ind-curr f90-continuation-indent))))            (f90-indent-to (f90-comment-indent))
1379            (f90-indent-to (+ ind-curr f90-continuation-indent) 'no-line-no)))          (if (not (zerop (- (current-indentation)
1380                               (+ ind-curr f90-continuation-indent))))
1381                (f90-indent-to (+ ind-curr f90-continuation-indent) 'no-line-no))))
1382      ;; process all following lines      ;; process all following lines
1383      (while (and  (zerop (forward-line 1)) (< (point) end-region-mark))      (while (and  (zerop (forward-line 1)) (< (point) end-region-mark))
1384        (beginning-of-line)        (beginning-of-line)
# Line 1434  If run in the middle of a line, the line Line 1426  If run in the middle of a line, the line
1426            (f90-indent-to ind-curr))            (f90-indent-to ind-curr))
1427        (while (and (f90-line-continued) (zerop (forward-line 1))        (while (and (f90-line-continued) (zerop (forward-line 1))
1428                    (< (point) end-region-mark))                    (< (point) end-region-mark))
1429          (if (not (zerop (- (current-indentation)          (if (looking-at "[ \t]*!")
1430                             (+ ind-curr f90-continuation-indent))))              (f90-indent-to (f90-comment-indent))
1431              (f90-indent-to (+ ind-curr f90-continuation-indent) 'no-line-no))))            (if (not (zerop (- (current-indentation)
1432                                 (+ ind-curr f90-continuation-indent))))
1433                  (f90-indent-to
1434                   (+ ind-curr f90-continuation-indent) 'no-line-no)))))
1435      ;; restore point etc      ;; restore point etc
1436      (setq f90-cache-position nil)      (setq f90-cache-position nil)
1437      (goto-char save-point)      (goto-char save-point)

Legend:
Removed from v.1.30.14.1  
changed lines
  Added in v.1.30.14.2

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