User: viteno
Date: 05/12/20 07:38:51
Modified: packages/xemacs-packages/fortran-modes ChangeLog fortran.el
Log:
Sync fortran.el with GNU Emacs 21.3.1
Revision Changes Path
1.14 +4 -0 XEmacs/packages/xemacs-packages/fortran-modes/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/fortran-modes/ChangeLog,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -p -r1.13 -r1.14
--- ChangeLog 2004/02/11 16:08:31 1.13
+++ ChangeLog 2005/12/20 06:38:51 1.14
@@ -1,3 +1,7 @@
+2005-12-20 Sergio Ballestrero <s.ballestrero(a)firenze.linux.it>
+
+ * fortran.el: Sync with Emacs 21.3.1.
+
2004-02-11 Norbert Koch <viteno(a)xemacs.org>
* Makefile (VERSION): XEmacs package 1.04 released.
1.4 +119 -21 XEmacs/packages/xemacs-packages/fortran-modes/fortran.el
Index: fortran.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/fortran-modes/fortran.el,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- fortran.el 2003/01/06 18:31:12 1.3
+++ fortran.el 2005/12/20 06:38:51 1.4
@@ -119,12 +119,12 @@ Fortran indentation plus `fortran-commen
:group 'fortran-indent
:group 'fortran-comment)
-(defcustom comment-line-start nil
+(defcustom fortran-comment-line-start nil
"*Delimiter inserted to start new full-line comment."
:type '(choice string (const nil))
:group 'fortran-comment)
-(defcustom comment-line-start-skip nil
+(defcustom fortran-comment-line-start-skip nil
"*Regexp to match the start of a full-line comment."
:type '(choice string (const nil))
:group 'fortran-comment)
@@ -489,6 +489,8 @@ This variable used in TAB format mode.")
(define-key fortran-mode-map "\C-c\C-r" 'fortran-column-ruler)
(define-key fortran-mode-map "\C-c\C-p" 'fortran-previous-statement)
(define-key fortran-mode-map "\C-c\C-n" 'fortran-next-statement)
+ (define-key fortran-mode-map "\C-c\C-d" 'fortran-join-line) ; like f90
+ (define-key fortran-mode-map "\M-^" 'fortran-join-line) ; subvert
delete-indentation
(define-key fortran-mode-map "\t" 'fortran-indent-line)
(define-key fortran-mode-map "0" 'fortran-electric-line-number)
(define-key fortran-mode-map "1" 'fortran-electric-line-number)
@@ -659,12 +661,12 @@ with no args, if that value is non-nil."
(setq indent-line-function 'fortran-indent-line)
(make-local-variable 'comment-indent-function)
(setq comment-indent-function 'fortran-comment-hook)
- (make-local-variable 'comment-line-start-skip)
- (setq comment-line-start-skip
+ (make-local-variable 'fortran-comment-line-start-skip)
+ (setq fortran-comment-line-start-skip
"^[Cc*]\\(\\([^ \t\n]\\)\\2\\2*\\)?[ \t]*\\|^#.*")
- (make-local-variable 'comment-line-start)
- (setq comment-line-start "c")
- (make-local-variable 'comment-start-skip)
+ (make-local-variable 'fortran-comment-line-start)
+ (setq fortran-comment-line-start "c")
+ (make-local-variable 'fortran-comment-start-skip)
(setq comment-start-skip "![ \t]*")
(make-local-variable 'comment-start)
(setq comment-start nil)
@@ -688,6 +690,8 @@ with no args, if that value is non-nil."
(make-local-variable 'fortran-tab-mode-string)
(setq fortran-tab-mode-string " TAB-format")
(setq indent-tabs-mode (fortran-analyze-file-format))
+ (set (make-local-variable 'fill-paragraph-function) 'fortran-fill-paragraph)
+ (set (make-local-variable 'normal-auto-fill-function) 'fortran-auto-fill)
(run-hooks 'fortran-mode-hook))
(defun fortran-comment-hook ()
@@ -706,7 +710,7 @@ or on a new line inserted before this li
(interactive)
(beginning-of-line)
;; Recognize existing comments of either kind.
- (cond ((looking-at comment-line-start-skip)
+ (cond ((looking-at fortran-comment-line-start-skip)
(fortran-indent-line))
((fortran-find-comment-start-skip) ; catches any inline comment and
; leaves point after comment-start-skip
@@ -731,7 +735,7 @@ or on a new line inserted before this li
(beginning-of-line)
(insert "\n")
(forward-char -1))
- (insert comment-line-start)
+ (insert fortran-comment-line-start)
(insert-char (if (stringp fortran-comment-indent-char)
(aref fortran-comment-indent-char 0)
fortran-comment-indent-char)
@@ -849,8 +853,8 @@ See also `fortran-window-create'."
"Break line at point and insert continuation marker and alignment."
(interactive)
(delete-horizontal-space)
- (if (save-excursion (beginning-of-line) (looking-at comment-line-start-skip))
- (insert "\n" comment-line-start " ")
+ (if (save-excursion (beginning-of-line) (looking-at fortran-comment-line-start-skip))
+ (insert "\n" fortran-comment-line-start " ")
(if indent-tabs-mode
(progn
(insert "\n\t")
@@ -945,13 +949,13 @@ non-comment Fortran statement in the fil
(beginning-of-line)
(setq continue-test
(and
- (not (looking-at comment-line-start-skip))
+ (not (looking-at fortran-comment-line-start-skip))
(or (looking-at
(concat "[ \t]*" (regexp-quote fortran-continuation-string)))
(or (looking-at " [^ 0\n]")
(looking-at "\t[1-9]")))))
(while (and (setq not-first-statement (= (forward-line -1) 0))
- (or (looking-at comment-line-start-skip)
+ (or (looking-at fortran-comment-line-start-skip)
(looking-at "[ \t]*$")
(looking-at " [^ 0\n]")
(looking-at "\t[1-9]")
@@ -974,7 +978,7 @@ non-comment Fortran statement in the fil
(while (and (setq not-last-statement
(and (= (forward-line 1) 0)
(not (eobp))))
- (or (looking-at comment-line-start-skip)
+ (or (looking-at fortran-comment-line-start-skip)
(looking-at "[ \t]*$")
(looking-at " [^ 0\n]")
(looking-at "\t[1-9]")
@@ -1220,7 +1224,7 @@ The marks are pushed."
(not (fortran-line-number-indented-correctly-p))))
(fortran-indent-to-column cfi)
(beginning-of-line)
- (if (and (not (looking-at comment-line-start-skip))
+ (if (and (not (looking-at fortran-comment-line-start-skip))
(fortran-find-comment-start-skip))
(fortran-indent-comment))))
;; Never leave point in left margin.
@@ -1312,7 +1316,7 @@ An abbrev before point is expanded if `a
(save-excursion
(beginning-of-line)
(cond ((looking-at "[ \t]*$"))
- ((looking-at comment-line-start-skip)
+ ((looking-at fortran-comment-line-start-skip)
(cond ((eq fortran-comment-indent-style 'relative)
(setq icol (+ icol fortran-comment-line-extra-indent)))
((eq fortran-comment-indent-style 'fixed)
@@ -1372,7 +1376,7 @@ For comment lines, returns indentation o
non-indentation text within the comment."
(save-excursion
(beginning-of-line)
- (cond ((looking-at comment-line-start-skip)
+ (cond ((looking-at fortran-comment-line-start-skip)
(goto-char (match-end 0))
(skip-chars-forward
(if (stringp fortran-comment-indent-char)
@@ -1400,7 +1404,7 @@ notes: 1) A non-zero/non-blank character
4) A TAB followed by a digit indicates a continuation line."
(save-excursion
(beginning-of-line)
- (if (looking-at comment-line-start-skip)
+ (if (looking-at fortran-comment-line-start-skip)
(if fortran-comment-indent-style
(let ((char (if (stringp fortran-comment-indent-char)
(aref fortran-comment-indent-char 0)
@@ -1540,7 +1544,7 @@ nil else."
(cond
((bolp) nil) ; bol is never inside a string
((save-excursion ; comment lines too
- (beginning-of-line)(looking-at comment-line-start-skip)) nil)
+ (beginning-of-line)(looking-at fortran-comment-line-start-skip)) nil)
(t (let (;; ok, serious now. Init some local vars:
(parse-state '(0 nil nil nil nil nil 0))
(quoted-comment-start (if comment-start
@@ -1556,7 +1560,7 @@ nil else."
(while not-done
(if (or ;; skip to next line if:
;; - comment line?
- (looking-at comment-line-start-skip)
+ (looking-at fortran-comment-line-start-skip)
;; - at end of line?
(eolp)
;; - not in a string and after comment-start?
@@ -1621,7 +1625,7 @@ automatically breaks the line at a previ
(quote
(save-excursion
(goto-char bol)
- (if (looking-at comment-line-start-skip)
+ (if (looking-at fortran-comment-line-start-skip)
nil ; OK to break quotes on comment lines.
(move-to-column fill-column)
(cond ((fortran-is-in-string-p (point))
@@ -1745,6 +1749,100 @@ file before the end or the first `fortra
'(fortran-tab-mode-string
(indent-tabs-mode fortran-tab-mode-string))
minor-mode-alist)))
+
+; fortran-join-line and fill
+; imported from GNU Emacs 21.3.1 by s.ballestrero(a)firenze.linux.it
+
+(defun fortran-remove-continuation ()
+ (if (looking-at "\\( [^ 0\n]\\|\t[1-9]\\|&\\)")
+ (progn (replace-match "")
+ (delete-indentation)
+ t)))
+
+(defun fortran-join-line (arg)
+ "Join current line to the previous one and re-indent.
+With a prefix argument, repeat this operation that many times.
+If the prefix argument ARG is negative, join the next -ARG lines.
+Continuation lines are correctly handled."
+ (interactive "*p")
+ (save-excursion
+ (when (> 0 arg)
+ (setq arg (- arg))
+ (forward-line arg))
+ (while (not (zerop arg))
+ (beginning-of-line)
+ (or (fortran-remove-continuation)
+ (delete-indentation))
+ (setq arg (1- arg)))
+ (fortran-indent-line)))
+
+(defun fortran-fill-paragraph (&optional justify)
+ "Fill surrounding comment block as paragraphs, else fill statement.
+Intended as the value of `fill-paragraph-function'."
+ (interactive "P")
+ (save-excursion
+ (beginning-of-line)
+ (if (not (looking-at fortran-comment-line-start-skip))
+ (fortran-fill-statement)
+ ;; We're in a comment block. Find the start and end of a
+ ;; paragraph, delimited either by non-comment lines or empty
+ ;; comments. (Get positions as markers, since the
+ ;; `indent-region' below can shift the block's end).
+ (let* ((non-empty-comment
+ (concat fortran-comment-line-start-skip "[^ \t\n]"))
+ (start (save-excursion
+ ;; Find (start of) first line.
+ (while (and (zerop (forward-line -1))
+ (looking-at non-empty-comment)))
+ (or (looking-at non-empty-comment)
+ (forward-line)) ; overshot
+ (point-marker)))
+ (end (save-excursion
+ ;; Find start of first line past region to fill.
+ (while (progn
+ (forward-line)
+ (looking-at non-empty-comment)))
+ (point-marker))))
+ ;; Indent the block, find the string comprising the effective
+ ;; comment start skip and use that as a fill-prefix for
+ ;; filling the region.
+ (indent-region start end nil)
+ (let ((paragraph-ignore-fill-prefix nil)
+ (fill-prefix (progn
+ (beginning-of-line)
+ (looking-at fortran-comment-line-start-skip)
+ (match-string 0))))
+ (let (fill-paragraph-function)
+ (fill-region start end justify))) ; with normal `fill-paragraph'
+ (set-marker start nil)
+ (set-marker end nil))))
+ t)
+
+(defun fortran-fill-statement ()
+ "Fill a fortran statement up to `fill-column'."
+ (interactive)
+ (let ((auto-fill-function #'fortran-auto-fill))
+ (if (not (save-excursion
+ (beginning-of-line)
+ (or (looking-at "[ \t]*$")
+ (looking-at fortran-comment-line-start-skip)
+ (and comment-start-skip
+ (looking-at (concat "[ \t]*"
+ comment-start-skip))))))
+ (save-excursion
+ ;; Find beginning of statement.
+ (fortran-next-statement)
+ (fortran-previous-statement)
+ ;; Re-indent initially.
+ (fortran-indent-line)
+ ;; Replace newline plus continuation field plus indentation with
+ ;; single space.
+ (while (progn
+ (forward-line)
+ (fortran-remove-continuation)))
+ (fortran-previous-statement)))
+ (fortran-indent-line)))
+
;; XEmacs additions
;;;###autoload(add-to-list 'auto-mode-alist '("\\.f\\(?:or\\)?\\'"
. fortran-mode))