emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/fortran.el


From: Glenn Morris
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/fortran.el
Date: Wed, 16 Apr 2003 07:09:28 -0400

Index: emacs/lisp/progmodes/fortran.el
diff -c emacs/lisp/progmodes/fortran.el:1.105 
emacs/lisp/progmodes/fortran.el:1.106
*** emacs/lisp/progmodes/fortran.el:1.105       Tue Apr 15 16:43:43 2003
--- emacs/lisp/progmodes/fortran.el     Wed Apr 16 07:09:28 2003
***************
*** 700,707 ****
    (if (looking-at fortran-comment-line-start-skip) 0
      (save-excursion
        (skip-chars-backward " \t")
!       (max (1+ (current-column))
!          comment-column))))
  
  (defun fortran-indent-comment ()
    "Align or create comment on current line.
--- 700,706 ----
    (if (looking-at fortran-comment-line-start-skip) 0
      (save-excursion
        (skip-chars-backward " \t")
!       (max (1+ (current-column)) comment-column))))
  
  (defun fortran-indent-comment ()
    "Align or create comment on current line.
***************
*** 754,767 ****
      (goto-char beg-region)
      (beginning-of-line)
      (if arg
!         (let ((com (regexp-quote fortran-comment-region))) ;uncomment region
            (if (looking-at com)
                (delete-region (point) (match-end 0)))
            (while (and (zerop (forward-line 1))
                        (< (point) end-region-mark))
              (if (looking-at com)
                  (delete-region (point) (match-end 0)))))
!       (insert fortran-comment-region) ;comment the region
        (while (and (zerop (forward-line 1))
                    (< (point) end-region-mark))
          (insert fortran-comment-region)))
--- 753,766 ----
      (goto-char beg-region)
      (beginning-of-line)
      (if arg
!         (let ((com (regexp-quote fortran-comment-region))) ; uncomment
            (if (looking-at com)
                (delete-region (point) (match-end 0)))
            (while (and (zerop (forward-line 1))
                        (< (point) end-region-mark))
              (if (looking-at com)
                  (delete-region (point) (match-end 0)))))
!       (insert fortran-comment-region)   ; comment
        (while (and (zerop (forward-line 1))
                    (< (point) end-region-mark))
          (insert fortran-comment-region)))
***************
*** 777,783 ****
    (let (c)
      (insert last-command-char)
      (if (and abbrev-mode
!              (or (eq (setq c (read-event)) ??) ;insert char if not equal to 
`?'
                   (eq c help-char)))
        (fortran-abbrev-help)
        (setq unread-command-events (list c)))))
--- 776,782 ----
    (let (c)
      (insert last-command-char)
      (if (and abbrev-mode
!              (or (eq (setq c (read-event)) ??) ; insert char if not `?'
                   (eq c help-char)))
        (fortran-abbrev-help)
        (setq unread-command-events (list c)))))
***************
*** 802,810 ****
  
  (defun fortran-column-ruler ()
    "Insert a column ruler momentarily above current line, till next keystroke.
! The ruler is defined by the value of `fortran-column-ruler-fixed' when in 
fixed
! format mode, and `fortran-column-ruler-tab' when in TAB format mode.
! The key typed is executed unless it is SPC."
    (interactive)
    (momentary-string-display
     (if indent-tabs-mode
--- 801,809 ----
  
  (defun fortran-column-ruler ()
    "Insert a column ruler momentarily above current line, till next keystroke.
! The ruler is defined by the value of `fortran-column-ruler-fixed' in fixed
! format mode, and `fortran-column-ruler-tab' in TAB format mode.
! The next key typed is executed unless it is SPC."
    (interactive)
    (momentary-string-display
     (if indent-tabs-mode
***************
*** 865,872 ****
        (insert ?\n (match-string 0))
      (if indent-tabs-mode
        (insert ?\n ?\t (fortran-numerical-continuation-char))
!       (insert "\n " fortran-continuation-string))) ; Space after \n important
!   (fortran-indent-line))              ; when the cont string is C, c or *.
  
  (defun fortran-remove-continuation ()
    "Delete any Fortran continuation characters at point.
--- 864,871 ----
        (insert ?\n (match-string 0))
      (if indent-tabs-mode
        (insert ?\n ?\t (fortran-numerical-continuation-char))
!       (insert "\n " fortran-continuation-string))) ; space after \n important
!   (fortran-indent-line))               ; when cont string is C, c or *
  
  (defun fortran-remove-continuation ()
    "Delete any Fortran continuation characters at point.
***************
*** 936,942 ****
        (fortran-indent-line))))
  
  
- 
  (defun fortran-check-end-prog-re ()
    "Check a preliminary match against `fortran-end-prog-re'."
    ;; Having got a possible match for the subprogram end, we need a
--- 935,940 ----
***************
*** 1093,1099 ****
        (let ((count 1))
          (while (and (not (zerop count))
                      (not (eq (fortran-next-statement) 'last-statement))
!                     ;; Keep local to subprogram
                      (not (and (looking-at fortran-end-prog-re)
                                (fortran-check-end-prog-re))))
            (skip-chars-forward " \t0-9")
--- 1091,1097 ----
        (let ((count 1))
          (while (and (not (zerop count))
                      (not (eq (fortran-next-statement) 'last-statement))
!                     ;; Keep local to subprogram.
                      (not (and (looking-at fortran-end-prog-re)
                                (fortran-check-end-prog-re))))
            (skip-chars-forward " \t0-9")
***************
*** 1122,1128 ****
        (let ((count 1))
          (while (and (not (zerop count))
                      (not (eq (fortran-previous-statement) 'first-statement))
!                     ;; Keep local to subprogram
                      (not (and (looking-at fortran-end-prog-re)
                                (fortran-check-end-prog-re))))
            (skip-chars-forward " \t0-9")
--- 1120,1126 ----
        (let ((count 1))
          (while (and (not (zerop count))
                      (not (eq (fortran-previous-statement) 'first-statement))
!                     ;; Keep local to subprogram.
                      (not (and (looking-at fortran-end-prog-re)
                                (fortran-check-end-prog-re))))
            (skip-chars-forward " \t0-9")
***************
*** 1173,1179 ****
                   (save-excursion
                     (if (or
                          (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]")
!                         (let (then-test) ; Multi-line if-then.
                            (while
                                (and
                                 (zerop (forward-line 1))
--- 1171,1177 ----
                   (save-excursion
                     (if (or
                          (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]")
!                         (let (then-test) ; multi-line if-then
                            (while
                                (and
                                 (zerop (forward-line 1))
***************
*** 1232,1238 ****
                   (save-excursion
                     (if (or
                          (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]")
!                         (let (then-test) ; Multi-line if-then.
                            (while
                                (and
                                 (zerop (forward-line 1))
--- 1230,1236 ----
                   (save-excursion
                     (if (or
                          (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]")
!                         (let (then-test) ; multi-line if-then
                            (while
                                (and
                                 (zerop (forward-line 1))
***************
*** 1327,1335 ****
          (skip-chars-forward " \t0-9")
          (cond ((looking-at "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?if[ \t]*(")
                 (if (or (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t_$(=a-z0-9]")
!                        (let (then-test)       ;multi-line if-then
                           (while (and (zerop (forward-line 1))
!                                      ;;search forward for then
                                       (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")
                                       (not (setq then-test
                                                  (looking-at
--- 1325,1333 ----
          (skip-chars-forward " \t0-9")
          (cond ((looking-at "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?if[ \t]*(")
                 (if (or (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t_$(=a-z0-9]")
!                        (let (then-test)       ; multi-line if-then
                           (while (and (zerop (forward-line 1))
!                                      ;; Search forward for then.
                                       (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")
                                       (not (setq then-test
                                                  (looking-at
***************
*** 1357,1363 ****
                 (setq icol (+ icol fortran-structure-indent)))
                ((and (looking-at fortran-end-prog-re1)
                      (fortran-check-end-prog-re))
!                ;; Previous END resets indent to minimum
                 (setq icol fortran-minimum-statement-indent)))))
      (save-excursion
        (beginning-of-line)
--- 1355,1361 ----
                 (setq icol (+ icol fortran-structure-indent)))
                ((and (looking-at fortran-end-prog-re1)
                      (fortran-check-end-prog-re))
!                ;; Previous END resets indent to minimum.
                 (setq icol fortran-minimum-statement-indent)))))
      (save-excursion
        (beginning-of-line)
***************
*** 1470,1477 ****
                       (insert ?\t (fortran-numerical-continuation-char) 1))
              (forward-char 6))
          (delete-horizontal-space)
!         ;; Put line number in columns 0-4
!         ;; or put continuation character in column 5.
          (cond ((eobp))
                ((looking-at (regexp-quote fortran-continuation-string))
                 (if indent-tabs-mode
--- 1468,1475 ----
                       (insert ?\t (fortran-numerical-continuation-char) 1))
              (forward-char 6))
          (delete-horizontal-space)
!         ;; Put line number in columns 0-4, or
!           ;; continuation character in column 5.
          (cond ((eobp))
                ((looking-at (regexp-quote fortran-continuation-string))
                 (if indent-tabs-mode
***************
*** 1521,1527 ****
        (beginning-of-line)
        (when (looking-at "[ \t]*[0-9]+")
          (skip-chars-forward " \t")
!         (skip-chars-forward "0")      ;skip past leading zeros
          (setq charnum
                (buffer-substring (point) (progn
                                            (skip-chars-forward "0-9")
--- 1519,1525 ----
        (beginning-of-line)
        (when (looking-at "[ \t]*[0-9]+")
          (skip-chars-forward " \t")
!         (skip-chars-forward "0")      ; skip past leading zeros
          (setq charnum
                (buffer-substring (point) (progn
                                            (skip-chars-forward "0-9")
***************
*** 1573,1590 ****
       ((save-excursion                 ; comment lines too
        (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
                                        (regexp-quote comment-start)))
              (not-done t)
              parse-limit end-of-line)
!         ;; move to start of current statement
          (fortran-next-statement)
          (fortran-previous-statement)
!         ;; now parse up to WHERE
          (while not-done
!           (if (or ;; skip to next line if:
                 ;; - comment line?
                 (looking-at fortran-comment-line-start-skip)
                 ;; - at end of line?
--- 1571,1587 ----
       ((save-excursion                 ; comment lines too
        (beginning-of-line)
        (looking-at fortran-comment-line-start-skip)) nil)
!      (t (let ((parse-state '(0 nil nil nil nil nil 0))
              (quoted-comment-start (if comment-start
                                        (regexp-quote comment-start)))
              (not-done t)
              parse-limit end-of-line)
!         ;; Move to start of current statement.
          (fortran-next-statement)
          (fortran-previous-statement)
!         ;; Now parse up to WHERE.
          (while not-done
!           (if (or ;; Skip to next line if:
                 ;; - comment line?
                 (looking-at fortran-comment-line-start-skip)
                 ;; - at end of line?
***************
*** 1597,1625 ****
                (if (> (forward-line) 0)
                    (setq not-done nil))
              ;; else:
!             ;; if we are at beginning of code line, skip any
              ;; whitespace, labels and tab continuation markers.
              (if (bolp) (skip-chars-forward " \t0-9"))
!             ;; if we are in column <= 5 now, check for continuation char
              (cond ((= 5 (current-column)) (forward-char 1))
                    ((and (< (current-column) 5)
                          (equal fortran-continuation-string
                                 (char-to-string (following-char)))
                          (forward-char 1))))
!             ;; find out parse-limit from here
              (setq end-of-line (line-end-position))
              (setq parse-limit (min where end-of-line))
!             ;; parse max up to comment-start, if non-nil and in current line
              (if comment-start
                  (save-excursion
                    (if (re-search-forward quoted-comment-start end-of-line t)
                        (setq parse-limit (min (point) parse-limit)))))
!             ;; now parse if still in limits
              (if (< (point) where)
                  (setq parse-state (parse-partial-sexp
                                     (point) parse-limit nil nil parse-state))
                (setq not-done nil))))
!         ;; result is
          (nth 3 parse-state))))))
  
  ;; From old version.
--- 1594,1622 ----
                (if (> (forward-line) 0)
                    (setq not-done nil))
              ;; else:
!             ;; If we are at beginning of code line, skip any
              ;; whitespace, labels and tab continuation markers.
              (if (bolp) (skip-chars-forward " \t0-9"))
!             ;; If we are in column <= 5 now, check for continuation char.
              (cond ((= 5 (current-column)) (forward-char 1))
                    ((and (< (current-column) 5)
                          (equal fortran-continuation-string
                                 (char-to-string (following-char)))
                          (forward-char 1))))
!             ;; Find out parse-limit from here.
              (setq end-of-line (line-end-position))
              (setq parse-limit (min where end-of-line))
!             ;; Parse max up to comment-start, if non-nil and in current line.
              (if comment-start
                  (save-excursion
                    (if (re-search-forward quoted-comment-start end-of-line t)
                        (setq parse-limit (min (point) parse-limit)))))
!             ;; Now parse if still in limits.
              (if (< (point) where)
                  (setq parse-state (parse-partial-sexp
                                     (point) parse-limit nil nil parse-state))
                (setq not-done nil))))
!         ;; Result.
          (nth 3 parse-state))))))
  
  ;; From old version.
***************
*** 1670,1676 ****
                 )
                (when (<= (point) (1+ bos))
                    (move-to-column (1+ fill-column))
!                   ;;what is this doing???
                    (or (re-search-forward "[\t\n,'+-/*)=]" eol t)
                        (goto-char bol)))
                (if (bolp)
--- 1667,1673 ----
                 )
                (when (<= (point) (1+ bos))
                    (move-to-column (1+ fill-column))
!                   ;; What is this doing???
                    (or (re-search-forward "[\t\n,'+-/*)=]" eol t)
                        (goto-char bol)))
                (if (bolp)
***************
*** 1682,1693 ****
                (if fortran-break-before-delimiters
                    (point)
                  (1+ (point)))))))
!     ;; if we are in an in-line comment, don't break unless the
      ;; line of code is longer than it should be. Otherwise
      ;; break the line at the column computed above.
      ;;
!     ;; Need to use fortran-find-comment-start-skip to make sure that quoted 
!'s
!     ;; don't prevent a break.
      (when (and (save-excursion
                 (beginning-of-line)
                 (if (not (fortran-find-comment-start-skip))
--- 1679,1690 ----
                (if fortran-break-before-delimiters
                    (point)
                  (1+ (point)))))))
!     ;; If we are in an in-line comment, don't break unless the
      ;; line of code is longer than it should be. Otherwise
      ;; break the line at the column computed above.
      ;;
!     ;; Need to use fortran-find-comment-start-skip to make sure that
!     ;; quoted !'s don't prevent a break.
      (when (and (save-excursion
                 (beginning-of-line)
                 (if (not (fortran-find-comment-start-skip))
***************
*** 1716,1722 ****
           (if (fortran-find-comment-start-skip)
               (delete-and-extract-region
                (match-beginning 0) (line-end-position))))))
!     ;; Forward line 1 really needs to go to next non white line
      (if (save-excursion (forward-line)
                        (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]"))
        (progn
--- 1713,1719 ----
           (if (fortran-find-comment-start-skip)
               (delete-and-extract-region
                (match-beginning 0) (line-end-position))))))
!     ;; Forward line 1 really needs to go to next non white line.
      (if (save-excursion (forward-line)
                        (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]"))
        (progn
***************
*** 1806,1812 ****
      ;; We must be inside function body for this to work.
      (fortran-beginning-of-subprogram)
      (let ((case-fold-search t))               ; case-insensitive
!       ;; search for fortran subprogram start
        (if (re-search-forward
             (concat "^[ \t]*\\(program\\|subroutine\\|function"
                     "\\|[ \ta-z0-9*()]*[ \t]+function\\|"
--- 1803,1809 ----
      ;; We must be inside function body for this to work.
      (fortran-beginning-of-subprogram)
      (let ((case-fold-search t))               ; case-insensitive
!       ;; Search for fortran subprogram start.
        (if (re-search-forward
             (concat "^[ \t]*\\(program\\|subroutine\\|function"
                     "\\|[ \ta-z0-9*()]*[ \t]+function\\|"
***************
*** 1816,1822 ****
             t)
            (or (match-string-no-properties 2)
                (progn
!                 ;; move to EOL or before first left paren
                  (if (re-search-forward "[(\n]" nil t)
                      (progn (backward-char)
                             (skip-chars-backward " \t"))
--- 1813,1819 ----
             t)
            (or (match-string-no-properties 2)
                (progn
!                 ;; Move to EOL or before first left paren.
                  (if (re-search-forward "[(\n]" nil t)
                      (progn (backward-char)
                             (skip-chars-backward " \t"))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]