+2012-12-11 Glenn Morris <rgm@gnu.org>
+
+ * progmodes/f90.el (f90-line-continued, f90-indent-region):
+ Treat preprocessor lines embedded in continuations like comments.
+ (f90-indent-line): Special-case preprocessor lines. (Bug#13138)
+
2012-12-11 Jay Belanger <jay.p.belanger@gmail.com>
* calc/calc.el (calc-standard-date-formats): Add more date
(defsubst f90-line-continued ()
"Return t if the current line is a continued one.
-This includes comment lines embedded in continued lines, but
-not the last line of a continued statement."
+This includes comment or preprocessor lines embedded in continued lines,
+but not the last line of a continued statement."
(save-excursion
(beginning-of-line)
- (while (and (looking-at "[ \t]*\\(!\\|$\\)") (zerop (forward-line -1))))
+ (while (and (looking-at "[ \t]*\\([!#]\\|$\\)") (zerop (forward-line -1))))
(end-of-line)
(while (f90-in-comment)
(search-backward "!" (line-beginning-position))
(f90-indent-line-no)
(setq no-line-number t)
(skip-chars-forward " \t"))
- (if (looking-at "!")
- (setq indent (f90-comment-indent))
- (and f90-smart-end (looking-at "end")
- (f90-match-end))
- (setq indent (f90-calculate-indent)))
+ ;; FIXME This means f90-calculate-indent gives different answers
+ ;; for comments and preprocessor lines to this function.
+ ;; Better to make f90-calculate-indent return the correct answer?
+ (cond ((looking-at "!") (setq indent (f90-comment-indent)))
+ ((looking-at "#") (setq indent 0))
+ (t
+ (and f90-smart-end (looking-at "end")
+ (f90-match-end))
+ (setq indent (f90-calculate-indent))))
(or (= indent (current-column))
(f90-indent-to indent no-line-number))
;; If initial point was within line's indentation,
(f90-indent-to ind-curr))
(while (and (f90-line-continued) (zerop (forward-line 1))
(< (point) end-region-mark))
- (if (looking-at "[ \t]*!")
- (f90-indent-to (f90-comment-indent))
- (or (= (current-indentation)
- (+ ind-curr f90-continuation-indent))
- (f90-indent-to
- (+ ind-curr f90-continuation-indent) 'no-line-no)))))
+ (cond ((looking-at "[ \t]*#") (f90-indent-to 0))
+ ((looking-at "[ \t]*!") (f90-indent-to (f90-comment-indent)))
+ (t
+ (or (= (current-indentation)
+ (+ ind-curr f90-continuation-indent))
+ (f90-indent-to
+ (+ ind-curr f90-continuation-indent) 'no-line-no))))))
;; Restore point, etc.
(setq f90-cache-position nil)
(goto-char save-point)