Homepage: https://www.gnu.org/software/emacs
Author: * See below for more details
Major mode for Prolog (and Mercury)
This package provides a major mode for editing Prolog code, with all the bells and whistles one would expect, including syntax highlighting and auto indentation. It can also send regions to an inferior Prolog process. Some settings you may wish to use: (setq prolog-system 'swi) ; optional, the system you are using; ; see `prolog-system' below for possible values (setq auto-mode-alist (append '(("\\.pl\\'" . prolog-mode) ("\\.m\\'" . mercury-mode)) auto-mode-alist)) The last expression above makes sure that files ending with .pl are assumed to be Prolog files and not Perl, which is the default Emacs setting. If this is not wanted, remove this line. It is then necessary to either o insert in your Prolog files the following comment as the first line: % -*- Mode: Prolog -*- and then the file will be open in Prolog mode no matter its extension, or o manually switch to prolog mode after opening a Prolog file, by typing M-x prolog-mode. If the command to start the prolog process ('sicstus', 'pl' or 'swipl' for SWI prolog, etc.) is not available in the default path, then it is necessary to set the value of the environment variable EPROLOG to a shell command to invoke the prolog process. You can also customize the variable `prolog-program-name' (in the group `prolog-inferior') and provide a full path for your Prolog system (swi, scitus, etc.). Changelog: Version 1.22: o Allowed both 'swipl' and 'pl' as names for the SWI Prolog interpreter. o Atoms that start a line are not blindly colored as predicates. Instead we check that they are followed by ( or :- first. Patch suggested by Guy Wiener. Version 1.21: o Cleaned up the code that defines faces. The missing face warnings on some Emacsen should disappear. Version 1.20: o Improved the handling of clause start detection and multi-line comments: `prolog-clause-start' no longer finds non-predicate (e.g., capitalized strings) beginning of clauses. `prolog-tokenize' recognizes when the end point is within a multi-line comment. Version 1.19: o Minimal changes for Aquamacs inclusion and in general for better coping with finding the Prolog executable. Patch provided by David Reitter Version 1.18: o Fixed syntax highlighting for clause heads that do not begin at the beginning of the line. o Fixed compilation warnings under Emacs. o Updated the email address of the current maintainer. Version 1.17: o Minor indentation fix (patch by Markus Triska) o `prolog-underscore-wordchar-flag' defaults now to nil (more consistent to other Emacs modes) Version 1.16: o Eliminated a possible compilation warning. Version 1.15: o Introduced three new customizable variables: electric colon (`prolog-electric-colon-flag', default nil), electric dash (`prolog-electric-dash-flag', default nil), and a possibility to prevent the predicate template insertion from adding commas (`prolog-electric-dot-full-predicate-template', defaults to t since it seems quicker to me to just type those commas). A trivial adaptation of a patch by Markus Triska. o Improved the behavior of electric if-then-else to only skip forward if the parenthesis/semicolon is preceded by whitespace. Once more a trivial adaptation of a patch by Markus Triska. Version 1.14: o Cleaned up align code. `prolog-align-flag' is eliminated (since on a second thought it does not do anything useful). Added key binding (C-c C-a) and menu entry for alignment. o Condensed regular expressions for lower and upper case characters (GNU Emacs seems to go over the regexp length limit with the original form). My code on the matter was improved considerably by Markus Triska. o Fixed `prolog-insert-spaces-after-paren' (which used an uninitialized variable). o Minor changes to clean up the code and avoid some implicit package requirements. Version 1.13: o Removed the use of `map-char-table' in `prolog-build-case-strings' which appears to cause problems in (at least) Emacs 23.0.0.1. o Added if-then-else indentation + corresponding electric characters. New customization: `prolog-electric-if-then-else-flag' o Align support (requires `align'). New customization: `prolog-align-flag'. o Temporary consult files have now the same name throughout the session. This prevents issues with reconsulting a buffer (this event is no longer passed to Prolog as a request to consult a new file). o Adaptive fill mode is now turned on. Comment indentation is still worse than it could be though, I am working on it. o Improved filling and auto-filling capabilities. Now block comments should be [auto-]filled correctly most of the time; the following pattern in particular is worth noting as being filled correctly:% some comment here that goes beyond the % rightmost column, possibly combined with % subsequent comment lines o `prolog-char-quote-workaround' now defaults to nil. o Note: Many of the above improvements have been suggested by Markus Triska, who also provided useful patches on the matter when he realized that I was slow in responding. Many thanks. Version 1.11 / 1.12 o GNU Emacs compatibility fix for paragraph filling (fixed incorrectly in 1.11, fix fixed in 1.12). Version 1.10 o Added paragraph filling in comment blocks and also correct auto filling for comments. o Fixed the possible "Regular expression too big" error in `prolog-electric-dot'. Version 1.9 o Parenthesis expressions are now indented by default so that components go one underneath the other, just as for compound terms. You can use the old style (the second and subsequent lines being indented to the right in a parenthesis expression) by setting the customizable variable `prolog-paren-indent-p' (group "Prolog Indentation") to t. o (Somehow awkward) handling of the 0' character escape sequence. I am looking into a better way of doing it but prospects look bleak. If this breaks things for you please let me know and also set the `prolog-char-quote-workaround' (group "Prolog Other") to nil. Version 1.8 o Key binding fix. Version 1.7 o Fixed a number of issues with the syntax of single quotes, including Debian bug #324520. Version 1.6 o Fixed mercury mode menu initialization (Debian bug #226121). o Fixed (i.e., eliminated) Delete remapping (Debian bug #229636). o Corrected indentation for clauses defining quoted atoms. Version 1.5: o Keywords fontifying should work in console mode so this is enabled everywhere. Version 1.4: o Now supports GNU Prolog--minor adaptation of a patch by Stefan Moeding. Version 1.3: o Info-follow-nearest-node now called correctly under Emacs too (thanks to Nicolas Pelletier). Should be implemented more elegantly (i.e., without compilation warnings) in the future. Version 1.2: o Another prompt fix, still in SWI mode (people seem to have changed the prompt of SWI Prolog). Version 1.1: o Fixed dots in the end of line comments causing indentation problems. The following code is now correctly indented (note the dot terminating the comment): a(X) :- b(X), c(X). % comment here. a(X). and so is this (and variants): a(X) :- b(X), c(X). /* comment here. */ a(X). Version 1.0: o Revamped the menu system. o Yet another prompt recognition fix (SWI mode). o This is more of a renumbering than a new edition. I promoted the mode to version 1.0 to emphasize the fact that it is now mature and stable enough to be considered production (in my opinion anyway). Version 0.1.41: o GNU Emacs compatibility fixes. Version 0.1.40: o prolog-get-predspec is now suitable to be called as imenu-extract-index-name-function. The predicate index works. o Since imenu works now as advertised, prolog-imenu-flag is t by default. o Eliminated prolog-create-predicate-index since the imenu utilities now work well. Actually, this function is also buggy, and I see no reason to fix it since we do not need it anyway. o Fixed prolog-pred-start, prolog-clause-start, prolog-clause-info. o Fix for prolog-build-case-strings; now prolog-upper-case-string and prolog-lower-case-string are correctly initialized, o Various font-lock changes; most importantly, block comments (/* ... */) are now correctly fontified in XEmacs even when they extend on multiple lines. Version 0.1.36: o The debug prompt of SWI Prolog is now correctly recognized. Version 0.1.35: o Minor font-lock bug fixes.