Subject: 24.5; prolog-mode: broken indentation for if-then-else construct

From: Markus Triska <[email-masked]>
Date: Sun, 20 Sep 2015 15:02:59 +0200

Let .emacs solely consist of:

   (setq prolog-indent-width 8
         prolog-electric-tab-flag nil
         prolog-electric-if-then-else-flag t
         prolog-paren-indent 4
         prolog-electric-dot-flag nil
         prolog-paren-indent-p t
         prolog-char-quote-workaround nil)

When I then do:

   $ emacs --no-splash -f prolog-mode

and press the following key sequence:

   t e s t SPC : - RET ( a SPC - > RET b RET ; c RET ) .

then I get the following indentation (shown in untabified form):

test :-
        (   a ->
                    b
         ;c
                  ).

This is highly non-idiomatic and very unexpected layout of Prolog code.

In contrast, in the current version (1.25) of the Prolog mode supplied
directly from its maintainer Stefan Bruda and available from:

   https://bruda.ca/_media/emacs/prolog.el

and using the exact same steps, I get the intended indentation:

test :-
        (   a ->
            b
        ;   c
        ).

Thank you for looking into this!

All the best,
Markus

In GNU Emacs 24.5.1 (x86_64-apple-darwin14.0.0, GTK+ Version 2.24.28)
 of 2015-09-20 on mt-mbpro
Windowing system distributor `The X.Org Foundation', version 11.0.11502000
Configured using:
 `configure --prefix=/opt/local --without-dbus --without-libotf
 --without-m17n-flt --without-gpm --without-gnutls --with-xml2 --infodir
 /opt/local/share/info/emacs --without-xaw3d --without-imagemagick
 --with-xpm --with-jpeg --with-tiff --with-gif --with-png --with-xft
 --with-x-toolkit=gtk2 --with-gconf --with-rsvg 'CFLAGS=-pipe -Os -arch
 x86_64' CPPFLAGS=-I/opt/local/include 'LDFLAGS=-L/opt/local/lib
 -Wl,-headerpad_max_install_names -lfreetype -lfontconfig -Wl,-no_pie
 -arch x86_64''

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix