diff options
| author | Richard M. Stallman | 1996-02-09 02:54:26 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-02-09 02:54:26 +0000 |
| commit | 7f03b2b5db8ec309f33b195c0fc483ac4170f26f (patch) | |
| tree | ea38167ad50e9e0e95e46f712a68385e377ebd13 | |
| parent | c82378204072645f98830b37f286ebfa755d759d (diff) | |
| download | emacs-7f03b2b5db8ec309f33b195c0fc483ac4170f26f.tar.gz emacs-7f03b2b5db8ec309f33b195c0fc483ac4170f26f.zip | |
(f90-indent-subprogram, f90-match-end): Pass proper format string to message.
(f90-face-*): Reinstalled code deleted on Sep 22.
(f90-hilit-patterns): New variable.
(f90-mode): Call hilit-set-mode-patterns if defined.
(f90-auto-hilit19): New variable.
(f90-fill-region): Bind f90-auto-hilit19 to nil.
(f90-update-line): Rehilight if appropriate.
| -rw-r--r-- | lisp/progmodes/f90.el | 116 |
1 files changed, 105 insertions, 11 deletions
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index a43143dc59a..b858e319fcb 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el | |||
| @@ -188,6 +188,9 @@ whether to blink the matching beginning.") | |||
| 188 | "*Automatic case conversion of keywords. | 188 | "*Automatic case conversion of keywords. |
| 189 | The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil") | 189 | The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil") |
| 190 | 190 | ||
| 191 | (defvar f90-auto-hilit19 t | ||
| 192 | "*Automatic highlight of line at every indent or newline (for hilit19).") | ||
| 193 | |||
| 191 | (defvar f90-leave-line-no nil | 194 | (defvar f90-leave-line-no nil |
| 192 | "*If nil, left-justify linenumbers.") | 195 | "*If nil, left-justify linenumbers.") |
| 193 | 196 | ||
| @@ -434,6 +437,90 @@ whether to blink the matching beginning.") | |||
| 434 | f90-font-lock-keywords-2 | 437 | f90-font-lock-keywords-2 |
| 435 | "*Default expressions to highlight in F90 mode.") | 438 | "*Default expressions to highlight in F90 mode.") |
| 436 | 439 | ||
| 440 | ;; hilit19 customization and expressions | ||
| 441 | (defvar f90-face-string 'named-param "*Face for strings.") | ||
| 442 | (defvar f90-face-comment 'comment "*Face for comments.") | ||
| 443 | (defvar f90-face-decl 'include "*Face for declarations.") | ||
| 444 | (defvar f90-face-prog 'defun "*Face for program blocks.") | ||
| 445 | (defvar f90-face-label 'Tomato-bold "*Face for labels.") | ||
| 446 | (defvar f90-face-type 'defun "*Face for type blocks.") | ||
| 447 | (defvar f90-face-interface 'defun "*Face for interface blocks.") | ||
| 448 | (defvar f90-face-contains 'defun "*Face for contains statement.") | ||
| 449 | (defvar f90-face-do 'SteelBlue-bold "*Face for do-structure.") | ||
| 450 | (defvar f90-face-if 'define "*Face for if-structure.") | ||
| 451 | (defvar f90-face-select 'define "*Face for select-case structure.") | ||
| 452 | (defvar f90-face-stop 'defun "*Face for stop and return.") | ||
| 453 | (defvar f90-face-exit 'SteelBlue-bold "*Face for exit and cycle.") | ||
| 454 | (defvar f90-face-keyword 'struct "*Face for keywords.") | ||
| 455 | (defvar f90-face-intrinsics 'struct "*Face for intrinsic procedures.") | ||
| 456 | ;; Highlighting for HPF (High-Peformance Fortran) | ||
| 457 | (defvar f90-face-hpf-procedures 'struct "*Face for hpf procedures.") | ||
| 458 | (defvar f90-face-hpf-directives 'struct "*Face for hpf directives.") | ||
| 459 | (defvar f90-face-hpf-keywords 'struct "*Face for hpf keywords.") | ||
| 460 | |||
| 461 | (defvar f90-hilit-patterns | ||
| 462 | (list | ||
| 463 | ;; Allow for strings delimited by ' and by " and for multirow strings. | ||
| 464 | ;; A multi-row string includes &\n& (+ possible whitespace and comments) | ||
| 465 | (list (concat | ||
| 466 | "\\(\"[^\"\n]*\\(&[ \t]*\\(![^\n]*\\)?\n[ \t]*&[^\"\n]*\\)*\"" | ||
| 467 | "\\|'[^'\n]*\\(&[ \t]*\\(![^\n]*\\)?\n[ \t]*&[^'\n]*\\)*'\\)") | ||
| 468 | nil f90-face-string) | ||
| 469 | (list "!" "$" f90-face-comment) | ||
| 470 | (list "\\(\\(real\\|integer\\|character\\|complex\\|logical\ | ||
| 471 | \\|type[ \t]*(\\sw+)\\).*\\)::" 1 f90-face-decl) | ||
| 472 | (list "implicit[ \t]*none" nil f90-face-decl) | ||
| 473 | (list "^[ \t]*\\(program\\|module\\)[ \t]+\\sw+" 1 f90-face-prog) | ||
| 474 | (list "^[ \t]*\\(program\\|module\\)[ \t]+\\(\\sw+\\)" 2 f90-face-label) | ||
| 475 | (list "\\(^.*\\(function\\|subroutine\\)\\)[ \t]+\\sw+" 1 | ||
| 476 | f90-face-prog) | ||
| 477 | (list "^.*\\(function\\|subroutine\\)[ \t]+\\(\\sw+\\)" 2 | ||
| 478 | f90-face-label) | ||
| 479 | (list "^[ \t]*end[ \t]*\\(program\\|module\\|function\ | ||
| 480 | \\|subroutine\\|type\\)" nil f90-face-prog) | ||
| 481 | (list (concat "^[ \t]*end[ \t]*\\(program\\|module\\|function\\|" | ||
| 482 | "subroutine\\|type\\)[ \t]+\\(\\sw+\\)") 2 f90-face-label) | ||
| 483 | (list "^[ \t]*\\(type\\)[ \t]+\\sw+" 1 f90-face-type) | ||
| 484 | (list "^[ \t]*type[ \t]+\\(\\sw+\\)" 1 f90-face-label) | ||
| 485 | (list "^[ \t]*\\(type[ \t]*,[ \t]*\\(private\\|public\\)\\)[ \t]*::[ \t]*\\(\\sw+\\)" 1 f90-face-type) | ||
| 486 | (list "^[ \t]*\\(type[ \t]*,[ \t]*\\(private\\|public\\)\\)[ \t]*::[ \t]*\\(\\sw+\\)" 3 f90-face-label) | ||
| 487 | (list "^[ \t]*\\(end[ \t]*\\)?interface\\>" nil f90-face-interface) | ||
| 488 | (list "^[ \t]*contains\\>" nil f90-face-contains) | ||
| 489 | (list "^[ \t]*\\(\\sw+[ \t]*:[ \t]*\\)?\\(do\\([ \t]*while\\)?\\)\\>" | ||
| 490 | 2 f90-face-do) | ||
| 491 | (list "^[ \t]*\\(\\sw+\\)[ \t]*:[ \t]*\\(do\\([ \t]*while\\)?\\)\\>" 1 | ||
| 492 | f90-face-label) | ||
| 493 | (list "^[ \t]*\\(end[ \t]*do\\)\\>" 1 f90-face-do) | ||
| 494 | (list "^[ \t]*end[ \t]*do[ \t]+\\(\\sw+\\)" 1 f90-face-label) | ||
| 495 | (list "^[ \t]*\\(\\sw+[ \t]*:[ \t]*\\)?\\(if\\)\\>" 2 f90-face-if) | ||
| 496 | (list "^[ \t]*\\(\\sw+\\)[ \t]*:[ \t]*if\\>" 1 f90-face-label) | ||
| 497 | (list "^[ \t]*\\(end[ \t]*if\\)\\>" 1 f90-face-if) | ||
| 498 | (list "^[ \t]*end[ \t]*if[ \t]+\\(\\sw+\\)" 1 f90-face-label) | ||
| 499 | (list "^[ \t]*\\(\\sw+[ \t]*:[ \t]*\\)?\\(select[ \t]*case\\)\\>" 2 | ||
| 500 | f90-face-select) | ||
| 501 | (list "^[ \t]*\\(\\sw+\\)[ \t]*:[ \t]*\\(select[ \t]*case\\)\\>" 1 | ||
| 502 | f90-face-label) | ||
| 503 | (list "^[ \t]*end[ \t]*select\\>" nil f90-face-select) | ||
| 504 | (list "^[ \t]*end[ \t]*select\\>[ \t]+\\(\\sw+\\)" 1 f90-face-label) | ||
| 505 | (list "\\(where\\|forall\\)[ \t]*(" 1 f90-face-if) | ||
| 506 | (list "\\<\\(elsewhere\\|else\\|else[ \t]*if\\)\\>" nil f90-face-if) | ||
| 507 | (list "\\<end[ \t]*\\(where\\|forall\\)\\>" nil f90-face-if) | ||
| 508 | (list "\\<then\\>" nil f90-face-if) | ||
| 509 | (list "\\<\\(exit\\|cycle\\)\\>" nil f90-face-exit) | ||
| 510 | (list "\\<\\(exit\\|cycle\\)[ \t]*\\sw+\\>" nil f90-face-label) | ||
| 511 | (list "\\<\\(stop\\|return\\)\\>" nil f90-face-stop) | ||
| 512 | (list "^[ \t]*\\(case\\)[ \t]*\\((\\|default\\)" 1 f90-face-select) | ||
| 513 | (list (concat "\\<\\("(mapconcat 'identity f90-keywords "\\|") | ||
| 514 | "\\)\\>") nil f90-face-keyword) | ||
| 515 | (list (concat "\\<\\("(mapconcat 'identity f90-intrinsic-procedures "\\|") | ||
| 516 | "\\)\\>") nil f90-face-intrinsics) | ||
| 517 | (list (concat "\\<\\("(mapconcat 'identity f90-hpf-procedures "\\|") | ||
| 518 | "\\)\\>") nil f90-face-hpf-procedures) | ||
| 519 | (list (concat "\\<\\("(mapconcat 'identity f90-hpf-directives "\\|") | ||
| 520 | "\\)\\>") nil f90-face-hpf-directives) | ||
| 521 | (list (concat "\\<\\("(mapconcat 'identity f90-hpf-keywords "\\|") | ||
| 522 | "\\)\\>") nil f90-face-hpf-keywords))) | ||
| 523 | |||
| 437 | ;; syntax table | 524 | ;; syntax table |
| 438 | (defvar f90-mode-syntax-table nil | 525 | (defvar f90-mode-syntax-table nil |
| 439 | "Syntax table in use in F90 mode buffers.") | 526 | "Syntax table in use in F90 mode buffers.") |
| @@ -739,6 +826,10 @@ with no args, if that value is non-nil." | |||
| 739 | (make-local-variable 'abbrev-all-caps) | 826 | (make-local-variable 'abbrev-all-caps) |
| 740 | (setq abbrev-all-caps t) | 827 | (setq abbrev-all-caps t) |
| 741 | (setq indent-tabs-mode nil) | 828 | (setq indent-tabs-mode nil) |
| 829 | |||
| 830 | (if (fboundp 'hilit-set-mode-patterns) | ||
| 831 | (hilit-set-mode-patterns | ||
| 832 | 'f90-mode f90-hilit-patterns nil 'case-insensitive)) | ||
| 742 | ;; Setting up things for font-lock | 833 | ;; Setting up things for font-lock |
| 743 | (if (string-match "Xemacs" emacs-version) | 834 | (if (string-match "Xemacs" emacs-version) |
| 744 | (progn | 835 | (progn |
| @@ -969,7 +1060,9 @@ block[ \t]*data\\)\\>") | |||
| 969 | (progn (setq bol (f90-get-beg-of-line) | 1060 | (progn (setq bol (f90-get-beg-of-line) |
| 970 | eol (f90-get-end-of-line)) | 1061 | eol (f90-get-end-of-line)) |
| 971 | (if f90-auto-keyword-case | 1062 | (if f90-auto-keyword-case |
| 972 | (f90-change-keywords f90-auto-keyword-case bol eol)))))) | 1063 | (f90-change-keywords f90-auto-keyword-case bol eol) |
| 1064 | (if (and f90-auto-hilit19 (fboundp 'hilit-rehighlight-region)) | ||
| 1065 | (hilit-rehighlight-region bol eol t))))))) | ||
| 973 | 1066 | ||
| 974 | (defun f90-get-correct-indent () | 1067 | (defun f90-get-correct-indent () |
| 975 | "Get correct indent for a line starting with line number. | 1068 | "Get correct indent for a line starting with line number. |
| @@ -1324,14 +1417,14 @@ If run in the middle of a line, the line is not broken." | |||
| 1324 | (setq program (f90-mark-subprogram)) | 1417 | (setq program (f90-mark-subprogram)) |
| 1325 | (if program | 1418 | (if program |
| 1326 | (progn | 1419 | (progn |
| 1327 | (message (concat "Indenting " (car program) " " | 1420 | (message "Indenting %s %s." |
| 1328 | (car (cdr program))".")) | 1421 | (car program) (car (cdr program))) |
| 1329 | (f90-indent-region (point) (mark)) | 1422 | (f90-indent-region (point) (mark)) |
| 1330 | (message (concat "Indenting " (car program) " " | 1423 | (message "Indenting %s %s...done." |
| 1331 | (car (cdr program)) "...done."))) | 1424 | (car program) (car (cdr program)))) |
| 1332 | (message "Indenting the whole file.") | 1425 | (message "Indenting the whole file.") |
| 1333 | (f90-indent-region (point) (mark)) | 1426 | (f90-indent-region (point) (mark)) |
| 1334 | (message (concat "Indenting the whole file...done.")))))) | 1427 | (message "Indenting the whole file...done."))))) |
| 1335 | 1428 | ||
| 1336 | ;; autofill and break-line | 1429 | ;; autofill and break-line |
| 1337 | (defun f90-break-line (&optional no-update) | 1430 | (defun f90-break-line (&optional no-update) |
| @@ -1418,6 +1511,7 @@ automatically breaks the line at a previous space." | |||
| 1418 | "Fill every line in region by forward parsing. Join lines if possible." | 1511 | "Fill every line in region by forward parsing. Join lines if possible." |
| 1419 | (interactive "*r") | 1512 | (interactive "*r") |
| 1420 | (let ((end-region-mark (make-marker)) | 1513 | (let ((end-region-mark (make-marker)) |
| 1514 | (f90-auto-hilit19 nil) | ||
| 1421 | (f90-smart-end nil) (f90-auto-keyword-case nil) indent (go-on t) | 1515 | (f90-smart-end nil) (f90-auto-keyword-case nil) indent (go-on t) |
| 1422 | (af-function auto-fill-function) (auto-fill-function nil)) | 1516 | (af-function auto-fill-function) (auto-fill-function nil)) |
| 1423 | (set-marker end-region-mark end-region) | 1517 | (set-marker end-region-mark end-region) |
| @@ -1506,11 +1600,11 @@ Leave point at the end of line." | |||
| 1506 | (f90-update-line) | 1600 | (f90-update-line) |
| 1507 | (if (eq f90-smart-end 'blink) | 1601 | (if (eq f90-smart-end 'blink) |
| 1508 | (if (< (point) top-of-window) | 1602 | (if (< (point) top-of-window) |
| 1509 | (message (concat | 1603 | (message "Matches %d: %s" |
| 1510 | "Matches " (what-line) ": " | 1604 | (what-line) |
| 1511 | (buffer-substring | 1605 | (buffer-substring |
| 1512 | (progn (beginning-of-line) (point)) | 1606 | (progn (beginning-of-line) (point)) |
| 1513 | (progn (end-of-line) (point))))) | 1607 | (progn (end-of-line) (point)))) |
| 1514 | (sit-for 1))) | 1608 | (sit-for 1))) |
| 1515 | (setq beg-block (car matching-beg)) | 1609 | (setq beg-block (car matching-beg)) |
| 1516 | (setq beg-name (car (cdr matching-beg))) | 1610 | (setq beg-name (car (cdr matching-beg))) |