From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Markus Triska Newsgroups: gmane.emacs.bugs Subject: bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct Date: Wed, 23 Sep 2015 23:08:24 +0200 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1443042568 27995 80.91.229.3 (23 Sep 2015 21:09:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Sep 2015 21:09:28 +0000 (UTC) To: 21526@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 23 23:09:12 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZerHs-0004e6-Ig for geb-bug-gnu-emacs@m.gmane.org; Wed, 23 Sep 2015 23:09:12 +0200 Original-Received: from localhost ([::1]:50791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZerHs-0005Ac-23 for geb-bug-gnu-emacs@m.gmane.org; Wed, 23 Sep 2015 17:09:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZerHo-0005AX-Fc for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2015 17:09:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZerHj-0000DW-Ea for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2015 17:09:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50859) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZerHj-0000DF-B4 for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2015 17:09:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZerHi-0000Cw-Oq for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2015 17:09:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Markus Triska Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Sep 2015 21:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21526 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.1443042527772 (code B ref -1); Wed, 23 Sep 2015 21:09:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Sep 2015 21:08:47 +0000 Original-Received: from localhost ([127.0.0.1]:43069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZerHS-0000CN-L1 for submit@debbugs.gnu.org; Wed, 23 Sep 2015 17:08:46 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46450) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZerHQ-0000CF-Ch for submit@debbugs.gnu.org; Wed, 23 Sep 2015 17:08:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZerHO-0008VD-TG for submit@debbugs.gnu.org; Wed, 23 Sep 2015 17:08:43 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:49581) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZerHO-0008V5-Py for submit@debbugs.gnu.org; Wed, 23 Sep 2015 17:08:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZerHN-00053i-LG for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2015 17:08:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZerHI-0008S4-Jl for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2015 17:08:41 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:58900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZerHI-0008RV-Cp for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2015 17:08:36 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZerHF-0003s8-Ct for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2015 23:08:33 +0200 Original-Received: from 91.141.2.97.wireless.dyn.drei.com ([91.141.2.97]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Sep 2015 23:08:33 +0200 Original-Received: from triska by 91.141.2.97.wireless.dyn.drei.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Sep 2015 23:08:33 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 150 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 91.141.2.97.wireless.dyn.drei.com Cancel-Lock: sha1:h9vhSeA1FdZ3CxDujH9pcP+Xrno= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:106849 Archived-At: Here are some further cases I found when trying the latest version: (a) The indentation of (\+)/1 (not provable) is not correct and yields an error. For example, when I press RET when point is at the "H": test :- \+ a,HERE then I get: test :- \+ a, HERE and the message: Error: (error "Bumped into unknown token") The expected result is: test :- \+ a, HERE (and no error). For example, the clause may eventually look like: test :- \+ a, b, \+ \+ c, d. In connection with if-then-else, we expect the layout: test :- ( \+ a -> b ; \+ c, \+ d ). but currently get: test :- ( \+ a -> b ; \+ c, \+ d ). (b) Comments within if-then-else constructs are also not correctly indented. For example, a block like: test :- ( a -> % what should we do % with two lines? b is still indented exactly as expected. However, when I then add two subsequent comment lines also in the else branch, I get: test :- ( a -> % what should we do % on two lines? b ; % what else should % we do on two lines c ). Whereas we expect (and Stefan Bruda's version also yields): test :- ( a -> % what should we do % on two lines? b ; % what else should % we do on two lines c ). The remaining two issues are not related to if-then-else, but I still include them in this report for easy reference. I will of course file separate issues for them if you prefer that. (c) Arguments of directives should be more indented. For example, a directive whose arguments span several lines should look like this: :- multifile pred1, pred2, pred3. Instead, when I press RET when point is at the H: :- multifileHERE I unexpectedly get: :- multifile HERE `prolog-keywords' contains the directives where a hanging indentation of prolog-indent-width in subsequent lines would be very welcome. (d) Code patterns like the following are quite common: test_predicate(a) :- !. test_predicate(b) :- !. test_predicate(c) :- !, test_goal1, test_goal2. test_predicate(d) :- !, test_goal3. For a block like that, I get with the current git version: test_predicate(a) :- !. test_predicate(b) :- !. test_predicate(c) :- !, test_goal1, test_goal2. test_predicate(d) :- !, test_goal3. Whereas with Stefan Bruda's original version, I get the first layout. I have used the following two source files, together amounting to more than 8,000 lines of Prolog code written using Stefan Bruda's version with the settings I posted, to find such regressions: One is a constraint solver over Boolean variables: https://github.com/SWI-Prolog/swipl-devel/blob/master/library/clp/clpb.pl And the other is a constraint solver over integers: https://github.com/SWI-Prolog/swipl-devel/blob/master/library/clp/clpfd.pl I hope that these files are useful as further test cases for you. All the best! Markus