aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2002-04-29 23:24:28 +0000
committerGlenn Morris2002-04-29 23:24:28 +0000
commit6965846537b7fbc0b812e1ab20992b071ff4b76b (patch)
tree24aa40b0d7d435a1afbf0cf6d582537ecfb8ad54
parent5167cfda36b6784cba15bde63e8e9a19f07bfb39 (diff)
downloademacs-6965846537b7fbc0b812e1ab20992b071ff4b76b.tar.gz
emacs-6965846537b7fbc0b812e1ab20992b071ff4b76b.zip
Whitespace changes.
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/progmodes/f90.el250
2 files changed, 122 insertions, 130 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7246ec6f46d..7022e5be7db 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -23,7 +23,7 @@
23 * autoinsert.el (auto-insert-directory): Doc fix. 23 * autoinsert.el (auto-insert-directory): Doc fix.
24 24
25 * progmodes/f90.el: Add/change doc strings for many inline 25 * progmodes/f90.el: Add/change doc strings for many inline
26 functions. 26 functions. Whitespace changes.
27 (f90-indent-line-no, f90-update-line): Minor code changes. 27 (f90-indent-line-no, f90-update-line): Minor code changes.
28 28
292002-04-29 Kim F. Storm <storm@cua.dk> 292002-04-29 Kim F. Storm <storm@cua.dk>
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index bc6ee812931..7f47db95540 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -66,14 +66,14 @@
66;; the variable f90-comment-region in every line of the region. 66;; the variable f90-comment-region in every line of the region.
67 67
68;; One common convention for free vs. fixed format is that free-format files 68;; One common convention for free vs. fixed format is that free-format files
69;; have the ending .f90 or .f95 while fixed format files have the ending .f. 69;; have the ending .f90 or .f95 while fixed format files have the ending .f.
70;; Emacs automatically loads Fortran files in the appropriate mode based 70;; Emacs automatically loads Fortran files in the appropriate mode based
71;; on extension. You can modify this by adjusting the variable auto-mode-alist. 71;; on extension. You can modify this by adjusting the variable auto-mode-alist.
72;; For example: 72;; For example:
73;; (add-to-list 'auto-mode-alist '("\\.f\\'" . f90-mode)) 73;; (add-to-list 'auto-mode-alist '("\\.f\\'" . f90-mode))
74 74
75;; Once you have entered f90-mode, you may get more info by using 75;; Once you have entered f90-mode, you may get more info by using
76;; the command describe-mode (C-h m). For online help use 76;; the command describe-mode (C-h m). For online help use
77;; C-h f <Name of function you want described>, or 77;; C-h f <Name of function you want described>, or
78;; C-h v <Name of variable you want described>. 78;; C-h v <Name of variable you want described>.
79 79
@@ -277,37 +277,37 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil."
277 277
278(defconst f90-procedures-re 278(defconst f90-procedures-re
279 (concat "\\<" 279 (concat "\\<"
280 (regexp-opt 280 (regexp-opt
281 '("abs" "achar" "acos" "adjustl" "adjustr" "aimag" "aint" 281 '("abs" "achar" "acos" "adjustl" "adjustr" "aimag" "aint"
282 "all" "allocated" "anint" "any" "asin" "associated" 282 "all" "allocated" "anint" "any" "asin" "associated"
283 "atan" "atan2" "bit_size" "btest" "ceiling" "char" "cmplx" 283 "atan" "atan2" "bit_size" "btest" "ceiling" "char" "cmplx"
284 "conjg" "cos" "cosh" "count" "cshift" "date_and_time" "dble" 284 "conjg" "cos" "cosh" "count" "cshift" "date_and_time" "dble"
285 "digits" "dim" "dot_product" "dprod" "eoshift" "epsilon" 285 "digits" "dim" "dot_product" "dprod" "eoshift" "epsilon"
286 "exp" "exponent" "floor" "fraction" "huge" "iachar" "iand" 286 "exp" "exponent" "floor" "fraction" "huge" "iachar" "iand"
287 "ibclr" "ibits" "ibset" "ichar" "ieor" "index" "int" "ior" 287 "ibclr" "ibits" "ibset" "ichar" "ieor" "index" "int" "ior"
288 "ishft" "ishftc" "kind" "lbound" "len" "len_trim" "lge" "lgt" 288 "ishft" "ishftc" "kind" "lbound" "len" "len_trim" "lge" "lgt"
289 "lle" "llt" "log" "log10" "logical" "matmul" "max" 289 "lle" "llt" "log" "log10" "logical" "matmul" "max"
290 "maxexponent" "maxloc" "maxval" "merge" "min" "minexponent" 290 "maxexponent" "maxloc" "maxval" "merge" "min" "minexponent"
291 "minloc" "minval" "mod" "modulo" "mvbits" "nearest" "nint" 291 "minloc" "minval" "mod" "modulo" "mvbits" "nearest" "nint"
292 "not" "pack" "precision" "present" "product" "radix" 292 "not" "pack" "precision" "present" "product" "radix"
293 ;; Real is taken out here to avoid highlighting declarations. 293 ;; Real is taken out here to avoid highlighting declarations.
294 "random_number" "random_seed" "range" ;; "real" 294 "random_number" "random_seed" "range" ;; "real"
295 "repeat" "reshape" "rrspacing" "scale" "scan" 295 "repeat" "reshape" "rrspacing" "scale" "scan"
296 "selected_int_kind" "selected_real_kind" "set_exponent" 296 "selected_int_kind" "selected_real_kind" "set_exponent"
297 "shape" "sign" "sin" "sinh" "size" "spacing" "spread" "sqrt" 297 "shape" "sign" "sin" "sinh" "size" "spacing" "spread" "sqrt"
298 "sum" "system_clock" "tan" "tanh" "tiny" "transfer" 298 "sum" "system_clock" "tan" "tanh" "tiny" "transfer"
299 "transpose" "trim" "ubound" "unpack" "verify" 299 "transpose" "trim" "ubound" "unpack" "verify"
300 ;; F95 intrinsic functions. 300 ;; F95 intrinsic functions.
301 "null" "cpu_time") t) 301 "null" "cpu_time") t)
302 ;; A left parenthesis to avoid highlighting non-procedures. 302 ;; A left parenthesis to avoid highlighting non-procedures.
303 "[ \t]*(") 303 "[ \t]*(")
304 "Regexp whose first part matches F90 intrinsic procedures.") 304 "Regexp whose first part matches F90 intrinsic procedures.")
305 305
306(defconst f90-operators-re 306(defconst f90-operators-re
307 (concat "\\." 307 (concat "\\."
308 (regexp-opt '("and" "eq" "eqv" "false" "ge" "gt" "le" "lt" "ne" 308 (regexp-opt '("and" "eq" "eqv" "false" "ge" "gt" "le" "lt" "ne"
309 "neqv" "not" "or" "true") t) 309 "neqv" "not" "or" "true") t)
310 "\\.") 310 "\\.")
311 "Regexp matching intrinsic operators.") 311 "Regexp matching intrinsic operators.")
312 312
313(defconst f90-hpf-keywords-re 313(defconst f90-hpf-keywords-re
@@ -328,7 +328,7 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil."
328 "product_suffix" "sum_prefix" "sum_scatter" "sum_suffix" 328 "product_suffix" "sum_prefix" "sum_scatter" "sum_suffix"
329 ;; Directives 329 ;; Directives
330 "align" "distribute" "dynamic" "independent" "inherit" "processors" 330 "align" "distribute" "dynamic" "independent" "inherit" "processors"
331 "realign" "redistribute" "template" 331 "realign" "redistribute" "template"
332 ;; Keywords 332 ;; Keywords
333 "block" "cyclic" "extrinsic" "new" "onto" "pure" "with") 'words) 333 "block" "cyclic" "extrinsic" "new" "onto" "pure" "with") 'words)
334 "Regexp for all HPF keywords, procedures and directives.") 334 "Regexp for all HPF keywords, procedures and directives.")
@@ -343,49 +343,57 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil."
343;;; '("\\<\\(type\\)[ \t]*\\(.*::[ \t]*\\|[ \t]+\\)\\(\\sw+\\)" 343;;; '("\\<\\(type\\)[ \t]*\\(.*::[ \t]*\\|[ \t]+\\)\\(\\sw+\\)"
344;;; (1 font-lock-keyword-face) (3 font-lock-function-name-face)) 344;;; (1 font-lock-keyword-face) (3 font-lock-function-name-face))
345 ;; Other functions and declarations. 345 ;; Other functions and declarations.
346 '("\\<\\(\\(?:end[ \t]*\\)?\\(program\\|module\\|function\\|subroutine\\|type\\)\\|use\\|call\\)\\>[ \t]*\\(\\sw+\\)?" 346 '("\\<\\(\\(?:end[ \t]*\\)?\\(program\\|module\\|function\\|\
347subroutine\\|type\\)\\|use\\|call\\)\\>[ \t]*\\(\\sw+\\)?"
347 (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t)) 348 (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t))
348 "\\<\\(\\(end[ \t]*\\)?\\(interface\\|block[ \t]*data\\)\\|contains\\)\\>") 349 "\\<\\(\\(end[ \t]*\\)?\\(interface\\|block[ \t]*data\\)\\|contains\\)\\>")
349 "This does fairly subdued highlighting of comments and function calls.") 350 "This does fairly subdued highlighting of comments and function calls.")
350 351
351(defvar f90-font-lock-keywords-2 352(defvar f90-font-lock-keywords-2
352 (append f90-font-lock-keywords-1 353 (append
353 (list 354 f90-font-lock-keywords-1
354 ;; Variable declarations (avoid the real function call) 355 (list
355 '("^[ \t0-9]*\\(real\\|integer\\|c\\(haracter\\|omplex\\)\\|logical\\|type[ \t]*(\\sw+)\\)\\(.*::\\|[ \t]*(.*)\\)?\\([^!\n]*\\)" 356 ;; Variable declarations (avoid the real function call)
356 (1 font-lock-type-face t) (4 font-lock-variable-name-face)) 357 '("^[ \t0-9]*\\(real\\|integer\\|c\\(haracter\\|omplex\\)\\|\
357 ;; do, if, select, where, and forall constructs 358logical\\|type[ \t]*(\\sw+)\\)\\(.*::\\|[ \t]*(.*)\\)?\\([^!\n]*\\)"
358 '("\\<\\(end[ \t]*\\(do\\|if\\|select\\|forall\\|where\\)\\)\\>\\([ \t]+\\(\\sw+\\)\\)?" 359 (1 font-lock-type-face t) (4 font-lock-variable-name-face))
359 (1 font-lock-keyword-face) (3 font-lock-constant-face nil t)) 360 ;; do, if, select, where, and forall constructs
360 '("^[ \t0-9]*\\(\\(\\sw+\\)[ \t]*:[ \t]*\\)?\\(\\(if\\|do\\([ \t]*while\\)?\\|select[ \t]*case\\|where\\|forall\\)\\)\\>" 361 '("\\<\\(end[ \t]*\\(do\\|if\\|select\\|forall\\|where\\)\\)\\>\
361 (2 font-lock-constant-face nil t) (3 font-lock-keyword-face)) 362\\([ \t]+\\(\\sw+\\)\\)?"
362 ;; implicit declaration 363 (1 font-lock-keyword-face) (3 font-lock-constant-face nil t))
363 '("\\<\\(implicit\\)[ \t]*\\(real\\|integer\\|c\\(haracter\\|omplex\\)\\|logical\\|type[ \t]*(\\sw+)\\|none\\)\\>" (1 font-lock-keyword-face) (2 font-lock-type-face)) 364 '("^[ \t0-9]*\\(\\(\\sw+\\)[ \t]*:[ \t]*\\)?\\(\\(if\\|\
364 '("\\<\\(namelist\\|common\\)[ \t]*\/\\(\\sw+\\)?\/" (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) 365do\\([ \t]*while\\)?\\|select[ \t]*case\\|where\\|forall\\)\\)\\>"
365 "\\<else\\([ \t]*if\\|where\\)?\\>" 366 (2 font-lock-constant-face nil t) (3 font-lock-keyword-face))
366 "\\<\\(then\\|continue\\|format\\|include\\|stop\\|return\\)\\>" 367 ;; implicit declaration
367 '("\\<\\(exit\\|cycle\\)[ \t]*\\(\\sw+\\)?\\>" 368 '("\\<\\(implicit\\)[ \t]*\\(real\\|integer\\|c\\(haracter\\|omplex\\)\
368 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) 369\\|logical\\|type[ \t]*(\\sw+)\\|none\\)\\>"
369 '("\\<\\(case\\)[ \t]*\\(default\\|(\\)" . 1) 370 (1 font-lock-keyword-face) (2 font-lock-type-face))
370 '("\\<\\(do\\|go *to\\)\\>[ \t]*\\([0-9]+\\)" 371 '("\\<\\(namelist\\|common\\)[ \t]*\/\\(\\sw+\\)?\/"
371 (1 font-lock-keyword-face) (2 font-lock-constant-face)) 372 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
372 ;; line numbers (lines whose first character after number is letter) 373 "\\<else\\([ \t]*if\\|where\\)?\\>"
373 '("^[ \t]*\\([0-9]+\\)[ \t]*[a-z]+" (1 font-lock-constant-face t)))) 374 "\\<\\(then\\|continue\\|format\\|include\\|stop\\|return\\)\\>"
375 '("\\<\\(exit\\|cycle\\)[ \t]*\\(\\sw+\\)?\\>"
376 (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
377 '("\\<\\(case\\)[ \t]*\\(default\\|(\\)" . 1)
378 '("\\<\\(do\\|go *to\\)\\>[ \t]*\\([0-9]+\\)"
379 (1 font-lock-keyword-face) (2 font-lock-constant-face))
380 ;; line numbers (lines whose first character after number is letter)
381 '("^[ \t]*\\([0-9]+\\)[ \t]*[a-z]+" (1 font-lock-constant-face t))))
374 "Highlights declarations, do-loops and other constructs.") 382 "Highlights declarations, do-loops and other constructs.")
375 383
376(defvar f90-font-lock-keywords-3 384(defvar f90-font-lock-keywords-3
377 (append f90-font-lock-keywords-2 385 (append f90-font-lock-keywords-2
378 (list 386 (list
379 f90-keywords-level-3-re 387 f90-keywords-level-3-re
380 f90-operators-re 388 f90-operators-re
381 (list f90-procedures-re '(1 font-lock-keyword-face keep)) 389 (list f90-procedures-re '(1 font-lock-keyword-face keep))
382 "\\<real\\>" ; Avoid overwriting real defs. 390 "\\<real\\>" ; Avoid overwriting real defs.
383 )) 391 ))
384 "Highlights all F90 keywords and intrinsic procedures.") 392 "Highlights all F90 keywords and intrinsic procedures.")
385 393
386(defvar f90-font-lock-keywords-4 394(defvar f90-font-lock-keywords-4
387 (append f90-font-lock-keywords-3 395 (append f90-font-lock-keywords-3
388 (list f90-hpf-keywords-re)) 396 (list f90-hpf-keywords-re))
389 "Highlights all F90 and HPF keywords.") 397 "Highlights all F90 and HPF keywords.")
390 398
391(defvar f90-font-lock-keywords 399(defvar f90-font-lock-keywords
@@ -405,7 +413,7 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil."
405 (modify-syntax-entry ?\" "\"" f90-mode-syntax-table) ; string quote 413 (modify-syntax-entry ?\" "\"" f90-mode-syntax-table) ; string quote
406 (modify-syntax-entry ?\` "w" f90-mode-syntax-table) ; for abbrevs 414 (modify-syntax-entry ?\` "w" f90-mode-syntax-table) ; for abbrevs
407 (modify-syntax-entry ?\r " " f90-mode-syntax-table) ; return is whitespace 415 (modify-syntax-entry ?\r " " f90-mode-syntax-table) ; return is whitespace
408 (modify-syntax-entry ?+ "." f90-mode-syntax-table) 416 (modify-syntax-entry ?+ "." f90-mode-syntax-table)
409 (modify-syntax-entry ?- "." f90-mode-syntax-table) 417 (modify-syntax-entry ?- "." f90-mode-syntax-table)
410 (modify-syntax-entry ?= "." f90-mode-syntax-table) 418 (modify-syntax-entry ?= "." f90-mode-syntax-table)
411 (modify-syntax-entry ?* "." f90-mode-syntax-table) 419 (modify-syntax-entry ?* "." f90-mode-syntax-table)
@@ -440,7 +448,7 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil."
440 (define-key f90-mode-map "*" 'f90-electric-insert) 448 (define-key f90-mode-map "*" 'f90-electric-insert)
441 (define-key f90-mode-map "/" 'f90-electric-insert)) 449 (define-key f90-mode-map "/" 'f90-electric-insert))
442 450
443 451
444;; menus 452;; menus
445(if f90-xemacs-flag 453(if f90-xemacs-flag
446 (defvar f90-xemacs-menu 454 (defvar f90-xemacs-menu
@@ -463,10 +471,10 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil."
463 ["Upcase Keywords (region)" f90-upcase-region-keywords 471 ["Upcase Keywords (region)" f90-upcase-region-keywords
464 t] 472 t]
465 ["Capitalize Keywords (buffer)" f90-capitalize-keywords t] 473 ["Capitalize Keywords (buffer)" f90-capitalize-keywords t]
466 ["Capitalize Keywords (region)" 474 ["Capitalize Keywords (region)"
467 f90-capitalize-region-keywords t] 475 f90-capitalize-region-keywords t]
468 ["Downcase Keywords (buffer)" f90-downcase-keywords t] 476 ["Downcase Keywords (buffer)" f90-downcase-keywords t]
469 ["Downcase Keywords (region)" 477 ["Downcase Keywords (region)"
470 f90-downcase-region-keywords t] 478 f90-downcase-region-keywords t]
471 "-----" 479 "-----"
472 ["Toggle abbrev-mode" abbrev-mode t] 480 ["Toggle abbrev-mode" abbrev-mode t]
@@ -476,27 +484,20 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil."
476 484
477 (defvar f90-change-case-menu 485 (defvar f90-change-case-menu
478 (let ((map (make-sparse-keymap "Change Keyword Case"))) 486 (let ((map (make-sparse-keymap "Change Keyword Case")))
479
480 (define-key map [dkr] (cons "Downcase Keywords (region)" 487 (define-key map [dkr] (cons "Downcase Keywords (region)"
481 'f90-downcase-region-keywords)) 488 'f90-downcase-region-keywords))
482 (put 'f90-downcase-region-keywords 'menu-enable 'mark-active) 489 (put 'f90-downcase-region-keywords 'menu-enable 'mark-active)
483
484 (define-key map [ckr] (cons "Capitalize Keywords (region)" 490 (define-key map [ckr] (cons "Capitalize Keywords (region)"
485 'f90-capitalize-region-keywords)) 491 'f90-capitalize-region-keywords))
486 (put 'f90-capitalize-region-keywords 'menu-enable 'mark-active) 492 (put 'f90-capitalize-region-keywords 'menu-enable 'mark-active)
487
488 (define-key map [ukr] (cons "Upcase Keywords (region)" 493 (define-key map [ukr] (cons "Upcase Keywords (region)"
489 'f90-upcase-region-keywords)) 494 'f90-upcase-region-keywords))
490 (put 'f90-upcase-region-keywords 'menu-enable 'mark-active) 495 (put 'f90-upcase-region-keywords 'menu-enable 'mark-active)
491
492 (define-key map [line] (list "-----------------")) 496 (define-key map [line] (list "-----------------"))
493
494 (define-key map [dkb] (cons "Downcase Keywords (buffer)" 497 (define-key map [dkb] (cons "Downcase Keywords (buffer)"
495 'f90-downcase-keywords)) 498 'f90-downcase-keywords))
496
497 (define-key map [ckb] (cons "Capitalize Keywords (buffer)" 499 (define-key map [ckb] (cons "Capitalize Keywords (buffer)"
498 'f90-capitalize-keywords)) 500 'f90-capitalize-keywords))
499
500 (define-key map [ukb] (cons "Upcase Keywords (buffer)" 501 (define-key map [ukb] (cons "Upcase Keywords (buffer)"
501 'f90-upcase-keywords)) 502 'f90-upcase-keywords))
502 map) 503 map)
@@ -508,35 +509,35 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil."
508 (defalias 'f90-font-lock-off 'font-lock-mode) 509 (defalias 'f90-font-lock-off 'font-lock-mode)
509 (put 'f90-font-lock-on 'menu-enable 'font-lock-mode) 510 (put 'f90-font-lock-on 'menu-enable 'font-lock-mode)
510 (put 'f90-font-lock-off 'menu-enable '(not font-lock-mode)) 511 (put 'f90-font-lock-off 'menu-enable '(not font-lock-mode))
511 512
512 (defun f90-font-lock-1 () 513 (defun f90-font-lock-1 ()
513 (interactive) 514 (interactive)
514 "Set font-lock-keywords to f90-font-lock-keywords-1." 515 "Set font-lock-keywords to f90-font-lock-keywords-1."
515 (font-lock-mode 1) 516 (font-lock-mode 1)
516 (setq font-lock-keywords f90-font-lock-keywords-1) 517 (setq font-lock-keywords f90-font-lock-keywords-1)
517 (font-lock-fontify-buffer)) 518 (font-lock-fontify-buffer))
518 519
519 (defun f90-font-lock-2 () 520 (defun f90-font-lock-2 ()
520 (interactive) 521 (interactive)
521 "Set font-lock-keywords to f90-font-lock-keywords-2." 522 "Set font-lock-keywords to f90-font-lock-keywords-2."
522 (font-lock-mode 1) 523 (font-lock-mode 1)
523 (setq font-lock-keywords f90-font-lock-keywords-2) 524 (setq font-lock-keywords f90-font-lock-keywords-2)
524 (font-lock-fontify-buffer)) 525 (font-lock-fontify-buffer))
525 526
526 (defun f90-font-lock-3 () 527 (defun f90-font-lock-3 ()
527 (interactive) 528 (interactive)
528 "Set font-lock-keywords to f90-font-lock-keywords-3." 529 "Set font-lock-keywords to f90-font-lock-keywords-3."
529 (font-lock-mode 1) 530 (font-lock-mode 1)
530 (setq font-lock-keywords f90-font-lock-keywords-3) 531 (setq font-lock-keywords f90-font-lock-keywords-3)
531 (font-lock-fontify-buffer)) 532 (font-lock-fontify-buffer))
532 533
533 (defun f90-font-lock-4 () 534 (defun f90-font-lock-4 ()
534 (interactive) 535 (interactive)
535 "Set font-lock-keywords to f90-font-lock-keywords-4." 536 "Set font-lock-keywords to f90-font-lock-keywords-4."
536 (font-lock-mode 1) 537 (font-lock-mode 1)
537 (setq font-lock-keywords f90-font-lock-keywords-4) 538 (setq font-lock-keywords f90-font-lock-keywords-4)
538 (font-lock-fontify-buffer)) 539 (font-lock-fontify-buffer))
539 540
540 (defvar f90-font-lock-menu 541 (defvar f90-font-lock-menu
541 (let ((map (make-sparse-keymap "f90-font-lock-menu"))) 542 (let ((map (make-sparse-keymap "f90-font-lock-menu")))
542 (define-key map [h4] (cons "Maximum highlighting (level 4)" 543 (define-key map [h4] (cons "Maximum highlighting (level 4)"
@@ -557,9 +558,8 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil."
557 (defalias 'f90-font-lock-menu f90-font-lock-menu) 558 (defalias 'f90-font-lock-menu f90-font-lock-menu)
558 559
559 (define-key f90-mode-map [menu-bar] (make-sparse-keymap)) 560 (define-key f90-mode-map [menu-bar] (make-sparse-keymap))
560 (define-key f90-mode-map [menu-bar f90] 561 (define-key f90-mode-map [menu-bar f90]
561 (cons "F90" (make-sparse-keymap "f90"))) 562 (cons "F90" (make-sparse-keymap "f90")))
562
563 (define-key f90-mode-map [menu-bar f90 f90-imenu-menu] 563 (define-key f90-mode-map [menu-bar f90 f90-imenu-menu]
564 '("Add imenu Menu" . f90-add-imenu-menu)) 564 '("Add imenu Menu" . f90-add-imenu-menu))
565 (define-key f90-mode-map [menu-bar f90 abbrev-mode] 565 (define-key f90-mode-map [menu-bar f90 abbrev-mode]
@@ -574,31 +574,24 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil."
574 (cons "Highlighting" 'f90-font-lock-menu)) 574 (cons "Highlighting" 'f90-font-lock-menu))
575 (define-key f90-mode-map [menu-bar f90 line2] 575 (define-key f90-mode-map [menu-bar f90 line2]
576 '("----")) 576 '("----"))
577
578 (define-key f90-mode-map [menu-bar f90 f90-insert-end] 577 (define-key f90-mode-map [menu-bar f90 f90-insert-end]
579 '("Insert Block End" . f90-insert-end)) 578 '("Insert Block End" . f90-insert-end))
580 (define-key f90-mode-map [menu-bar f90 f90-join-lines] 579 (define-key f90-mode-map [menu-bar f90 f90-join-lines]
581 '("Join with Next Line" . f90-join-lines)) 580 '("Join with Next Line" . f90-join-lines))
582 (define-key f90-mode-map [menu-bar f90 f90-break-line] 581 (define-key f90-mode-map [menu-bar f90 f90-break-line]
583 '("Break Line at Point" . f90-break-line)) 582 '("Break Line at Point" . f90-break-line))
584
585 (define-key f90-mode-map [menu-bar f90 line3] 583 (define-key f90-mode-map [menu-bar f90 line3]
586 '("----")) 584 '("----"))
587
588 (define-key f90-mode-map [menu-bar f90 f90-fill-region] 585 (define-key f90-mode-map [menu-bar f90 f90-fill-region]
589 '("Fill Region" . f90-fill-region)) 586 '("Fill Region" . f90-fill-region))
590 (put 'f90-fill-region 'menu-enable 'mark-active) 587 (put 'f90-fill-region 'menu-enable 'mark-active)
591
592 (define-key f90-mode-map [menu-bar f90 indent-region] 588 (define-key f90-mode-map [menu-bar f90 indent-region]
593 '("Indent Region" . indent-region)) 589 '("Indent Region" . indent-region))
594
595 (define-key f90-mode-map [menu-bar f90 f90-comment-region] 590 (define-key f90-mode-map [menu-bar f90 f90-comment-region]
596 '("(Un)Comment Region" . f90-comment-region)) 591 '("(Un)Comment Region" . f90-comment-region))
597 (put 'f90-comment-region 'menu-enable 'mark-active) 592 (put 'f90-comment-region 'menu-enable 'mark-active)
598
599 (define-key f90-mode-map [menu-bar f90 line4] 593 (define-key f90-mode-map [menu-bar f90 line4]
600 '("----")) 594 '("----"))
601
602 (define-key f90-mode-map [menu-bar f90 f90-end-of-subprogram] 595 (define-key f90-mode-map [menu-bar f90 f90-end-of-subprogram]
603 '("End of Subprogram" . f90-end-of-subprogram)) 596 '("End of Subprogram" . f90-end-of-subprogram))
604 (define-key f90-mode-map [menu-bar f90 f90-beginning-of-subprogram] 597 (define-key f90-mode-map [menu-bar f90 f90-beginning-of-subprogram]
@@ -610,16 +603,16 @@ The options are 'downcase-word, 'upcase-word, 'capitalize-word and nil."
610 ) 603 )
611 604
612;; Regexps for finding program structures. 605;; Regexps for finding program structures.
613(defconst f90-blocks-re 606(defconst f90-blocks-re
614 "\\(block[ \t]*data\\|do\\|if\\|interface\\|function\\|module\\|\ 607 "\\(block[ \t]*data\\|do\\|if\\|interface\\|function\\|module\\|\
615program\\|select\\|subroutine\\|type\\|where\\|forall\\)\\>") 608program\\|select\\|subroutine\\|type\\|where\\|forall\\)\\>")
616(defconst f90-program-block-re 609(defconst f90-program-block-re
617 "\\(program\\|module\\|subroutine\\|function\\)") 610 "\\(program\\|module\\|subroutine\\|function\\)")
618(defconst f90-else-like-re 611(defconst f90-else-like-re
619 "\\(else\\([ \t]*if\\|where\\)?\\|case[ \t]*\\(default\\|(\\)\\)") 612 "\\(else\\([ \t]*if\\|where\\)?\\|case[ \t]*\\(default\\|(\\)\\)")
620(defconst f90-end-if-re 613(defconst f90-end-if-re
621 "end[ \t]*\\(if\\|select\\|where\\|forall\\)\\>") 614 "end[ \t]*\\(if\\|select\\|where\\|forall\\)\\>")
622(defconst f90-end-type-re 615(defconst f90-end-type-re
623 "end[ \t]*\\(type\\|interface\\|block[ \t]*data\\)") 616 "end[ \t]*\\(type\\|interface\\|block[ \t]*data\\)")
624(defconst f90-type-def-re 617(defconst f90-type-def-re
625 "\\<\\(type\\)\\([^(\n]*\\)\\(::\\)?[ \t]*\\b\\(\\sw+\\)") 618 "\\<\\(type\\)\\([^(\n]*\\)\\(::\\)?[ \t]*\\b\\(\\sw+\\)")
@@ -641,7 +634,7 @@ program\\|select\\|subroutine\\|type\\|where\\|forall\\)\\>")
641 '("Modules" "^[ \t0-9]*module[ \t]+\\(\\sw+\\)[ \t]*\\(!\\|$\\)" 1) 634 '("Modules" "^[ \t0-9]*module[ \t]+\\(\\sw+\\)[ \t]*\\(!\\|$\\)" 1)
642 '("Types" "^[ \t0-9]*type[ \t]+\\(\\sw+\\)" 1) 635 '("Types" "^[ \t0-9]*type[ \t]+\\(\\sw+\\)" 1)
643 (list 636 (list
644 "Procedures" 637 "Procedures"
645 (concat 638 (concat
646 "^[ \t0-9]*" 639 "^[ \t0-9]*"
647 "\\(" 640 "\\("
@@ -656,7 +649,7 @@ program\\|select\\|subroutine\\|type\\|where\\|forall\\)\\>")
656 good-char "?" good-char "?" 649 good-char "?" good-char "?"
657 "\\)" 650 "\\)"
658 "[ \t]*\\(function\\|subroutine\\)[ \t]+\\(\\sw+\\)") 651 "[ \t]*\\(function\\|subroutine\\)[ \t]+\\(\\sw+\\)")
659 4))) 652 4)))
660 "Generic imenu expression for F90 mode.") 653 "Generic imenu expression for F90 mode.")
661 654
662(defun f90-add-imenu-menu () 655(defun f90-add-imenu-menu ()
@@ -771,7 +764,7 @@ Variables controlling indentation style and extra features:
771 `f90-continuation-indent' 764 `f90-continuation-indent'
772 Extra indentation applied to continuation lines. (default 5) 765 Extra indentation applied to continuation lines. (default 5)
773 `f90-comment-region' 766 `f90-comment-region'
774 String inserted by \\[f90-comment-region] at start of each line in 767 String inserted by \\[f90-comment-region] at start of each line in
775 region. (default \"!!!$\") 768 region. (default \"!!!$\")
776 `f90-indented-comment-re' 769 `f90-indented-comment-re'
777 Regexp determining the type of comment to be intended like code. 770 Regexp determining the type of comment to be intended like code.
@@ -829,13 +822,13 @@ with no args, if that value is non-nil."
829 (when f90-xemacs-flag 822 (when f90-xemacs-flag
830 (put 'f90-mode 'font-lock-keywords-case-fold-search t) 823 (put 'f90-mode 'font-lock-keywords-case-fold-search t)
831 (when (and (featurep 'menubar) 824 (when (and (featurep 'menubar)
832 current-menubar 825 current-menubar
833 (not (assoc "F90" current-menubar))) 826 (not (assoc "F90" current-menubar)))
834 (set-buffer-menubar (copy-sequence current-menubar)) 827 (set-buffer-menubar (copy-sequence current-menubar))
835 (add-submenu nil f90-xemacs-menu))) 828 (add-submenu nil f90-xemacs-menu)))
836 ;; XEmacs: (Don't need a special case, since both emacsen work alike -sb) 829 ;; XEmacs: (Don't need a special case, since both emacsen work alike -sb)
837 (make-local-variable 'font-lock-defaults) 830 (make-local-variable 'font-lock-defaults)
838 (setq font-lock-defaults 831 (setq font-lock-defaults
839 '((f90-font-lock-keywords f90-font-lock-keywords-1 832 '((f90-font-lock-keywords f90-font-lock-keywords-1
840 f90-font-lock-keywords-2 833 f90-font-lock-keywords-2
841 f90-font-lock-keywords-3 834 f90-font-lock-keywords-3
@@ -859,7 +852,7 @@ and lies before point."
859 f90-cache-position 852 f90-cache-position
860 (point-min)))) 853 (point-min))))
861 (nth 3 (parse-partial-sexp beg-pnt (point))))) 854 (nth 3 (parse-partial-sexp beg-pnt (point)))))
862 855
863(defsubst f90-in-comment () 856(defsubst f90-in-comment ()
864 "Return non-nil if point is inside a comment. 857 "Return non-nil if point is inside a comment.
865Checks from point-min, or f90-cache-position, if that is non-nil 858Checks from point-min, or f90-cache-position, if that is non-nil
@@ -979,7 +972,7 @@ NAME is nil if the statement has no label."
979(defsubst f90-looking-at-type-like () 972(defsubst f90-looking-at-type-like ()
980 "Return (KIND NAME) if a type/interface/block-data block starts after point. 973 "Return (KIND NAME) if a type/interface/block-data block starts after point.
981NAME is non-nil only for type." 974NAME is non-nil only for type."
982 (cond 975 (cond
983 ((looking-at f90-type-def-re) 976 ((looking-at f90-type-def-re)
984 (list (match-string 1) (match-string 4))) 977 (list (match-string 1) (match-string 4)))
985 ((looking-at "\\(interface\\|block[\t]*data\\)\\>") 978 ((looking-at "\\(interface\\|block[\t]*data\\)\\>")
@@ -1000,7 +993,7 @@ NAME is non-nil only for type."
1000 993
1001(defsubst f90-looking-at-program-block-end () 994(defsubst f90-looking-at-program-block-end ()
1002 "Return (KIND NAME) if a block with name NAME ends after point." 995 "Return (KIND NAME) if a block with name NAME ends after point."
1003 (if (looking-at (concat "end[ \t]*" f90-blocks-re 996 (if (looking-at (concat "end[ \t]*" f90-blocks-re
1004 "?\\([ \t]+\\(\\sw+\\)\\)?\\>")) 997 "?\\([ \t]+\\(\\sw+\\)\\)?\\>"))
1005 (list (match-string 1) (match-string 3)))) 998 (list (match-string 1) (match-string 3))))
1006 999
@@ -1110,8 +1103,7 @@ Does not check type and subprogram indentation."
1110 (setq icol (- icol f90-do-indent)))) 1103 (setq icol (- icol f90-do-indent))))
1111 (end-of-line)) 1104 (end-of-line))
1112 icol))) 1105 icol)))
1113 1106
1114
1115(defun f90-calculate-indent () 1107(defun f90-calculate-indent ()
1116 "Calculate the indent column based on previous statements." 1108 "Calculate the indent column based on previous statements."
1117 (interactive) 1109 (interactive)
@@ -1134,7 +1126,7 @@ Does not check type and subprogram indentation."
1134 (cond ((or (f90-looking-at-if-then) 1126 (cond ((or (f90-looking-at-if-then)
1135 (f90-looking-at-where-or-forall) 1127 (f90-looking-at-where-or-forall)
1136 (f90-looking-at-select-case) 1128 (f90-looking-at-select-case)
1137 (looking-at f90-else-like-re)) 1129 (looking-at f90-else-like-re))
1138 (setq icol (+ icol f90-if-indent))) 1130 (setq icol (+ icol f90-if-indent)))
1139 ((f90-looking-at-do) 1131 ((f90-looking-at-do)
1140 (setq icol (+ icol f90-do-indent))) 1132 (setq icol (+ icol f90-do-indent)))
@@ -1192,12 +1184,12 @@ Return (type name) or nil if not found."
1192 (interactive) 1184 (interactive)
1193 (let ((count 1) (case-fold-search t) matching-beg) 1185 (let ((count 1) (case-fold-search t) matching-beg)
1194 (beginning-of-line) (skip-chars-forward " \t0-9") 1186 (beginning-of-line) (skip-chars-forward " \t0-9")
1195 (if (setq matching-beg (f90-looking-at-program-block-start)) 1187 (if (setq matching-beg (f90-looking-at-program-block-start))
1196 (setq count (- count 1))) 1188 (setq count (- count 1)))
1197 (while (and (not (zerop count)) 1189 (while (and (not (zerop count))
1198 (re-search-backward f90-program-block-re nil 'move)) 1190 (re-search-backward f90-program-block-re nil 'move))
1199 (beginning-of-line) (skip-chars-forward " \t0-9") 1191 (beginning-of-line) (skip-chars-forward " \t0-9")
1200 (cond 1192 (cond
1201 ((setq matching-beg (f90-looking-at-program-block-start)) 1193 ((setq matching-beg (f90-looking-at-program-block-start))
1202 (setq count (- count 1))) 1194 (setq count (- count 1)))
1203 ((f90-looking-at-program-block-end) 1195 ((f90-looking-at-program-block-end)
@@ -1292,7 +1284,7 @@ after indenting."
1292 (if (looking-at "!") 1284 (if (looking-at "!")
1293 (setq indent (f90-comment-indent)) 1285 (setq indent (f90-comment-indent))
1294 (if (and (looking-at "end") f90-smart-end) 1286 (if (and (looking-at "end") f90-smart-end)
1295 (f90-match-end)) 1287 (f90-match-end))
1296 (setq indent (f90-calculate-indent))) 1288 (setq indent (f90-calculate-indent)))
1297 (if (zerop (- indent (current-column))) 1289 (if (zerop (- indent (current-column)))
1298 nil 1290 nil
@@ -1301,7 +1293,7 @@ after indenting."
1301 ;; position after the indentation. Else stay at same point in text. 1293 ;; position after the indentation. Else stay at same point in text.
1302 (if (< (point) (marker-position pos)) 1294 (if (< (point) (marker-position pos))
1303 (goto-char (marker-position pos))) 1295 (goto-char (marker-position pos)))
1304 (if auto-fill-function 1296 (if auto-fill-function
1305 (f90-do-auto-fill) ; also updates line 1297 (f90-do-auto-fill) ; also updates line
1306 (if (not no-update) (f90-update-line))) 1298 (if (not no-update) (f90-update-line)))
1307 (set-marker pos nil))) 1299 (set-marker pos nil)))
@@ -1368,7 +1360,7 @@ If run in the middle of a line, the line is not broken."
1368 (if struct (setq block-list (cons struct block-list))) 1360 (if struct (setq block-list (cons struct block-list)))
1369 (while (and (f90-line-continued) (zerop (forward-line 1)) 1361 (while (and (f90-line-continued) (zerop (forward-line 1))
1370 (< (point) end-region-mark)) 1362 (< (point) end-region-mark))
1371 (if (not (zerop (- (current-indentation) 1363 (if (not (zerop (- (current-indentation)
1372 (+ ind-curr f90-continuation-indent)))) 1364 (+ ind-curr f90-continuation-indent))))
1373 (f90-indent-to (+ ind-curr f90-continuation-indent) 'no-line-no))) 1365 (f90-indent-to (+ ind-curr f90-continuation-indent) 'no-line-no)))
1374 ;; process all following lines 1366 ;; process all following lines
@@ -1400,7 +1392,7 @@ If run in the middle of a line, the line is not broken."
1400 ((setq end-struct (f90-looking-at-program-block-end)) 1392 ((setq end-struct (f90-looking-at-program-block-end))
1401 (setq beg-struct (car block-list) 1393 (setq beg-struct (car block-list)
1402 block-list (cdr block-list)) 1394 block-list (cdr block-list))
1403 (if f90-smart-end 1395 (if f90-smart-end
1404 (save-excursion 1396 (save-excursion
1405 (f90-block-match (car beg-struct)(car (cdr beg-struct)) 1397 (f90-block-match (car beg-struct)(car (cdr beg-struct))
1406 (car end-struct)(car (cdr end-struct))))) 1398 (car end-struct)(car (cdr end-struct)))))
@@ -1418,7 +1410,7 @@ If run in the middle of a line, the line is not broken."
1418 (f90-indent-to ind-curr)) 1410 (f90-indent-to ind-curr))
1419 (while (and (f90-line-continued) (zerop (forward-line 1)) 1411 (while (and (f90-line-continued) (zerop (forward-line 1))
1420 (< (point) end-region-mark)) 1412 (< (point) end-region-mark))
1421 (if (not (zerop (- (current-indentation) 1413 (if (not (zerop (- (current-indentation)
1422 (+ ind-curr f90-continuation-indent)))) 1414 (+ ind-curr f90-continuation-indent))))
1423 (f90-indent-to (+ ind-curr f90-continuation-indent) 'no-line-no)))) 1415 (f90-indent-to (+ ind-curr f90-continuation-indent) 'no-line-no))))
1424 ;; restore point etc 1416 ;; restore point etc
@@ -1465,7 +1457,7 @@ is non-nil, call `f90-update-line' after inserting the continuation marker."
1465 (newline 1) 1457 (newline 1)
1466 (if f90-beginning-ampersand (insert "&"))))) 1458 (if f90-beginning-ampersand (insert "&")))))
1467 (indent-according-to-mode)) 1459 (indent-according-to-mode))
1468 1460
1469(defun f90-find-breakpoint () 1461(defun f90-find-breakpoint ()
1470 "From `fill-column', search backward for break-delimiter." 1462 "From `fill-column', search backward for break-delimiter."
1471 (let ((bol (line-beginning-position))) 1463 (let ((bol (line-beginning-position)))
@@ -1487,13 +1479,13 @@ Update keyword case first."
1487 ;; Will not break **, //, or => (specified by f90-no-break-re). 1479 ;; Will not break **, //, or => (specified by f90-no-break-re).
1488 (f90-update-line) 1480 (f90-update-line)
1489 (while (> (current-column) fill-column) 1481 (while (> (current-column) fill-column)
1490 (let ((pos-mark (point-marker))) 1482 (let ((pos-mark (point-marker)))
1491 (move-to-column fill-column) 1483 (move-to-column fill-column)
1492 (if (not (f90-in-string)) 1484 (if (not (f90-in-string))
1493 (f90-find-breakpoint)) 1485 (f90-find-breakpoint))
1494 (f90-break-line) 1486 (f90-break-line)
1495 (goto-char pos-mark) 1487 (goto-char pos-mark)
1496 (set-marker pos-mark nil)))) 1488 (set-marker pos-mark nil))))
1497 1489
1498 1490
1499(defun f90-join-lines () 1491(defun f90-join-lines ()
@@ -1554,20 +1546,20 @@ Leave point at the end of line."
1554 (if end-block 1546 (if end-block
1555 (progn 1547 (progn
1556 (message "END %s does not match %s." end-block beg-block) 1548 (message "END %s does not match %s." end-block beg-block)
1557 (end-of-line) 1549 (end-of-line)
1558 (throw 'no-match nil)) 1550 (throw 'no-match nil))
1559 (message "Inserting %s." beg-block) 1551 (message "Inserting %s." beg-block)
1560 (insert (concat " " beg-block))) 1552 (insert (concat " " beg-block)))
1561 (search-forward end-block)) 1553 (search-forward end-block))
1562 (if (not (f90-equal-symbols beg-name end-name)) 1554 (if (not (f90-equal-symbols beg-name end-name))
1563 (cond ((and beg-name (not end-name)) 1555 (cond ((and beg-name (not end-name))
1564 (message "Inserting %s." beg-name) 1556 (message "Inserting %s." beg-name)
1565 (insert (concat " " beg-name))) 1557 (insert (concat " " beg-name)))
1566 ((and beg-name end-name) 1558 ((and beg-name end-name)
1567 (message "Replacing %s with %s." end-name beg-name) 1559 (message "Replacing %s with %s." end-name beg-name)
1568 (search-forward end-name) 1560 (search-forward end-name)
1569 (replace-match beg-name)) 1561 (replace-match beg-name))
1570 ((and (not beg-name) end-name) 1562 ((and (not beg-name) end-name)
1571 (message "Deleting %s." end-name) 1563 (message "Deleting %s." end-name)
1572 (search-forward end-name) 1564 (search-forward end-name)
1573 (replace-match ""))) 1565 (replace-match "")))
@@ -1586,12 +1578,12 @@ Leave point at the end of line."
1586 (setq end-name (car (cdr end-struct))) 1578 (setq end-name (car (cdr end-struct)))
1587 (save-excursion 1579 (save-excursion
1588 (beginning-of-line) 1580 (beginning-of-line)
1589 (while 1581 (while
1590 (and (not (zerop count)) 1582 (and (not (zerop count))
1591 (let ((stop nil) notexist) 1583 (let ((stop nil) notexist)
1592 (while (not stop) 1584 (while (not stop)
1593 (setq notexist 1585 (setq notexist
1594 (not (re-search-backward 1586 (not (re-search-backward
1595 (concat "\\(" f90-blocks-re "\\)") nil t))) 1587 (concat "\\(" f90-blocks-re "\\)") nil t)))
1596 (if notexist 1588 (if notexist
1597 (setq stop t) 1589 (setq stop t)
@@ -1638,7 +1630,7 @@ Leave point at the end of line."
1638;; abbrevs and keywords 1630;; abbrevs and keywords
1639 1631
1640(defun f90-abbrev-start () 1632(defun f90-abbrev-start ()
1641 "Typing `\\[help-command] or `? lists all the F90 abbrevs. 1633 "Typing `\\[help-command] or `? lists all the F90 abbrevs.
1642Any other key combination is executed normally." 1634Any other key combination is executed normally."
1643 (interactive) 1635 (interactive)
1644 (let (e c) 1636 (let (e c)
@@ -1706,7 +1698,7 @@ Any other key combination is executed normally."
1706 (save-excursion 1698 (save-excursion
1707 (setq beg (if beg beg (point-min))) 1699 (setq beg (if beg beg (point-min)))
1708 (setq end (if end end (point-max))) 1700 (setq end (if end end (point-max)))
1709 (let ((keyword-re 1701 (let ((keyword-re
1710 (concat "\\(" 1702 (concat "\\("
1711 f90-keywords-re "\\|" f90-procedures-re "\\|" 1703 f90-keywords-re "\\|" f90-procedures-re "\\|"
1712 f90-hpf-keywords-re "\\|" f90-operators-re "\\)")) 1704 f90-hpf-keywords-re "\\|" f90-operators-re "\\)"))