Mercurial > emacs
comparison lisp/progmodes/fortran.el @ 12772:f4b2913b7f58
(fortran-auto-fill-mode, fortran-do-auto-fill, fortran-fill):
Invoke auto filling only when past fill-column.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 05 Aug 1995 01:02:10 +0000 |
parents | ad18c3ad23b3 |
children | 33e141d3250f |
comparison
equal
deleted
inserted
replaced
12771:6f07c79d9a05 | 12772:f4b2913b7f58 |
---|---|
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.5.1 (Sept 16, 1994) | 7 ;; Version 1.30.6 (July 27, 1995) |
8 ;; Keywords: languages | 8 ;; Keywords: languages |
9 | 9 |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 | 11 |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
44 ;;; comment-indent-function with comment-indent-hook | 44 ;;; comment-indent-function with comment-indent-hook |
45 ;;; (setq unread-command-events (list c)) with (setq unread-command-char c) | 45 ;;; (setq unread-command-events (list c)) with (setq unread-command-char c) |
46 | 46 |
47 ;;; Bugs to bug-fortran-mode@erl.mit.edu | 47 ;;; Bugs to bug-fortran-mode@erl.mit.edu |
48 | 48 |
49 (defconst fortran-mode-version "version 1.30.5.1") | 49 (defconst fortran-mode-version "version 1.30.6") |
50 | 50 |
51 ;;; Code: | 51 ;;; Code: |
52 | 52 |
53 ;;;###autoload | 53 ;;;###autoload |
54 (defvar fortran-tab-mode-default nil | 54 (defvar fortran-tab-mode-default nil |
158 (defvar fortran-analyze-depth 100 | 158 (defvar fortran-analyze-depth 100 |
159 "Number of lines to scan to determine whether to use fixed or TAB format\ | 159 "Number of lines to scan to determine whether to use fixed or TAB format\ |
160 style.") | 160 style.") |
161 | 161 |
162 (defvar fortran-break-before-delimiters t | 162 (defvar fortran-break-before-delimiters t |
163 "*Non-nil causes `fortran-do-auto-fill' to break lines before delimiters.") | 163 "*Non-nil causes `fortran-fill' to break lines before delimiters.") |
164 | 164 |
165 (if fortran-mode-syntax-table | 165 (if fortran-mode-syntax-table |
166 () | 166 () |
167 (setq fortran-mode-syntax-table (make-syntax-table)) | 167 (setq fortran-mode-syntax-table (make-syntax-table)) |
168 (modify-syntax-entry ?\; "w" fortran-mode-syntax-table) | 168 (modify-syntax-entry ?\; "w" fortran-mode-syntax-table) |
440 region. (default \"c$$$\") | 440 region. (default \"c$$$\") |
441 fortran-electric-line-number | 441 fortran-electric-line-number |
442 Non-nil causes line number digits to be moved to the correct column | 442 Non-nil causes line number digits to be moved to the correct column |
443 as typed. (default t) | 443 as typed. (default t) |
444 fortran-break-before-delimiters | 444 fortran-break-before-delimiters |
445 Non-nil causes `fortran-do-auto-fill' breaks lines before delimiters. | 445 Non-nil causes `fortran-fill' breaks lines before delimiters. |
446 (default t) | 446 (default t) |
447 fortran-startup-message | 447 fortran-startup-message |
448 Set to nil to inhibit message first time Fortran mode is used. | 448 Set to nil to inhibit message first time Fortran mode is used. |
449 | 449 |
450 Turning on Fortran mode calls the value of the variable `fortran-mode-hook' | 450 Turning on Fortran mode calls the value of the variable `fortran-mode-hook' |
1032 (move-to-column cfi)) | 1032 (move-to-column cfi)) |
1033 (if (and auto-fill-function | 1033 (if (and auto-fill-function |
1034 (> (save-excursion (end-of-line) (current-column)) fill-column)) | 1034 (> (save-excursion (end-of-line) (current-column)) fill-column)) |
1035 (save-excursion | 1035 (save-excursion |
1036 (end-of-line) | 1036 (end-of-line) |
1037 (fortran-do-auto-fill))) | 1037 (fortran-fill))) |
1038 (if fortran-blink-matching-if | 1038 (if fortran-blink-matching-if |
1039 (progn | 1039 (progn |
1040 (fortran-blink-matching-if) | 1040 (fortran-blink-matching-if) |
1041 (fortran-blink-matching-do))))) | 1041 (fortran-blink-matching-do))))) |
1042 | 1042 |
1406 (interactive "P") | 1406 (interactive "P") |
1407 (prog1 (setq auto-fill-function | 1407 (prog1 (setq auto-fill-function |
1408 (if (if (null arg) | 1408 (if (if (null arg) |
1409 (not auto-fill-function) | 1409 (not auto-fill-function) |
1410 (> (prefix-numeric-value arg) 0)) | 1410 (> (prefix-numeric-value arg) 0)) |
1411 'fortran-indent-line | 1411 'fortran-do-auto-fill |
1412 nil)) | 1412 nil)) |
1413 (force-mode-line-update))) | 1413 (force-mode-line-update))) |
1414 | 1414 |
1415 (defun fortran-do-auto-fill () | 1415 (defun fortran-do-auto-fill () |
1416 (if (> (current-column) fill-column) | |
1417 (fortran-indent-line))) | |
1418 | |
1419 (defun fortran-fill () | |
1416 (interactive) | 1420 (interactive) |
1417 (let* ((opoint (point)) | 1421 (let* ((opoint (point)) |
1418 (bol (save-excursion (beginning-of-line) (point))) | 1422 (bol (save-excursion (beginning-of-line) (point))) |
1419 (eol (save-excursion (end-of-line) (point))) | 1423 (eol (save-excursion (end-of-line) (point))) |
1420 (bos (min eol (+ bol (fortran-current-line-indentation)))) | 1424 (bos (min eol (+ bol (fortran-current-line-indentation)))) |
1508 (looking-at "\t[1-9]"))) | 1512 (looking-at "\t[1-9]"))) |
1509 (progn | 1513 (progn |
1510 (end-of-line) | 1514 (end-of-line) |
1511 (delete-region (point) (match-end 0)) | 1515 (delete-region (point) (match-end 0)) |
1512 (delete-horizontal-space) | 1516 (delete-horizontal-space) |
1513 (fortran-do-auto-fill)) | 1517 (fortran-fill)) |
1514 (fortran-split-line)) | 1518 (fortran-split-line)) |
1515 (if comment-string | 1519 (if comment-string |
1516 (save-excursion | 1520 (save-excursion |
1517 (goto-char bol) | 1521 (goto-char bol) |
1518 (end-of-line) | 1522 (end-of-line) |