From unknown Sun Jun 22 11:39:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#9690: 24.0.90; f90 mode incorrectly indents top-level preprocessor directives Resent-From: Lawrence Mitchell Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Oct 2011 11:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9690 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 9690@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.131798753417717 (code B ref -1); Fri, 07 Oct 2011 11:39:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Oct 2011 11:38:54 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RC8lR-0004bi-Pz for submit@debbugs.gnu.org; Fri, 07 Oct 2011 07:38:53 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RC8lP-0004bW-NL for submit@debbugs.gnu.org; Fri, 07 Oct 2011 07:38:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RC8l5-0003bD-LV for submit@debbugs.gnu.org; Fri, 07 Oct 2011 07:38:32 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:55394) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RC8l5-0003b9-Ht for submit@debbugs.gnu.org; Fri, 07 Oct 2011 07:38:31 -0400 Received: from eggs.gnu.org ([140.186.70.92]:36131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RC8l4-0001CN-Jk for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2011 07:38:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RC8l3-0003aK-CM for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2011 07:38:30 -0400 Received: from treacle.ucs.ed.ac.uk ([129.215.16.102]:51535) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RC8l0-0003UD-S5 for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2011 07:38:29 -0400 Received: from lmtp1.ucs.ed.ac.uk (lmtp1.ucs.ed.ac.uk [129.215.149.64]) by treacle.ucs.ed.ac.uk (8.13.8/8.13.4) with ESMTP id p97BbsCX016733 for ; Fri, 7 Oct 2011 12:37:59 +0100 (BST) Received: from e4300lm (e4300lm.epcc.ed.ac.uk [129.215.63.156]) (authenticated user=lmitche4 mech=PLAIN bits=0) by lmtp1.ucs.ed.ac.uk (8.13.8/8.13.7) with ESMTP id p97BboxO021391 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Fri, 7 Oct 2011 12:37:54 +0100 (BST) From: Lawrence Mitchell Date: Fri, 07 Oct 2011 12:37:50 +0100 Message-ID: <871uupav75.fsf@ed.ac.uk> MIME-Version: 1.0 Content-Type: text/plain X-Edinburgh-Scanned: at treacle.ucs.ed.ac.uk with MIMEDefang 2.60, Sophie, Sophos Anti-Virus, Clam AntiVirus X-Scanned-By: MIMEDefang 2.60 on 129.215.16.102 X-Scanned-By: MIMEDefang 2.52 on 129.215.149.64 X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.9 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) 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, From unknown Sun Jun 22 11:39:41 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Lawrence Mitchell Subject: bug#9690: closed (Re: bug#9690: 24.0.90; f90 mode incorrectly indents top-level preprocessor directives) Message-ID: References: <871uupav75.fsf@ed.ac.uk> X-Gnu-PR-Message: they-closed 9690 X-Gnu-PR-Package: emacs Reply-To: 9690@debbugs.gnu.org Date: Sat, 08 Oct 2011 21:53:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1318110782-11613-1" This is a multi-part message in MIME format... ------------=_1318110782-11613-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #9690: 24.0.90; f90 mode incorrectly indents top-level preprocessor directi= ves which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 9690@debbugs.gnu.org. --=20 9690: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D9690 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1318110782-11613-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 9690-done) by debbugs.gnu.org; 8 Oct 2011 21:52:40 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RCeox-00030l-Uw for submit@debbugs.gnu.org; Sat, 08 Oct 2011 17:52:40 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RCeow-00030e-1f for 9690-done@debbugs.gnu.org; Sat, 08 Oct 2011 17:52:38 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1RCeot-0000k6-Sy; Sat, 08 Oct 2011 17:52:35 -0400 From: Glenn Morris To: 9690-done@debbugs.gnu.org Subject: Re: bug#9690: 24.0.90; f90 mode incorrectly indents top-level preprocessor directives References: <871uupav75.fsf@ed.ac.uk> X-Spook: satellite imagery threat broadside investigation X-Ran: DJq`Lk'0CVA_=wVQ/2wk0n{jm.r:w"dJPtOk9tZT#YO''v\]}U4.|ab#w\PolA*URVM3e$ X-Hue: blue X-Debbugs-No-Ack: yes X-Attribution: GM Date: Sat, 08 Oct 2011 17:52:35 -0400 In-Reply-To: <871uupav75.fsf@ed.ac.uk> (Lawrence Mitchell's message of "Fri, 07 Oct 2011 12:37:50 +0100") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 9690-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) Version: 24.0.91 Thank you for the report. I fixed this in a different way. ------------=_1318110782-11613-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Oct 2011 11:38:54 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RC8lR-0004bi-Pz for submit@debbugs.gnu.org; Fri, 07 Oct 2011 07:38:53 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RC8lP-0004bW-NL for submit@debbugs.gnu.org; Fri, 07 Oct 2011 07:38:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RC8l5-0003bD-LV for submit@debbugs.gnu.org; Fri, 07 Oct 2011 07:38:32 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:55394) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RC8l5-0003b9-Ht for submit@debbugs.gnu.org; Fri, 07 Oct 2011 07:38:31 -0400 Received: from eggs.gnu.org ([140.186.70.92]:36131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RC8l4-0001CN-Jk for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2011 07:38:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RC8l3-0003aK-CM for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2011 07:38:30 -0400 Received: from treacle.ucs.ed.ac.uk ([129.215.16.102]:51535) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RC8l0-0003UD-S5 for bug-gnu-emacs@gnu.org; Fri, 07 Oct 2011 07:38:29 -0400 Received: from lmtp1.ucs.ed.ac.uk (lmtp1.ucs.ed.ac.uk [129.215.149.64]) by treacle.ucs.ed.ac.uk (8.13.8/8.13.4) with ESMTP id p97BbsCX016733 for ; Fri, 7 Oct 2011 12:37:59 +0100 (BST) Received: from e4300lm (e4300lm.epcc.ed.ac.uk [129.215.63.156]) (authenticated user=lmitche4 mech=PLAIN bits=0) by lmtp1.ucs.ed.ac.uk (8.13.8/8.13.7) with ESMTP id p97BboxO021391 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Fri, 7 Oct 2011 12:37:54 +0100 (BST) From: Lawrence Mitchell To: bug-gnu-emacs@gnu.org Subject: 24.0.90; f90 mode incorrectly indents top-level preprocessor directives Date: Fri, 07 Oct 2011 12:37:50 +0100 Message-ID: <871uupav75.fsf@ed.ac.uk> MIME-Version: 1.0 Content-Type: text/plain X-Edinburgh-Scanned: at treacle.ucs.ed.ac.uk with MIMEDefang 2.60, Sophie, Sophos Anti-Virus, Clam AntiVirus X-Scanned-By: MIMEDefang 2.60 on 129.215.16.102 X-Scanned-By: MIMEDefang 2.52 on 129.215.149.64 X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) 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, ------------=_1318110782-11613-1--