[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/ediprolog e75c0ddfc4 30/31: Merge Jun 8 2020 commit '7511
From: |
Stefan Monnier |
Subject: |
[elpa] scratch/ediprolog e75c0ddfc4 30/31: Merge Jun 8 2020 commit '751119cfee9' into externals/ediprolog |
Date: |
Sun, 2 Oct 2022 17:01:39 -0400 (EDT) |
branch: scratch/ediprolog
commit e75c0ddfc47f968a4e227f83421abc963287ad12
Merge: 3fa2be14ea 751119cfee
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Merge Jun 8 2020 commit '751119cfee9' into externals/ediprolog
This seems to be the commit in the upstream repository that most closely
matches the commit in the elpa.git.
---
README.md | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ediprolog.el | 4 +--
factorial.png | Bin 0 -> 60804 bytes
3 files changed, 103 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000000..406a356fd1
--- /dev/null
+++ b/README.md
@@ -0,0 +1,101 @@
+# Introduction
+
+*ediprolog* lets you interact with Prolog in all Emacs buffers.
+You can consult Prolog programs and evaluate embedded queries.
+
+**Project page**:
+
+[**https://www.metalevel.at/ediprolog/**](https://www.metalevel.at/ediprolog/)
+
+**Video**:
+
+[https://www.metalevel.at/prolog/videos/ediprolog](https://www.metalevel.at/prolog/videos/ediprolog)
+
+See also [PceProlog](https://www.metalevel.at/pceprolog/).
+
+# Installation
+
+With Emacs≥24.1, the simplest way to install ediprolog is to use
+Emacs's built-in *package manager* via the key sequence:
+
+ M-x package-install RET ediprolog RET
+
+Alternatively, copy [ediprolog.el](ediprolog.el) to your `load-path`
+and add the following form to your `.emacs`, then evaluate the form or
+restart Emacs:
+
+ (require 'ediprolog)
+
+After you have installed ediprolog, you can customize it with:
+
+ M-x customize-group RET ediprolog RET
+
+The two most important configuration options are:
+
+ - `ediprolog-system`, either `scryer` or `swi`
+ - `ediprolog-program`, the path of the Prolog executable.
+
+# Usage
+
+The central function is `ediprolog-dwim` (Do What I Mean). I recommend
+to bind it to the function key F10 by adding the following
+form to your `.emacs` and evaluating it:
+
+ (global-set-key [f10] 'ediprolog-dwim)
+
+In the following, I assume that you have also done this.
+
+Depending on the content at point, `ediprolog-dwim` does the
+"appropriate" thing: If point is on a *query*, it sends the query to a
+Prolog process, and you interact with the process in the current
+buffer as on a terminal. Queries start with "?-" or ":-", possibly
+preceded by "%" and whitespace. An example of a query is:
+
+ %?- member(X, [a,b,c]).
+
+If you press F10 when point is on that query, you get:
+
+ %?- member(X, [a,b,c]).
+ %@ X = a
+ %@ ; X = b
+ %@ ; X = c
+ %@ ; false.
+
+When waiting for output of the Prolog process, you can press C-g to
+unblock Emacs and continue with other work. To resume interaction
+with the Prolog process, use **M-x ediprolog-toplevel RET**.
+
+If you press F10 when point is *not* on a query, the buffer content is
+consulted in the Prolog process, and point is moved to the first error
+(if any). You do *not* need to *save* the file beforehand, since
+the *buffer content* (not the file) is consulted.
+
+For convenience, the most recent interactions with the Prolog
+process are logged in the buffer `*ediprolog-history*`.
+
+Use **M-x ediprolog-localize RET** to make any Prolog process started
+in the current buffer buffer-local. This way, you can run distinct
+processes simultaneously. Revert with
+**M-x ediprolog-unlocalize RET**.
+
+`ediprolog-dwim` with prefix arguments has special meanings:
+
+| Key Sequence | Meaning |
+|--------------|----------------------------------------------------------|
+| C-0 F10 | kill Prolog process |
+| C-1 F10 | always consult buffer (even when point is on a query) |
+| C-2 F10 | always consult buffer, using a new process |
+| C-7 F10 | equivalent to `ediprolog-toplevel' |
+| C-u F10 | first consult buffer, then evaluate query (if any) |
+| C-u C-u F10 | like C-u F10, with a new process |
+
+Tested with Scryer Prolog 0.8.119 and SWI-Prolog 8.1.24, using Emacs
+versions 26.1 and 27.0.50.
+
+# Screenshot
+
+Here is a sample interaction, using
+[CLP(FD) constraints](https://www.metalevel.at/prolog/clpfd) to
+relate a number to its factorial:
+
+![Factorial](factorial.png)
diff --git a/ediprolog.el b/ediprolog.el
index d88d30e80c..503643ddab 100644
--- a/ediprolog.el
+++ b/ediprolog.el
@@ -1,6 +1,6 @@
;;; ediprolog.el --- Emacs Does Interactive Prolog
-;; Copyright (C) 2006-2009, 2012-2013, 2016-2017, 2020 Free Software
Foundation, Inc.
+;; Copyright (C) 2006-2022 Free Software Foundation, Inc.
;; Author: Markus Triska <triska@metalevel.at>
;; Keywords: languages, processes
@@ -69,7 +69,7 @@
;; If you press F10 when point is *not* on a query, the buffer content
;; is consulted in the Prolog process, and point is moved to the first
-;; error (if any). In transient mark mode, if the region is active,
+;; error (if any). In transient mark mode, if the region is active,
;; only the text in the region is consulted.
;; For convenience, the most recent interactions with the Prolog
diff --git a/factorial.png b/factorial.png
new file mode 100644
index 0000000000..b85c8c0f05
Binary files /dev/null and b/factorial.png differ
- [elpa] scratch/ediprolog 49679a0c44 28/31: use library(clpz) and Scryer Prolog interaction in screenshot, (continued)
- [elpa] scratch/ediprolog 49679a0c44 28/31: use library(clpz) and Scryer Prolog interaction in screenshot, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog 62ce0025b8 27/31: use compact string notation in sample queries, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog 29a8c4a796 03/31: wording for README, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog 277d0f9e72 05/31: add screenshot, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog ade75de9ae 07/31: table formatting, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog 51a610ebc2 08/31: formatting and layout of Emacs commands, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog 1c8b127701 02/31: initial revision, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog f1b2480f46 12/31: preparing version 1.2, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog 2b348c3161 15/31: describe screenshot, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog 9c4c80ad4a 21/31: improve compatibility with older Emacs versions, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog e75c0ddfc4 30/31: Merge Jun 8 2020 commit '751119cfee9' into externals/ediprolog,
Stefan Monnier <=
- [elpa] scratch/ediprolog 751119cfee 22/31: update Scryer Prolog answer, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog 8ba8786386 18/31: clarify installation, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog 5fd08fe19a 23/31: improve compatibility with older Emacs versions, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog ebd79c0abd 26/31: enable faithful processing of multiline queries for Scryer Prolog, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog 6f94bf2368 19/31: add link to video, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog 8b554e63aa 24/31: document Scryer Prolog default setting, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog 4b265d2fb5 09/31: add a note distinguishing buffer content and file, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog 3f8ab3eea0 10/31: wording, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog dc0e51ba57 29/31: ediprolog 2.2: support newer Scryer Prolog versions, and smaller improvements, Stefan Monnier, 2022/10/02
- [elpa] scratch/ediprolog 34f7aa545c 04/31: transition to markdown, Stefan Monnier, 2022/10/02