Mercurial > emacs
annotate lisp/progmodes/prolog.el @ 112447:bcecab2ad22d
* nsterm.m (x_set_offset): Set dont_constrain to 0 so the call to
setFrameTopLeftPoint is constrained.
author | Jan D. <jan.h.d@swipnet.se> |
---|---|
date | Sun, 23 Jan 2011 14:28:14 +0100 |
parents | 43d75ad47207 |
children |
rev | line source |
---|---|
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1 ;;; prolog.el --- major mode for editing and running Prolog (and Mercury) code |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2 |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3 ;; Copyright (C) 1986, 1987, 1997, 1998, 1999, 2002, 2003, 2011 Free Software Foundation, Inc. |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
4 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
5 ;; Authors: Emil Åström <emil_astrom(at)hotmail(dot)com> |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
6 ;; Milan Zamazal <pdm(at)freesoft(dot)cz> |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
7 ;; Stefan Bruda <stefan(at)bruda(dot)ca> (current maintainer) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
8 ;; * See below for more details |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
9 ;; Keywords: prolog major mode sicstus swi mercury |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
10 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
11 (defvar prolog-mode-version "1.22" |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
12 "Prolog mode version number.") |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
13 |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
14 ;; This file is part of GNU Emacs. |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
15 |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
16 ;; GNU Emacs is free software: you can redistribute it and/or modify |
41 | 17 ;; it under the terms of the GNU General Public License as published by |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
18 ;; the Free Software Foundation, either version 3 of the License, or |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
19 ;; (at your option) any later version. |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
20 |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
21 ;; GNU Emacs is distributed in the hope that it will be useful, |
41 | 22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
24 ;; GNU General Public License for more details. | |
25 | |
26 ;; You should have received a copy of the GNU General Public License | |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
27 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
28 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
29 ;; Original author: Masanobu UMEDA <umerin(at)mse(dot)kyutech(dot)ac(dot)jp> |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
30 ;; Parts of this file was taken from a modified version of the original |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
31 ;; by Johan Andersson, Peter Olin, Mats Carlsson, Johan Bevemyr, Stefan |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
32 ;; Andersson, and Per Danielsson (all SICS people), and Henrik Båkman |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
33 ;; at Uppsala University, Sweden. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
34 ;; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
35 ;; Some ideas and also a few lines of code have been borrowed (not stolen ;-) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
36 ;; from Oz.el, the Emacs major mode for the Oz programming language, |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
37 ;; Copyright (C) 1993 DFKI GmbH, Germany, with permission. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
38 ;; Authors: Ralf Scheidhauer and Michael Mehl ([scheidhr|mehl](at)dfki(dot)uni-sb(dot)de) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
39 ;; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
40 ;; More ideas and code have been taken from the SICStus debugger mode |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
41 ;; (http://www.csd.uu.se/~perm/source_debug/index.shtml -- broken link |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
42 ;; as of Mon May 5 08:23:48 EDT 2003) by Per Mildner. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
43 ;; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
44 ;; Additions for ECLiPSe and other helpful suggestions: Stephan Heuel |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
45 ;; <heuel(at)ipb(dot)uni-bonn(dot)de> |
41 | 46 |
2308
f287613dfc28
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
47 ;;; Commentary: |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
48 ;; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
49 ;; This package provides a major mode for editing Prolog code, with |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
50 ;; all the bells and whistles one would expect, including syntax |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
51 ;; highlighting and auto indentation. It can also send regions to an |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
52 ;; inferior Prolog process. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
53 ;; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
54 ;; The code requires the comint, easymenu, info, imenu, and font-lock |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
55 ;; libraries. These are normally distributed with GNU Emacs and |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
56 ;; XEmacs. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
57 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
58 ;;; Installation: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
59 ;; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
60 ;; Insert the following lines in your init file--typically ~/.emacs |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
61 ;; (GNU Emacs and XEmacs <21.4), or ~/.xemacs/init.el (XEmacs |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
62 ;; 21.4)--to use this mode when editing Prolog files under Emacs: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
63 ;; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
64 ;; (setq load-path (cons "/usr/lib/xemacs/site-lisp" load-path)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
65 ;; (autoload 'run-prolog "prolog" "Start a Prolog sub-process." t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
66 ;; (autoload 'prolog-mode "prolog" "Major mode for editing Prolog programs." t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
67 ;; (autoload 'mercury-mode "prolog" "Major mode for editing Mercury programs." t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
68 ;; (setq prolog-system 'swi) ; optional, the system you are using; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
69 ;; ; see `prolog-system' below for possible values |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
70 ;; (setq auto-mode-alist (append '(("\\.pl$" . prolog-mode) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
71 ;; ("\\.m$" . mercury-mode)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
72 ;; auto-mode-alist)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
73 ;; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
74 ;; where the path in the first line is the file system path to this file. |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
75 ;; MSDOS paths can be written like "d:/programs/emacs-19.34/site-lisp". |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
76 ;; Note: In XEmacs, either `/usr/lib/xemacs/site-lisp' (RPM default in |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
77 ;; Red Hat-based distributions) or `/usr/local/lib/xemacs/site-lisp' |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
78 ;; (default when compiling from sources) are automatically added to |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
79 ;; `load-path', so the first line is not necessary provided that you |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
80 ;; put this file in the appropriate place. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
81 ;; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
82 ;; The last s-expression above makes sure that files ending with .pl |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
83 ;; are assumed to be Prolog files and not Perl, which is the default |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
84 ;; Emacs setting. If this is not wanted, remove this line. It is then |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
85 ;; necessary to either |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
86 ;; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
87 ;; o insert in your Prolog files the following comment as the first line: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
88 ;; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
89 ;; % -*- Mode: Prolog -*- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
90 ;; |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
91 ;; and then the file will be open in Prolog mode no matter its |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
92 ;; extension, or |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
93 ;; |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
94 ;; o manually switch to prolog mode after opening a Prolog file, by typing |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
95 ;; M-x prolog-mode. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
96 ;; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
97 ;; If the command to start the prolog process ('sicstus', 'pl' or |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
98 ;; 'swipl' for SWI prolog, etc.) is not available in the default path, |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
99 ;; then it is necessary to set the value of the environment variable |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
100 ;; EPROLOG to a shell command to invoke the prolog process. In XEmacs |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
101 ;; and Emacs 20+ you can also customize the variable |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
102 ;; `prolog-program-name' (in the group `prolog-inferior') and provide |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
103 ;; a full path for your Prolog system (swi, scitus, etc.). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
104 ;; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
105 ;; Note: I (Stefan, the current maintainer) work under XEmacs. Future |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
106 ;; developments will thus be biased towards XEmacs (OK, I admit it, |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
107 ;; I am biased towards XEmacs in general), though I will do my best |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
108 ;; to keep the GNU Emacs compatibility. So if you work under Emacs |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
109 ;; and see something that does not work do drop me a line, as I have |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
110 ;; a smaller chance to notice this kind of bugs otherwise. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
111 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
112 ;; Changelog: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
113 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
114 ;; Version 1.22: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
115 ;; o Allowed both 'swipl' and 'pl' as names for the SWI Prolog |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
116 ;; interpreter. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
117 ;; o Atoms that start a line are not blindly coloured as |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
118 ;; predicates. Instead we check that they are followed by ( or |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
119 ;; :- first. Patch suggested by Guy Wiener. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
120 ;; Version 1.21: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
121 ;; o Cleaned up the code that defines faces. The missing face |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
122 ;; warnings on some Emacsen should disappear. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
123 ;; Version 1.20: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
124 ;; o Improved the handling of clause start detection and multi-line |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
125 ;; comments: `prolog-clause-start' no longer finds non-predicate |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
126 ;; (e.g., capitalized strings) beginning of clauses. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
127 ;; `prolog-tokenize' recognizes when the end point is within a |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
128 ;; multi-line comment. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
129 ;; Version 1.19: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
130 ;; o Minimal changes for Aquamacs inclusion and in general for |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
131 ;; better coping with finding the Prolog executable. Patch |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
132 ;; provided by David Reitter |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
133 ;; Version 1.18: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
134 ;; o Fixed syntax highlighting for clause heads that do not begin at |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
135 ;; the beginning of the line. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
136 ;; o Fixed compilation warnings under Emacs. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
137 ;; o Updated the email address of the current maintainer. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
138 ;; Version 1.17: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
139 ;; o Minor indentation fix (patch by Markus Triska) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
140 ;; o `prolog-underscore-wordchar-flag' defaults now to nil (more |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
141 ;; consistent to other Emacs modes) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
142 ;; Version 1.16: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
143 ;; o Eliminated a possible compilation warning. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
144 ;; Version 1.15: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
145 ;; o Introduced three new customizable variables: electric colon |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
146 ;; (`prolog-electric-colon-flag', default nil), electric dash |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
147 ;; (`prolog-electric-dash-flag', default nil), and a possibility |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
148 ;; to prevent the predicate template insertion from adding commata |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
149 ;; (`prolog-electric-dot-full-predicate-template', defaults to t |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
150 ;; since it seems quicker to me to just type those commata). A |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
151 ;; trivial adaptation of a patch by Markus Triska. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
152 ;; o Improved the behaviour of electric if-then-else to only skip |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
153 ;; forward if the parenthesis/semicolon is preceded by |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
154 ;; whitespace. Once more a trivial adaptation of a patch by |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
155 ;; Markus Triska. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
156 ;; Version 1.14: |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
157 ;; o Cleaned up align code. `prolog-align-flag' is eliminated (since |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
158 ;; on a second thought it does not do anything useful). Added key |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
159 ;; binding (C-c C-a) and menu entry for alignment. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
160 ;; o Condensed regular expressions for lower and upper case |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
161 ;; characters (GNU Emacs seems to go over the regexp length limit |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
162 ;; with the original form). My code on the matter was improved |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
163 ;; considerably by Markus Triska. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
164 ;; o Fixed `prolog-insert-spaces-after-paren' (which used an |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
165 ;; unitialized variable). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
166 ;; o Minor changes to clean up the code and avoid some implicit |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
167 ;; package requirements. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
168 ;; Version 1.13: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
169 ;; o Removed the use of `map-char-table' in `prolog-build-case-strings' |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
170 ;; which appears to cause prblems in (at least) Emacs 23.0.0.1. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
171 ;; o Added if-then-else indentation + corresponding electric |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
172 ;; characters. New customization: `prolog-electric-if-then-else-flag' |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
173 ;; o Align support (requires `align'). New customization: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
174 ;; `prolog-align-flag'. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
175 ;; o Temporary consult files have now the same name throughout the |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
176 ;; session. This prevents issues with reconsulting a buffer |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
177 ;; (this event is no longer passed to Prolog as a request to |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
178 ;; consult a new file). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
179 ;; o Adaptive fill mode is now turned on. Comment indentation is |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
180 ;; still worse than it could be though, I am working on it. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
181 ;; o Improved filling and auto-filling capabilities. Now block |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
182 ;; comments should be [auto-]filled correctly most of the time; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
183 ;; the following pattern in particular is worth noting as being |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
184 ;; filled correctly: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
185 ;; <some code here> % some comment here that goes beyond the |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
186 ;; % rightmost column, possibly combined with |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
187 ;; % subsequent comment lines |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
188 ;; o `prolog-char-quote-workaround' now defaults to nil. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
189 ;; o Note: Many of the above improvements have been suggested by |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
190 ;; Markus Triska, who also provided useful patches on the matter |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
191 ;; when he realized that I was slow in responding. Many thanks. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
192 ;; Version 1.11 / 1.12 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
193 ;; o GNU Emacs compatibility fix for paragraph filling (fixed |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
194 ;; incorrectly in 1.11, fix fixed in 1.12). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
195 ;; Version 1.10 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
196 ;; o Added paragraph filling in comment blocks and also correct auto |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
197 ;; filling for comments. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
198 ;; o Fixed the possible "Regular expression too big" error in |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
199 ;; `prolog-electric-dot'. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
200 ;; Version 1.9 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
201 ;; o Parenthesis expressions are now indented by default so that |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
202 ;; components go one underneath the other, just as for compound |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
203 ;; terms. You can use the old style (the second and subsequent |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
204 ;; lines being indented to the right in a parenthesis expression) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
205 ;; by setting the customizable variable `prolog-paren-indent-p' |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
206 ;; (group "Prolog Indentation") to t. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
207 ;; o (Somehow awkward) handling of the 0' character escape |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
208 ;; sequence. I am looking into a better way of doing it but |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
209 ;; prospects look bleak. If this breaks things for you please let |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
210 ;; me know and also set the `prolog-char-quote-workaround' (group |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
211 ;; "Prolog Other") to nil. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
212 ;; Version 1.8 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
213 ;; o Key binding fix. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
214 ;; Version 1.7 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
215 ;; o Fixed a number of issues with the syntax of single quotes, |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
216 ;; including Debian bug #324520. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
217 ;; Version 1.6 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
218 ;; o Fixed mercury mode menu initialization (Debian bug #226121). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
219 ;; o Fixed (i.e., eliminated) Delete remapping (Debian bug #229636). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
220 ;; o Corrected indentation for clauses defining quoted atoms. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
221 ;; Version 1.5: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
222 ;; o Keywords fontifying should work in console mode so this is |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
223 ;; enabled everywhere. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
224 ;; Version 1.4: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
225 ;; o Now supports GNU Prolog--minor adaptation of a patch by Stefan |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
226 ;; Moeding. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
227 ;; Version 1.3: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
228 ;; o Info-follow-nearest-node now called correctly under Emacs too |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
229 ;; (thanks to Nicolas Pelletier). Should be implemented more |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
230 ;; elegantly (i.e., without compilation warnings) in the future. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
231 ;; Version 1.2: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
232 ;; o Another prompt fix, still in SWI mode (people seem to have |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
233 ;; changed the prompt of SWI Prolog). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
234 ;; Version 1.1: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
235 ;; o Fixed dots in the end of line comments causing indentation |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
236 ;; problems. The following code is now correctly indented (note |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
237 ;; the dot terminating the comment): |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
238 ;; a(X) :- b(X), |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
239 ;; c(X). % comment here. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
240 ;; a(X). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
241 ;; and so is this (and variants): |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
242 ;; a(X) :- b(X), |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
243 ;; c(X). /* comment here. */ |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
244 ;; a(X). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
245 ;; Version 1.0: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
246 ;; o Revamped the menu system. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
247 ;; o Yet another prompt recognition fix (SWI mode). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
248 ;; o This is more of a renumbering than a new edition. I promoted |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
249 ;; the mode to version 1.0 to emphasize the fact that it is now |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
250 ;; mature and stable enough to be considered production (in my |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
251 ;; opinion anyway). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
252 ;; Version 0.1.41: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
253 ;; o GNU Emacs compatibility fixes. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
254 ;; Version 0.1.40: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
255 ;; o prolog-get-predspec is now suitable to be called as |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
256 ;; imenu-extract-index-name-function. The predicate index works. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
257 ;; o Since imenu works now as advertised, prolog-imenu-flag is t |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
258 ;; by default. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
259 ;; o Eliminated prolog-create-predicate-index since the imenu |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
260 ;; utilities now work well. Actually, this function is also |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
261 ;; buggy, and I see no reason to fix it since we do not need it |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
262 ;; anyway. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
263 ;; o Fixed prolog-pred-start, prolog-clause-start, prolog-clause-info. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
264 ;; o Fix for prolog-build-case-strings; now prolog-upper-case-string |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
265 ;; and prolog-lower-case-string are correctly initialized, |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
266 ;; o Various font-lock changes; most importantly, block comments (/* |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
267 ;; ... */) are now correctly fontified in XEmacs even when they |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
268 ;; extend on multiple lines. |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
269 ;; Version 0.1.36: |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
270 ;; o The debug prompt of SWI Prolog is now correctly recognized. |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
271 ;; Version 0.1.35: |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
272 ;; o Minor font-lock bug fixes. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
273 |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
274 ;;; TODO: |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
275 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
276 ;; Replace ":type 'sexp" with more precise Custom types. |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
277 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
278 ;;; Code: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
279 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
280 (eval-when-compile |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
281 (require 'compile) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
282 (require 'font-lock) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
283 ;; We need imenu everywhere because of the predicate index! |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
284 (require 'imenu) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
285 ;) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
286 (require 'info) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
287 (require 'shell) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
288 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
289 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
290 (require 'comint) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
291 (require 'easymenu) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
292 (require 'align) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
293 |
65238
a372b82c546e
(comint-prompt-regexp): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64699
diff
changeset
|
294 |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
295 (defgroup prolog nil |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
296 "Major modes for editing and running Prolog and Mercury files." |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
297 :group 'languages) |
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
298 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
299 (defgroup prolog-faces nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
300 "Prolog mode specific faces." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
301 :group 'font-lock) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
302 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
303 (defgroup prolog-indentation nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
304 "Prolog mode indentation configuration." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
305 :group 'prolog) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
306 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
307 (defgroup prolog-font-lock nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
308 "Prolog mode font locking patterns." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
309 :group 'prolog) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
310 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
311 (defgroup prolog-keyboard nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
312 "Prolog mode keyboard flags." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
313 :group 'prolog) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
314 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
315 (defgroup prolog-inferior nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
316 "Inferior Prolog mode options." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
317 :group 'prolog) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
318 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
319 (defgroup prolog-other nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
320 "Other Prolog mode options." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
321 :group 'prolog) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
322 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
323 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
324 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
325 ;; User configurable variables |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
326 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
327 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
328 ;; General configuration |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
329 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
330 (defcustom prolog-system nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
331 "*Prolog interpreter/compiler used. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
332 The value of this variable is nil or a symbol. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
333 If it is a symbol, it determines default values of other configuration |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
334 variables with respect to properties of the specified Prolog |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
335 interpreter/compiler. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
336 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
337 Currently recognized symbol values are: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
338 eclipse - Eclipse Prolog |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
339 mercury - Mercury |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
340 sicstus - SICStus Prolog |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
341 swi - SWI Prolog |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
342 gnu - GNU Prolog" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
343 :group 'prolog |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
344 :type '(choice (const :tag "SICStus" :value sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
345 (const :tag "SWI Prolog" :value swi) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
346 (const :tag "Default" :value nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
347 (make-variable-buffer-local 'prolog-system) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
348 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
349 ;; NB: This alist can not be processed in prolog-mode-variables to |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
350 ;; create a prolog-system-version-i variable since it is needed |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
351 ;; prior to the call to prolog-mode-variables. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
352 (defcustom prolog-system-version |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
353 '((sicstus (3 . 6)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
354 (swi (0 . 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
355 (mercury (0 . 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
356 (eclipse (3 . 7)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
357 (gnu (0 . 0))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
358 "*Alist of Prolog system versions. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
359 The version numbers are of the format (Major . Minor)." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
360 :group 'prolog) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
361 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
362 ;; Indentation |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
363 |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
364 (defcustom prolog-indent-width 4 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
365 "*The indentation width used by the editing buffer." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
366 :group 'prolog-indentation |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
367 :type 'integer) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
368 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
369 (defcustom prolog-align-comments-flag t |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
370 "*Non-nil means automatically align comments when indenting." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
371 :group 'prolog-indentation |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
372 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
373 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
374 (defcustom prolog-indent-mline-comments-flag t |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
375 "*Non-nil means indent contents of /* */ comments. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
376 Otherwise leave such lines as they are." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
377 :group 'prolog-indentation |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
378 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
379 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
380 (defcustom prolog-object-end-to-0-flag t |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
381 "*Non-nil means indent closing '}' in SICStus object definitions to level 0. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
382 Otherwise indent to `prolog-indent-width'." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
383 :group 'prolog-indentation |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
384 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
385 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
386 (defcustom prolog-left-indent-regexp "\\(;\\|\\*?->\\)" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
387 "*Regexp for character sequences after which next line is indented. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
388 Next line after such a regexp is indented to the opening paranthesis level." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
389 :group 'prolog-indentation |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
390 :type 'regexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
391 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
392 (defcustom prolog-paren-indent-p nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
393 "*If non-nil, increase indentation for parenthesis expressions. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
394 The second and subsequent line in a parenthesis expression other than |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
395 a compound term can either be indented `prolog-paren-indent' to the |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
396 right (if this variable is non-nil) or in the same way as for compound |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
397 terms (if this variable is nil, default)." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
398 :group 'prolog-indentation |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
399 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
400 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
401 (defcustom prolog-paren-indent 4 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
402 "*The indentation increase for parenthesis expressions. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
403 Only used in ( If -> Then ; Else) and ( Disj1 ; Disj2 ) style expressions." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
404 :group 'prolog-indentation |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
405 :type 'integer) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
406 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
407 (defcustom prolog-parse-mode 'beg-of-clause |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
408 "*The parse mode used (decides from which point parsing is done). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
409 Legal values: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
410 'beg-of-line - starts parsing at the beginning of a line, unless the |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
411 previous line ends with a backslash. Fast, but has |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
412 problems detecting multiline /* */ comments. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
413 'beg-of-clause - starts parsing at the beginning of the current clause. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
414 Slow, but copes better with /* */ comments." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
415 :group 'prolog-indentation |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
416 :type '(choice (const :value beg-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
417 (const :value beg-of-clause))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
418 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
419 ;; Font locking |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
420 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
421 (defcustom prolog-keywords |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
422 '((eclipse |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
423 ("use_module" "begin_module" "module_interface" "dynamic" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
424 "external" "export" "dbgcomp" "nodbgcomp" "compile")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
425 (mercury |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
426 ("all" "else" "end_module" "equality" "external" "fail" "func" "if" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
427 "implementation" "import_module" "include_module" "inst" "instance" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
428 "interface" "mode" "module" "not" "pragma" "pred" "some" "then" "true" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
429 "type" "typeclass" "use_module" "where")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
430 (sicstus |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
431 ("block" "dynamic" "mode" "module" "multifile" "meta_predicate" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
432 "parallel" "public" "sequential" "volatile")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
433 (swi |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
434 ("discontiguous" "dynamic" "ensure_loaded" "export" "export_list" "import" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
435 "meta_predicate" "module" "module_transparent" "multifile" "require" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
436 "use_module" "volatile")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
437 (gnu |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
438 ("built_in" "char_conversion" "discontiguous" "dynamic" "ensure_linked" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
439 "ensure_loaded" "foreign" "include" "initialization" "multifile" "op" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
440 "public" "set_prolog_flag")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
441 (t |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
442 ;; FIXME: Shouldn't we just use the union of all the above here? |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
443 ("dynamic" "module"))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
444 "*Alist of Prolog keywords which is used for font locking of directives." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
445 :group 'prolog-font-lock |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
446 :type 'sexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
447 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
448 (defcustom prolog-types |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
449 '((mercury |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
450 ("char" "float" "int" "io__state" "string" "univ")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
451 (t nil)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
452 "*Alist of Prolog types used by font locking." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
453 :group 'prolog-font-lock |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
454 :type 'sexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
455 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
456 (defcustom prolog-mode-specificators |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
457 '((mercury |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
458 ("bound" "di" "free" "ground" "in" "mdi" "mui" "muo" "out" "ui" "uo")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
459 (t nil)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
460 "*Alist of Prolog mode specificators used by font locking." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
461 :group 'prolog-font-lock |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
462 :type 'sexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
463 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
464 (defcustom prolog-determinism-specificators |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
465 '((mercury |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
466 ("cc_multi" "cc_nondet" "det" "erroneous" "failure" "multi" "nondet" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
467 "semidet")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
468 (t nil)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
469 "*Alist of Prolog determinism specificators used by font locking." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
470 :group 'prolog-font-lock |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
471 :type 'sexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
472 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
473 (defcustom prolog-directives |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
474 '((mercury |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
475 ("^#[0-9]+")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
476 (t nil)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
477 "*Alist of Prolog source code directives used by font locking." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
478 :group 'prolog-font-lock |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
479 :type 'sexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
480 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
481 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
482 ;; Keyboard |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
483 |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
484 (defcustom prolog-electric-newline-flag (not (fboundp 'electric-indent-mode)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
485 "*Non-nil means automatically indent the next line when the user types RET." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
486 :group 'prolog-keyboard |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
487 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
488 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
489 (defcustom prolog-hungry-delete-key-flag nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
490 "*Non-nil means delete key consumes all preceding spaces." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
491 :group 'prolog-keyboard |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
492 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
493 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
494 (defcustom prolog-electric-dot-flag nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
495 "*Non-nil means make dot key electric. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
496 Electric dot appends newline or inserts head of a new clause. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
497 If dot is pressed at the end of a line where at least one white space |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
498 precedes the point, it inserts a recursive call to the current predicate. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
499 If dot is pressed at the beginning of an empty line, it inserts the head |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
500 of a new clause for the current predicate. It does not apply in strings |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
501 and comments. |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
502 It does not apply in strings and comments." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
503 :group 'prolog-keyboard |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
504 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
505 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
506 (defcustom prolog-electric-dot-full-predicate-template nil |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
507 "*If nil, electric dot inserts only the current predicate's name and `(' |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
508 for recursive calls or new clause heads. Non-nil means to also |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
509 insert enough commata to cover the predicate's arity and `)', |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
510 and dot and newline for recursive calls." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
511 :group 'prolog-keyboard |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
512 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
513 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
514 (defcustom prolog-electric-underscore-flag nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
515 "*Non-nil means make underscore key electric. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
516 Electric underscore replaces the current variable with underscore. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
517 If underscore is pressed not on a variable then it behaves as usual." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
518 :group 'prolog-keyboard |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
519 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
520 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
521 (defcustom prolog-electric-tab-flag nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
522 "*Non-nil means make TAB key electric. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
523 Electric TAB inserts spaces after parentheses, ->, and ; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
524 in ( If -> Then ; Else) and ( Disj1 ; Disj2 ) style expressions." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
525 :group 'prolog-keyboard |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
526 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
527 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
528 (defcustom prolog-electric-if-then-else-flag nil |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
529 "*Non-nil makes `(', `>' and `;' electric |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
530 to automatically indent if-then-else constructs." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
531 :group 'prolog-keyboard |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
532 :type 'boolean) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
533 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
534 (defcustom prolog-electric-colon-flag nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
535 "*Makes `:' electric (inserts `:-' on a new line). |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
536 If non-nil, pressing `:' at the end of a line that starts in |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
537 the first column (i.e., clause heads) inserts ` :-' and newline." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
538 :group 'prolog-keyboard |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
539 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
540 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
541 (defcustom prolog-electric-dash-flag nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
542 "*Makes `-' electric (inserts a `-->' on a new line). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
543 If non-nil, pressing `-' at the end of a line that starts in |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
544 the first column (i.e., DCG heads) inserts ` -->' and newline." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
545 :group 'prolog-keyboard |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
546 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
547 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
548 (defcustom prolog-old-sicstus-keys-flag nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
549 "*Non-nil means old SICStus Prolog mode keybindings are used." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
550 :group 'prolog-keyboard |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
551 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
552 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
553 ;; Inferior mode |
45608
706ae7fb4033
(prolog-mode-syntax-table): Add flags to ?/ and ?* entries
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
20396
diff
changeset
|
554 |
53891
4b85b1e3d610
(prolog-program-name): Use gprolog if available.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
555 (defcustom prolog-program-name |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
556 `(((getenv "EPROLOG") (eval (getenv "EPROLOG"))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
557 (eclipse "eclipse") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
558 (mercury nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
559 (sicstus "sicstus") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
560 (swi ,(if (not (executable-find "swipl")) "pl" "swipl")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
561 (gnu "gprolog") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
562 (t ,(let ((names '("prolog" "gprolog" "swipl" "pl"))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
563 (while (and names |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
564 (not (executable-find (car names)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
565 (setq names (cdr names))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
566 (or (car names) "prolog")))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
567 "*Alist of program names for invoking an inferior Prolog with `run-prolog'." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
568 :group 'prolog-inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
569 :type 'sexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
570 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
571 (defcustom prolog-program-switches |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
572 '((sicstus ("-i")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
573 (t nil)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
574 "*Alist of switches given to inferior Prolog run with `run-prolog'." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
575 :group 'prolog-inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
576 :type 'sexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
577 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
578 (defcustom prolog-consult-string |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
579 '((eclipse "[%f].") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
580 (mercury nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
581 (sicstus (eval (if (prolog-atleast-version '(3 . 7)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
582 "prolog:zap_file(%m,%b,consult,%l)." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
583 "prolog:zap_file(%m,%b,consult)."))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
584 (swi "[%f].") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
585 (gnu "[%f].") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
586 (t "reconsult(%f).")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
587 "*Alist of strings defining predicate for reconsulting. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
588 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
589 Some parts of the string are replaced: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
590 `%f' by the name of the consulted file (can be a temporary file) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
591 `%b' by the file name of the buffer to consult |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
592 `%m' by the module name and name of the consulted file separated by colon |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
593 `%l' by the line offset into the file. This is 0 unless consulting a |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
594 region of a buffer, in which case it is the number of lines before |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
595 the region." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
596 :group 'prolog-inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
597 :type 'sexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
598 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
599 (defcustom prolog-compile-string |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
600 '((eclipse "[%f].") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
601 (mercury "mmake ") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
602 (sicstus (eval (if (prolog-atleast-version '(3 . 7)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
603 "prolog:zap_file(%m,%b,compile,%l)." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
604 "prolog:zap_file(%m,%b,compile)."))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
605 (swi "[%f].") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
606 (t "compile(%f).")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
607 "*Alist of strings and lists defining predicate for recompilation. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
608 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
609 Some parts of the string are replaced: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
610 `%f' by the name of the compiled file (can be a temporary file) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
611 `%b' by the file name of the buffer to compile |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
612 `%m' by the module name and name of the compiled file separated by colon |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
613 `%l' by the line offset into the file. This is 0 unless compiling a |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
614 region of a buffer, in which case it is the number of lines before |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
615 the region. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
616 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
617 If `prolog-program-name' is non-nil, it is a string sent to a Prolog process. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
618 If `prolog-program-name' is nil, it is an argument to the `compile' function." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
619 :group 'prolog-inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
620 :type 'sexp) |
41 | 621 |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
622 (defcustom prolog-eof-string "end_of_file.\n" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
623 "*Alist of strings that represent end of file for prolog. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
624 nil means send actual operating system end of file." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
625 :group 'prolog-inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
626 :type 'sexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
627 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
628 (defcustom prolog-prompt-regexp |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
629 '((eclipse "^[a-zA-Z0-9()]* *\\?- \\|^\\[[a-zA-Z]* [0-9]*\\]:") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
630 (sicstus "| [ ?][- ] *") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
631 (swi "^\\(\\[[a-zA-Z]*\\] \\)?[1-9]?[0-9]*[ ]?\\?- \\|^| +") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
632 (t "^ *\\?-")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
633 "*Alist of prompts of the prolog system command line." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
634 :group 'prolog-inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
635 :type 'sexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
636 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
637 (defcustom prolog-continued-prompt-regexp |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
638 '((sicstus "^\\(| +\\| +\\)") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
639 (t "^|: +")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
640 "*Alist of regexps matching the prompt when consulting `user'." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
641 :group 'prolog-inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
642 :type 'sexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
643 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
644 (defcustom prolog-debug-on-string "debug.\n" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
645 "*Predicate for enabling debug mode." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
646 :group 'prolog-inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
647 :type 'string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
648 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
649 (defcustom prolog-debug-off-string "nodebug.\n" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
650 "*Predicate for disabling debug mode." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
651 :group 'prolog-inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
652 :type 'string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
653 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
654 (defcustom prolog-trace-on-string "trace.\n" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
655 "*Predicate for enabling tracing." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
656 :group 'prolog-inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
657 :type 'string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
658 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
659 (defcustom prolog-trace-off-string "notrace.\n" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
660 "*Predicate for disabling tracing." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
661 :group 'prolog-inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
662 :type 'string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
663 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
664 (defcustom prolog-zip-on-string "zip.\n" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
665 "*Predicate for enabling zip mode for SICStus." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
666 :group 'prolog-inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
667 :type 'string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
668 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
669 (defcustom prolog-zip-off-string "nozip.\n" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
670 "*Predicate for disabling zip mode for SICStus." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
671 :group 'prolog-inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
672 :type 'string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
673 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
674 (defcustom prolog-use-standard-consult-compile-method-flag t |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
675 "*Non-nil means use the standard compilation method. |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
676 Otherwise the new compilation method will be used. This |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
677 utilises a special compilation buffer with the associated |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
678 features such as parsing of error messages and automatically |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
679 jumping to the source code responsible for the error. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
680 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
681 Warning: the new method is so far only experimental and |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
682 does contain bugs. The recommended setting for the novice user |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
683 is non-nil for this variable." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
684 :group 'prolog-inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
685 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
686 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
687 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
688 ;; Miscellaneous |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
689 |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
690 (defcustom prolog-use-prolog-tokenizer-flag |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
691 (not (fboundp 'syntax-propertize-rules)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
692 "*Non-nil means use the internal prolog tokenizer for indentation etc. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
693 Otherwise use `parse-partial-sexp' which is faster but sometimes incorrect." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
694 :group 'prolog-other |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
695 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
696 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
697 (defcustom prolog-imenu-flag t |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
698 "*Non-nil means add a clause index menu for all prolog files." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
699 :group 'prolog-other |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
700 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
701 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
702 (defcustom prolog-imenu-max-lines 3000 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
703 "*The maximum number of lines of the file for imenu to be enabled. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
704 Relevant only when `prolog-imenu-flag' is non-nil." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
705 :group 'prolog-other |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
706 :type 'integer) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
707 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
708 (defcustom prolog-info-predicate-index |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
709 "(sicstus)Predicate Index" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
710 "*The info node for the SICStus predicate index." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
711 :group 'prolog-other |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
712 :type 'string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
713 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
714 (defcustom prolog-underscore-wordchar-flag nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
715 "*Non-nil means underscore (_) is a word-constituent character." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
716 :group 'prolog-other |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
717 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
718 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
719 (defcustom prolog-use-sicstus-sd nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
720 "*If non-nil, use the source level debugger of SICStus 3#7 and later." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
721 :group 'prolog-other |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
722 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
723 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
724 (defcustom prolog-char-quote-workaround nil |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
725 "*If non-nil, declare 0 as a quote character to handle 0'<char>. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
726 This is really kludgy, and unneeded (i.e. obsolete) in Emacs>=24." |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
727 :group 'prolog-other |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
728 :type 'boolean) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
729 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
730 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
731 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
732 ;; Internal variables |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
733 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
734 |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
735 ;;(defvar prolog-temp-filename "") ; Later set by `prolog-temporary-file' |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
736 |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
737 (defvar prolog-mode-syntax-table |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
738 ;; The syntax accepted varies depending on the implementation used. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
739 ;; Here are some of the differences: |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
740 ;; - SWI-Prolog accepts nested /*..*/ comments. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
741 ;; - Edinburgh-style Prologs take <radix>'<number> for non-decimal number, |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
742 ;; whereas ISO-style Prologs use 0[obx]<number> instead. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
743 ;; - In atoms \x<hex> sometimes needs a terminating \ (ISO-style) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
744 ;; and sometimes not. |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
745 (let ((table (make-syntax-table))) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
746 (if prolog-underscore-wordchar-flag |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
747 (modify-syntax-entry ?_ "w" table) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
748 (modify-syntax-entry ?_ "_" table)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
749 |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
750 (modify-syntax-entry ?+ "." table) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
751 (modify-syntax-entry ?- "." table) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
752 (modify-syntax-entry ?= "." table) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
753 (modify-syntax-entry ?< "." table) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
754 (modify-syntax-entry ?> "." table) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
755 (modify-syntax-entry ?| "." table) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
756 (modify-syntax-entry ?\' "\"" table) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
757 |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
758 ;; Any better way to handle the 0'<char> construct?!? |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
759 (when prolog-char-quote-workaround |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
760 (modify-syntax-entry ?0 "\\" table)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
761 |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
762 (modify-syntax-entry ?% "<" table) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
763 (modify-syntax-entry ?\n ">" table) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
764 (if (featurep 'xemacs) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
765 (progn |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
766 (modify-syntax-entry ?* ". 67" table) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
767 (modify-syntax-entry ?/ ". 58" table) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
768 ) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
769 ;; Emacs wants to see this it seems: |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
770 (modify-syntax-entry ?* ". 23b" table) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
771 (modify-syntax-entry ?/ ". 14" table) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
772 ) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
773 table)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
774 (defvar prolog-mode-abbrev-table nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
775 (defvar prolog-upper-case-string "" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
776 "A string containing all upper case characters. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
777 Set by prolog-build-case-strings.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
778 (defvar prolog-lower-case-string "" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
779 "A string containing all lower case characters. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
780 Set by prolog-build-case-strings.") |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
781 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
782 (defvar prolog-atom-char-regexp "" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
783 "Set by prolog-set-atom-regexps.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
784 ;; "Regexp specifying characters which constitute atoms without quoting.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
785 (defvar prolog-atom-regexp "" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
786 "Set by prolog-set-atom-regexps.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
787 |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
788 (defconst prolog-left-paren "[[({]" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
789 "The characters used as left parentheses for the indentation code.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
790 (defconst prolog-right-paren "[])}]" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
791 "The characters used as right parentheses for the indentation code.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
792 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
793 (defconst prolog-quoted-atom-regexp |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
794 "\\(^\\|[^0-9]\\)\\('\\([^\n']\\|\\\\'\\)*'\\)" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
795 "Regexp matching a quoted atom.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
796 (defconst prolog-string-regexp |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
797 "\\(\"\\([^\n\"]\\|\\\\\"\\)*\"\\)" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
798 "Regexp matching a string.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
799 (defconst prolog-head-delimiter "\\(:-\\|\\+:\\|-:\\|\\+\\?\\|-\\?\\|-->\\)" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
800 "A regexp for matching on the end delimiter of a head (e.g. \":-\").") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
801 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
802 (defvar prolog-compilation-buffer "*prolog-compilation*" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
803 "Name of the output buffer for Prolog compilation/consulting.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
804 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
805 (defvar prolog-temporary-file-name nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
806 (defvar prolog-keywords-i nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
807 (defvar prolog-types-i nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
808 (defvar prolog-mode-specificators-i nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
809 (defvar prolog-determinism-specificators-i nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
810 (defvar prolog-directives-i nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
811 (defvar prolog-program-name-i nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
812 (defvar prolog-program-switches-i nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
813 (defvar prolog-consult-string-i nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
814 (defvar prolog-compile-string-i nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
815 (defvar prolog-eof-string-i nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
816 (defvar prolog-prompt-regexp-i nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
817 (defvar prolog-continued-prompt-regexp-i nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
818 (defvar prolog-help-function-i nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
819 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
820 (defvar prolog-align-rules |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
821 (eval-when-compile |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
822 (mapcar |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
823 (lambda (x) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
824 (let ((name (car x)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
825 (sym (cdr x))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
826 `(,(intern (format "prolog-%s" name)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
827 (regexp . ,(format "\\(\\s-*\\)%s\\(\\s-*\\)" sym)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
828 (tab-stop . nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
829 (modes . '(prolog-mode)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
830 (group . (1 2))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
831 '(("dcg" . "-->") ("rule" . ":-") ("simplification" . "<=>") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
832 ("propagation" . "==>"))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
833 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
834 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
835 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
836 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
837 ;; Prolog mode |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
838 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
839 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
840 ;; Example: (prolog-atleast-version '(3 . 6)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
841 (defun prolog-atleast-version (version) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
842 "Return t if the version of the current prolog system is VERSION or later. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
843 VERSION is of the format (Major . Minor)" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
844 ;; Version.major < major or |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
845 ;; Version.major = major and Version.minor <= minor |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
846 (let* ((thisversion (prolog-find-value-by-system prolog-system-version)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
847 (thismajor (car thisversion)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
848 (thisminor (cdr thisversion))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
849 (or (< (car version) thismajor) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
850 (and (= (car version) thismajor) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
851 (<= (cdr version) thisminor))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
852 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
853 |
41 | 854 (define-abbrev-table 'prolog-mode-abbrev-table ()) |
855 | |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
856 (defun prolog-find-value-by-system (alist) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
857 "Get value from ALIST according to `prolog-system'." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
858 (if (listp alist) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
859 (let (result |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
860 id) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
861 (while alist |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
862 (setq id (car (car alist))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
863 (if (or (eq id prolog-system) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
864 (eq id t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
865 (and (listp id) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
866 (eval id))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
867 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
868 (setq result (car (cdr (car alist)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
869 (if (and (listp result) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
870 (eq (car result) 'eval)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
871 (setq result (eval (car (cdr result))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
872 (setq alist nil)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
873 (setq alist (cdr alist)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
874 result) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
875 alist)) |
108632
d38b0dd2bdbe
Provide a simple generic indentation engine and use it for Prolog.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108588
diff
changeset
|
876 |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
877 (defconst prolog-syntax-propertize-function |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
878 (when (fboundp 'syntax-propertize-rules) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
879 (syntax-propertize-rules |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
880 ;; GNU Prolog only accepts 0'\' rather than 0'', but the only |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
881 ;; possible meaning of 0'' is rather clear. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
882 ("\\<0\\(''?\\)" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
883 (1 (unless (save-excursion (nth 8 (syntax-ppss (match-beginning 0)))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
884 (string-to-syntax "_")))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
885 ;; We could check that we're not inside an atom, but I don't think |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
886 ;; that 'foo 8'z could be a valid syntax anyway, so why bother? |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
887 ("\\<[1-9][0-9]*\\('\\)[0-9a-zA-Z]" (1 "_")) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
888 ;; Supposedly, ISO-Prolog wants \NNN\ for octal and \xNNN\ for hexadecimal |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
889 ;; escape sequences in atoms, so be careful not to let the terminating \ |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
890 ;; escape a subsequent quote. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
891 ("\\\\[x0-7][0-9a-fA-F]*\\(\\\\\\)" (1 "_")) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
892 ))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
893 |
41 | 894 (defun prolog-mode-variables () |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
895 "Set some common variables to Prolog code specific values." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
896 (setq local-abbrev-table prolog-mode-abbrev-table) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
897 (set (make-local-variable 'paragraph-start) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
898 (concat "[ \t]*$\\|" page-delimiter)) ;'%%..' |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
899 (set (make-local-variable 'paragraph-separate) paragraph-start) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
900 (set (make-local-variable 'paragraph-ignore-fill-prefix) t) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
901 (set (make-local-variable 'normal-auto-fill-function) 'prolog-do-auto-fill) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
902 (set (make-local-variable 'indent-line-function) 'prolog-indent-line) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
903 (set (make-local-variable 'comment-start) "%") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
904 (set (make-local-variable 'comment-end) "") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
905 (set (make-local-variable 'comment-add) 1) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
906 (set (make-local-variable 'comment-start-skip) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
907 ;; This complex regexp makes sure that comments cannot start |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
908 ;; inside quoted atoms or strings |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
909 (format "^\\(\\(%s\\|%s\\|[^\n\'\"%%]\\)*\\)\\(/\\*+ *\\|%%+ *\\)" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
910 prolog-quoted-atom-regexp prolog-string-regexp)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
911 (set (make-local-variable 'comment-indent-function) 'prolog-comment-indent) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
912 (set (make-local-variable 'parens-require-spaces) nil) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
913 ;; Initialize Prolog system specific variables |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
914 (dolist (var '(prolog-keywords prolog-types prolog-mode-specificators |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
915 prolog-determinism-specificators prolog-directives |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
916 prolog-program-name prolog-program-switches |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
917 prolog-consult-string prolog-compile-string prolog-eof-string |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
918 prolog-prompt-regexp prolog-continued-prompt-regexp |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
919 prolog-help-function)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
920 (set (intern (concat (symbol-name var) "-i")) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
921 (prolog-find-value-by-system (symbol-value var)))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
922 (when (null prolog-program-name-i) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
923 (set (make-local-variable 'compile-command) prolog-compile-string-i)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
924 (set (make-local-variable 'font-lock-defaults) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
925 '(prolog-font-lock-keywords nil nil ((?_ . "w")))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
926 (set (make-local-variable 'syntax-propertize-function) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
927 prolog-syntax-propertize-function) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
928 ) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
929 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
930 (defun prolog-mode-keybindings-common (map) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
931 "Define keybindings common to both Prolog modes in MAP." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
932 (define-key map "\C-c?" 'prolog-help-on-predicate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
933 (define-key map "\C-c/" 'prolog-help-apropos) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
934 (define-key map "\C-c\C-d" 'prolog-debug-on) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
935 (define-key map "\C-c\C-t" 'prolog-trace-on) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
936 (if (and (eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
937 (prolog-atleast-version '(3 . 7))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
938 (define-key map "\C-c\C-z" 'prolog-zip-on)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
939 (define-key map "\C-c\r" 'run-prolog)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
940 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
941 (defun prolog-mode-keybindings-edit (map) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
942 "Define keybindings for Prolog mode in MAP." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
943 (define-key map "\M-a" 'prolog-beginning-of-clause) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
944 (define-key map "\M-e" 'prolog-end-of-clause) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
945 (define-key map "\M-q" 'prolog-fill-paragraph) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
946 (define-key map "\C-c\C-a" 'align) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
947 (define-key map "\C-\M-a" 'prolog-beginning-of-predicate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
948 (define-key map "\C-\M-e" 'prolog-end-of-predicate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
949 (define-key map "\M-\C-c" 'prolog-mark-clause) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
950 (define-key map "\M-\C-h" 'prolog-mark-predicate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
951 (define-key map "\M-\C-n" 'prolog-forward-list) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
952 (define-key map "\M-\C-p" 'prolog-backward-list) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
953 (define-key map "\C-c\C-n" 'prolog-insert-predicate-template) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
954 (define-key map "\C-c\C-s" 'prolog-insert-predspec) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
955 (define-key map "\M-\r" 'prolog-insert-next-clause) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
956 (define-key map "\C-c\C-va" 'prolog-variables-to-anonymous) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
957 (define-key map "\C-c\C-v\C-s" 'prolog-view-predspec) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
958 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
959 (define-key map [Backspace] 'prolog-electric-delete) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
960 (define-key map "." 'prolog-electric-dot) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
961 (define-key map "_" 'prolog-electric-underscore) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
962 (define-key map "(" 'prolog-electric-if-then-else) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
963 (define-key map ";" 'prolog-electric-if-then-else) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
964 (define-key map ">" 'prolog-electric-if-then-else) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
965 (define-key map ":" 'prolog-electric-colon) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
966 (define-key map "-" 'prolog-electric-dash) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
967 (if prolog-electric-newline-flag |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
968 (define-key map "\r" 'newline-and-indent)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
969 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
970 ;; If we're running SICStus, then map C-c C-c e/d to enabling |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
971 ;; and disabling of the source-level debugging facilities. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
972 ;(if (and (eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
973 ; (prolog-atleast-version '(3 . 7))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
974 ; (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
975 ; (define-key map "\C-c\C-ce" 'prolog-enable-sicstus-sd) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
976 ; (define-key map "\C-c\C-cd" 'prolog-disable-sicstus-sd) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
977 ; )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
978 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
979 (if prolog-old-sicstus-keys-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
980 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
981 (define-key map "\C-c\C-c" 'prolog-consult-predicate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
982 (define-key map "\C-cc" 'prolog-consult-region) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
983 (define-key map "\C-cC" 'prolog-consult-buffer) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
984 (define-key map "\C-c\C-k" 'prolog-compile-predicate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
985 (define-key map "\C-ck" 'prolog-compile-region) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
986 (define-key map "\C-cK" 'prolog-compile-buffer)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
987 (define-key map "\C-c\C-p" 'prolog-consult-predicate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
988 (define-key map "\C-c\C-r" 'prolog-consult-region) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
989 (define-key map "\C-c\C-b" 'prolog-consult-buffer) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
990 (define-key map "\C-c\C-f" 'prolog-consult-file) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
991 (define-key map "\C-c\C-cp" 'prolog-compile-predicate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
992 (define-key map "\C-c\C-cr" 'prolog-compile-region) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
993 (define-key map "\C-c\C-cb" 'prolog-compile-buffer) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
994 (define-key map "\C-c\C-cf" 'prolog-compile-file)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
995 |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
996 ;; Inherited from the old prolog.el. |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
997 (define-key map "\e\C-x" 'prolog-consult-region) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
998 (define-key map "\C-c\C-l" 'prolog-consult-file) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
999 (define-key map "\C-c\C-z" 'switch-to-prolog)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1000 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1001 (defun prolog-mode-keybindings-inferior (map) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1002 "Define keybindings for inferior Prolog mode in MAP." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1003 ;; No inferior mode specific keybindings now. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1004 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1005 |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1006 (defvar prolog-mode-map |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1007 (let ((map (make-sparse-keymap))) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1008 (prolog-mode-keybindings-common map) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1009 (prolog-mode-keybindings-edit map) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1010 map)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1011 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1012 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1013 (defvar prolog-mode-hook nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1014 "List of functions to call after the prolog mode has initialised.") |
41 | 1015 |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1016 (unless (fboundp 'prog-mode) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1017 (defalias 'prog-mode 'fundamental-mode)) |
258 | 1018 ;;;###autoload |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1019 (define-derived-mode prolog-mode prog-mode "Prolog" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1020 "Major mode for editing Prolog code. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1021 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1022 Blank lines and `%%...' separate paragraphs. `%'s starts a comment |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1023 line and comments can also be enclosed in /* ... */. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1024 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1025 If an optional argument SYSTEM is non-nil, set up mode for the given system. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1026 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1027 To find out what version of Prolog mode you are running, enter |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1028 `\\[prolog-mode-version]'. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1029 |
41 | 1030 Commands: |
1031 \\{prolog-mode-map} | |
242 | 1032 Entry to this mode calls the value of `prolog-mode-hook' |
41 | 1033 if that value is non-nil." |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1034 (setq mode-name (concat "Prolog" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1035 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1036 ((eq prolog-system 'eclipse) "[ECLiPSe]") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1037 ((eq prolog-system 'sicstus) "[SICStus]") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1038 ((eq prolog-system 'swi) "[SWI]") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1039 ((eq prolog-system 'gnu) "[GNU]") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1040 (t "")))) |
41 | 1041 (prolog-mode-variables) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1042 (prolog-build-case-strings) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1043 (prolog-set-atom-regexps) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1044 (dolist (ar prolog-align-rules) (add-to-list 'align-rules-list ar)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1045 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1046 ;; imenu entry moved to the appropriate hook for consistency |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1047 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1048 ;; Load SICStus debugger if suitable |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1049 (if (and (eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1050 (prolog-atleast-version '(3 . 7)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1051 prolog-use-sicstus-sd) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1052 (prolog-enable-sicstus-sd)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1053 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1054 (prolog-menu)) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1055 |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1056 (defvar mercury-mode-map |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1057 (let ((map (make-sparse-keymap))) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1058 (set-keymap-parent map prolog-mode-map) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1059 map)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1060 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1061 ;;;###autoload |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1062 (define-derived-mode mercury-mode prolog-mode "Prolog[Mercury]" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1063 "Major mode for editing Mercury programs. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1064 Actually this is just customized `prolog-mode'." |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1065 (set (make-local-variable 'prolog-system) 'mercury)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1066 |
41 | 1067 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1068 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1069 ;; Inferior prolog mode |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1070 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1071 |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1072 (defvar prolog-inferior-mode-map |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1073 (let ((map (make-sparse-keymap))) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1074 (prolog-mode-keybindings-common map) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1075 (prolog-mode-keybindings-inferior map) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1076 map)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1077 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1078 (defvar prolog-inferior-mode-hook nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1079 "List of functions to call after the inferior prolog mode has initialised.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1080 |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1081 (define-derived-mode prolog-inferior-mode comint-mode "Inferior Prolog" |
41 | 1082 "Major mode for interacting with an inferior Prolog process. |
1083 | |
1084 The following commands are available: | |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1085 \\{prolog-inferior-mode-map} |
41 | 1086 |
242 | 1087 Entry to this mode calls the value of `prolog-mode-hook' with no arguments, |
1088 if that value is non-nil. Likewise with the value of `comint-mode-hook'. | |
1089 `prolog-mode-hook' is called after `comint-mode-hook'. | |
41 | 1090 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1091 You can send text to the inferior Prolog from other buffers |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1092 using the commands `send-region', `send-string' and \\[prolog-consult-region]. |
41 | 1093 |
1094 Commands: | |
1095 Tab indents for Prolog; with argument, shifts rest | |
1096 of expression rigidly with the current line. | |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1097 Paragraphs are separated only by blank lines and '%%'. '%'s start comments. |
41 | 1098 |
1099 Return at end of buffer sends line as input. | |
1100 Return not at end copies rest of line to end and sends it. | |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1101 \\[comint-delchar-or-maybe-eof] sends end-of-file as input. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1102 \\[comint-kill-input] and \\[backward-kill-word] are kill commands, |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1103 imitating normal Unix input editing. |
41 | 1104 \\[comint-interrupt-subjob] interrupts the shell or its current subjob if any. |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1105 \\[comint-stop-subjob] stops, likewise. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1106 \\[comint-quit-subjob] sends quit signal, likewise. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1107 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1108 To find out what version of Prolog mode you are running, enter |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1109 `\\[prolog-mode-version]'." |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1110 (setq comint-input-filter 'prolog-input-filter) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1111 (setq mode-line-process '(": %s")) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1112 (prolog-mode-variables) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1113 (setq comint-prompt-regexp prolog-prompt-regexp-i) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1114 (set (make-local-variable 'shell-dirstack-query) "pwd.") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1115 (prolog-inferior-menu)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1116 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1117 (defun prolog-input-filter (str) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1118 (cond ((string-match "\\`\\s *\\'" str) nil) ;whitespace |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1119 ((not (eq major-mode 'prolog-inferior-mode)) t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1120 ((= (length str) 1) nil) ;one character |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1121 ((string-match "\\`[rf] *[0-9]*\\'" str) nil) ;r(edo) or f(ail) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1122 (t t))) |
72696
560a2e73e11b
(inferior-prolog-flavor): New var left out of previous commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
72684
diff
changeset
|
1123 |
258 | 1124 ;;;###autoload |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1125 (defun run-prolog (arg) |
72684
f65ec4fd2be1
Remove * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68773
diff
changeset
|
1126 "Run an inferior Prolog process, input and output via buffer *prolog*. |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1127 With prefix argument ARG, restart the Prolog process if running before." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1128 (interactive "P") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1129 (if (and arg (get-process "prolog")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1130 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1131 (process-send-string "prolog" "halt.\n") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1132 (while (get-process "prolog") (sit-for 0.1)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1133 (let ((buff (buffer-name))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1134 (if (not (string= buff "*prolog*")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1135 (prolog-goto-prolog-process-buffer)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1136 ;; Load SICStus debugger if suitable |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1137 (if (and (eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1138 (prolog-atleast-version '(3 . 7)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1139 prolog-use-sicstus-sd) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1140 (prolog-enable-sicstus-sd)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1141 (prolog-mode-variables) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1142 (prolog-ensure-process) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1143 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1144 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1145 (defun prolog-ensure-process (&optional wait) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1146 "If Prolog process is not running, run it. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1147 If the optional argument WAIT is non-nil, wait for Prolog prompt specified by |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1148 the variable `prolog-prompt-regexp'." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1149 (if (null prolog-program-name-i) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1150 (error "This Prolog system has defined no interpreter.")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1151 (if (comint-check-proc "*prolog*") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1152 () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1153 (apply 'make-comint "prolog" prolog-program-name-i nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1154 prolog-program-switches-i) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1155 (with-current-buffer "*prolog*" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1156 (prolog-inferior-mode) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1157 (if wait |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1158 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1159 (goto-char (point-max)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1160 (while |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1161 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1162 (not |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1163 (re-search-backward |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1164 (concat "\\(" prolog-prompt-regexp-i "\\)" "\\=") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1165 nil t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1166 (sit-for 0.1))))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1167 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1168 (defun prolog-process-insert-string (process string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1169 "Insert STRING into inferior Prolog buffer running PROCESS." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1170 ;; Copied from elisp manual, greek to me |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1171 (with-current-buffer (process-buffer process) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1172 ;; FIXME: Use window-point-insertion-type instead. |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1173 (let ((moving (= (point) (process-mark process)))) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1174 (save-excursion |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1175 ;; Insert the text, moving the process-marker. |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1176 (goto-char (process-mark process)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1177 (insert string) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1178 (set-marker (process-mark process) (point))) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1179 (if moving (goto-char (process-mark process)))))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1180 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1181 ;;------------------------------------------------------------ |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1182 ;; Old consulting and compiling functions |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1183 ;;------------------------------------------------------------ |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1184 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1185 (defun prolog-old-process-region (compilep start end) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1186 "Process the region limited by START and END positions. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1187 If COMPILEP is non-nil then use compilation, otherwise consulting." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1188 (prolog-ensure-process) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1189 ;(let ((tmpfile prolog-temp-filename) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1190 (let ((tmpfile (prolog-bsts (prolog-temporary-file))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1191 ;(process (get-process "prolog")) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1192 (first-line (1+ (count-lines |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1193 (point-min) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1194 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1195 (goto-char start) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1196 (point)))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1197 (write-region start end tmpfile) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1198 (process-send-string |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1199 "prolog" (prolog-build-prolog-command |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1200 compilep tmpfile (prolog-bsts buffer-file-name) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1201 first-line)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1202 (prolog-goto-prolog-process-buffer))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1203 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1204 (defun prolog-old-process-predicate (compilep) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1205 "Process the predicate around point. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1206 If COMPILEP is non-nil then use compilation, otherwise consulting." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1207 (prolog-old-process-region |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1208 compilep (prolog-pred-start) (prolog-pred-end))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1209 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1210 (defun prolog-old-process-buffer (compilep) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1211 "Process the entire buffer. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1212 If COMPILEP is non-nil then use compilation, otherwise consulting." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1213 (prolog-old-process-region compilep (point-min) (point-max))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1214 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1215 (defun prolog-old-process-file (compilep) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1216 "Process the file of the current buffer. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1217 If COMPILEP is non-nil then use compilation, otherwise consulting." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1218 (save-some-buffers) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1219 (prolog-ensure-process) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1220 (let ((filename (prolog-bsts buffer-file-name))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1221 (process-send-string |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1222 "prolog" (prolog-build-prolog-command |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1223 compilep filename filename)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1224 (prolog-goto-prolog-process-buffer))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1225 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1226 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1227 ;;------------------------------------------------------------ |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1228 ;; Consulting and compiling |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1229 ;;------------------------------------------------------------ |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1230 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1231 ;;; Interactive interface functions, used by both the standard |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1232 ;;; and the experimental consultation and compilation functions |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1233 (defun prolog-consult-file () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1234 "Consult file of current buffer." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1235 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1236 (if prolog-use-standard-consult-compile-method-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1237 (prolog-old-process-file nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1238 (prolog-consult-compile-file nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1239 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1240 (defun prolog-consult-buffer () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1241 "Consult buffer." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1242 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1243 (if prolog-use-standard-consult-compile-method-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1244 (prolog-old-process-buffer nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1245 (prolog-consult-compile-buffer nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1246 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1247 (defun prolog-consult-region (beg end) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1248 "Consult region between BEG and END." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1249 (interactive "r") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1250 (if prolog-use-standard-consult-compile-method-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1251 (prolog-old-process-region nil beg end) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1252 (prolog-consult-compile-region nil beg end))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1253 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1254 (defun prolog-consult-predicate () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1255 "Consult the predicate around current point." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1256 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1257 (if prolog-use-standard-consult-compile-method-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1258 (prolog-old-process-predicate nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1259 (prolog-consult-compile-predicate nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1260 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1261 (defun prolog-compile-file () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1262 "Compile file of current buffer." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1263 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1264 (if prolog-use-standard-consult-compile-method-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1265 (prolog-old-process-file t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1266 (prolog-consult-compile-file t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1267 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1268 (defun prolog-compile-buffer () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1269 "Compile buffer." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1270 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1271 (if prolog-use-standard-consult-compile-method-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1272 (prolog-old-process-buffer t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1273 (prolog-consult-compile-buffer t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1274 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1275 (defun prolog-compile-region (beg end) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1276 "Compile region between BEG and END." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1277 (interactive "r") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1278 (if prolog-use-standard-consult-compile-method-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1279 (prolog-old-process-region t beg end) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1280 (prolog-consult-compile-region t beg end))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1281 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1282 (defun prolog-compile-predicate () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1283 "Compile the predicate around current point." |
72696
560a2e73e11b
(inferior-prolog-flavor): New var left out of previous commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
72684
diff
changeset
|
1284 (interactive) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1285 (if prolog-use-standard-consult-compile-method-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1286 (prolog-old-process-predicate t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1287 (prolog-consult-compile-predicate t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1288 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1289 (defun prolog-buffer-module () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1290 "Select Prolog module name appropriate for current buffer. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1291 Bases decision on buffer contents (-*- line)." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1292 ;; Look for -*- ... module: MODULENAME; ... -*- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1293 (let (beg end) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1294 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1295 (goto-char (point-min)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1296 (skip-chars-forward " \t") |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1297 (and (search-forward "-*-" (line-end-position) t) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1298 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1299 (skip-chars-forward " \t") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1300 (setq beg (point)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1301 (search-forward "-*-" (line-end-position) t)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1302 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1303 (forward-char -3) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1304 (skip-chars-backward " \t") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1305 (setq end (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1306 (goto-char beg) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1307 (and (let ((case-fold-search t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1308 (search-forward "module:" end t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1309 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1310 (skip-chars-forward " \t") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1311 (setq beg (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1312 (if (search-forward ";" end t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1313 (forward-char -1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1314 (goto-char end)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1315 (skip-chars-backward " \t") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1316 (buffer-substring beg (point))))))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1317 |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1318 (defun prolog-build-prolog-command (compilep file buffername |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1319 &optional first-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1320 "Make Prolog command for FILE compilation/consulting. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1321 If COMPILEP is non-nil, consider compilation, otherwise consulting." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1322 (let* ((compile-string |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1323 (if compilep prolog-compile-string-i prolog-consult-string-i)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1324 (module (prolog-buffer-module)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1325 (file-name (concat "'" file "'")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1326 (module-name (if module (concat "'" module "'"))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1327 (module-file (if module |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1328 (concat module-name ":" file-name) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1329 file-name)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1330 strbeg strend |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1331 (lineoffset (if first-line |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1332 (- first-line 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1333 0))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1334 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1335 ;; Assure that there is a buffer name |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1336 (if (not buffername) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1337 (error "The buffer is not saved")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1338 |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1339 (if (not (string-match "\\`'.*'\\'" buffername)) ; Add quotes |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1340 (setq buffername (concat "'" buffername "'"))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1341 (while (string-match "%m" compile-string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1342 (setq strbeg (substring compile-string 0 (match-beginning 0))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1343 (setq strend (substring compile-string (match-end 0))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1344 (setq compile-string (concat strbeg module-file strend))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1345 ;; FIXME: The code below will %-expand any %[fbl] that appears in |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1346 ;; module-file. |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1347 (while (string-match "%f" compile-string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1348 (setq strbeg (substring compile-string 0 (match-beginning 0))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1349 (setq strend (substring compile-string (match-end 0))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1350 (setq compile-string (concat strbeg file-name strend))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1351 (while (string-match "%b" compile-string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1352 (setq strbeg (substring compile-string 0 (match-beginning 0))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1353 (setq strend (substring compile-string (match-end 0))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1354 (setq compile-string (concat strbeg buffername strend))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1355 (while (string-match "%l" compile-string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1356 (setq strbeg (substring compile-string 0 (match-beginning 0))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1357 (setq strend (substring compile-string (match-end 0))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1358 (setq compile-string (concat strbeg (format "%d" lineoffset) strend))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1359 (concat compile-string "\n"))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1360 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1361 ;;; The rest of this page is experimental code! |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1362 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1363 ;; Global variables for process filter function |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1364 (defvar prolog-process-flag nil |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1365 "Non-nil means that a prolog task (i.e. a consultation or compilation job) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1366 is running.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1367 (defvar prolog-consult-compile-output "" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1368 "Hold the unprocessed output from the current prolog task.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1369 (defvar prolog-consult-compile-first-line 1 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1370 "The number of the first line of the file to consult/compile. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1371 Used for temporary files.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1372 (defvar prolog-consult-compile-file nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1373 "The file to compile/consult (can be a temporary file).") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1374 (defvar prolog-consult-compile-real-file nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1375 "The file name of the buffer to compile/consult.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1376 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1377 (defun prolog-consult-compile (compilep file &optional first-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1378 "Consult/compile FILE. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1379 If COMPILEP is non-nil, perform compilation, otherwise perform CONSULTING. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1380 COMMAND is a string described by the variables `prolog-consult-string' |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1381 and `prolog-compile-string'. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1382 Optional argument FIRST-LINE is the number of the first line in the compiled |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1383 region. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1384 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1385 This function must be called from the source code buffer." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1386 (if prolog-process-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1387 (error "Another Prolog task is running.")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1388 (prolog-ensure-process t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1389 (let* ((buffer (get-buffer-create prolog-compilation-buffer)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1390 (real-file buffer-file-name) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1391 (command-string (prolog-build-prolog-command compilep file |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1392 real-file first-line)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1393 (process (get-process "prolog")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1394 (old-filter (process-filter process))) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1395 (with-current-buffer buffer |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1396 (delete-region (point-min) (point-max)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1397 (compilation-mode) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1398 ;; Setting up font-locking for this buffer |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1399 (set (make-local-variable 'font-lock-defaults) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1400 '(prolog-font-lock-keywords nil nil ((?_ . "w")))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1401 (if (eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1402 (progn |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1403 (set (make-local-variable 'compilation-parse-errors-function) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1404 'prolog-parse-sicstus-compilation-errors))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1405 (toggle-read-only 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1406 (insert command-string "\n")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1407 (save-selected-window |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1408 (pop-to-buffer buffer)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1409 (setq prolog-process-flag t |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1410 prolog-consult-compile-output "" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1411 prolog-consult-compile-first-line (if first-line (1- first-line) 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1412 prolog-consult-compile-file file |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1413 prolog-consult-compile-real-file (if (string= |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1414 file buffer-file-name) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1415 nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1416 real-file)) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1417 (with-current-buffer buffer |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1418 (goto-char (point-max)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1419 (set-process-filter process 'prolog-consult-compile-filter) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1420 (process-send-string "prolog" command-string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1421 ;; (prolog-build-prolog-command compilep file real-file first-line)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1422 (while (and prolog-process-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1423 (accept-process-output process 10)) ; 10 secs is ok? |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1424 (sit-for 0.1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1425 (unless (get-process "prolog") |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1426 (setq prolog-process-flag nil))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1427 (insert (if compilep |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1428 "\nCompilation finished.\n" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1429 "\nConsulted.\n")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1430 (set-process-filter process old-filter)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1431 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1432 (defun prolog-parse-sicstus-compilation-errors (limit) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1433 "Parse the prolog compilation buffer for errors. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1434 Argument LIMIT is a buffer position limiting searching. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1435 For use with the `compilation-parse-errors-function' variable." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1436 (setq compilation-error-list nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1437 (message "Parsing SICStus error messages...") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1438 (let (filepath dir file errorline) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1439 (while |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1440 (re-search-backward |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1441 "{\\([a-zA-Z ]* ERROR\\|Warning\\):.* in line[s ]*\\([0-9]+\\)" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1442 limit t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1443 (setq errorline (string-to-number (match-string 2))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1444 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1445 (re-search-backward |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1446 "{\\(consulting\\|compiling\\|processing\\) \\(.*\\)\\.\\.\\.}" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1447 limit t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1448 (setq filepath (match-string 2))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1449 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1450 ;; ###### Does this work with SICStus under Windows (i.e. backslahes and stuff?) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1451 (if (string-match "\\(.*/\\)\\([^/]*\\)$" filepath) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1452 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1453 (setq dir (match-string 1 filepath)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1454 (setq file (match-string 2 filepath)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1455 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1456 (setq compilation-error-list |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1457 (cons |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1458 (cons (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1459 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1460 (point-marker)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1461 (list (list file dir) errorline)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1462 compilation-error-list) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1463 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1464 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1465 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1466 (defun prolog-consult-compile-filter (process output) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1467 "Filter function for Prolog compilation PROCESS. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1468 Argument OUTPUT is a name of the output file." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1469 ;;(message "start") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1470 (setq prolog-consult-compile-output |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1471 (concat prolog-consult-compile-output output)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1472 ;;(message "pccf1: %s" prolog-consult-compile-output) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1473 ;; Iterate through the lines of prolog-consult-compile-output |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1474 (let (outputtype) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1475 (while (and prolog-process-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1476 (or |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1477 ;; Trace question |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1478 (progn |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1479 (setq outputtype 'trace) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1480 (and (eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1481 (string-match |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1482 "^[ \t]*[0-9]+[ \t]*[0-9]+[ \t]*Call:.*? " |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1483 prolog-consult-compile-output))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1484 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1485 ;; Match anything |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1486 (progn |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1487 (setq outputtype 'normal) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1488 (string-match "^.*\n" prolog-consult-compile-output)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1489 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1490 ;;(message "outputtype: %s" outputtype) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1491 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1492 (setq output (match-string 0 prolog-consult-compile-output)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1493 ;; remove the text in output from prolog-consult-compile-output |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1494 (setq prolog-consult-compile-output |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1495 (substring prolog-consult-compile-output (length output))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1496 ;;(message "pccf2: %s" prolog-consult-compile-output) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1497 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1498 ;; If temporary files were used, then we change the error |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1499 ;; messages to point to the original source file. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1500 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1501 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1502 ;; If the prolog process was in trace mode then it requires |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1503 ;; user input |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1504 ((and (eq prolog-system 'sicstus) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1505 (eq outputtype 'trace)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1506 (let ((input (concat (read-string output) "\n"))) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
1507 (process-send-string process input) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1508 (setq output (concat output input)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1509 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1510 ((eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1511 (if (and prolog-consult-compile-real-file |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1512 (string-match |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1513 "\\({.*:.* in line[s ]*\\)\\([0-9]+\\)-\\([0-9]+\\)" output)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1514 (setq output (replace-match |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1515 ;; Adds a {processing ...} line so that |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1516 ;; `prolog-parse-sicstus-compilation-errors' |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1517 ;; finds the real file instead of the temporary one. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1518 ;; Also fixes the line numbers. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1519 (format "Added by Emacs: {processing %s...}\n%s%d-%d" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1520 prolog-consult-compile-real-file |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1521 (match-string 1 output) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1522 (+ prolog-consult-compile-first-line |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1523 (string-to-number |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1524 (match-string 2 output))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1525 (+ prolog-consult-compile-first-line |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1526 (string-to-number |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1527 (match-string 3 output)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1528 t t output))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1529 ) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1530 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1531 ((eq prolog-system 'swi) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1532 (if (and prolog-consult-compile-real-file |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1533 (string-match (format |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1534 "%s\\([ \t]*:[ \t]*\\)\\([0-9]+\\)" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1535 prolog-consult-compile-file) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1536 output)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1537 (setq output (replace-match |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1538 ;; Real filename + text + fixed linenum |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1539 (format "%s%s%d" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1540 prolog-consult-compile-real-file |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1541 (match-string 1 output) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1542 (+ prolog-consult-compile-first-line |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1543 (string-to-number |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1544 (match-string 2 output)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1545 t t output))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1546 ) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1547 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1548 (t ()) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1549 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1550 ;; Write the output in the *prolog-compilation* buffer |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1551 (insert output))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1552 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1553 ;; If the prompt is visible, then the task is finished |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1554 (if (string-match prolog-prompt-regexp-i prolog-consult-compile-output) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1555 (setq prolog-process-flag nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1556 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1557 (defun prolog-consult-compile-file (compilep) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1558 "Consult/compile file of current buffer. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1559 If COMPILEP is non-nil, compile, otherwise consult." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1560 (let ((file buffer-file-name)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1561 (if file |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1562 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1563 (save-some-buffers) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1564 (prolog-consult-compile compilep file)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1565 (prolog-consult-compile-region compilep (point-min) (point-max))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1566 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1567 (defun prolog-consult-compile-buffer (compilep) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1568 "Consult/compile current buffer. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1569 If COMPILEP is non-nil, compile, otherwise consult." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1570 (prolog-consult-compile-region compilep (point-min) (point-max))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1571 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1572 (defun prolog-consult-compile-region (compilep beg end) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1573 "Consult/compile region between BEG and END. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1574 If COMPILEP is non-nil, compile, otherwise consult." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1575 ;(let ((file prolog-temp-filename) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1576 (let ((file (prolog-bsts (prolog-temporary-file))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1577 (lines (count-lines 1 beg))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1578 (write-region beg end file nil 'no-message) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1579 (write-region "\n" nil file t 'no-message) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1580 (prolog-consult-compile compilep file |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1581 (if (looking-at "^") (1+ lines) lines)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1582 (delete-file file))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1583 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1584 (defun prolog-consult-compile-predicate (compilep) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1585 "Consult/compile the predicate around current point. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1586 If COMPILEP is non-nil, compile, otherwise consult." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1587 (prolog-consult-compile-region |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1588 compilep (prolog-pred-start) (prolog-pred-end))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1589 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1590 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1591 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1592 ;; Font-lock stuff |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1593 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1594 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1595 ;; Auxilliary functions |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1596 (defun prolog-make-keywords-regexp (keywords &optional protect) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1597 "Create regexp from the list of strings KEYWORDS. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1598 If PROTECT is non-nil, surround the result regexp by word breaks." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1599 (let ((regexp |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1600 (if (fboundp 'regexp-opt) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1601 ;; Emacs 20 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1602 ;; Avoid compile warnings under earlier versions by using eval |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1603 (eval '(regexp-opt keywords)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1604 ;; Older Emacsen |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1605 (concat (mapconcat 'regexp-quote keywords "\\|"))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1606 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1607 (if protect |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1608 (concat "\\<\\(" regexp "\\)\\>") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1609 regexp))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1610 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1611 (defun prolog-font-lock-object-matcher (bound) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1612 "Find SICStus objects method name for font lock. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1613 Argument BOUND is a buffer position limiting searching." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1614 (let (point |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1615 (case-fold-search nil)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1616 (while (and (not point) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1617 (re-search-forward "\\(::[ \t\n]*{\\|&\\)[ \t]*" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1618 bound t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1619 (while (or (re-search-forward "\\=\n[ \t]*" bound t) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1620 (re-search-forward "\\=%.*" bound t) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1621 (and (re-search-forward "\\=/\\*" bound t) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1622 (re-search-forward "\\*/[ \t]*" bound t)))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1623 (setq point (re-search-forward |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1624 (format "\\=\\(%s\\)" prolog-atom-regexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1625 bound t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1626 point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1627 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1628 (defsubst prolog-face-name-p (facename) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1629 ;; Return t if FACENAME is the name of a face. This method is |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1630 ;; necessary since facep in XEmacs only returns t for the actual |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1631 ;; face objects (while it's only their names that are used just |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1632 ;; about anywhere else) without providing a predicate that tests |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1633 ;; face names. This function (including the above commentary) is |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1634 ;; borrowed from cc-mode. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1635 (memq facename (face-list))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1636 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1637 ;; Set everything up |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1638 (defun prolog-font-lock-keywords () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1639 "Set up font lock keywords for the current Prolog system." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1640 ;(when window-system |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1641 (require 'font-lock) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1642 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1643 ;; Define Prolog faces |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1644 (defface prolog-redo-face |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1645 '((((class grayscale)) (:italic t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1646 (((class color)) (:foreground "darkorchid")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1647 (t (:italic t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1648 "Prolog mode face for highlighting redo trace lines." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1649 :group 'prolog-faces) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1650 (defface prolog-exit-face |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1651 '((((class grayscale)) (:underline t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1652 (((class color) (background dark)) (:foreground "green")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1653 (((class color) (background light)) (:foreground "ForestGreen")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1654 (t (:underline t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1655 "Prolog mode face for highlighting exit trace lines." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1656 :group 'prolog-faces) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1657 (defface prolog-exception-face |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1658 '((((class grayscale)) (:bold t :italic t :underline t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1659 (((class color)) (:bold t :foreground "black" :background "Khaki")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1660 (t (:bold t :italic t :underline t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1661 "Prolog mode face for highlighting exception trace lines." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1662 :group 'prolog-faces) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1663 (defface prolog-warning-face |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1664 '((((class grayscale)) (:underline t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1665 (((class color) (background dark)) (:foreground "blue")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1666 (((class color) (background light)) (:foreground "MidnightBlue")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1667 (t (:underline t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1668 "Face name to use for compiler warnings." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1669 :group 'prolog-faces) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1670 (defface prolog-builtin-face |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1671 '((((class color) (background light)) (:foreground "Purple")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1672 (((class color) (background dark)) (:foreground "Cyan")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1673 (((class grayscale) (background light)) (:foreground "LightGray" :bold t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1674 (((class grayscale) (background dark)) (:foreground "DimGray" :bold t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1675 (t (:bold t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1676 "Face name to use for compiler warnings." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1677 :group 'prolog-faces) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1678 (defvar prolog-warning-face |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1679 (if (prolog-face-name-p 'font-lock-warning-face) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1680 'font-lock-warning-face |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1681 'prolog-warning-face) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1682 "Face name to use for built in predicates.") |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1683 (defvar prolog-builtin-face |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1684 (if (prolog-face-name-p 'font-lock-builtin-face) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1685 'font-lock-builtin-face |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1686 'prolog-builtin-face) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1687 "Face name to use for built in predicates.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1688 (defvar prolog-redo-face 'prolog-redo-face |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1689 "Face name to use for redo trace lines.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1690 (defvar prolog-exit-face 'prolog-exit-face |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1691 "Face name to use for exit trace lines.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1692 (defvar prolog-exception-face 'prolog-exception-face |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1693 "Face name to use for exception trace lines.") |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1694 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1695 ;; Font Lock Patterns |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1696 (let ( |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1697 ;; "Native" Prolog patterns |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1698 (head-predicates |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1699 (list (format "^\\(%s\\)\\((\\|[ \t]*:-\\)" prolog-atom-regexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1700 1 font-lock-function-name-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1701 ;(list (format "^%s" prolog-atom-regexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1702 ; 0 font-lock-function-name-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1703 (head-predicates-1 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1704 (list (format "\\.[ \t]*\\(%s\\)" prolog-atom-regexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1705 1 font-lock-function-name-face) ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1706 (variables |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1707 '("\\<\\([_A-Z][a-zA-Z0-9_]*\\)" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1708 1 font-lock-variable-name-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1709 (important-elements |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1710 (list (if (eq prolog-system 'mercury) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1711 "[][}{;|]\\|\\\\[+=]\\|<?=>?" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1712 "[][}{!;|]\\|\\*->") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1713 0 'font-lock-keyword-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1714 (important-elements-1 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1715 '("[^-*]\\(->\\)" 1 font-lock-keyword-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1716 (predspecs ; module:predicate/cardinality |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1717 (list (format "\\<\\(%s:\\|\\)%s/[0-9]+" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1718 prolog-atom-regexp prolog-atom-regexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1719 0 font-lock-function-name-face 'prepend)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1720 (keywords ; directives (queries) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1721 (list |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1722 (if (eq prolog-system 'mercury) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1723 (concat |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1724 "\\<\\(" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1725 (prolog-make-keywords-regexp prolog-keywords-i) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1726 "\\|" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1727 (prolog-make-keywords-regexp |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1728 prolog-determinism-specificators-i) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1729 "\\)\\>") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1730 (concat |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1731 "^[?:]- *\\(" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1732 (prolog-make-keywords-regexp prolog-keywords-i) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1733 "\\)\\>")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1734 1 prolog-builtin-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1735 (quoted_atom (list prolog-quoted-atom-regexp |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1736 2 'font-lock-string-face 'append)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1737 (string (list prolog-string-regexp |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1738 1 'font-lock-string-face 'append)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1739 ;; SICStus specific patterns |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1740 (sicstus-object-methods |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1741 (if (eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1742 '(prolog-font-lock-object-matcher |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1743 1 font-lock-function-name-face))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1744 ;; Mercury specific patterns |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1745 (types |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1746 (if (eq prolog-system 'mercury) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1747 (list |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1748 (prolog-make-keywords-regexp prolog-types-i t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1749 0 'font-lock-type-face))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1750 (modes |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1751 (if (eq prolog-system 'mercury) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1752 (list |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1753 (prolog-make-keywords-regexp prolog-mode-specificators-i t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1754 0 'font-lock-reference-face))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1755 (directives |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1756 (if (eq prolog-system 'mercury) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1757 (list |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1758 (prolog-make-keywords-regexp prolog-directives-i t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1759 0 'prolog-warning-face))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1760 ;; Inferior mode specific patterns |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1761 (prompt |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1762 (list prolog-prompt-regexp-i 0 'font-lock-keyword-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1763 (trace-exit |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1764 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1765 ((eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1766 '("[ \t]*[0-9]+[ \t]+[0-9]+[ \t]*\\(Exit\\):" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1767 1 prolog-exit-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1768 ((eq prolog-system 'swi) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1769 '("[ \t]*\\(Exit\\):[ \t]*([ \t0-9]*)" 1 prolog-exit-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1770 (t nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1771 (trace-fail |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1772 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1773 ((eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1774 '("[ \t]*[0-9]+[ \t]+[0-9]+[ \t]*\\(Fail\\):" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1775 1 prolog-warning-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1776 ((eq prolog-system 'swi) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1777 '("[ \t]*\\(Fail\\):[ \t]*([ \t0-9]*)" 1 prolog-warning-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1778 (t nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1779 (trace-redo |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1780 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1781 ((eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1782 '("[ \t]*[0-9]+[ \t]+[0-9]+[ \t]*\\(Redo\\):" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1783 1 prolog-redo-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1784 ((eq prolog-system 'swi) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1785 '("[ \t]*\\(Redo\\):[ \t]*([ \t0-9]*)" 1 prolog-redo-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1786 (t nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1787 (trace-call |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1788 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1789 ((eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1790 '("[ \t]*[0-9]+[ \t]+[0-9]+[ \t]*\\(Call\\):" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1791 1 font-lock-function-name-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1792 ((eq prolog-system 'swi) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1793 '("[ \t]*\\(Call\\):[ \t]*([ \t0-9]*)" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1794 1 font-lock-function-name-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1795 (t nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1796 (trace-exception |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1797 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1798 ((eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1799 '("[ \t]*[0-9]+[ \t]+[0-9]+[ \t]*\\(Exception\\):" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1800 1 prolog-exception-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1801 ((eq prolog-system 'swi) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1802 '("[ \t]*\\(Exception\\):[ \t]*([ \t0-9]*)" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1803 1 prolog-exception-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1804 (t nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1805 (error-message-identifier |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1806 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1807 ((eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1808 '("{\\([A-Z]* ?ERROR:\\)" 1 prolog-exception-face prepend)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1809 ((eq prolog-system 'swi) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1810 '("^[[]\\(WARNING:\\)" 1 prolog-builtin-face prepend)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1811 (t nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1812 (error-whole-messages |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1813 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1814 ((eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1815 '("{\\([A-Z]* ?ERROR:.*\\)}[ \t]*$" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1816 1 font-lock-comment-face append)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1817 ((eq prolog-system 'swi) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1818 '("^[[]WARNING:[^]]*[]]$" 0 font-lock-comment-face append)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1819 (t nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1820 (error-warning-messages |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1821 ;; Mostly errors that SICStus asks the user about how to solve, |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1822 ;; such as "NAME CLASH:" for example. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1823 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1824 ((eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1825 '("^[A-Z ]*[A-Z]+:" 0 prolog-warning-face)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1826 (t nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1827 (warning-messages |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1828 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1829 ((eq prolog-system 'sicstus) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1830 '("\\({ ?\\(Warning\\|WARNING\\) ?:.*}\\)[ \t]*$" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1831 2 prolog-warning-face prepend)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1832 (t nil)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1833 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1834 ;; Make font lock list |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1835 (delq |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1836 nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1837 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1838 ((eq major-mode 'prolog-mode) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1839 (list |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1840 head-predicates |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1841 head-predicates-1 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1842 quoted_atom |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1843 string |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1844 variables |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1845 important-elements |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1846 important-elements-1 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1847 predspecs |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1848 keywords |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1849 sicstus-object-methods |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1850 types |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1851 modes |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1852 directives)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1853 ((eq major-mode 'prolog-inferior-mode) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1854 (list |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1855 prompt |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1856 error-message-identifier |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1857 error-whole-messages |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1858 error-warning-messages |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1859 warning-messages |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1860 predspecs |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1861 trace-exit |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1862 trace-fail |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1863 trace-redo |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1864 trace-call |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1865 trace-exception)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1866 ((eq major-mode 'compilation-mode) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1867 (list |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1868 error-message-identifier |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1869 error-whole-messages |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1870 error-warning-messages |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1871 warning-messages |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1872 predspecs)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1873 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1874 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1875 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1876 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1877 ;; Indentation stuff |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1878 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1879 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1880 ;; NB: This function *MUST* have this optional argument since XEmacs |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1881 ;; assumes it. This does not mean we have to use it... |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1882 (defun prolog-indent-line (&optional whole-exp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1883 "Indent current line as Prolog code. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1884 With argument, indent any additional lines of the same clause |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1885 rigidly along with this one (not yet)." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1886 (interactive "p") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1887 (let ((indent (prolog-indent-level)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1888 (pos (- (point-max) (point))) beg) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1889 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1890 (setq beg (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1891 (skip-chars-forward " \t") |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1892 (indent-line-to indent) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1893 (if (> (- (point-max) pos) (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1894 (goto-char (- (point-max) pos))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1895 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1896 ;; Align comments |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1897 (if (and prolog-align-comments-flag |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1898 (save-excursion |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1899 (line-beginning-position) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1900 ;; (let ((start (comment-search-forward (line-end-position) t))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1901 ;; (and start ;There's a comment to indent. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1902 ;; ;; If it's first on the line, we've indented it already |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1903 ;; ;; and prolog-goto-comment-column would inf-loop. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1904 ;; (progn (goto-char start) (skip-chars-backward " \t") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1905 ;; (not (bolp))))))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1906 (and (looking-at comment-start-skip) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1907 ;; The definition of comment-start-skip used in this |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1908 ;; mode is unusual in that it only matches at BOL. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1909 (progn (skip-chars-forward " \t") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1910 (not (eq (point) (match-end 1))))))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1911 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1912 (prolog-goto-comment-column t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1913 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1914 ;; Insert spaces if needed |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1915 (if (or prolog-electric-tab-flag prolog-electric-if-then-else-flag) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1916 (prolog-insert-spaces-after-paren)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1917 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1918 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1919 (defun prolog-comment-indent () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1920 "Compute prolog comment indentation." |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1921 ;; FIXME: Only difference with default behavior is that %%% is not |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1922 ;; flushed to column 0 but just left where the user put it. |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1923 (cond ((looking-at "%%%") (prolog-indentation-level-of-line)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1924 ((looking-at "%%") (prolog-indent-level)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1925 (t |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1926 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1927 (skip-chars-backward " \t") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1928 ;; Insert one space at least, except at left margin. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1929 (max (+ (current-column) (if (bolp) 0 1)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1930 comment-column))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1931 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1932 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1933 (defun prolog-indent-level () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1934 "Compute prolog indentation level." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1935 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1936 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1937 (let ((totbal (prolog-region-paren-balance |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1938 (prolog-clause-start t) (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1939 (oldpoint (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1940 (skip-chars-forward " \t") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1941 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1942 ((looking-at "%%%") (prolog-indentation-level-of-line)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1943 ;Large comment starts |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1944 ((looking-at "%[^%]") comment-column) ;Small comment starts |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1945 ((bobp) 0) ;Beginning of buffer |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1946 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1947 ;; If we found '}' then we must check if it's the |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1948 ;; end of an object declaration or something else. |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1949 ((and (looking-at "}") |
72696
560a2e73e11b
(inferior-prolog-flavor): New var left out of previous commit.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
72684
diff
changeset
|
1950 (save-excursion |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1951 (forward-char 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1952 ;; Goto to matching { |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1953 (if prolog-use-prolog-tokenizer-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1954 (prolog-backward-list) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1955 (backward-list)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1956 (skip-chars-backward " \t") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1957 (backward-char 2) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1958 (looking-at "::"))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1959 ;; It was an object |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1960 (if prolog-object-end-to-0-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1961 0 |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1962 prolog-indent-width)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1963 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1964 ;;End of /* */ comment |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1965 ((looking-at "\\*/") |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1966 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1967 (prolog-find-start-of-mline-comment) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1968 (skip-chars-backward " \t") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1969 (- (current-column) 2))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1970 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1971 ;; Here we check if the current line is within a /* */ pair |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1972 ((and (looking-at "[^%/]") |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1973 (eq (prolog-in-string-or-comment) 'cmt)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1974 (if prolog-indent-mline-comments-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1975 (prolog-find-start-of-mline-comment) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1976 ;; Same as before |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1977 (prolog-indentation-level-of-line))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1978 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1979 (t |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1980 (let ((empty t) ind linebal) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1981 ;; See previous indentation |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1982 (while empty |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1983 (forward-line -1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1984 (beginning-of-line) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1985 (if (bobp) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1986 (setq empty nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1987 (skip-chars-forward " \t") |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1988 (if (not (or (not (member (prolog-in-string-or-comment) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1989 '(nil txt))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1990 (looking-at "%") |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1991 (looking-at "\n"))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1992 (setq empty nil)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1993 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1994 ;; Store this line's indentation |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1995 (setq ind (if (bobp) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1996 0 ;Beginning of buffer. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
1997 (current-column))) ;Beginning of clause. |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1998 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
1999 ;; Compute the balance of the line |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2000 (setq linebal (prolog-paren-balance)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2001 ;;(message "bal of previous line %d totbal %d" linebal totbal) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2002 (if (< linebal 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2003 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2004 ;; Add 'indent-level' mode to find-unmatched-paren instead? |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2005 (end-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2006 (setq ind (prolog-find-indent-of-matching-paren)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2007 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2008 ;;(message "ind %d" ind) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2009 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2010 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2011 ;; Check if the line ends with ":-", ".", ":: {", "}" (might be |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2012 ;; unnecessary), "&" or ")" (The last four concerns SICStus objects) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2013 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2014 ;; If the last char of the line is a '&' then set the indent level |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2015 ;; to prolog-indent-width (used in SICStus objects) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2016 ((and (eq prolog-system 'sicstus) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2017 (looking-at ".+&[ \t]*\\(%.*\\|\\)$")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2018 (setq ind prolog-indent-width)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2019 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2020 ;; Increase indentation if the previous line was the head of a rule |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2021 ;; and does not contain a '.' |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2022 ((and (looking-at (format ".*%s[^\\.]*[ \t]*\\(%%.*\\|\\)$" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2023 prolog-head-delimiter)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2024 ;; We must check that the match is at a paren balance of 0. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2025 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2026 (let ((p (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2027 (re-search-forward prolog-head-delimiter) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2028 (>= 0 (prolog-region-paren-balance p (point)))))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2029 (let ((headindent |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2030 (if (< (prolog-paren-balance) 0) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2031 (save-excursion |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2032 (end-of-line) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2033 (prolog-find-indent-of-matching-paren)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2034 (prolog-indentation-level-of-line)))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2035 (setq ind (+ headindent prolog-indent-width)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2036 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2037 ;; The previous line was the head of an object |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2038 ((looking-at ".+ *::.*{[ \t]*$") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2039 (setq ind prolog-indent-width)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2040 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2041 ;; If a '.' is found at the end of the previous line, then |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2042 ;; decrease the indentation. (The \\(%.*\\|\\) part of the |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2043 ;; regexp is for comments at the end of the line) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2044 ((and (looking-at "^.+\\.[ \t]*\\(%.*\\|\\)$") |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2045 ;; Make sure that the '.' found is not in a comment or string |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2046 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2047 (end-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2048 (re-search-backward "\\.[ \t]*\\(%.*\\|\\)$" (point-min)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2049 ;; Guard against the real '.' being followed by a |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2050 ;; commented '.'. |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2051 (if (eq (prolog-in-string-or-comment) 'cmt) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2052 ;; commented out '.' |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2053 (let ((here (line-beginning-position))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2054 (end-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2055 (re-search-backward "\\.[ \t]*%.*$" here t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2056 (not (prolog-in-string-or-comment)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2057 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2058 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2059 (setq ind 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2060 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2061 ;; If a '.' is found at the end of the previous line, then |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2062 ;; decrease the indentation. (The /\\*.*\\*/ part of the |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2063 ;; regexp is for C-like comments at the end of the |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2064 ;; line--can we merge with the case above?). |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2065 ((and (looking-at "^.+\\.[ \t]*\\(/\\*.*\\|\\)$") |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2066 ;; Make sure that the '.' found is not in a comment or string |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2067 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2068 (end-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2069 (re-search-backward "\\.[ \t]*\\(/\\*.*\\|\\)$" (point-min)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2070 ;; Guard against the real '.' being followed by a |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2071 ;; commented '.'. |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2072 (if (eq (prolog-in-string-or-comment) 'cmt) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2073 ;; commented out '.' |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2074 (let ((here (line-beginning-position))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2075 (end-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2076 (re-search-backward "\\.[ \t]*/\\*.*$" here t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2077 (not (prolog-in-string-or-comment)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2078 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2079 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2080 (setq ind 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2081 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2082 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2083 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2084 ;; If the last non comment char is a ',' or left paren or a left- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2085 ;; indent-regexp then indent to open parenthesis level |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2086 (if (and |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2087 (> totbal 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2088 ;; SICStus objects have special syntax rules if point is |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2089 ;; not inside additional parens (objects are defined |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2090 ;; within {...}) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2091 (not (and (eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2092 (= totbal 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2093 (prolog-in-object)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2094 (if (looking-at |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2095 (format "\\(%s\\|%s\\|0'.\\|[0-9]+'[0-9a-zA-Z]+\\|[^\n\'\"%%]\\)*\\(,\\|%s\\|%s\\)\[ \t]*\\(%%.*\\|\\)$" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2096 prolog-quoted-atom-regexp prolog-string-regexp |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2097 prolog-left-paren prolog-left-indent-regexp)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2098 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2099 (goto-char oldpoint) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2100 (setq ind (prolog-find-unmatched-paren |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2101 (if prolog-paren-indent-p |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2102 'termdependent |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2103 'skipwhite))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2104 ;;(setq ind (prolog-find-unmatched-paren 'termdependent)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2105 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2106 (goto-char oldpoint) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2107 (setq ind (prolog-find-unmatched-paren nil)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2108 )) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2109 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2110 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2111 ;; Return the indentation level |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2112 ind |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2113 )))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2114 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2115 (defun prolog-find-indent-of-matching-paren () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2116 "Find the indentation level based on the matching parenthesis. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2117 Indentation level is set to the one the point is after when the function is |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2118 called." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2119 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2120 ;; Go to the matching paren |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2121 (if prolog-use-prolog-tokenizer-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2122 (prolog-backward-list) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2123 (backward-list)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2124 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2125 ;; If this was the first paren on the line then return this line's |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2126 ;; indentation level |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2127 (if (prolog-paren-is-the-first-on-line-p) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2128 (prolog-indentation-level-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2129 ;; It was not the first one |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2130 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2131 ;; Find the next paren |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2132 (prolog-goto-next-paren 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2133 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2134 ;; If this paren is a left one then use its column as indent level, |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2135 ;; if not then recurse this function |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2136 (if (looking-at prolog-left-paren) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2137 (+ (current-column) 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2138 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2139 (forward-char 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2140 (prolog-find-indent-of-matching-paren))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2141 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2142 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2143 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2144 (defun prolog-indentation-level-of-line () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2145 "Return the indentation level of the current line." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2146 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2147 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2148 (skip-chars-forward " \t") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2149 (current-column))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2150 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2151 (defun prolog-paren-is-the-first-on-line-p () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2152 "Return t if the parenthesis under the point is the first one on the line. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2153 Return nil otherwise. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2154 Note: does not check if the point is actually at a parenthesis!" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2155 (save-excursion |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2156 (let ((begofline (line-beginning-position))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2157 (if (= begofline (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2158 t |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2159 (if (prolog-goto-next-paren begofline) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2160 nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2161 t))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2162 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2163 (defun prolog-find-unmatched-paren (&optional mode) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2164 "Return the column of the last unmatched left parenthesis. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2165 If MODE is `skipwhite' then any white space after the parenthesis is added to |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2166 the answer. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2167 If MODE is `plusone' then the parenthesis' column +1 is returned. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2168 If MODE is `termdependent' then if the unmatched parenthesis is part of |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2169 a compound term the function will work as `skipwhite', otherwise |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2170 it will return the column paren plus the value of `prolog-paren-indent'. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2171 If MODE is nil or not set then the parenthesis' exact column is returned." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2172 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2173 ;; If the next paren we find is a left one we're finished, if it's |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2174 ;; a right one then we go back one step and recurse |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2175 (prolog-goto-next-paren 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2176 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2177 (let ((roundparen (looking-at "("))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2178 (if (looking-at prolog-left-paren) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2179 (let ((not-part-of-term |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2180 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2181 (backward-char 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2182 (looking-at "[ \t]")))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2183 (if (eq mode nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2184 (current-column) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2185 (if (and roundparen |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2186 (eq mode 'termdependent) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2187 not-part-of-term) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2188 (+ (current-column) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2189 (if prolog-electric-tab-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2190 ;; Electric TAB |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2191 prolog-paren-indent |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2192 ;; Not electric TAB |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2193 (if (looking-at ".[ \t]*$") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2194 2 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2195 prolog-paren-indent)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2196 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2197 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2198 (forward-char 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2199 (if (or (eq mode 'skipwhite) (eq mode 'termdependent) ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2200 (skip-chars-forward " \t")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2201 (current-column)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2202 ;; Not looking at left paren |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2203 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2204 (forward-char 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2205 ;; Go to the matching paren. When we get there we have a total |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2206 ;; balance of 0. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2207 (if prolog-use-prolog-tokenizer-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2208 (prolog-backward-list) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2209 (backward-list)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2210 (prolog-find-unmatched-paren mode))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2211 ))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2212 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2213 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2214 (defun prolog-paren-balance () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2215 "Return the parenthesis balance of the current line. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2216 A return value of n means n more left parentheses than right ones." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2217 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2218 (end-of-line) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2219 (prolog-region-paren-balance (line-beginning-position) (point)))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2220 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2221 (defun prolog-region-paren-balance (beg end) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2222 "Return the summed parenthesis balance in the region. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2223 The region is limited by BEG and END positions." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2224 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2225 (let ((state (if prolog-use-prolog-tokenizer-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2226 (prolog-tokenize beg end) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2227 (parse-partial-sexp beg end)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2228 (nth 0 state)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2229 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2230 (defun prolog-goto-next-paren (limit-pos) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2231 "Move the point to the next parenthesis earlier in the buffer. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2232 Return t if a match was found before LIMIT-POS. Return nil otherwise." |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2233 (let ((retval (re-search-backward |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2234 (concat prolog-left-paren "\\|" prolog-right-paren) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2235 limit-pos t))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2236 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2237 ;; If a match was found but it was in a string or comment, then recurse |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2238 (if (and retval (prolog-in-string-or-comment)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2239 (prolog-goto-next-paren limit-pos) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2240 retval) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2241 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2242 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2243 (defun prolog-in-string-or-comment () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2244 "Check whether string, atom, or comment is under current point. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2245 Return: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2246 `txt' if the point is in a string, atom, or character code expression |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2247 `cmt' if the point is in a comment |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2248 nil otherwise." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2249 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2250 (let* ((start |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2251 (if (eq prolog-parse-mode 'beg-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2252 ;; 'beg-of-line |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2253 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2254 (let (safepoint) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2255 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2256 (setq safepoint (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2257 (while (and (> (point) (point-min)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2258 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2259 (forward-line -1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2260 (end-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2261 (if (not (bobp)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2262 (backward-char 1)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2263 (looking-at "\\\\")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2264 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2265 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2266 (setq safepoint (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2267 safepoint)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2268 ;; 'beg-of-clause |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2269 (prolog-clause-start))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2270 (end (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2271 (state (if prolog-use-prolog-tokenizer-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2272 (prolog-tokenize start end) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2273 (if (fboundp 'syntax-ppss) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2274 (syntax-ppss) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2275 (parse-partial-sexp start end))))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2276 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2277 ((nth 3 state) 'txt) ; String |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2278 ((nth 4 state) 'cmt) ; Comment |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2279 (t |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2280 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2281 ((looking-at "%") 'cmt) ; Start of a comment |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2282 ((looking-at "/\\*") 'cmt) ; Start of a comment |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2283 ((looking-at "\'") 'txt) ; Start of an atom |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2284 ((looking-at "\"") 'txt) ; Start of a string |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2285 (t nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2286 )))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2287 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2288 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2289 (defun prolog-find-start-of-mline-comment () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2290 "Return the start column of a /* */ comment. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2291 This assumes that the point is inside a comment." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2292 (re-search-backward "/\\*" (point-min) t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2293 (forward-char 2) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2294 (skip-chars-forward " \t") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2295 (current-column)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2296 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2297 (defun prolog-insert-spaces-after-paren () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2298 "Insert spaces after the opening parenthesis, \"then\" (->) and \"else\" (;) branches. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2299 Spaces are inserted if all preceding objects on the line are |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2300 whitespace characters, parentheses, or then/else branches." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2301 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2302 (let ((regexp (concat "(\\|" prolog-left-indent-regexp)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2303 level) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2304 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2305 (skip-chars-forward " \t") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2306 (when (looking-at regexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2307 ;; Treat "( If -> " lines specially. |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2308 ;;(setq incr (if (looking-at "(.*->") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2309 ;; 2 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2310 ;; prolog-paren-indent)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2311 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2312 ;; work on all subsequent "->", "(", ";" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2313 (while (looking-at regexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2314 (goto-char (match-end 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2315 (setq level (+ (prolog-find-unmatched-paren) prolog-paren-indent)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2316 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2317 ;; Remove old white space |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2318 (let ((start (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2319 (skip-chars-forward " \t") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2320 (delete-region start (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2321 (indent-to level) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2322 (skip-chars-forward " \t")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2323 ))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2324 (when (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2325 (backward-char 2) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2326 (looking-at "\\s ;\\|\\s (\\|->")) ; (looking-at "\\s \\((\\|;\\)")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2327 (skip-chars-forward " \t")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2328 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2329 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2330 ;;;; Comment filling |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2331 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2332 (defun prolog-comment-limits () |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2333 "Return the current comment limits plus the comment type (block or line). |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2334 The comment limits are the range of a block comment or the range that |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2335 contains all adjacent line comments (i.e. all comments that starts in |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2336 the same column with no empty lines or non-whitespace characters |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2337 between them)." |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2338 (let ((here (point)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2339 lit-limits-b lit-limits-e lit-type beg end |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2340 ) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2341 (save-restriction |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2342 ;; Widen to catch comment limits correctly. |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2343 (widen) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2344 (setq end (line-end-position) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2345 beg (line-beginning-position)) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2346 (save-excursion |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2347 (beginning-of-line) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2348 (setq lit-type (if (search-forward-regexp "%" end t) 'line 'block)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2349 ; (setq lit-type 'line) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2350 ;(if (search-forward-regexp "^[ \t]*%" end t) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2351 ; (setq lit-type 'line) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2352 ; (if (not (search-forward-regexp "%" end t)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2353 ; (setq lit-type 'block) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2354 ; (if (not (= (forward-line 1) 0)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2355 ; (setq lit-type 'block) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2356 ; (setq done t |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2357 ; ret (prolog-comment-limits))) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2358 ; )) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2359 (if (eq lit-type 'block) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2360 (progn |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2361 (goto-char here) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2362 (when (looking-at "/\\*") (forward-char 2)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2363 (when (and (looking-at "\\*") (> (point) (point-min)) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2364 (forward-char -1) (looking-at "/")) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2365 (forward-char 1)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2366 (when (save-excursion (search-backward "/*" nil t)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2367 (list (save-excursion (search-backward "/*") (point)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2368 (or (search-forward "*/" nil t) (point-max)) lit-type))) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2369 ;; line comment |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2370 (setq lit-limits-b (- (point) 1) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2371 lit-limits-e end) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2372 (condition-case nil |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2373 (if (progn (goto-char lit-limits-b) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2374 (looking-at "%")) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2375 (let ((col (current-column)) done) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2376 (setq beg (point) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2377 end lit-limits-e) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2378 ;; Always at the beginning of the comment |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2379 ;; Go backward now |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2380 (beginning-of-line) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2381 (while (and (zerop (setq done (forward-line -1))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2382 (search-forward-regexp "^[ \t]*%" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2383 (line-end-position) t) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2384 (= (+ 1 col) (current-column))) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2385 (setq beg (- (point) 1))) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2386 (when (= done 0) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2387 (forward-line 1)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2388 ;; We may have a line with code above... |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2389 (when (and (zerop (setq done (forward-line -1))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2390 (search-forward "%" (line-end-position) t) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2391 (= (+ 1 col) (current-column))) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2392 (setq beg (- (point) 1))) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2393 (when (= done 0) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2394 (forward-line 1)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2395 ;; Go forward |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2396 (goto-char lit-limits-b) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2397 (beginning-of-line) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2398 (while (and (zerop (forward-line 1)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2399 (search-forward-regexp "^[ \t]*%" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2400 (line-end-position) t) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2401 (= (+ 1 col) (current-column))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2402 (setq end (line-end-position))) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2403 (list beg end lit-type)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2404 (list lit-limits-b lit-limits-e lit-type) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2405 ) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2406 (error (list lit-limits-b lit-limits-e lit-type)))) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2407 )))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2408 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2409 (defun prolog-guess-fill-prefix () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2410 ;; fill 'txt entities? |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2411 (when (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2412 (end-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2413 (equal (prolog-in-string-or-comment) 'cmt)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2414 (let* ((bounds (prolog-comment-limits)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2415 (cbeg (car bounds)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2416 (type (nth 2 bounds)) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2417 beg end) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2418 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2419 (end-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2420 (setq end (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2421 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2422 (setq beg (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2423 (if (and (eq type 'line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2424 (> cbeg beg) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2425 (save-excursion (not (search-forward-regexp "^[ \t]*%" |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2426 cbeg t)))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2427 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2428 (goto-char cbeg) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2429 (search-forward-regexp "%+[ \t]*" end t) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2430 (prolog-replace-in-string (buffer-substring beg (point)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2431 "[^ \t%]" " ")) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2432 ;(goto-char beg) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2433 (if (search-forward-regexp "^[ \t]*\\(%+\\|\\*+\\|/\\*+\\)[ \t]*" |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2434 end t) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2435 (prolog-replace-in-string (buffer-substring beg (point)) "/" " ") |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2436 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2437 (when (search-forward-regexp "^[ \t]+" end t) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2438 (buffer-substring beg (point))))))))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2439 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2440 (defun prolog-fill-paragraph () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2441 "Fill paragraph comment at or after point." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2442 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2443 (let* ((bounds (prolog-comment-limits)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2444 (type (nth 2 bounds))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2445 (if (eq type 'line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2446 (let ((fill-prefix (prolog-guess-fill-prefix))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2447 (fill-paragraph nil)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2448 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2449 (save-restriction |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2450 ;; exclude surrounding lines that delimit a multiline comment |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2451 ;; and don't contain alphabetic characters, like "/*******", |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2452 ;; "- - - */" etc. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2453 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2454 (backward-paragraph) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2455 (unless (bobp) (forward-line)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2456 (if (string-match "^/\\*[^a-zA-Z]*$" (thing-at-point 'line)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2457 (narrow-to-region (point-at-eol) (point-max)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2458 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2459 (forward-paragraph) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2460 (forward-line -1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2461 (if (string-match "^[^a-zA-Z]*\\*/$" (thing-at-point 'line)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2462 (narrow-to-region (point-min) (point-at-bol)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2463 (let ((fill-prefix (prolog-guess-fill-prefix))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2464 (fill-paragraph nil)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2465 ))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2466 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2467 (defun prolog-do-auto-fill () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2468 "Carry out Auto Fill for Prolog mode. |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2469 In effect it sets the `fill-prefix' when inside comments and then calls |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2470 `do-auto-fill'." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2471 (let ((fill-prefix (prolog-guess-fill-prefix))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2472 (do-auto-fill) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2473 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2474 |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2475 (defalias 'prolog-replace-in-string |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2476 (if (fboundp 'replace-in-string) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2477 #'replace-in-string |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2478 (lambda (str regexp newtext &optional literal) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2479 (replace-regexp-in-string regexp newtext str nil literal)))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2480 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2481 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2482 ;; The tokenizer |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2483 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2484 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2485 (defconst prolog-tokenize-searchkey |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2486 (concat "[0-9]+'" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2487 "\\|" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2488 "['\"]" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2489 "\\|" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2490 prolog-left-paren |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2491 "\\|" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2492 prolog-right-paren |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2493 "\\|" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2494 "%" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2495 "\\|" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2496 "/\\*" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2497 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2498 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2499 (defun prolog-tokenize (beg end &optional stopcond) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2500 "Tokenize a region of prolog code between BEG and END. |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2501 STOPCOND decides the stop condition of the parsing. Valid values |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2502 are 'zerodepth which stops the parsing at the first right parenthesis |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2503 where the parenthesis depth is zero, 'skipover which skips over |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2504 the current entity (e.g. a list, a string, etc.) and nil. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2505 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2506 The function returns a list with the following information: |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2507 0. parenthesis depth |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2508 3. 'atm if END is inside an atom |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2509 'str if END is inside a string |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2510 'chr if END is in a character code expression (0'x) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2511 nil otherwise |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2512 4. non-nil if END is inside a comment |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2513 5. end position (always equal to END if STOPCOND is nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2514 The rest of the elements are undefined." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2515 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2516 (let* ((end2 (1+ end)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2517 oldp |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2518 (depth 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2519 (quoted nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2520 inside_cmt |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2521 (endpos end2) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2522 skiptype ; The type of entity we'll skip over |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2523 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2524 (goto-char beg) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2525 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2526 (if (and (eq stopcond 'skipover) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2527 (looking-at "[^[({'\"]")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2528 (setq endpos (point)) ; Stay where we are |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2529 (while (and |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2530 (re-search-forward prolog-tokenize-searchkey end2 t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2531 (< (point) end2)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2532 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2533 (setq oldp (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2534 (goto-char (match-beginning 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2535 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2536 ;; Atoms and strings |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2537 ((looking-at "'") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2538 ;; Find end of atom |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2539 (if (re-search-forward "[^\\]'" end2 'limit) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2540 ;; Found end of atom |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2541 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2542 (setq oldp end2) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2543 (if (and (eq stopcond 'skipover) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2544 (not skiptype)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2545 (setq endpos (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2546 (setq oldp (point)))) ; Continue tokenizing |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2547 (setq quoted 'atm))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2548 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2549 ((looking-at "\"") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2550 ;; Find end of string |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2551 (if (re-search-forward "[^\\]\"" end2 'limit) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2552 ;; Found end of string |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2553 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2554 (setq oldp end2) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2555 (if (and (eq stopcond 'skipover) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2556 (not skiptype)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2557 (setq endpos (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2558 (setq oldp (point)))) ; Continue tokenizing |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2559 (setq quoted 'str))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2560 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2561 ;; Paren stuff |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2562 ((looking-at prolog-left-paren) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2563 (setq depth (1+ depth)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2564 (setq skiptype 'paren)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2565 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2566 ((looking-at prolog-right-paren) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2567 (setq depth (1- depth)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2568 (if (and |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2569 (or (eq stopcond 'zerodepth) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2570 (and (eq stopcond 'skipover) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2571 (eq skiptype 'paren))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2572 (= depth 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2573 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2574 (setq endpos (1+ (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2575 (setq oldp end2)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2576 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2577 ;; Comment stuff |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2578 ((looking-at comment-start) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2579 (end-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2580 ;; (if (>= (point) end2) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2581 (if (>= (point) end) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2582 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2583 (setq inside_cmt t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2584 (setq oldp end2)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2585 (setq oldp (point)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2586 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2587 ((looking-at "/\\*") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2588 (if (re-search-forward "\\*/" end2 'limit) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2589 (setq oldp (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2590 (setq inside_cmt t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2591 (setq oldp end2))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2592 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2593 ;; 0'char |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2594 ((looking-at "0'") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2595 (setq oldp (1+ (match-end 0))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2596 (if (> oldp end) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2597 (setq quoted 'chr))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2598 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2599 ;; base'number |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2600 ((looking-at "[0-9]+'") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2601 (goto-char (match-end 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2602 (skip-chars-forward "0-9a-zA-Z") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2603 (setq oldp (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2604 |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2605 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2606 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2607 (goto-char oldp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2608 )) ; End of while |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2609 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2610 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2611 ;; Deal with multi-line comments |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2612 (and (prolog-inside-mline-comment end) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2613 (setq inside_cmt t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2614 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2615 ;; Create return list |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2616 (list depth nil nil quoted inside_cmt endpos) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2617 ))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2618 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2619 (defun prolog-inside-mline-comment (here) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2620 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2621 (goto-char here) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2622 (let* ((next-close (save-excursion (search-forward "*/" nil t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2623 (next-open (save-excursion (search-forward "/*" nil t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2624 (prev-open (save-excursion (search-backward "/*" nil t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2625 (prev-close (save-excursion (search-backward "*/" nil t))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2626 (unmatched-next-close (and next-close |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2627 (or (not next-open) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2628 (> next-open next-close)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2629 (unmatched-prev-open (and prev-open |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2630 (or (not prev-close) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2631 (> prev-open prev-close)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2632 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2633 (or unmatched-next-close unmatched-prev-open) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2634 ))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2635 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2636 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2637 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2638 ;; Online help |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2639 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2640 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2641 (defvar prolog-help-function |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2642 '((mercury nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2643 (eclipse prolog-help-online) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2644 ;; (sicstus prolog-help-info) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2645 (sicstus prolog-find-documentation) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2646 (swi prolog-help-online) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2647 (t prolog-help-online)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2648 "Alist for the name of the function for finding help on a predicate.") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2649 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2650 (defun prolog-help-on-predicate () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2651 "Invoke online help on the atom under cursor." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2652 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2653 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2654 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2655 ;; Redirect help for SICStus to `prolog-find-documentation'. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2656 ((eq prolog-help-function-i 'prolog-find-documentation) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2657 (prolog-find-documentation)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2658 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2659 ;; Otherwise, ask for the predicate name and then call the function |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2660 ;; in prolog-help-function-i |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2661 (t |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2662 (let* ((word (prolog-atom-under-point)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2663 (predicate (read-string |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2664 (format "Help on predicate%s: " |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2665 (if word |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2666 (concat " (default " word ")") |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2667 "")) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2668 nil nil word)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2669 ;;point |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2670 ) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2671 (if prolog-help-function-i |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2672 (funcall prolog-help-function-i predicate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2673 (error "Sorry, no help method defined for this Prolog system.")))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2674 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2675 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2676 (defun prolog-help-info (predicate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2677 (let ((buffer (current-buffer)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2678 oldp |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2679 (str (concat "^\\* " (regexp-quote predicate) " */"))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2680 (require 'info) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2681 (pop-to-buffer nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2682 (Info-goto-node prolog-info-predicate-index) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2683 (if (not (re-search-forward str nil t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2684 (error (format "Help on predicate `%s' not found." predicate))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2685 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2686 (setq oldp (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2687 (if (re-search-forward str nil t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2688 ;; Multiple matches, ask user |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2689 (let ((max 2) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2690 n) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2691 ;; Count matches |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2692 (while (re-search-forward str nil t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2693 (setq max (1+ max))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2694 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2695 (goto-char oldp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2696 (re-search-backward "[^ /]" nil t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2697 (recenter 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2698 (setq n (read-string ;; was read-input, which is obsolete |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2699 (format "Several matches, choose (1-%d): " max) "1")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2700 (forward-line (- (string-to-number n) 1))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2701 ;; Single match |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2702 (re-search-backward "[^ /]" nil t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2703 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2704 ;; (Info-follow-nearest-node (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2705 (prolog-Info-follow-nearest-node) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2706 (re-search-forward (concat "^`" (regexp-quote predicate)) nil t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2707 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2708 (recenter 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2709 (pop-to-buffer buffer))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2710 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2711 (defun prolog-Info-follow-nearest-node () |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2712 (if (featurep 'xemacs) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2713 (Info-follow-nearest-node (point)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2714 (Info-follow-nearest-node))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2715 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2716 (defun prolog-help-online (predicate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2717 (prolog-ensure-process) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2718 (process-send-string "prolog" (concat "help(" predicate ").\n")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2719 (display-buffer "*prolog*")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2720 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2721 (defun prolog-help-apropos (string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2722 "Find Prolog apropos on given STRING. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2723 This function is only available when `prolog-system' is set to `swi'." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2724 (interactive "sApropos: ") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2725 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2726 ((eq prolog-system 'swi) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2727 (prolog-ensure-process) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2728 (process-send-string "prolog" (concat "apropos(" string ").\n")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2729 (display-buffer "*prolog*")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2730 (t |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2731 (error "Sorry, no Prolog apropos available for this Prolog system.")))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2732 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2733 (defun prolog-atom-under-point () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2734 "Return the atom under or left to the point." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2735 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2736 (let ((nonatom_chars "[](){},\. \t\n") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2737 start) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2738 (skip-chars-forward (concat "^" nonatom_chars)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2739 (skip-chars-backward nonatom_chars) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2740 (skip-chars-backward (concat "^" nonatom_chars)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2741 (setq start (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2742 (skip-chars-forward (concat "^" nonatom_chars)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2743 (buffer-substring-no-properties start (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2744 ))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2745 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2746 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2747 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2748 ;; Help function with completion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2749 ;; Stolen from Per Mildner's SICStus debugger mode and modified |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2750 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2751 (defun prolog-find-documentation () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2752 "Go to the Info node for a predicate in the SICStus Info manual." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2753 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2754 (let ((pred (prolog-read-predicate))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2755 (prolog-goto-predicate-info pred))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2756 |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2757 (defvar prolog-info-alist nil |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2758 "Alist with all builtin predicates. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2759 Only for internal use by `prolog-find-documentation'") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2760 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2761 ;; Very similar to prolog-help-info except that that function cannot |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2762 ;; cope with arity and that it asks the user if there are several |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2763 ;; functors with different arity. This function also uses |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2764 ;; prolog-info-alist for finding the info node, rather than parsing |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2765 ;; the predicate index. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2766 (defun prolog-goto-predicate-info (predicate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2767 "Go to the info page for PREDICATE, which is a PredSpec." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2768 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2769 (require 'info) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2770 (string-match "\\(.*\\)/\\([0-9]+\\).*$" predicate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2771 (let ((buffer (current-buffer)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2772 (name (match-string 1 predicate)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2773 (arity (string-to-number (match-string 2 predicate))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2774 ;oldp |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2775 ;(str (regexp-quote predicate)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2776 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2777 (pop-to-buffer nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2778 |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2779 (Info-goto-node |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2780 prolog-info-predicate-index) ;; We must be in the SICStus pages |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2781 (Info-goto-node (car (cdr (assoc predicate prolog-info-alist)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2782 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2783 (prolog-find-term (regexp-quote name) arity "^`") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2784 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2785 (recenter 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2786 (pop-to-buffer buffer)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2787 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2788 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2789 (defun prolog-read-predicate () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2790 "Read a PredSpec from the user. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2791 Returned value is a string \"FUNCTOR/ARITY\". |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2792 Interaction supports completion." |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2793 (let ((default (prolog-atom-under-point))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2794 ;; If the predicate index is not yet built, do it now |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2795 (if (not prolog-info-alist) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2796 (prolog-build-info-alist)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2797 ;; Test if the default string could be the base for completion. |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2798 ;; Discard it if not. |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2799 (if (eq (try-completion default prolog-info-alist) nil) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2800 (setq default nil)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2801 ;; Read the PredSpec from the user |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2802 (completing-read |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2803 (if (zerop (length default)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2804 "Help on predicate: " |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2805 (concat "Help on predicate (default " default "): ")) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2806 prolog-info-alist nil t nil nil default))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2807 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2808 (defun prolog-build-info-alist (&optional verbose) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2809 "Build an alist of all builtins and library predicates. |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2810 Each element is of the form (\"NAME/ARITY\" . (INFO-NODE1 INFO-NODE2 ...)). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2811 Typically there is just one Info node associated with each name |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2812 If an optional argument VERBOSE is non-nil, print messages at the beginning |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2813 and end of list building." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2814 (if verbose |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2815 (message "Building info alist...")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2816 (setq prolog-info-alist |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2817 (let ((l ()) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2818 (last-entry (cons "" ()))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2819 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2820 (save-window-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2821 ;; select any window but the minibuffer (as we cannot switch |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2822 ;; buffers in minibuffer window. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2823 ;; I am not sure this is the right/best way |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2824 (if (active-minibuffer-window) ; nil if none active |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2825 (select-window (next-window))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2826 ;; Do this after going away from minibuffer window |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2827 (save-window-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2828 (info)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2829 (Info-goto-node prolog-info-predicate-index) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2830 (goto-char (point-min)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2831 (while (re-search-forward |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2832 "^\\* \\(.+\\)/\\([0-9]+\\)\\([^\n:*]*\\):" nil t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2833 (let* ((name (match-string 1)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2834 (arity (string-to-number (match-string 2))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2835 (comment (match-string 3)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2836 (fa (format "%s/%d%s" name arity comment)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2837 info-node) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2838 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2839 ;; Extract the info node name |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2840 (setq info-node (progn |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2841 (re-search-forward ":[ \t]*\\([^:]+\\).$") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2842 (match-string 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2843 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2844 ;; ###### Easier? (from Milan version 0.1.28) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2845 ;; (setq info-node (Info-extract-menu-node-name)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2846 (if (equal fa (car last-entry)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2847 (setcdr last-entry (cons info-node (cdr last-entry))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2848 (setq last-entry (cons fa (list info-node)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2849 l (cons last-entry l))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2850 (nreverse l) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2851 )))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2852 (if verbose |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2853 (message "Building info alist... done."))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2854 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2855 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2856 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2857 ;; Miscellaneous functions |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2858 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2859 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2860 ;; For Windows. Change backslash to slash. SICStus handles either |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2861 ;; path separator but backslash must be doubled, therefore use slash. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2862 (defun prolog-bsts (string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2863 "Change backslashes to slashes in STRING." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2864 (let ((str1 (copy-sequence string)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2865 (len (length string)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2866 (i 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2867 (while (< i len) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2868 (if (char-equal (aref str1 i) ?\\) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2869 (aset str1 i ?/)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2870 (setq i (1+ i))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2871 str1)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2872 |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2873 ;;(defun prolog-temporary-file () |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2874 ;; "Make temporary file name for compilation." |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2875 ;; (make-temp-name |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2876 ;; (concat |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2877 ;; (or |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2878 ;; (getenv "TMPDIR") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2879 ;; (getenv "TEMP") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2880 ;; (getenv "TMP") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2881 ;; (getenv "SYSTEMP") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2882 ;; "/tmp") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2883 ;; "/prolcomp"))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2884 ;;(setq prolog-temp-filename (prolog-bsts (prolog-temporary-file))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2885 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2886 (defun prolog-temporary-file () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2887 "Make temporary file name for compilation." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2888 (if prolog-temporary-file-name |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2889 ;; We already have a file, erase content and continue |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2890 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2891 (write-region "" nil prolog-temporary-file-name nil 'silent) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2892 prolog-temporary-file-name) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2893 ;; Actually create the file and set `prolog-temporary-file-name' |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2894 ;; accordingly. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2895 (setq prolog-temporary-file-name |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2896 (make-temp-file "prolcomp" nil ".pl")))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2897 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2898 (defun prolog-goto-prolog-process-buffer () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2899 "Switch to the prolog process buffer and go to its end." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2900 (switch-to-buffer-other-window "*prolog*") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2901 (goto-char (point-max)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2902 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2903 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2904 (defun prolog-enable-sicstus-sd () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2905 "Enable the source level debugging facilities of SICStus 3.7 and later." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2906 (interactive) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2907 (require 'pltrace) ; Load the SICStus debugger code |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2908 ;; Turn on the source level debugging by default |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2909 (add-hook 'prolog-inferior-mode-hook 'pltrace-on) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2910 (if (not prolog-use-sicstus-sd) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2911 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2912 ;; If there is a *prolog* buffer, then call pltrace-on |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2913 (if (get-buffer "*prolog*") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2914 ;; Avoid compilation warnings by using eval |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2915 (eval '(pltrace-on))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2916 (setq prolog-use-sicstus-sd t) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
2917 ))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2918 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2919 (defun prolog-disable-sicstus-sd () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2920 "Disable the source level debugging facilities of SICStus 3.7 and later." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2921 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2922 (setq prolog-use-sicstus-sd nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2923 ;; Remove the hook |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2924 (remove-hook 'prolog-inferior-mode-hook 'pltrace-on) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2925 ;; If there is a *prolog* buffer, then call pltrace-off |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2926 (if (get-buffer "*prolog*") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2927 ;; Avoid compile warnings by using eval |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2928 (eval '(pltrace-off)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2929 |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2930 (defun prolog-toggle-sicstus-sd () |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2931 ;; FIXME: Use define-minor-mode. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2932 "Toggle the source level debugging facilities of SICStus 3.7 and later." |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2933 (interactive) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2934 (if prolog-use-sicstus-sd |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2935 (prolog-disable-sicstus-sd) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2936 (prolog-enable-sicstus-sd))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2937 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2938 (defun prolog-debug-on (&optional arg) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2939 "Enable debugging. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2940 When called with prefix argument ARG, disable debugging instead." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2941 (interactive "P") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2942 (if arg |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2943 (prolog-debug-off) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2944 (prolog-process-insert-string (get-process "prolog") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2945 prolog-debug-on-string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2946 (process-send-string "prolog" prolog-debug-on-string))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2947 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2948 (defun prolog-debug-off () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2949 "Disable debugging." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2950 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2951 (prolog-process-insert-string (get-process "prolog") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2952 prolog-debug-off-string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2953 (process-send-string "prolog" prolog-debug-off-string)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2954 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2955 (defun prolog-trace-on (&optional arg) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2956 "Enable tracing. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2957 When called with prefix argument ARG, disable tracing instead." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2958 (interactive "P") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2959 (if arg |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2960 (prolog-trace-off) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2961 (prolog-process-insert-string (get-process "prolog") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2962 prolog-trace-on-string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2963 (process-send-string "prolog" prolog-trace-on-string))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2964 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2965 (defun prolog-trace-off () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2966 "Disable tracing." |
72684
f65ec4fd2be1
Remove * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68773
diff
changeset
|
2967 (interactive) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2968 (prolog-process-insert-string (get-process "prolog") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2969 prolog-trace-off-string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2970 (process-send-string "prolog" prolog-trace-off-string)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2971 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2972 (defun prolog-zip-on (&optional arg) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2973 "Enable zipping (for SICStus 3.7 and later). |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2974 When called with prefix argument ARG, disable zipping instead." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2975 (interactive "P") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2976 (if arg |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2977 (prolog-zip-off) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2978 (prolog-process-insert-string (get-process "prolog") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2979 prolog-zip-on-string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2980 (process-send-string "prolog" prolog-zip-on-string))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2981 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2982 (defun prolog-zip-off () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2983 "Disable zipping (for SICStus 3.7 and later)." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2984 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2985 (prolog-process-insert-string (get-process "prolog") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2986 prolog-zip-off-string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2987 (process-send-string "prolog" prolog-zip-off-string)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2988 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2989 ;; (defun prolog-create-predicate-index () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2990 ;; "Create an index for all predicates in the buffer." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2991 ;; (let ((predlist '()) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
2992 ;; clauseinfo |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2993 ;; object |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2994 ;; pos |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2995 ;; ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2996 ;; (goto-char (point-min)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2997 ;; ;; Replace with prolog-clause-start! |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2998 ;; (while (re-search-forward "^.+:-" nil t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
2999 ;; (setq pos (match-beginning 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3000 ;; (setq clauseinfo (prolog-clause-info)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3001 ;; (setq object (prolog-in-object)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3002 ;; (setq predlist (append |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3003 ;; predlist |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3004 ;; (list (cons |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3005 ;; (if (and (eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3006 ;; (prolog-in-object)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3007 ;; (format "%s::%s/%d" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3008 ;; object |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3009 ;; (nth 0 clauseinfo) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3010 ;; (nth 1 clauseinfo)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3011 ;; (format "%s/%d" |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3012 ;; (nth 0 clauseinfo) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3013 ;; (nth 1 clauseinfo))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3014 ;; pos |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3015 ;; )))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3016 ;; (prolog-end-of-predicate)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3017 ;; predlist)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3018 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3019 (defun prolog-get-predspec () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3020 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3021 (let ((state (prolog-clause-info)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3022 (object (prolog-in-object))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3023 (if (or (equal (nth 0 state) "") (equal (prolog-in-string-or-comment) 'cmt)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3024 nil |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3025 (if (and (eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3026 object) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3027 (format "%s::%s/%d" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3028 object |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3029 (nth 0 state) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3030 (nth 1 state)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3031 (format "%s/%d" |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3032 (nth 0 state) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3033 (nth 1 state))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3034 )))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3035 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3036 ;; For backward compatibility. Stolen from custom.el. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3037 (or (fboundp 'match-string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3038 ;; Introduced in Emacs 19.29. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3039 (defun match-string (num &optional string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3040 "Return string of text matched by last search. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3041 NUM specifies which parenthesized expression in the last regexp. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3042 Value is nil if NUMth pair didn't match, or there were less than NUM pairs. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3043 Zero means the entire text matched by the whole regexp or whole string. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3044 STRING should be given if the last search was by `string-match' on STRING." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3045 (if (match-beginning num) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3046 (if string |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3047 (substring string (match-beginning num) (match-end num)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3048 (buffer-substring (match-beginning num) (match-end num)))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3049 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3050 (defun prolog-pred-start () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3051 "Return the starting point of the first clause of the current predicate." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3052 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3053 (goto-char (prolog-clause-start)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3054 ;; Find first clause, unless it was a directive |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3055 (if (and (not (looking-at "[:?]-")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3056 (not (looking-at "[ \t]*[%/]")) ; Comment |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3057 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3058 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3059 (let* ((pinfo (prolog-clause-info)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3060 (predname (nth 0 pinfo)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3061 (arity (nth 1 pinfo)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3062 (op (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3063 (while (and (re-search-backward |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3064 (format "^%s\\([(\\.]\\| *%s\\)" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3065 predname prolog-head-delimiter) nil t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3066 (= arity (nth 1 (prolog-clause-info))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3067 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3068 (setq op (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3069 (if (eq prolog-system 'mercury) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3070 ;; Skip to the beginning of declarations of the predicate |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3071 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3072 (goto-char (prolog-beginning-of-clause)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3073 (while (and (not (eq (point) op)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3074 (looking-at |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3075 (format ":-[ \t]*\\(pred\\|mode\\)[ \t]+%s" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3076 predname))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3077 (setq op (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3078 (goto-char (prolog-beginning-of-clause))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3079 op) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3080 (point)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3081 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3082 (defun prolog-pred-end () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3083 "Return the position at the end of the last clause of the current predicate." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3084 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3085 (goto-char (prolog-clause-end)) ; if we are before the first predicate |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3086 (goto-char (prolog-clause-start)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3087 (let* ((pinfo (prolog-clause-info)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3088 (predname (nth 0 pinfo)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3089 (arity (nth 1 pinfo)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3090 oldp |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3091 (notdone t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3092 (op (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3093 (if (looking-at "[:?]-") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3094 ;; This was a directive |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3095 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3096 (if (and (eq prolog-system 'mercury) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3097 (looking-at |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3098 (format ":-[ \t]*\\(pred\\|mode\\)[ \t]+\\(%s+\\)" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3099 prolog-atom-regexp))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3100 ;; Skip predicate declarations |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3101 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3102 (setq predname (buffer-substring-no-properties |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3103 (match-beginning 2) (match-end 2))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3104 (while (re-search-forward |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3105 (format |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3106 "\n*\\(:-[ \t]*\\(pred\\|mode\\)[ \t]+\\)?%s[( \t]" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3107 predname) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3108 nil t)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3109 (goto-char (prolog-clause-end)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3110 (setq op (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3111 ;; It was not a directive, find the last clause |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3112 (while (and notdone |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3113 (re-search-forward |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3114 (format "^%s\\([(\\.]\\| *%s\\)" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3115 predname prolog-head-delimiter) nil t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3116 (= arity (nth 1 (prolog-clause-info)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3117 (setq oldp (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3118 (setq op (prolog-clause-end)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3119 (if (>= oldp op) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3120 ;; End of clause not found. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3121 (setq notdone nil) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3122 ;; Continue while loop |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3123 (goto-char op)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3124 op))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3125 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3126 (defun prolog-clause-start (&optional not-allow-methods) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3127 "Return the position at the start of the head of the current clause. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3128 If NOTALLOWMETHODS is non-nil then do not match on methods in |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3129 objects (relevent only if 'prolog-system' is set to 'sicstus)." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3130 (save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3131 (let ((notdone t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3132 (retval (point-min))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3133 (end-of-line) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3134 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3135 ;; SICStus object? |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3136 (if (and (not not-allow-methods) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3137 (eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3138 (prolog-in-object)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3139 (while (and |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3140 notdone |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3141 ;; Search for a head or a fact |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3142 (re-search-backward |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3143 ;; If in object, then find method start. |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3144 ;; "^[ \t]+[a-z$].*\\(:-\\|&\\|:: {\\|,\\)" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3145 "^[ \t]+[a-z$].*\\(:-\\|&\\|:: {\\)" ; The comma causes |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3146 ; problems since we cannot assume |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3147 ; that the line starts at column 0, |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3148 ; thus we don't know if the line |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3149 ; is a head or a subgoal |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3150 (point-min) t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3151 (if (>= (prolog-paren-balance) 0) ; To no match on " a) :-" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3152 ;; Start of method found |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3153 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3154 (setq retval (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3155 (setq notdone nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3156 ) ; End of while |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3157 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3158 ;; Not in object |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3159 (while (and |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3160 notdone |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3161 ;; Search for a text at beginning of a line |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3162 ;; ###### |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3163 ;; (re-search-backward "^[a-z$']" nil t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3164 (let ((case-fold-search nil)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3165 (re-search-backward |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3166 ;; (format "^[%s$']" prolog-lower-case-string) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3167 ;; FIXME: Use [:lower:] |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3168 (format "^\\([%s$']\\|[:?]-\\)" prolog-lower-case-string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3169 nil t))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3170 (let ((bal (prolog-paren-balance))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3171 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3172 ((> bal 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3173 ;; Start of clause found |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3174 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3175 (setq retval (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3176 (setq notdone nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3177 ((and (= bal 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3178 (looking-at |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3179 (format ".*\\(\\.\\|%s\\|!,\\)[ \t]*\\(%%.*\\|\\)$" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3180 prolog-head-delimiter))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3181 ;; Start of clause found if the line ends with a '.' or |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3182 ;; a prolog-head-delimiter |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3183 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3184 (setq retval (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3185 (setq notdone nil)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3186 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3187 (t nil) ; Do nothing |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3188 )))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3189 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3190 retval))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3191 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3192 (defun prolog-clause-end (&optional not-allow-methods) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3193 "Return the position at the end of the current clause. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3194 If NOTALLOWMETHODS is non-nil then do not match on methods in |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3195 objects (relevent only if 'prolog-system' is set to 'sicstus)." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3196 (save-excursion |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3197 (beginning-of-line) ; Necessary since we use "^...." for the search. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3198 (if (re-search-forward |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3199 (if (and (not not-allow-methods) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3200 (eq prolog-system 'sicstus) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3201 (prolog-in-object)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3202 (format |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3203 "^\\(%s\\|%s\\|[^\n\'\"%%]\\)*&[ \t]*\\(\\|%%.*\\)$\\|[ \t]*}" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3204 prolog-quoted-atom-regexp prolog-string-regexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3205 (format |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3206 "^\\(%s\\|%s\\|[^\n\'\"%%]\\)*\\.[ \t]*\\(\\|%%.*\\)$" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3207 prolog-quoted-atom-regexp prolog-string-regexp)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3208 nil t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3209 (if (and (prolog-in-string-or-comment) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3210 (not (eobp))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3211 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3212 (forward-char) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3213 (prolog-clause-end)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3214 (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3215 (point)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3216 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3217 (defun prolog-clause-info () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3218 "Return a (name arity) list for the current clause." |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3219 (save-excursion |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3220 (goto-char (prolog-clause-start)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3221 (let* ((op (point)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3222 (predname |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3223 (if (looking-at prolog-atom-char-regexp) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3224 (progn |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3225 (skip-chars-forward "^ (\\.") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3226 (buffer-substring op (point))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3227 "")) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3228 (arity 0)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3229 ;; Retrieve the arity. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3230 (if (looking-at prolog-left-paren) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3231 (let ((endp (save-excursion |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3232 (prolog-forward-list) (point)))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3233 (setq arity 1) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3234 (forward-char 1) ; Skip the opening paren. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3235 (while (progn |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3236 (skip-chars-forward "^[({,'\"") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3237 (< (point) endp)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3238 (if (looking-at ",") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3239 (progn |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3240 (setq arity (1+ arity)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3241 (forward-char 1) ; Skip the comma. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3242 ) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3243 ;; We found a string, list or something else we want |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3244 ;; to skip over. Always use prolog-tokenize, |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3245 ;; parse-partial-sexp does not have a 'skipover mode. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3246 (goto-char (nth 5 (prolog-tokenize (point) endp 'skipover)))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3247 ))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3248 (list predname arity)))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3249 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3250 (defun prolog-in-object () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3251 "Return object name if the point is inside a SICStus object definition." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3252 ;; Return object name if the last line that starts with a character |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3253 ;; that is neither white space nor a comment start |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3254 (save-excursion |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3255 (if (save-excursion |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3256 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3257 (looking-at "\\([^\n ]+\\)[ \t]*::[ \t]*{")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3258 ;; We were in the head of the object |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3259 (match-string 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3260 ;; We were not in the head |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3261 (if (and (re-search-backward "^[a-z$'}]" nil t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3262 (looking-at "\\([^\n ]+\\)[ \t]*::[ \t]*{")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3263 (match-string 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3264 nil)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3265 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3266 (defun prolog-forward-list () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3267 "Move the point to the matching right parenthesis." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3268 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3269 (if prolog-use-prolog-tokenizer-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3270 (let ((state (prolog-tokenize (point) (point-max) 'zerodepth))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3271 (goto-char (nth 5 state))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3272 (forward-list))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3273 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3274 ;; NB: This could be done more efficiently! |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3275 (defun prolog-backward-list () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3276 "Move the point to the matching left parenthesis." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3277 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3278 (if prolog-use-prolog-tokenizer-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3279 (let ((bal 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3280 (paren-regexp (concat prolog-left-paren "\\|" prolog-right-paren)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3281 (notdone t)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3282 ;; FIXME: Doesn't this incorrectly count 0'( and 0') ? |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3283 (while (and notdone (re-search-backward paren-regexp nil t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3284 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3285 ((looking-at prolog-left-paren) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3286 (if (not (prolog-in-string-or-comment)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3287 (setq bal (1+ bal))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3288 (if (= bal 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3289 (setq notdone nil))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3290 ((looking-at prolog-right-paren) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3291 (if (not (prolog-in-string-or-comment)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3292 (setq bal (1- bal)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3293 ))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3294 (backward-list))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3295 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3296 (defun prolog-beginning-of-clause () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3297 "Move to the beginning of current clause. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3298 If already at the beginning of clause, move to previous clause." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3299 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3300 (let ((point (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3301 (new-point (prolog-clause-start))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3302 (if (and (>= new-point point) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3303 (> point 1)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3304 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3305 (goto-char (1- point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3306 (goto-char (prolog-clause-start))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3307 (goto-char new-point) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3308 (skip-chars-forward " \t")))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3309 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3310 ;; (defun prolog-previous-clause () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3311 ;; "Move to the beginning of the previous clause." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3312 ;; (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3313 ;; (forward-char -1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3314 ;; (prolog-beginning-of-clause)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3315 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3316 (defun prolog-end-of-clause () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3317 "Move to the end of clause. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3318 If already at the end of clause, move to next clause." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3319 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3320 (let ((point (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3321 (new-point (prolog-clause-end))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3322 (if (and (<= new-point point) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3323 (not (eq new-point (point-max)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3324 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3325 (goto-char (1+ point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3326 (goto-char (prolog-clause-end))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3327 (goto-char new-point)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3328 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3329 ;; (defun prolog-next-clause () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3330 ;; "Move to the beginning of the next clause." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3331 ;; (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3332 ;; (prolog-end-of-clause) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3333 ;; (forward-char) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3334 ;; (prolog-end-of-clause) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3335 ;; (prolog-beginning-of-clause)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3336 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3337 (defun prolog-beginning-of-predicate () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3338 "Go to the nearest beginning of predicate before current point. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3339 Return the final point or nil if no such a beginning was found." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3340 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3341 (let ((op (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3342 (pos (prolog-pred-start))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3343 (if pos |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3344 (if (= op pos) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3345 (if (not (bobp)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3346 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3347 (goto-char pos) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3348 (backward-char 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3349 (setq pos (prolog-pred-start)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3350 (if pos |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3351 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3352 (goto-char pos) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3353 (point))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3354 (goto-char pos) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3355 (point))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3356 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3357 (defun prolog-end-of-predicate () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3358 "Go to the end of the current predicate." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3359 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3360 (let ((op (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3361 (goto-char (prolog-pred-end)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3362 (if (= op (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3363 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3364 (forward-line 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3365 (prolog-end-of-predicate))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3366 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3367 (defun prolog-insert-predspec () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3368 "Insert the predspec for the current predicate." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3369 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3370 (let* ((pinfo (prolog-clause-info)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3371 (predname (nth 0 pinfo)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3372 (arity (nth 1 pinfo))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3373 (insert (format "%s/%d" predname arity)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3374 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3375 (defun prolog-view-predspec () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3376 "Insert the predspec for the current predicate." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3377 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3378 (let* ((pinfo (prolog-clause-info)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3379 (predname (nth 0 pinfo)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3380 (arity (nth 1 pinfo))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3381 (message (format "%s/%d" predname arity)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3382 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3383 (defun prolog-insert-predicate-template () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3384 "Insert the template for the current clause." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3385 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3386 (let* ((n 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3387 oldp |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3388 (pinfo (prolog-clause-info)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3389 (predname (nth 0 pinfo)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3390 (arity (nth 1 pinfo))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3391 (insert predname) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3392 (if (> arity 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3393 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3394 (insert "(") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3395 (when prolog-electric-dot-full-predicate-template |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3396 (setq oldp (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3397 (while (< n arity) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3398 (insert ",") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3399 (setq n (1+ n))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3400 (insert ")") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3401 (goto-char oldp)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3402 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3403 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3404 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3405 (defun prolog-insert-next-clause () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3406 "Insert newline and the name of the current clause." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3407 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3408 (insert "\n") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3409 (prolog-insert-predicate-template)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3410 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3411 (defun prolog-insert-module-modeline () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3412 "Insert a modeline for module specification. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3413 This line should be first in the buffer. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3414 The module name should be written manually just before the semi-colon." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3415 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3416 (insert "%%% -*- Module: ; -*-\n") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3417 (backward-char 6)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3418 |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3419 (defalias 'prolog-uncomment-region |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3420 (if (fboundp 'uncomment-region) #'uncomment-region |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3421 (lambda (beg end) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3422 "Uncomment the region between BEG and END." |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3423 (interactive "r") |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3424 (comment-region beg end -1)))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3425 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3426 (defun prolog-goto-comment-column (&optional nocreate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3427 "Move comments on the current line to the correct position. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3428 If NOCREATE is nil (or omitted) and there is no comment on the line, then |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3429 a new comment is created." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3430 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3431 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3432 (if (or (not nocreate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3433 (and |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3434 (re-search-forward |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3435 (format "^\\(\\(%s\\|%s\\|[^\n\'\"%%]\\)*\\)%% *" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3436 prolog-quoted-atom-regexp prolog-string-regexp) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3437 (line-end-position) 'limit) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3438 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3439 (goto-char (match-beginning 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3440 (not (eq (prolog-in-string-or-comment) 'txt))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3441 (indent-for-comment))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3442 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3443 (defun prolog-indent-predicate () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3444 "*Indent the current predicate." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3445 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3446 (indent-region (prolog-pred-start) (prolog-pred-end) nil)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3447 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3448 (defun prolog-indent-buffer () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3449 "*Indent the entire buffer." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3450 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3451 (indent-region (point-min) (point-max) nil)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3452 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3453 (defun prolog-mark-clause () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3454 "Put mark at the end of this clause and move point to the beginning." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3455 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3456 (let ((pos (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3457 (goto-char (prolog-clause-end)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3458 (forward-line 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3459 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3460 (set-mark (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3461 (goto-char pos) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3462 (goto-char (prolog-clause-start)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3463 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3464 (defun prolog-mark-predicate () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3465 "Put mark at the end of this predicate and move point to the beginning." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3466 (interactive) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3467 (goto-char (prolog-pred-end)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3468 (let ((pos (point))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3469 (forward-line 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3470 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3471 (set-mark (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3472 (goto-char pos) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3473 (goto-char (prolog-pred-start)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3474 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3475 ;; Stolen from `cc-mode.el': |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3476 (defun prolog-electric-delete (arg) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3477 "Delete preceding character or whitespace. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3478 If `prolog-hungry-delete-key-flag' is non-nil, then all preceding whitespace is |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3479 consumed. If however an ARG is supplied, or `prolog-hungry-delete-key-flag' is |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3480 nil, or point is inside a literal then the function in the variable |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3481 `backward-delete-char' is called." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3482 (interactive "P") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3483 (if (or (not prolog-hungry-delete-key-flag) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3484 arg |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3485 (prolog-in-string-or-comment)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3486 (funcall 'backward-delete-char (prefix-numeric-value arg)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3487 (let ((here (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3488 (skip-chars-backward " \t\n") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3489 (if (/= (point) here) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3490 (delete-region (point) here) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3491 (funcall 'backward-delete-char 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3492 )))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3493 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3494 ;; For XEmacs compatibility (suggested by Per Mildner) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3495 (put 'prolog-electric-delete 'pending-delete 'supersede) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3496 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3497 (defun prolog-electric-if-then-else (arg) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3498 "If `prolog-electric-if-then-else-flag' is non-nil, indent if-then-else constructs. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3499 Bound to the >, ; and ( keys." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3500 (interactive "P") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3501 (self-insert-command (prefix-numeric-value arg)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3502 (if prolog-electric-if-then-else-flag (prolog-insert-spaces-after-paren))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3503 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3504 (defun prolog-electric-colon (arg) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3505 "If `prolog-electric-colon-flag' is non-nil, insert the electric `:' construct. |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3506 That is, insert space (if appropriate), `:-' and newline if colon is pressed |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3507 at the end of a line that starts in the first column (i.e., clause |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3508 heads)." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3509 (interactive "P") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3510 (if (and prolog-electric-colon-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3511 (null arg) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3512 (eolp) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3513 ;(not (string-match "^\\s " (thing-at-point 'line)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3514 (not (string-match "^\\(\\s \\|%\\)" (thing-at-point 'line)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3515 (progn |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3516 (unless (save-excursion (backward-char 1) (looking-at "\\s ")) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3517 (insert " ")) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3518 (insert ":-\n") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3519 (prolog-indent-line)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3520 (self-insert-command (prefix-numeric-value arg)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3521 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3522 (defun prolog-electric-dash (arg) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3523 "If `prolog-electric-dash-flag' is non-nil, insert the electric `-' construct. |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3524 that is, insert space (if appropriate), `-->' and newline if dash is pressed |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3525 at the end of a line that starts in the first column (i.e., DCG |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3526 heads)." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3527 (interactive "P") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3528 (if (and prolog-electric-dash-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3529 (null arg) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3530 (eolp) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3531 ;(not (string-match "^\\s " (thing-at-point 'line)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3532 (not (string-match "^\\(\\s \\|%\\)" (thing-at-point 'line)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3533 (progn |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3534 (unless (save-excursion (backward-char 1) (looking-at "\\s ")) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3535 (insert " ")) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3536 (insert "-->\n") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3537 (prolog-indent-line)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3538 (self-insert-command (prefix-numeric-value arg)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3539 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3540 (defun prolog-electric-dot (arg) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3541 "Insert dot and newline or a head of a new clause. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3542 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3543 If `prolog-electric-dot-flag' is nil, then simply insert dot. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3544 Otherwise:: |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3545 When invoked at the end of nonempty line, insert dot and newline. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3546 When invoked at the end of an empty line, insert a recursive call to |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3547 the current predicate. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3548 When invoked at the beginning of line, insert a head of a new clause |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3549 of the current predicate. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3550 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3551 When called with prefix argument ARG, insert just dot." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3552 (interactive "P") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3553 ;; Check for situations when the electricity should not be active |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3554 (if (or (not prolog-electric-dot-flag) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3555 arg |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3556 (prolog-in-string-or-comment) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3557 ;; Do not be electric in a floating point number or an operator |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3558 (not |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3559 (or |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3560 ;; (re-search-backward |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3561 ;; ###### |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3562 ;; "\\(^\\|[])}a-zA-Z_!'0-9]+\\)[ \t]*\\=" nil t))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3563 (save-excursion |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3564 (re-search-backward |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3565 ;; "\\(^\\|[])}_!'0-9]+\\)[ \t]*\\=" nil t))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3566 "\\(^\\|[])}_!'0-9]+\\)[ \t]*\\=" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3567 nil t)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3568 (save-excursion |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3569 (re-search-backward |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3570 ;; "\\(^\\|[])}a-zA-Z]+\\)[ \t]*\\=" nil t))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3571 (format "\\(^\\|[])}%s]+\\)[ \t]*\\=" |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3572 prolog-lower-case-string) ;FIXME: [:lower:] |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3573 nil t)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3574 (save-excursion |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3575 (re-search-backward |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3576 ;; "\\(^\\|[])}a-zA-Z]+\\)[ \t]*\\=" nil t))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3577 (format "\\(^\\|[])}%s]+\\)[ \t]*\\=" |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3578 prolog-upper-case-string) ;FIXME: [:upper:] |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3579 nil t)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3580 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3581 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3582 ;; Do not be electric if inside a parenthesis pair. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3583 (not (= (prolog-region-paren-balance (prolog-clause-start) (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3584 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3585 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3586 (funcall 'self-insert-command (prefix-numeric-value arg)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3587 (cond |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3588 ;; Beginning of line |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3589 ((bolp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3590 (prolog-insert-predicate-template)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3591 ;; At an empty line with at least one whitespace |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3592 ((save-excursion |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3593 (beginning-of-line) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3594 (looking-at "[ \t]+$")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3595 (prolog-insert-predicate-template) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3596 (when prolog-electric-dot-full-predicate-template |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3597 (save-excursion |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3598 (end-of-line) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3599 (insert ".\n")))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3600 ;; Default |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3601 (t |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3602 (insert ".\n")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3603 ))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3604 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3605 (defun prolog-electric-underscore () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3606 "Replace variable with an underscore. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3607 If `prolog-electric-underscore-flag' is non-nil and the point is |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3608 on a variable then replace the variable with underscore and skip |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3609 the following comma and whitespace, if any. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3610 If the point is not on a variable then insert underscore." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3611 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3612 (if prolog-electric-underscore-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3613 (let (;start |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3614 (case-fold-search nil) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3615 (oldp (point))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3616 ;; ###### |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3617 ;;(skip-chars-backward "a-zA-Z_") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3618 (skip-chars-backward |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3619 (format "%s%s_" |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3620 ;; FIXME: Why not "a-zA-Z"? |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3621 prolog-lower-case-string |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3622 prolog-upper-case-string)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3623 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3624 ;(setq start (point)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3625 (if (and (not (prolog-in-string-or-comment)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3626 ;; ###### |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3627 ;; (looking-at "\\<[_A-Z][a-zA-Z_0-9]*\\>")) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3628 (looking-at (format "\\<[_%s][%s%s_0-9]*\\>" |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3629 ;; FIXME: Use [:upper:] and friends. |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3630 prolog-upper-case-string |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3631 prolog-lower-case-string |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3632 prolog-upper-case-string))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3633 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3634 (replace-match "_") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3635 (skip-chars-forward ", \t\n")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3636 (goto-char oldp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3637 (self-insert-command 1)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3638 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3639 (self-insert-command 1)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3640 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3641 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3642 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3643 (defun prolog-find-term (functor arity &optional prefix) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3644 "Go to the position at the start of the next occurance of a term. |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3645 The term is specified with FUNCTOR and ARITY. The optional argument |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3646 PREFIX is the prefix of the search regexp." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3647 (let* (;; If prefix is not set then use the default "\\<" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3648 (prefix (if (not prefix) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3649 "\\<" |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3650 prefix)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3651 (regexp (concat prefix functor)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3652 (i 1)) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3653 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3654 ;; Build regexp for the search if the arity is > 0 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3655 (if (= arity 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3656 ;; Add that the functor must be at the end of a word. This |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3657 ;; does not work if the arity is > 0 since the closing ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3658 ;; is not a word constituent. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3659 (setq regexp (concat regexp "\\>")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3660 ;; Arity is > 0, add parens and commas |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3661 (setq regexp (concat regexp "(")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3662 (while (< i arity) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3663 (setq regexp (concat regexp ".+,")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3664 (setq i (1+ i))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3665 (setq regexp (concat regexp ".+)"))) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3666 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3667 ;; Search, and return position |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3668 (if (re-search-forward regexp nil t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3669 (goto-char (match-beginning 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3670 (error "Term not found")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3671 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3672 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3673 (defun prolog-variables-to-anonymous (beg end) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3674 "Replace all variables within a region BEG to END by anonymous variables." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3675 (interactive "r") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3676 (save-excursion |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3677 (let ((case-fold-search nil)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3678 (goto-char end) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3679 (while (re-search-backward "\\<[A-Z_][a-zA-Z_0-9]*\\>" beg t) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3680 (progn |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3681 (replace-match "_") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3682 (backward-char))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3683 ))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3684 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3685 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3686 (defun prolog-set-atom-regexps () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3687 "Set the `prolog-atom-char-regexp' and `prolog-atom-regexp' variables. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3688 Must be called after `prolog-build-case-strings'." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3689 (setq prolog-atom-char-regexp |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3690 (format "[%s%s0-9_$]" |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3691 ;; FIXME: why not a-zA-Z? |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3692 prolog-lower-case-string |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3693 prolog-upper-case-string)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3694 (setq prolog-atom-regexp |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3695 (format "[%s$]%s*" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3696 prolog-lower-case-string |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3697 prolog-atom-char-regexp)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3698 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3699 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3700 (defun prolog-build-case-strings () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3701 "Set `prolog-upper-case-string' and `prolog-lower-case-string'. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3702 Uses the current case-table for extracting the relevant information." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3703 (let ((up_string "") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3704 (low_string "")) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3705 ;; Use `map-char-table' if it is defined. Otherwise enumerate all |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3706 ;; numbers between 0 and 255. `map-char-table' is probably safer. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3707 ;; |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3708 ;; `map-char-table' causes problems under Emacs 23.0.0.1, the |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3709 ;; while loop seems to do its job well (Ryszard Szopa) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3710 ;; |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3711 ;;(if (and (not (featurep 'xemacs)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3712 ;; (fboundp 'map-char-table)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3713 ;; (map-char-table |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3714 ;; (lambda (key value) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3715 ;; (cond |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3716 ;; ((and |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3717 ;; (eq (prolog-int-to-char key) (downcase key)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3718 ;; (eq (prolog-int-to-char key) (upcase key))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3719 ;; ;; Do nothing if upper and lower case are the same |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3720 ;; ) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3721 ;; ((eq (prolog-int-to-char key) (downcase key)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3722 ;; ;; The char is lower case |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3723 ;; (setq low_string (format "%s%c" low_string key))) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3724 ;; ((eq (prolog-int-to-char key) (upcase key)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3725 ;; ;; The char is upper case |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3726 ;; (setq up_string (format "%s%c" up_string key))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3727 ;; )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3728 ;; (current-case-table)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3729 ;; `map-char-table' was undefined. |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3730 (let ((key 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3731 (while (< key 256) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3732 (cond |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3733 ((and |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3734 (eq (prolog-int-to-char key) (downcase key)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3735 (eq (prolog-int-to-char key) (upcase key))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3736 ;; Do nothing if upper and lower case are the same |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3737 ) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3738 ((eq (prolog-int-to-char key) (downcase key)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3739 ;; The char is lower case |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3740 (setq low_string (format "%s%c" low_string key))) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3741 ((eq (prolog-int-to-char key) (upcase key)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3742 ;; The char is upper case |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3743 (setq up_string (format "%s%c" up_string key))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3744 ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3745 (setq key (1+ key)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3746 ;; ) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3747 ;; The strings are single-byte strings |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3748 (setq prolog-upper-case-string (prolog-dash-letters up_string)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3749 (setq prolog-lower-case-string (prolog-dash-letters low_string)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3750 )) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3751 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3752 ;(defun prolog-regexp-dash-continuous-chars (chars) |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3753 ; (let ((ints (mapcar #'prolog-char-to-int (string-to-list chars))) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3754 ; (beg 0) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3755 ; (end 0)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3756 ; (if (null ints) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3757 ; chars |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3758 ; (while (and (< (+ beg 1) (length chars)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3759 ; (not (or (= (+ (nth beg ints) 1) (nth (+ beg 1) ints)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3760 ; (= (nth beg ints) (nth (+ beg 1) ints))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3761 ; (setq beg (+ beg 1))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3762 ; (setq beg (+ beg 1) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3763 ; end beg) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3764 ; (while (and (< (+ end 1) (length chars)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3765 ; (or (= (+ (nth end ints) 1) (nth (+ end 1) ints)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3766 ; (= (nth end ints) (nth (+ end 1) ints)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3767 ; (setq end (+ end 1))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3768 ; (if (equal (substring chars end) "") |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3769 ; (substring chars 0 beg) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3770 ; (concat (substring chars 0 beg) "-" |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3771 ; (prolog-regexp-dash-continuous-chars (substring chars end)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3772 ; ))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3773 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3774 (defun prolog-ints-intervals (ints) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3775 "Return a list of intervals (from . to) covering INTS." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3776 (when ints |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3777 (setq ints (sort ints '<)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3778 (let ((prev (car ints)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3779 (interval-start (car ints)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3780 intervals) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3781 (while ints |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3782 (let ((next (car ints))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3783 (when (> next (1+ prev)) ; start of new interval |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3784 (setq intervals (cons (cons interval-start prev) intervals)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3785 (setq interval-start next)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3786 (setq prev next) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3787 (setq ints (cdr ints)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3788 (setq intervals (cons (cons interval-start prev) intervals)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3789 (reverse intervals)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3790 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3791 (defun prolog-dash-letters (string) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3792 "Return a condensed regexp covering all letters in STRING." |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3793 (let ((intervals (prolog-ints-intervals (mapcar #'prolog-char-to-int |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3794 (string-to-list string)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3795 codes) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3796 (while intervals |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3797 (let* ((i (car intervals)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3798 (from (car i)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3799 (to (cdr i)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3800 (c (cond ((= from to) `(,from)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3801 ((= (1+ from) to) `(,from ,to)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3802 (t `(,from ?- ,to))))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3803 (setq codes (cons c codes))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3804 (setq intervals (cdr intervals))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3805 (apply 'concat (reverse codes)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3806 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3807 ;(defun prolog-condense-character-sets (regexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3808 ; "Condense adjacent characters in character sets of REGEXP." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3809 ; (let ((next -1)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3810 ; (while (setq next (string-match "\\[\\(.*?\\)\\]" regexp (1+ next))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3811 ; (setq regexp (replace-match (prolog-dash-letters (match-string 1 regexp)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3812 ; t t regexp 1)))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3813 ; regexp) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3814 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3815 ;; GNU Emacs compatibility: GNU Emacs does not differentiate between |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3816 ;; ints and chars, or at least these two are interchangeable. |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3817 (defalias 'prolog-int-to-char |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3818 (if (fboundp 'int-to-char) #'int-to-char #'identity)) |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3819 |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3820 (defalias 'prolog-char-to-int |
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
3821 (if (fboundp 'char-to-int) #'char-to-int #'identity)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3822 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3823 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3824 ;; Menu stuff (both for the editing buffer and for the inferior |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3825 ;; prolog buffer) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3826 ;;------------------------------------------------------------------- |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3827 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3828 (unless (fboundp 'region-exists-p) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3829 (defun region-exists-p () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3830 "Non-nil iff the mark is set. Lobotomized version for Emacsen that do not provide their own." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3831 (mark))) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3832 |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3833 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3834 ;; GNU Emacs ignores `easy-menu-add' so the order in which the menus |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3835 ;; are defined _is_ important! |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3836 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3837 (easy-menu-define |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3838 prolog-menu-help (list prolog-mode-map prolog-inferior-mode-map) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3839 "Help menu for the Prolog mode." |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3840 ;; FIXME: Does it really deserve a whole menu to itself? |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3841 `(,(if (featurep 'xemacs) "Help" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3842 ;; Not sure it's worth the trouble. --Stef |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3843 ;; (add-to-list 'menu-bar-final-items |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3844 ;; (easy-menu-intern "Prolog-Help")) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3845 "Prolog-help") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3846 ["On predicate" prolog-help-on-predicate prolog-help-function-i] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3847 ["Apropos" prolog-help-apropos (eq prolog-system 'swi)] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3848 "---" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3849 ["Describe mode" describe-mode t])) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3850 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3851 (easy-menu-define |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3852 prolog-edit-menu-runtime prolog-mode-map |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3853 "Runtime Prolog commands available from the editing buffer" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3854 ;; FIXME: Don't use a whole menu for just "Run Mercury". --Stef |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3855 `("System" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3856 ;; Runtime menu name. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3857 ,@(unless (featurep 'xemacs) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3858 '(:label (cond ((eq prolog-system 'eclipse) "ECLiPSe") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3859 ((eq prolog-system 'mercury) "Mercury") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3860 (t "System")))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3861 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3862 ;; Consult items, NIL for mercury. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3863 ["Consult file" prolog-consult-file |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3864 :included (not (eq prolog-system 'mercury))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3865 ["Consult buffer" prolog-consult-buffer |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3866 :included (not (eq prolog-system 'mercury))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3867 ["Consult region" prolog-consult-region :active (region-exists-p) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3868 :included (not (eq prolog-system 'mercury))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3869 ["Consult predicate" prolog-consult-predicate |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3870 :included (not (eq prolog-system 'mercury))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3871 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3872 ;; Compile items, NIL for everything but SICSTUS. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3873 ,(if (featurep 'xemacs) "---" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3874 ["---" nil :included (eq prolog-system 'sicstus)]) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3875 ["Compile file" prolog-compile-file |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3876 :included (eq prolog-system 'sicstus)] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3877 ["Compile buffer" prolog-compile-buffer |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3878 :included (eq prolog-system 'sicstus)] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3879 ["Compile region" prolog-compile-region :active (region-exists-p) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3880 :included (eq prolog-system 'sicstus)] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3881 ["Compile predicate" prolog-compile-predicate |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3882 :included (eq prolog-system 'sicstus)] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3883 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3884 ;; Debug items, NIL for Mercury. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3885 ,(if (featurep 'xemacs) "---" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3886 ["---" nil :included (not (eq prolog-system 'mercury))]) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3887 ;; FIXME: Could we use toggle or radio buttons? --Stef |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3888 ["Debug" prolog-debug-on :included (not (eq prolog-system 'mercury))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3889 ["Debug off" prolog-debug-off |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3890 ;; In SICStus, these are pairwise disjunctive, |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3891 ;; so it's enough with a single "off"-command |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3892 :included (not (memq prolog-system '(mercury sicstus)))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3893 ["Trace" prolog-trace-on :included (not (eq prolog-system 'mercury))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3894 ["Trace off" prolog-trace-off |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3895 :included (not (memq prolog-system '(mercury sicstus)))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3896 ["Zip" prolog-zip-on :included (and (eq prolog-system 'sicstus) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3897 (prolog-atleast-version '(3 . 7)))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3898 ["All debug off" prolog-debug-off |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3899 :included (eq prolog-system 'sicstus)] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3900 ["Source level debugging" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3901 prolog-toggle-sicstus-sd |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3902 :included (and (eq prolog-system 'sicstus) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3903 (prolog-atleast-version '(3 . 7))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3904 :style toggle |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3905 :selected prolog-use-sicstus-sd] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3906 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3907 "---" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3908 ["Run" run-prolog |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3909 :suffix (cond ((eq prolog-system 'eclipse) "ECLiPSe") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3910 ((eq prolog-system 'mercury) "Mercury") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3911 (t "Prolog"))])) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3912 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3913 (easy-menu-define |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3914 prolog-edit-menu-insert-move prolog-mode-map |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3915 "Commands for Prolog code manipulation." |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3916 '("Prolog" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3917 ["Comment region" comment-region (region-exists-p)] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3918 ["Uncomment region" prolog-uncomment-region (region-exists-p)] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3919 ["Add comment/move to comment" indent-for-comment t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3920 ["Convert variables in region to '_'" prolog-variables-to-anonymous |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3921 :active (region-exists-p) :included (not (eq prolog-system 'mercury))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3922 "---" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3923 ["Insert predicate template" prolog-insert-predicate-template t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3924 ["Insert next clause head" prolog-insert-next-clause t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3925 ["Insert predicate spec" prolog-insert-predspec t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3926 ["Insert module modeline" prolog-insert-module-modeline t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3927 "---" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3928 ["Beginning of clause" prolog-beginning-of-clause t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3929 ["End of clause" prolog-end-of-clause t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3930 ["Beginning of predicate" prolog-beginning-of-predicate t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3931 ["End of predicate" prolog-end-of-predicate t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3932 "---" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3933 ["Indent line" prolog-indent-line t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3934 ["Indent region" indent-region (region-exists-p)] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3935 ["Indent predicate" prolog-indent-predicate t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3936 ["Indent buffer" prolog-indent-buffer t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3937 ["Align region" align (region-exists-p)] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3938 "---" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3939 ["Mark clause" prolog-mark-clause t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3940 ["Mark predicate" prolog-mark-predicate t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3941 ["Mark paragraph" mark-paragraph t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3942 ;;"---" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3943 ;;["Fontify buffer" font-lock-fontify-buffer t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3944 )) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3945 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3946 (defun prolog-menu () |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3947 "Add the menus for the Prolog editing buffers." |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3948 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3949 (easy-menu-add prolog-edit-menu-insert-move) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3950 (easy-menu-add prolog-edit-menu-runtime) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3951 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3952 ;; Add predicate index menu |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3953 (set (make-local-variable 'imenu-create-index-function) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3954 'imenu-default-create-index-function) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3955 ;;Milan (this has problems with object methods...) ###### Does it? (Stefan) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3956 (setq imenu-prev-index-position-function 'prolog-beginning-of-predicate) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3957 (setq imenu-extract-index-name-function 'prolog-get-predspec) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3958 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3959 (if (and prolog-imenu-flag |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3960 (< (count-lines (point-min) (point-max)) prolog-imenu-max-lines)) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
3961 (imenu-add-to-menubar "Predicates")) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3962 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3963 (easy-menu-add prolog-menu-help)) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3964 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3965 (easy-menu-define |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3966 prolog-inferior-menu-all prolog-inferior-mode-map |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3967 "Menu for the inferior Prolog buffer." |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3968 `("Prolog" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3969 ;; Runtime menu name. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3970 ,@(unless (featurep 'xemacs) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3971 '(:label (cond ((eq prolog-system 'eclipse) "ECLiPSe") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3972 ((eq prolog-system 'mercury) "Mercury") |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3973 (t "Prolog")))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3974 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3975 ;; Debug items, NIL for Mercury. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3976 ,(if (featurep 'xemacs) "---" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3977 ["---" nil :included (not (eq prolog-system 'mercury))]) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3978 ;; FIXME: Could we use toggle or radio buttons? --Stef |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3979 ["Debug" prolog-debug-on :included (not (eq prolog-system 'mercury))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3980 ["Debug off" prolog-debug-off |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3981 ;; In SICStus, these are pairwise disjunctive, |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3982 ;; so it's enough with a single "off"-command |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3983 :included (not (memq prolog-system '(mercury sicstus)))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3984 ["Trace" prolog-trace-on :included (not (eq prolog-system 'mercury))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3985 ["Trace off" prolog-trace-off |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3986 :included (not (memq prolog-system '(mercury sicstus)))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3987 ["Zip" prolog-zip-on :included (and (eq prolog-system 'sicstus) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3988 (prolog-atleast-version '(3 . 7)))] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3989 ["All debug off" prolog-debug-off |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3990 :included (eq prolog-system 'sicstus)] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3991 ["Source level debugging" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3992 prolog-toggle-sicstus-sd |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3993 :included (and (eq prolog-system 'sicstus) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3994 (prolog-atleast-version '(3 . 7))) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3995 :style toggle |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3996 :selected prolog-use-sicstus-sd] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3997 |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3998 ;; Runtime. |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
3999 "---" |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
4000 ["Interrupt Prolog" comint-interrupt-subjob t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
4001 ["Quit Prolog" comint-quit-subjob t] |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
4002 ["Kill Prolog" comint-kill-subjob t])) |
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
4003 |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
4004 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
4005 (defun prolog-inferior-menu () |
112190
0bfc36865094
* lisp/progmodes/prolog.el: Fix up coding conventions and such.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112189
diff
changeset
|
4006 "Create the menus for the Prolog inferior buffer. |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
4007 This menu is dynamically created because one may change systems during |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
4008 the life of an Emacs session." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
4009 (easy-menu-add prolog-inferior-menu-all) |
112210
43d75ad47207
* lisp/progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
112190
diff
changeset
|
4010 (easy-menu-add prolog-menu-help)) |
112189
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
4011 |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
4012 (defun prolog-mode-version () |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
4013 "Echo the current version of Prolog mode in the minibuffer." |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
4014 (interactive) |
b8f8e953d12f
* lisp/progmodes/prolog.el: Replace by a whole new file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111870
diff
changeset
|
4015 (message "Using Prolog mode version %s" prolog-mode-version)) |
72684
f65ec4fd2be1
Remove * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68773
diff
changeset
|
4016 |
18383 | 4017 (provide 'prolog) |
4018 | |
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
258
diff
changeset
|
4019 ;;; prolog.el ends here |