unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9690: 24.0.90; f90 mode incorrectly indents top-level preprocessor directives
@ 2011-10-07 11:37 Lawrence Mitchell
  2011-10-08 21:52 ` Glenn Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Lawrence Mitchell @ 2011-10-07 11:37 UTC (permalink / raw)
  To: 9690


emacs -Q

C-x b *tmp* RET

M-x f90-mode RET

M-: (insert "#include "foo.h") RET

TAB

Note how the preprocessor directive is indented by
f90-program-indent, rather than 0 spaces.

Patch and commit message

Cheers,
Lawrence


f90: Don't indent top-level preprocessor directives

* lisp/progmodes/f90.el (f90-calculate-indent): Special case
preprocessor directives and give them 0 indent.

diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index eb33822..95caf3a 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -1820,11 +1820,14 @@ after indenting."
         (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)))
+    (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,





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#9690: 24.0.90; f90 mode incorrectly indents top-level preprocessor directives
  2011-10-07 11:37 bug#9690: 24.0.90; f90 mode incorrectly indents top-level preprocessor directives Lawrence Mitchell
@ 2011-10-08 21:52 ` Glenn Morris
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2011-10-08 21:52 UTC (permalink / raw)
  To: 9690-done

Version: 24.0.91

Thank you for the report. I fixed this in a different way.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-08 21:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-07 11:37 bug#9690: 24.0.90; f90 mode incorrectly indents top-level preprocessor directives Lawrence Mitchell
2011-10-08 21:52 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).