# HG changeset patch # User Dave Love # Date 886182577 0 # Node ID 918448e5d2949b39236c466c24e5969471699444 # Parent 14fa73136e644fce074d4a0f01b46e0785f287e5 Various docstring and commentary fixes, including note of current maintainer. (fortran-mode): Use imenu-syntax-alist. (fortran-imenu-generic-expression): Use fortran-continuation-string, not always `+'. (fortran-font-lock-keywords-1): Include symbol syntax as well as word, following syntax table changes. (fortran-imenu-generic-expression): Likewise. (fortran-mode-map): Add a menu. (fortran-mode-version, fortran-startup-message): Delete misleading variables. (fortran-mode): Don't use them. (fortran-column-ruler-fixed, fortran-column-ruler-tab): Fix leading \ which made `0' into null. (fortran-join-lines): New function and key binding. (fortran-narrow-to-subprogram): New function and key binding. (fortran-mode-syntax-table): Make ?., ?_, ?$ symbol, not word. diff -r 14fa73136e64 -r 918448e5d294 lisp/progmodes/fortran.el --- a/lisp/progmodes/fortran.el Fri Jan 30 11:05:41 1998 +0000 +++ b/lisp/progmodes/fortran.el Fri Jan 30 17:49:37 1998 +0000 @@ -1,10 +1,9 @@ ;;; fortran.el --- Fortran mode for GNU Emacs -;; Copyright (c) 1986, 1993, 1994, 1995, 1997 Free Software Foundation, Inc. +;; Copyright (c) 1986, 1993, 1994, 1995, 1997, 1998 Free Software Foundation, Inc. ;; Author: Michael D. Prange -;; Maintainer: bug-fortran-mode@erl.mit.edu (Steve Gildea and others) -;; Version 1.30.6 (July 27, 1995) +;; Maintainer: Dave Love ;; Keywords: languages ;; This file is part of GNU Emacs. @@ -26,30 +25,24 @@ ;;; Commentary: -;; Fortran mode has been upgraded and is now maintained by Stephen A. Wood -;; (saw@cebaf.gov). It now will use either fixed format continuation line -;; markers (character in 6th column), or tab format continuation line style -;; (digit after a TAB character.) A auto-fill mode has been added to -;; automatically wrap fortran lines that get too long. +;; This mode is documented in the Emacs manual. +;; +;; Note that it is for editing Fortran77 or Fortran90 fixed source +;; form. For editing Fortran90 free format source, use `f90-mode' +;; (f90.el). + +;;; History: + +;; Fortran mode was upgraded by Stephen A. Wood (saw@cebaf.gov). ;; We acknowledge many contributions and valuable suggestions by ;; Lawrence R. Dodd, Ralf Fassel, Ralph Finch, Stephen Gildea, ;; Dr. Anil Gokhale, Ulrich Mueller, Mark Neale, Eric Prestemon, ;; Gary Sabot and Richard Stallman. -;; This file may be used with GNU Emacs version 18.xx if the following -;; variable and function substitutions are made. -;; Replace: -;; frame-width with screen-width -;; auto-fill-function with auto-fill-hook -;; comment-indent-function with comment-indent-hook -;; (setq unread-command-events (list c)) with (setq unread-command-char c) - -;; Bugs to bug-fortran-mode@erl.mit.edu - ;;; Code: -(defconst fortran-mode-version "version 1.30.6") +(require 'easymenu) (defgroup fortran nil "Fortran mode for Emacs" @@ -102,7 +95,8 @@ :group 'fortran-indent) (defcustom fortran-comment-indent-style 'fixed - "*nil forces comment lines not to be touched, + "*How to indent comments. +nil forces comment lines not to be touched, 'fixed makes fixed comment indentation to `fortran-comment-line-extra-indent' columns beyond `fortran-minimum-statement-indent-fixed' (for `indent-tabs-mode' of nil) or `fortran-minimum-statement-indent-tab' (for @@ -175,13 +169,13 @@ (defcustom fortran-comment-region "c$$$" "*String inserted by \\[fortran-comment-region]\ - at start of each line in region." +at start of each line in region." :type 'string :group 'fortran-comment) (defcustom fortran-electric-line-number t "*Non-nil causes line number digits to be moved to the correct column as\ - typed." +typed." :type 'boolean :group 'fortran) @@ -192,7 +186,7 @@ (defvar fortran-column-ruler-fixed "0 4 6 10 20 30 40 5\ -\0 60 70\n\ +0 60 70\n\ \[ ]|{ | | | | | | | | \ \| | | | |}\n" "*String displayed above current line by \\[fortran-column-ruler]. @@ -200,7 +194,7 @@ (defvar fortran-column-ruler-tab "0 810 20 30 40 5\ -\0 60 70\n\ +0 60 70\n\ \[ ]| { | | | | | | | | \ \| | | | |}\n" "*String displayed above current line by \\[fortran-column-ruler]. @@ -214,7 +208,7 @@ (defvar fortran-analyze-depth 100 "Number of lines to scan to determine whether to use fixed or TAB format\ - style.") +style.") (defcustom fortran-break-before-delimiters t "*Non-nil causes `fortran-fill' to break lines before delimiters." @@ -224,6 +218,8 @@ (if fortran-mode-syntax-table () (setq fortran-mode-syntax-table (make-syntax-table)) + ;; We might like `;' to be punctuation (g77 multi-statement lines), + ;; but that screws abbrevs. (modify-syntax-entry ?\; "w" fortran-mode-syntax-table) (modify-syntax-entry ?\r " " fortran-mode-syntax-table) (modify-syntax-entry ?+ "." fortran-mode-syntax-table) @@ -234,8 +230,11 @@ (modify-syntax-entry ?\' "\"" fortran-mode-syntax-table) (modify-syntax-entry ?\" "\"" fortran-mode-syntax-table) (modify-syntax-entry ?\\ "/" fortran-mode-syntax-table) - (modify-syntax-entry ?. "w" fortran-mode-syntax-table) - (modify-syntax-entry ?_ "w" fortran-mode-syntax-table) + ;; This might be better as punctuation, as for C, but this way you + ;; can treat floating-point numbers as symbols. + (modify-syntax-entry ?. "_" fortran-mode-syntax-table) ; e.g. `a.ne.b' + (modify-syntax-entry ?_ "_" fortran-mode-syntax-table) + (modify-syntax-entry ?$ "_" fortran-mode-syntax-table) ; esp. VMSisms (modify-syntax-entry ?\! "<" fortran-mode-syntax-table) (modify-syntax-entry ?\n ">" fortran-mode-syntax-table)) @@ -372,20 +371,22 @@ (defvar fortran-imenu-generic-expression ;; These patterns could be confused by sequence nos. in cols 72+ and ;; don't allow continuations everywhere. - '((nil - ;; Lines below are: 1. leading whitespace; 2. function - ;; declaration with optional type, e.g. `real', `real*4', - ;; character(*), `double precision' and possible statement - ;; continuation; 3. untyped declarations; 4. the variable to - ;; index. [This will be fooled by `end function' allowed by G77. - ;; Also, it assumes sensible whitespace is employed.] - "^\\s-+\\(\ + (list + (list + nil + ;; Lines below are: 1. leading whitespace; 2. function + ;; declaration with optional type, e.g. `real', `real*4', + ;; character(*), `double precision' and possible statement + ;; continuation; 3. untyped declarations; 4. the variable to + ;; index. [This will be fooled by `end function' allowed by G77. + ;; Also, it assumes sensible whitespace is employed.] + (concat "^\\s-+\\(\ \\(\\sw\\|\\s-\\|[*()+]\\)*\\