unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Markus Triska <triska@metalevel.at>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 21526@debbugs.gnu.org
Subject: bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct
Date: Wed, 30 Sep 2015 22:40:31 +0200	[thread overview]
Message-ID: <87bncjbpz4.fsf@metalevel.at> (raw)
In-Reply-To: <jwv612rd5kl.fsf-monnier+emacsbugs@gnu.org> (Stefan Monnier's message of "Wed, 30 Sep 2015 16:19:44 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Is there a precedence table somewhere that includes "multifile"
> and friends?  The one I have doesn't include it.

You can generate such a table directly from Prolog, using for example:

   ?- current_op(P, T, N), portray_clause(P-T-N), false.

This yields the precedence (smaller = tighter), types and names of all
operators that are available by default. Users may change these
precedences, but it is unusual and bad practice to change the precedence
of default operators. So I would use this as a good approximation.

Using SWI-Prolog, you obtain for example:

   250-yfx- (?).
   1-fx- ($).
   990-xfx- (:=).
   200-fy- (@).
   1150-fx- (volatile).
   700-xfx- (=@=).
   200-xfy- (^).
   700-xfx- (@>).
   100-yfx- ('.').
   1150-fx- (meta_predicate).
   400-yfx- (rdiv).
   500-yfx- (\/).
   1150-fx- (initialization).
   600-xfy- (:).
   1200-xfx- (-->).
   700-xfx- (=..).
   400-yfx- (*).
   700-xfx- (@>=).
   1100-xfy- (;).
   700-xfx- (\=@=).
   700-xfx- (>:<).
   1150-fx- (dynamic).
   700-xfx- (@<).
   700-xfx- (:<).
   700-xfx- (@=<).
   400-yfx- (xor).
   1150-fx- (discontiguous).
   700-xfx- (>=).
   400-yfx- (//).
   700-xfx- (>).
   400-yfx- (div).
   1150-fx- (module_transparent).
   1200-fx- (?-).
   500-yfx- (/\).
   400-yfx- (/).
   200-fy- (+).
   500-yfx- (+).
   1150-fx- (multifile).
   400-yfx- (<<).
   1150-fx- (public).
   1200-fx- (:-).
   1200-xfx- (:-).
   400-yfx- (rem).
   1000-xfy- (',').
   1150-fx- (thread_initialization).
   700-xfx- (\=).
   700-xfx- (=).
   1050-xfy- (*->).
   700-xfx- (=<).
   700-xfx- (<).
   1050-xfy- (->).
   700-xfx- (as).
   1150-fx- (thread_local).
   400-yfx- (>>).
   200-fy- (-).
   500-yfx- (-).
   700-xfx- (is).
   900-fy- (\+).
   200-fy- (\).
   700-xfx- (=:=).
   400-yfx- (mod).
   200-xfx- (**).
   700-xfx- (\==).
   700-xfx- (==).
   1105-xfy- ('|').
   700-xfx- (=\=).

In SWI-Prolog, try the query:

   ?- help(op/3).

to see what these type indicators (xfx, fx etc.) mean.

I hope this helps you to indent according to operator precedence.

All the best,
Markus





  reply	other threads:[~2015-09-30 20:40 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-20 13:02 bug#21526: 24.5; prolog-mode: broken indentation for if-then-else construct Markus Triska
2015-09-20 18:04 ` Stefan Monnier
2015-09-20 19:33   ` Markus Triska
2015-09-21  2:34     ` Stefan Monnier
2015-09-21  3:03     ` Stefan Monnier
2015-09-21  6:02       ` Markus Triska
2015-09-21 20:22         ` Stefan Monnier
2015-09-22  6:25           ` Markus Triska
2015-09-22 15:12           ` Stefan Monnier
2015-09-22 16:38             ` Markus Triska
2015-09-22 21:04               ` Markus Triska
2015-09-23 21:08                 ` Markus Triska
2015-09-25 16:20                   ` Markus Triska
2015-09-30  2:04                     ` Stefan Monnier
2015-09-30  3:28                   ` Stefan Monnier
2015-09-30  6:38                     ` Markus Triska
2015-09-30  9:23                       ` Stefan Monnier
2015-09-30 18:35                         ` Markus Triska
2015-09-30 20:19                           ` Stefan Monnier
2015-09-30 20:40                             ` Markus Triska [this message]
2015-10-01  0:14                               ` Stefan Monnier
2015-10-01  6:22                                 ` Markus Triska
2015-10-01 14:07                                   ` Stefan Monnier
2015-10-02 16:23                                     ` Markus Triska
2015-10-02 20:47                                       ` Stefan Monnier
2015-10-05 22:38                                         ` Markus Triska
2015-10-06  2:23                                           ` Stefan Monnier
2015-09-30 18:03                     ` Markus Triska
2015-09-30 21:19                       ` Stefan Monnier
2015-09-30  3:28                 ` Stefan Monnier
2015-09-30  2:07               ` Stefan Monnier
2015-09-30  6:32                 ` Markus Triska
2015-09-30  8:55                   ` Stefan Monnier
2015-09-30 18:11                     ` Markus Triska
2015-10-05 23:49                     ` Markus Triska
2015-10-06  1:17                       ` Stefan Monnier
2015-10-06 16:45                         ` Markus Triska
2015-10-06 20:09                           ` Stefan Monnier
2015-10-20 23:47                             ` Markus Triska
2015-10-21 16:06                               ` Stefan Monnier
2015-10-21 21:58                                 ` Markus Triska
2015-10-22  1:16                                   ` Stefan Monnier
2015-10-22 19:08                                     ` Markus Triska
2015-10-25 20:01                                       ` Stefan Monnier
2015-11-23 16:36               ` Stefan Monnier
2020-08-24 18:23                 ` Lars Ingebrigtsen
2015-09-29 15:27             ` Stefan Monnier
2015-09-29 16:24               ` Markus Triska

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bncjbpz4.fsf@metalevel.at \
    --to=triska@metalevel.at \
    --cc=21526@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).