[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sweeprolog c59ead20f7 075/166: ENHANCED: redirect Prolog m
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sweeprolog c59ead20f7 075/166: ENHANCED: redirect Prolog messages to Emacs message function |
Date: |
Fri, 30 Sep 2022 04:59:27 -0400 (EDT) |
branch: elpa/sweeprolog
commit c59ead20f772c58b34f65e6ee8f7670165b478cc
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>
ENHANCED: redirect Prolog messages to Emacs message function
---
README.org | 3 +--
sweep.el | 24 +++++++++++++++++++++++-
sweep.pl | 19 +++++++++++++++++++
3 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/README.org b/README.org
index 2808819cba..e9d9cea09b 100644
--- a/README.org
+++ b/README.org
@@ -6,7 +6,7 @@
#+startup: content indent
#+export_file_name: sweep.texi
#+texinfo_filename: sweep.info
-#+texinfo_dir_category: Prolog
+#+texinfo_dir_category: Emacs
#+texinfo_dir_title: Sweep: (sweep)
#+texinfo_dir_desc: SWI-Prolog Embedded in Emacs
#+texinfo_header: @set MAINTAINERSITE
@uref{https://eshelyaron.com,maintainer webpage}
@@ -330,7 +330,6 @@ This enables the many commands that the =xref= interface
provides, like
[[info:emacs#Find Identifiers][Find Identifiers in the Emacs manual]] for an
overview of the available
commands.
-
* The Prolog top-level
:PROPERTIES:
:CUSTOM_ID: prolog-top-level
diff --git a/sweep.el b/sweep.el
index 9304d2b6d4..1fa56f7970 100644
--- a/sweep.el
+++ b/sweep.el
@@ -107,6 +107,28 @@
(require 'sweep-module))
(error "Sweep will not work until `sweep-module' is compiled!"))))
+
+(defvar sweep-messages-buffer nil)
+
+(defun sweep-setup-message-hook ()
+ (with-current-buffer
+ (setq sweep-messages-buffer (get-buffer-create "*sweep-messages*"))
+ (compilation-minor-mode))
+ (sweep-open-query "user"
+ "sweep"
+ "sweep_setup_message_hook"
+ nil)
+ (let ((sol (sweep-next-solution)))
+ (sweep-close-query)
+ sol))
+
+(defun sweep-message (message)
+ (with-current-buffer sweep-messages-buffer
+ (save-excursion
+ (goto-char (point-max))
+ (insert message)
+ (newline))))
+
(defun sweep-start-prolog-server ()
(sweep-open-query "user"
"prolog_server"
@@ -122,9 +144,9 @@
(cons (expand-file-name "bin/swipl" (file-name-directory
load-file-name))
(cons "-q" (cons "--no-signals" sweep-init-args))))
+ (sweep-setup-message-hook)
(sweep-start-prolog-server))
-
(defvar sweep-predicate-completion-collection nil)
(defvar-local sweep-buffer-module "user")
diff --git a/sweep.pl b/sweep.pl
index 823f6e5f99..7b97502b38 100644
--- a/sweep.pl
+++ b/sweep.pl
@@ -33,6 +33,7 @@
:- module(sweep,
[ sweep_colourise_buffer/2,
sweep_colourise_some_terms/2,
+ sweep_setup_message_hook/2,
sweep_documentation/2,
sweep_identifier_at_point/2,
sweep_expand_file_name/2,
@@ -583,3 +584,21 @@ sweep_path_module(Path0, Module) :-
atom_string(Path, Path0),
xref_module(Path, Module0),
atom_string(Module0, Module).
+
+
+sweep_setup_message_hook(_, _) :-
+ retractall(user:thread_message_hook(_, _, _)),
+ asserta((
+ user:thread_message_hook(Term, Kind, Lines) :-
+ sweep_message_hook(Term, Kind, Lines)
+ )).
+
+sweep_message_hook(Term, Kind, _Lines) :-
+ should_handle_message_kind(Kind),
+ !,
+ message_to_string(Term, String),
+ sweep_funcall("sweep-message", String, _).
+
+should_handle_message_kind(error).
+should_handle_message_kind(warning).
+should_handle_message_kind(debug(_)).
- [nongnu] elpa/sweeprolog 66ac977deb 045/166: Make use of the new SWI-Prolog embedded GMP handling..., (continued)
- [nongnu] elpa/sweeprolog 66ac977deb 045/166: Make use of the new SWI-Prolog embedded GMP handling..., ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 8f1275f113 044/166: Remove the swipl-devel git submodule, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 5dcdec144d 052/166: PORT: use swipl --dump-runtime-variables to locate SWI-Prolog.h, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog b24f66da61 051/166: Add licensing information, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 43e5cdaf91 054/166: ADDED: global keymap sweep-prefix-map, not bound by default, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 239e205add 059/166: ADDED: sweep-mode, a major mode for editing Prolog code, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog d226bbb70c 063/166: ENHANCED: set per buffer module name in sweep-mode, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog d974b0fe0a 071/166: ADDED: prepare xref backend, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 27c441ab49 068/166: PORT: don't rely on defvar-keymap available only since Emacs 29, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 0b054bac88 072/166: ENHANCED: better detection of the identifier at point, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog c59ead20f7 075/166: ENHANCED: redirect Prolog messages to Emacs message function,
ELPA Syncer <=
- [nongnu] elpa/sweeprolog 031c07ac93 076/166: DOC: document the Prolog messages buffer, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 8ac0e7afb9 065/166: ENHANCED: also complete predicate names from xref, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 85ca3a5dc2 067/166: FIXED: bind SourceId in xref based completions, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 21a4475306 112/166: Makefile: Allow specifying the path to emacs, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog ec01154a41 102/166: PORT: sweep.el: require Emacs version 28 for RTLD_GLOBAL, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog e991b1a92c 097/166: ENHANCED: (sweep-load-buffer): use read-buffer to choose a buffer, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog c69c6bad3c 084/166: FIXED: correctly identify the predicate defined at start of clause, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 586521712e 110/166: DOC: README.org: add ^:{} option, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 0b545cc192 114/166: ADDED: (sweep-indent-line-ends-with-prefix-operator): New function, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog c60df8e7e3 101/166: DOC: Loading buffers: new section, ELPA Syncer, 2022/09/30