comparison lisp/modes/fortran.el @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 49a24b4fd526
comparison
equal deleted inserted replaced
1:c0c6a60d29db 2:ac2d302a0011
1 ;;; fortran.el --- Fortran mode for GNU Emacs 1 ;;; fortran.el --- Fortran mode for GNU Emacs
2 2
3 ;;; Copyright (c) 1986, 1993, 1994, 1995 Free Software Foundation, Inc. 3 ;; Copyright (c) 1986, 1993, 1994, 1995 Free Software Foundation, Inc.
4 4
5 ;; Author: Michael D. Prange <prange@erl.mit.edu> 5 ;; Author: Michael D. Prange <prange@erl.mit.edu>
6 ;; Maintainer: bug-fortran-mode@erl.mit.edu 6 ;; Maintainer: bug-fortran-mode@erl.mit.edu
7 ;; Version 1.30.6 (July 27, 1995) 7 ;; Version 1.30.6 (July 27, 1995)
8 ;; Keywords: languages 8 ;; Keywords: languages
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details. 20 ;; General Public License for more details.
21 21
22 ;; You should have received a copy of the GNU General Public License 22 ;; You should have received a copy of the GNU General Public License
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free 23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
24 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 25 ;; 02111-1307, USA.
26 ;;; Synched up with: FSF 19.30. 26
27 ;;; Synched up with: FSF 19.34.
27 28
28 ;;; Commentary: 29 ;;; Commentary:
29 30
30 ;; Fortran mode has been upgraded and is now maintained by Stephen A. Wood 31 ;; Fortran mode has been upgraded and is now maintained by Stephen A. Wood
31 ;; (saw@cebaf.gov). It now will use either fixed format continuation line 32 ;; (saw@cebaf.gov). It now will use either fixed format continuation line
36 ;; We acknowledge many contributions and valuable suggestions by 37 ;; We acknowledge many contributions and valuable suggestions by
37 ;; Lawrence R. Dodd, Ralf Fassel, Ralph Finch, Stephen Gildea, 38 ;; Lawrence R. Dodd, Ralf Fassel, Ralph Finch, Stephen Gildea,
38 ;; Dr. Anil Gokhale, Ulrich Mueller, Mark Neale, Eric Prestemon, 39 ;; Dr. Anil Gokhale, Ulrich Mueller, Mark Neale, Eric Prestemon,
39 ;; Gary Sabot and Richard Stallman. 40 ;; Gary Sabot and Richard Stallman.
40 41
41 ;;; This file may be used with GNU Emacs version 18.xx if the following 42 ;; This file may be used with GNU Emacs version 18.xx if the following
42 ;;; variable and function substitutions are made. 43 ;; variable and function substitutions are made.
43 ;;; Replace: 44 ;; Replace:
44 ;;; frame-width with screen-width 45 ;; frame-width with screen-width
45 ;;; auto-fill-function with auto-fill-hook 46 ;; auto-fill-function with auto-fill-hook
46 ;;; comment-indent-function with comment-indent-hook 47 ;; comment-indent-function with comment-indent-hook
47 ;;; (setq unread-command-events (list c)) with (setq unread-command-char c) 48 ;; (setq unread-command-events (list c)) with (setq unread-command-char c)
48 49
49 ;;; Bugs to bug-fortran-mode@erl.mit.edu 50 ;; Bugs to bug-fortran-mode@erl.mit.edu
51
52 ;;; Code:
50 53
51 (defconst fortran-mode-version "version 1.30.6") 54 (defconst fortran-mode-version "version 1.30.6")
52
53 ;;; Code:
54 55
55 ;;;###autoload 56 ;;;###autoload
56 (defvar fortran-tab-mode-default nil 57 (defvar fortran-tab-mode-default nil
57 "*Default tabbing/carriage control style for empty files in Fortran mode. 58 "*Default tabbing/carriage control style for empty files in Fortran mode.
58 A value of t specifies tab-digit style of continuation control. 59 A value of t specifies tab-digit style of continuation control.
170 (modify-syntax-entry ?\; "w" fortran-mode-syntax-table) 171 (modify-syntax-entry ?\; "w" fortran-mode-syntax-table)
171 (modify-syntax-entry ?\r " " fortran-mode-syntax-table) 172 (modify-syntax-entry ?\r " " fortran-mode-syntax-table)
172 (modify-syntax-entry ?+ "." fortran-mode-syntax-table) 173 (modify-syntax-entry ?+ "." fortran-mode-syntax-table)
173 (modify-syntax-entry ?- "." fortran-mode-syntax-table) 174 (modify-syntax-entry ?- "." fortran-mode-syntax-table)
174 (modify-syntax-entry ?= "." fortran-mode-syntax-table) 175 (modify-syntax-entry ?= "." fortran-mode-syntax-table)
176 ;; XEmacs change
175 ;;(modify-syntax-entry ?* "." fortran-mode-syntax-table) 177 ;;(modify-syntax-entry ?* "." fortran-mode-syntax-table)
176 (modify-syntax-entry ?/ "." fortran-mode-syntax-table) 178 (modify-syntax-entry ?/ "." fortran-mode-syntax-table)
177 (modify-syntax-entry ?\' "\"" fortran-mode-syntax-table) 179 (modify-syntax-entry ?\' "\"" fortran-mode-syntax-table)
178 (modify-syntax-entry ?\" "\"" fortran-mode-syntax-table) 180 (modify-syntax-entry ?\" "\"" fortran-mode-syntax-table)
179 (modify-syntax-entry ?\\ "/" fortran-mode-syntax-table) 181 (modify-syntax-entry ?\\ "/" fortran-mode-syntax-table)
180 (modify-syntax-entry ?. "w" fortran-mode-syntax-table) 182 (modify-syntax-entry ?. "w" fortran-mode-syntax-table)
181 (modify-syntax-entry ?_ "w" fortran-mode-syntax-table) 183 (modify-syntax-entry ?_ "w" fortran-mode-syntax-table)
182 (modify-syntax-entry ?\! "<" fortran-mode-syntax-table) 184 (modify-syntax-entry ?\! "<" fortran-mode-syntax-table)
185 ;; XEmacs change
183 ;;(modify-syntax-entry ?\n ">" fortran-mode-syntax-table) 186 ;;(modify-syntax-entry ?\n ">" fortran-mode-syntax-table)
184 187
185 ;; XEmacs: an attempt to make font-lock understand fortran comments. 188 ;; XEmacs: an attempt to make font-lock understand fortran comments.
186 (modify-syntax-entry ?\n "> 1" fortran-mode-syntax-table) 189 (modify-syntax-entry ?\n "> 1" fortran-mode-syntax-table)
187 (modify-syntax-entry ?* ". 2" fortran-mode-syntax-table) 190 (modify-syntax-entry ?* ". 2" fortran-mode-syntax-table)
318 ) 321 )
319 322
320 (defvar fortran-font-lock-keywords fortran-font-lock-keywords-1 323 (defvar fortran-font-lock-keywords fortran-font-lock-keywords-1
321 "Default expressions to highlight in Fortran mode.") 324 "Default expressions to highlight in Fortran mode.")
322 325
326 ;; XEmacs change
323 (put 'fortran-mode 'font-lock-defaults '((fortran-font-lock-keywords 327 (put 'fortran-mode 'font-lock-defaults '((fortran-font-lock-keywords
324 fortran-font-lock-keywords-1 328 fortran-font-lock-keywords-1
325 fortran-font-lock-keywords-2 329 fortran-font-lock-keywords-2
326 fortran-font-lock-keywords-3) 330 fortran-font-lock-keywords-3)
327 t t ((?/ . "$/")))) 331 t t ((?/ . "$/"))))
578 (message "Emacs Fortran mode %s. Bugs to %s" 582 (message "Emacs Fortran mode %s. Bugs to %s"
579 fortran-mode-version bug-fortran-mode)) 583 fortran-mode-version bug-fortran-mode))
580 (setq fortran-startup-message nil) 584 (setq fortran-startup-message nil)
581 (setq local-abbrev-table fortran-mode-abbrev-table) 585 (setq local-abbrev-table fortran-mode-abbrev-table)
582 (set-syntax-table fortran-mode-syntax-table) 586 (set-syntax-table fortran-mode-syntax-table)
587 ;; Font Lock mode support. (Removed for XEmacs)
588 ;; (make-local-variable 'font-lock-defaults)
589 ;; (setq font-lock-defaults '((fortran-font-lock-keywords
590 ;; fortran-font-lock-keywords-1
591 ;; fortran-font-lock-keywords-2
592 ;; fortran-font-lock-keywords-3)
593 ;; t t ((?/ . "$/"))))
583 (make-local-variable 'fortran-break-before-delimiters) 594 (make-local-variable 'fortran-break-before-delimiters)
584 (setq fortran-break-before-delimiters t) 595 (setq fortran-break-before-delimiters t)
585 (make-local-variable 'indent-line-function) 596 (make-local-variable 'indent-line-function)
586 (setq indent-line-function 'fortran-indent-line) 597 (setq indent-line-function 'fortran-indent-line)
587 (make-local-variable 'comment-indent-function) 598 (make-local-variable 'comment-indent-function)
692 703
693 (defun fortran-abbrev-start () 704 (defun fortran-abbrev-start ()
694 "Typing ;\\[help-command] or ;? lists all the Fortran abbrevs. 705 "Typing ;\\[help-command] or ;? lists all the Fortran abbrevs.
695 Any other key combination is executed normally." 706 Any other key combination is executed normally."
696 (interactive) 707 (interactive)
708 ;; XEmacs change
697 (let (e c) 709 (let (e c)
698 (insert last-command-char) 710 (insert last-command-char)
699 (setq e (next-command-event) 711 (setq e (next-command-event)
700 c (event-to-character e)) 712 c (event-to-character e))
701 ;; insert char if not equal to `?' 713 ;; insert char if not equal to `?'
702 (if (or (= c ??) (eq c help-char)) 714 (if (or (= c ??) (eq c help-char))
703 (fortran-abbrev-help) 715 (fortran-abbrev-help)
704 (setq unread-command-event e)))) 716 (setq unread-command-events e))))
705 717
706 (defun fortran-abbrev-help () 718 (defun fortran-abbrev-help ()
707 "List the currently defined abbrevs in Fortran mode." 719 "List the currently defined abbrevs in Fortran mode."
708 (interactive) 720 (interactive)
709 (message "Listing abbrev table...") 721 (message "Listing abbrev table...")
763 (if (or (not arg) 775 (if (or (not arg)
764 (= arg 1)) 776 (= arg 1))
765 (save-window-excursion 777 (save-window-excursion
766 (if (not (equal (fortran-window-create) 'error)) 778 (if (not (equal (fortran-window-create) 'error))
767 (progn (message "Type SPC to continue editing.") 779 (progn (message "Type SPC to continue editing.")
780 ;; XEmacs change
768 (let ((char (next-command-event))) 781 (let ((char (next-command-event)))
769 (or (equal (event-to-character char) ? ) 782 (or (equal (event-to-character char) ? )
770 (setq unread-command-event char)))))) 783 (setq unread-command-events char))))))
771 (fortran-window-create))) 784 (fortran-window-create)))
772 785
773 (defun fortran-split-line () 786 (defun fortran-split-line ()
774 "Break line at point and insert continuation marker and alignment." 787 "Break line at point and insert continuation marker and alignment."
775 (interactive) 788 (interactive)
1529 (if (if (null arg) 1542 (if (if (null arg)
1530 (not auto-fill-function) 1543 (not auto-fill-function)
1531 (> (prefix-numeric-value arg) 0)) 1544 (> (prefix-numeric-value arg) 0))
1532 'fortran-do-auto-fill 1545 'fortran-do-auto-fill
1533 nil)) 1546 nil))
1534 (force-mode-line-update))) 1547 (redraw-modeline)))
1535 1548
1536 (defun fortran-do-auto-fill () 1549 (defun fortran-do-auto-fill ()
1537 (if (> (current-column) fill-column) 1550 (if (> (current-column) fill-column)
1538 (fortran-indent-line))) 1551 (fortran-indent-line)))
1539 1552
1673 minor-mode-alist))) 1686 minor-mode-alist)))
1674 1687
1675 (provide 'fortran) 1688 (provide 'fortran)
1676 1689
1677 ;;; fortran.el ends here 1690 ;;; fortran.el ends here
1678