]> git.eshelyaron.com Git - sweep.git/log
sweep.git
13 months agoImprove top-level input fontification
Eshel Yaron [Sat, 16 Sep 2023 20:28:02 +0000 (22:28 +0200)]
Improve top-level input fontification

13 months agoImprove top-level threads management and cleanup
Eshel Yaron [Sat, 16 Sep 2023 18:50:47 +0000 (20:50 +0200)]
Improve top-level threads management and cleanup

* sweep.pl (sweep_top_level_thread_buffer/2): Remove predicate.
(sweep_top_level_threads/2): Remove in favor of...
(sweep_list_threads/2): New predicate.
(sweep_accept_top_level_client/2)
(sweep_top_level_start_pty/2): Return new thread id.
(sweep_cleanup_threads/0,2)
(sweep_create_thread/2,3)
(sweep_thread_start/0)
(sweep_thread_at_exit/0)
(sweep_supervisor_start/1)
(sweep_supervisor_loop/1)
(sweep_kill_thread/2)
(sweep_cleanup_thread/1): New predicates.

* sweeprolog.el (sweeprolog-init): Arrange for Sweep to shutdown
gracefully when Emacs is killed.
(sweeprolog-maybe-kill-top-levels)
(sweeprolog-maybe-shutdown)
(sweeprolog-shutdown)
(sweeprolog-top-level-maybe-delete-process)
(sweeprolog-top-level-delete-process): New functions.
(sweeprolog-restart)
(sweeprolog-top-level-buffer): Adapt.
(sweeprolog-top-level--populate-thread-id): Remove function.

13 months agoCheck that top-level thread is alive when signaling it
Eshel Yaron [Fri, 15 Sep 2023 08:08:04 +0000 (10:08 +0200)]
Check that top-level thread is alive when signaling it

* sweeprolog.el (sweeprolog-top-level-signal-current): Delete stale
pty "process" when trying to signal a top-level thread that has
already exited.

13 months ago; Don't refuse to kill top-level buffer with deleted process
Eshel Yaron [Thu, 14 Sep 2023 20:48:30 +0000 (22:48 +0200)]
; Don't refuse to kill top-level buffer with deleted process

13 months ago; Fix error on Emacs 27 with no 'font-lock-keywords'
Eshel Yaron [Thu, 14 Sep 2023 20:47:07 +0000 (22:47 +0200)]
; Fix error on Emacs 27 with no 'font-lock-keywords'

13 months agoENHANCED: Support pty top-level communication instead of TCP
Eshel Yaron [Thu, 14 Sep 2023 16:28:16 +0000 (18:28 +0200)]
ENHANCED: Support pty top-level communication instead of TCP

Add the ability for top-level buffers to communicate with their
backing threads via pty instead of a local TCP connection.  This is
controlled by a new user option, enabled by default on systems where
Emacs can creates a pty.

* sweep.pl (sweep_top_level_start_pty/2): New predicate.
* sweeprolog.el (sweeprolog-top-level-use-pty): New user option.
(sweeprolog-top-level-buffer): Use it.
* sweep.texi (The Prolog Top-level): Document it.

13 months agoProvide basic 'prettify-symbols-alist' in Sweep Prolog mode
Eshel Yaron [Thu, 14 Sep 2023 16:23:48 +0000 (18:23 +0200)]
Provide basic 'prettify-symbols-alist' in Sweep Prolog mode

* sweeprolog.el (sweeprolog-mode): set a local value for
'prettify-symbols-alist' that renders the neck operator as a unicode
left arrow.

13 months agoSupport Prettify Symbols and similar minor modes
Eshel Yaron [Thu, 14 Sep 2023 16:20:33 +0000 (18:20 +0200)]
Support Prettify Symbols and similar minor modes

* sweeprolog.el (sweeprolog-analyze-some-terms): Call
'font-lock-fontify-keywords-region' to support minor modes that
rely on 'font-lock-keywords'.

13 months ago; * sweeprolog.el (sweeprolog-hole): Avoid increasing text size
Eshel Yaron [Thu, 14 Sep 2023 16:18:19 +0000 (18:18 +0200)]
; * sweeprolog.el (sweeprolog-hole): Avoid increasing text size

14 months ago; * sweep.texi (Extract Goal): Improve indexing
Eshel Yaron [Sat, 9 Sep 2023 14:36:55 +0000 (16:36 +0200)]
; * sweep.texi (Extract Goal): Improve indexing

14 months agoAnnounce recent changes in NEWS.org and bump version to 0.24.1 V9.1.15-sweep-0.24.1
Eshel Yaron [Sat, 9 Sep 2023 07:57:31 +0000 (09:57 +0200)]
Announce recent changes in NEWS.org and bump version to 0.24.1

14 months agoOnly extract goals to separate predicates, not data terms
Eshel Yaron [Sat, 9 Sep 2023 07:32:38 +0000 (09:32 +0200)]
Only extract goals to separate predicates, not data terms

* sweeprolog.el (sweeprolog-context-menu-for-region)
(sweeprolog-maybe-extract-region-to-predicate): Check that the region
starts in a callable position.
(sweeprolog-extract-region-to-predicate): Reanalyze the buffer as a
last step.
* sweep.texi: Adjust.

14 months agoOnly enable right-click actions on region when click is in region
Eshel Yaron [Fri, 8 Sep 2023 20:29:06 +0000 (22:29 +0200)]
Only enable right-click actions on region when click is in region

* sweeprolog.el (sweeprolog-context-menu-region-beg-at-click)
(sweeprolog-context-menu-region-end-at-click): New variables.
(sweeprolog-context-menu-function): Let-bind them.
(sweeprolog-context-menu-for-region): Use them to reliably check that
click is actually inside the selected region.

14 months ago; * sweep.texi: Minor improvements
Eshel Yaron [Fri, 8 Sep 2023 19:57:41 +0000 (21:57 +0200)]
; * sweep.texi: Minor improvements

14 months ago; * sweep.texi (Extract Goal): Fix typos
Eshel Yaron [Fri, 8 Sep 2023 17:54:17 +0000 (19:54 +0200)]
; * sweep.texi (Extract Goal): Fix typos

14 months ago; * sweep.texi: Update menus
Eshel Yaron [Fri, 8 Sep 2023 17:45:59 +0000 (19:45 +0200)]
; * sweep.texi: Update menus

14 months agoAnnounce recent changes in NEWS.org and bump version to 0.24.0 V9.1.15-sweep-0.24.0
Eshel Yaron [Fri, 8 Sep 2023 17:35:34 +0000 (19:35 +0200)]
Announce recent changes in NEWS.org and bump version to 0.24.0

14 months agoADDED: New command 'sweeprolog-extract-region-to-predicate'
Eshel Yaron [Fri, 8 Sep 2023 17:25:44 +0000 (19:25 +0200)]
ADDED: New command 'sweeprolog-extract-region-to-predicate'

Add a command for extracting a part of a clause body into a separate
predicate.

* sweep.pl (sweep_term_variable_names/2)
(sweep_goal_may_cut/2): New helper predicates.
* sweeprolog.el (sweeprolog-extract-region-to-predicate): New command.
(sweeprolog-maybe-extract-region-to-predicate): New function.
(sweeprolog-insert-term-functions): Add it.
* sweep.texi (Insert Term DWIM, Extract Goal): Document it.

14 months agoCleanup 'defcustom' types and docstrings
Eshel Yaron [Mon, 4 Sep 2023 11:58:26 +0000 (13:58 +0200)]
Cleanup 'defcustom' types and docstrings

* sweeprolog.el (sweeprolog-swipl-sources)
(sweeprolog-module-header-comment-skeleton)
(sweeprolog-indent-offset, sweeprolog-qq-mode-alist)
(sweeprolog-enable-cycle-spacing)
(sweeprolog-analyze-buffer-on-idle)
(sweeprolog-analyze-buffer-max-size)
(sweeprolog-analyze-buffer-min-interval)
(sweeprolog-swipl-path)
(sweeprolog-messages-buffer-name)
(sweeprolog-read-flag-prompt)
(sweeprolog-read-module-prompt)
(sweeprolog-read-predicate-prompt)
(sweeprolog-read-exportable-predicate-prompt)
(sweeprolog-read-pack-prompt)
(sweeprolog-top-level-display-action)
(sweeprolog-top-level-min-history-length)
(sweeprolog-init-args)
(sweeprolog-enable-flymake)
(sweeprolog-note-implicit-autoloads)
(sweeprolog-enable-eldoc)
(sweeprolog-enable-cursor-sensor)
(sweeprolog-new-predicate-location-function)
(sweeprolog-top-level-signal-default-goal)
(sweeprolog-highlight-holes)
(sweeprolog-read-predicate-documentation-function)
(sweeprolog-enable-help-echo)
(sweeprolog-rename-variable-allow-existing)
(sweeprolog-dependency-directive)
(sweeprolog-highlight-breakpoints)
(sweeprolog-top-level-persistent-history): Minor docstring and ':type'
touch ups.
(sweeprolog-init-on-load): Remove obsolete option.
(sweeprolog-libswipl-path): Remove unused option.
(sweeprolog-menu)
(sweeprolog-start-prolog-server)
(sweeprolog-message)
(sweeprolog-top-level-menu-kill)
(sweeprolog-top-level-menu-go-to)
(sweeprolog-top-level-menu-mode): Minor docstring improvements.
(sweeprolog-submit-bug-report): Stop including
'sweeprolog-libswipl-path' in bug reports.

14 months agoAdd included copy of 'emacs-module.h' to '.elpaignore'
Eshel Yaron [Sun, 3 Sep 2023 09:46:37 +0000 (11:46 +0200)]
Add included copy of 'emacs-module.h' to '.elpaignore'

14 months agoPORT: MSVC V9.1.15 V9.1.16 V9.1.17 V9.1.18
Jan Wielemaker [Fri, 1 Sep 2023 15:57:19 +0000 (17:57 +0200)]
PORT: MSVC

Need to get DLL linkage correct.  This also requires a change in
SWI-Prolog.h

14 months agoPORT: Include local copy of emacs-module.h in case this is not provided.
Jan Wielemaker [Fri, 1 Sep 2023 15:28:18 +0000 (17:28 +0200)]
PORT: Include local copy of emacs-module.h in case this is not provided.

14 months agoDelete README.org (superseded by sweep.texi and README.md)
Eshel Yaron [Thu, 31 Aug 2023 11:10:54 +0000 (13:10 +0200)]
Delete README.org (superseded by sweep.texi and README.md)

14 months ago* .elpaignore: Exclude more files from package tarball
Eshel Yaron [Thu, 31 Aug 2023 11:05:12 +0000 (13:05 +0200)]
* .elpaignore: Exclude more files from package tarball

14 months agoDelete unused .gitmodules file
Eshel Yaron [Thu, 31 Aug 2023 11:04:37 +0000 (13:04 +0200)]
Delete unused .gitmodules file

14 months ago* sweeprolog.el: Update commentary.
Eshel Yaron [Thu, 31 Aug 2023 11:03:50 +0000 (13:03 +0200)]
* sweeprolog.el: Update commentary.

14 months agoAdd a small README file in Markdown format
Eshel Yaron [Thu, 31 Aug 2023 11:02:15 +0000 (13:02 +0200)]
Add a small README file in Markdown format

* README.md: New file.

14 months agoAnnounce recent changes in NEWS.org and bump version to 0.23.1 V9.1.14-sweep-0.23.1
Eshel Yaron [Wed, 30 Aug 2023 20:28:50 +0000 (22:28 +0200)]
Announce recent changes in NEWS.org and bump version to 0.23.1

14 months ago* sweep.texi (Main Features): Refine main features table
Eshel Yaron [Wed, 30 Aug 2023 19:11:12 +0000 (21:11 +0200)]
* sweep.texi (Main Features): Refine main features table

14 months ago* sweep.texi: Minor markup fixes
Eshel Yaron [Wed, 30 Aug 2023 17:58:28 +0000 (19:58 +0200)]
* sweep.texi: Minor markup fixes

14 months agoRewrite the manual in Texinfo format
Eshel Yaron [Mon, 28 Aug 2023 18:26:39 +0000 (20:26 +0200)]
Rewrite the manual in Texinfo format

* sweep.texi: New file.
* sweep.pl (sweep_match_term/6): Demote expections in user supplied
goal to failure.
* sweeprolog.el (sweeprolog-messages-buffer-name)
(sweeprolog-top-level-mode): Capitalize "Sweep".

14 months agoPrefer plain "Sweep" over "\texttt{sweep}"
Eshel Yaron [Mon, 21 Aug 2023 18:05:22 +0000 (20:05 +0200)]
Prefer plain "Sweep" over "\texttt{sweep}"

* sweep.doc: Say "Sweep" instead of "\texttt{sweep}".

14 months agoRefine "Getting Started" section of the manual
Eshel Yaron [Mon, 21 Aug 2023 17:56:06 +0000 (19:56 +0200)]
Refine "Getting Started" section of the manual

* README.org (Getting Started): Refine.
* sweep.doc (Installation, Getting Started): Update.

14 months agoRespect PROMPT argument in 'sweeprolog-read-existing-variable'
Eshel Yaron [Sun, 20 Aug 2023 07:39:21 +0000 (09:39 +0200)]
Respect PROMPT argument in 'sweeprolog-read-existing-variable'

This fixes an omission from the recent Compat integration.

* sweeprolog.el (sweeprolog-read-existing-variable): Use PROMPT.

14 months agoAnnounce Compat dependency and bump version to 0.23.0 V9.1.14-sweep-0.23.0
Eshel Yaron [Thu, 17 Aug 2023 21:47:35 +0000 (23:47 +0200)]
Announce Compat dependency and bump version to 0.23.0

* NEWS.org (Version 0.23.0 on 2023-08-18): New entry.
* README.org (Installation): Reword.
* sweeprolog.el: Bump minor version.

14 months agoRemove compatibility functions for buttonizing text.
Eshel Yaron [Thu, 17 Aug 2023 21:41:39 +0000 (23:41 +0200)]
Remove compatibility functions for buttonizing text.

* sweeprolog.el (sweeprolog-render-html-span)
(sweeprolog-render-html-a)
(sweeprolog--describe-module)
(sweeprolog--describe-predicate): Use 'buttonize' and
'buttonize-region' instead of...
(sweeprolog--buttonize, sweeprolog--buttonize-region): Removed.

14 months agoUse 'without-restriction'.
Eshel Yaron [Thu, 17 Aug 2023 21:39:58 +0000 (23:39 +0200)]
Use 'without-restriction'.

* sweeprolog.el (sweeprolog-analyze-buffer)
(sweeprolog--buffer-string)
(sweeprolog-export-predicate): Use 'without-restriction' instead of
'save-restriction' and 'widen'.

14 months agoPrefer 'pos-bol/eol' over 'line-beginning/end-position'.
Eshel Yaron [Thu, 17 Aug 2023 21:38:08 +0000 (23:38 +0200)]
Prefer 'pos-bol/eol' over 'line-beginning/end-position'.

* sweeprolog.el (sweeprolog--quoted-atom-or-functor-completion-at-point):
(sweeprolog-end-of-top-term)
(sweeprolog-export-predicate)
(sweeprolog-align-spaces)
(sweeprolog-infer-indent-style)
(sweeprolog-indent-line-after-infix)
(sweeprolog-create-index-function): Use 'pos-bol/eol' instead of
'line-beginning/end-position'.

14 months agoUse 'format-prompt'.
Eshel Yaron [Thu, 17 Aug 2023 21:36:08 +0000 (23:36 +0200)]
Use 'format-prompt'.

* sweeprolog.el (sweeprolog-read-predicate)
(sweeprolog-plunit-testset-skeleton)
(sweeprolog-read-existing-variable)
(sweeprolog-read-breakpoint): Use 'format-prompt' instead of manual
prompt formatting.

14 months agoUse 'process-lines-handling-status'.
Eshel Yaron [Thu, 17 Aug 2023 21:33:46 +0000 (23:33 +0200)]
Use 'process-lines-handling-status'.

* sweeprolog.el (sweeprolog--ensure-module): Use
'process-lines-handling-status' instead of 'split-string'-based
approach.

14 months agoUse 'defvar-keymap' to define keymap variables.
Eshel Yaron [Thu, 17 Aug 2023 21:30:47 +0000 (23:30 +0200)]
Use 'defvar-keymap' to define keymap variables.

* sweeprolog.el (sweeprolog-mode-map)
(sweeprolog-forward-hole-repeat-map)
(sweeprolog-top-level-mode-map)
(sweeprolog-top-level-menu-mode-map)
(sweeprolog-help-prefix-map)
(sweeprolog-prefix-map)
(sweeprolog-forward-hole-on-tab-mode-map)
(sweeprolog-top-level-example-mode-map)
(sweeprolog-term-search-map)
(sweeprolog-read-term-map)
(sweeprolog-read-goal-map): Convert to 'defvar-keymap'.

14 months agoUse 'natnum' custom type
Eshel Yaron [Thu, 17 Aug 2023 21:28:45 +0000 (23:28 +0200)]
Use 'natnum' custom type

* sweeprolog.el (sweeprolog-indent-offset):
(sweeprolog-analyze-buffer-max-size):
(sweeprolog-pack-description-max-width): Update type to 'natnum'.

14 months ago* sweeprolog.el: Require 'compat'
Eshel Yaron [Thu, 17 Aug 2023 21:25:58 +0000 (23:25 +0200)]
* sweeprolog.el: Require 'compat'

Add a dependency on the GNU ELPA compatibility package Compat.

14 months agoAnnounce recent changes in NEWS.org and bump version to 0.22.2 V9.1.14-sweep-0.22.2
Eshel Yaron [Mon, 14 Aug 2023 18:09:57 +0000 (20:09 +0200)]
Announce recent changes in NEWS.org and bump version to 0.22.2

14 months agoWorkaround issue with Xwidgets and XPCE in older SWI-Prolog
Eshel Yaron [Mon, 14 Aug 2023 17:54:50 +0000 (19:54 +0200)]
Workaround issue with Xwidgets and XPCE in older SWI-Prolog

* sweeprolog.el (sweeprolog-init-args): Disable XPCE if Emacs is built
with Xwidgets and SWI-Prolog version is earlier then 9.1.14.

* README.org (Prolog Initialization and Cleanup): Reword
'sweeprolog-init-args' documentation.

15 months agoPORT: Explicitly export the symbols we need V9.1.14
Jan Wielemaker [Fri, 11 Aug 2023 09:33:14 +0000 (11:33 +0200)]
PORT: Explicitly export the symbols we need

By default, plugins are now compiled with hidden visibility for
internal symbols.

15 months agoMinor documentation improvements
Eshel Yaron [Tue, 8 Aug 2023 18:30:45 +0000 (21:30 +0300)]
Minor documentation improvements

* README.org: Prefer present over future tense, extend and reword.

15 months agoFix feedback in 'sweeprolog-set-prolog-flag'
Eshel Yaron [Tue, 8 Aug 2023 18:29:35 +0000 (21:29 +0300)]
Fix feedback in 'sweeprolog-set-prolog-flag'

Similarly to the previous fix for 'sweeprolog-pack-install', this
makes 'sweeprolog-set-prolog-flag' actually report its result, instead
of reporting failure even when successful.

* sweep.pl (sweep_set_prolog_flag/2): Bind the output argument to
non-nil on success.

15 months ago* README.org: Fix typos
Eshel Yaron [Mon, 7 Aug 2023 18:06:31 +0000 (21:06 +0300)]
* README.org: Fix typos

15 months agoDocumentation improvements for 'sweeprolog-prefix-map'
Eshel Yaron [Mon, 7 Aug 2023 17:55:57 +0000 (20:55 +0300)]
Documentation improvements for 'sweeprolog-prefix-map'

* sweeprolog.el (sweeprolog-prefix-map): Move binding for
'sweeprolog-view-messages' to...
(sweeprolog-help-prefix-map): ...here.  Also bind
'sweeprolog-view-news'.

* README.org (Discovering Sweep): Document 'sweeprolog-view-news'.
(Quick access to Sweep commands): Update.
(Examining Prolog messages): Reword.
(Installing Prolog Packages): Capitalize.

15 months agoFix feedback in 'sweeprolog-pack-install'
Eshel Yaron [Mon, 7 Aug 2023 15:48:48 +0000 (18:48 +0300)]
Fix feedback in 'sweeprolog-pack-install'

Have 'sweeprolog-pack-install' actually report its result, instead of
reporting failure even when successful.

* sweep.pl (sweep_pack_install/2): Bind the output argument to non-nil
on success.
* sweeprolog.el (sweeprolog-pack-description-max-width): New user
option.
(sweeprolog-read-pack-name): Use display text properties for alignment
instead of repeated spaces.

15 months agoAnnounce recent changes in NEWS.org and bump version to 0.22.1 V9.1.13-sweep-0.22.1
Eshel Yaron [Mon, 7 Aug 2023 12:43:53 +0000 (15:43 +0300)]
Announce recent changes in NEWS.org and bump version to 0.22.1

* sweeprolog.el: Bump patch version.
* NEWS.org (Version 0.22.1 on 2023-08-07): New section.

15 months agoAdd missing 'sweeprolog-submit-bug-report' command
Eshel Yaron [Mon, 7 Aug 2023 12:35:53 +0000 (15:35 +0300)]
Add missing 'sweeprolog-submit-bug-report' command

This command has been documented since Sweep version 0.6.0 but its
implementation was unintentionally committed.  This fixes that.

* sweeprolog.el (sweeprolog-submit-bug-report): New command.
(sweeprolog-menu): Add entry for 'sweeprolog-submit-bug-report'.
* README.org (Setting up Sweep for local development): Capitalize.
(Submitting patches and bug reports): Update.

15 months agoAdd autoloaded 'defalias' for prefix keymaps
Eshel Yaron [Fri, 4 Aug 2023 18:05:05 +0000 (21:05 +0300)]
Add autoloaded 'defalias' for prefix keymaps

* sweeprolog.el (sweeprolog-prefix-map)
(sweeprolog-help-prefix-map): New 'defalias' for respective keymaps.

* README.org (Quick Access Keymap): Adapt.

15 months agoDo not autoload keymaps
Philip Kaludercic [Thu, 3 Aug 2023 19:42:55 +0000 (19:42 +0000)]
Do not autoload keymaps

When a keymap is autoloaded (and the definition is copied over to the
-autoloads.el file), and the function are sharp-quoted, Emacs can
complain about undefined symbols, especially in combination with
'package-quickstart'.

15 months agoBump version to 0.22.0 V9.1.11-sweep-0.22.0
Eshel Yaron [Thu, 20 Jul 2023 10:17:16 +0000 (13:17 +0300)]
Bump version to 0.22.0

15 months ago; Use 'sweeprolog-deftest' more widely to isolate unit tests
Eshel Yaron [Wed, 19 Jul 2023 12:40:20 +0000 (15:40 +0300)]
; Use 'sweeprolog-deftest' more widely to isolate unit tests

15 months ago; Only load 'library(macros)' if available
Eshel Yaron [Tue, 18 Jul 2023 14:10:33 +0000 (17:10 +0300)]
; Only load 'library(macros)' if available

15 months agoRefactor and enhance 'completion-at-point' support
Eshel Yaron [Tue, 18 Jul 2023 13:48:13 +0000 (16:48 +0300)]
Refactor and enhance 'completion-at-point' support

Replace 'sweeprolog-completion-at-point-functions' with a single
function 'sweeprolog-completion-at-point' that implements a much more
refined context-sensitive decision tree to determine what kind of
completion to perform.

15 months ago; Fix typo
Eshel Yaron [Tue, 18 Jul 2023 13:45:16 +0000 (16:45 +0300)]
; Fix typo

* sweeprolog.el (sweeprolog-terms-at-point): Fix typo.

15 months ago; Simplify list notation
Eshel Yaron [Tue, 18 Jul 2023 13:37:21 +0000 (16:37 +0300)]
; Simplify list notation

* sweeprolog.el (sweeprolog-module-completion-table): Simplify list
notation of completion 'metadata' list.

15 months ago; Fix unused argument
Eshel Yaron [Tue, 18 Jul 2023 13:36:04 +0000 (16:36 +0300)]
; Fix unused argument

* sweeprolog.el (sweeprolog-module-minibuffer-annotation-1): Use 'pad'
argument.

15 months ago; Remove stale reference to 'sweeprolog-debug-prefix-face'
Eshel Yaron [Tue, 18 Jul 2023 13:33:41 +0000 (16:33 +0300)]
; Remove stale reference to 'sweeprolog-debug-prefix-face'

* sweeprolog.el (sweeprolog-message): Remove stale reference to
'sweeprolog-debug-prefix-face'.

16 months agoBump version to 0.21.0 V9.1.10-sweep-0.21.0
Eshel Yaron [Tue, 27 Jun 2023 18:43:40 +0000 (21:43 +0300)]
Bump version to 0.21.0

16 months agoAdd grouping and affixation functions for module completion
Eshel Yaron [Tue, 27 Jun 2023 18:36:45 +0000 (21:36 +0300)]
Add grouping and affixation functions for module completion

This adds a 'group-function' and an 'affixation-function' to
'sweeprolog-module-completion-table', for Emacs 28+

The affixation API allows us to compute the appropriate padding to
insert before annotations in a cleaner way.  Modules are group
according to their classes.

* sweep.pl (sweep_module_class/2): New predicate.

* sweeprolog.el (sweeprolog-module-minibuffer-annotation-1):
Extract helper function from...
(sweeprolog-module-minibuffer-annotation): ...here. Adapt.
(sweeprolog-module-minibuffer-affixation)
(sweeprolog-module-minibuffer-group): New functions.
(sweeprolog-module-completion-table): Use them.

16 months agoAnnounce recent changes in NEWS.org
Eshel Yaron [Tue, 27 Jun 2023 17:34:34 +0000 (20:34 +0300)]
Announce recent changes in NEWS.org

16 months agoReport correct predicate indicators in 'C-x 4 a'
Eshel Yaron [Tue, 27 Jun 2023 17:04:46 +0000 (20:04 +0300)]
Report correct predicate indicators in 'C-x 4 a'

* sweeprolog.el (sweeprolog-add-log-current-defun): New function.
(sweeprolog-mode): Set 'add-log-current-defun-function' to it.

* sweeprolog-tests.el: Test it.

16 months agoImprove module completion annotations
Eshel Yaron [Tue, 27 Jun 2023 16:53:49 +0000 (19:53 +0300)]
Improve module completion annotations

* sweep.pl (sweep_known_module/1, sweep_is_module/2)
(sweep_module_description_/3, sweep_matching_module/3)
(sweep_module_annotation/2): New predicates.
(sweep_modules_collection/2): Adapt.

* sweeprolog.el (sweeprolog-module-completion-table)
(sweeprolog-module-p, sweeprolog-module-minibuffer-annotation)
(sweeprolog-module-annotation): New functions.
(sweeprolog-modules-collection)
(sweeprolog-read-module-name): Adapt.
(sweeprolog-find-module): Improve feedback for modules that are not
backed by files.

16 months agoFix highlighting for nonexistent Prolog flag names
Eshel Yaron [Sat, 24 Jun 2023 07:42:06 +0000 (10:42 +0300)]
Fix highlighting for nonexistent Prolog flag names

16 months ago* sweeprolog.el: Reorganizes 'defface's
Eshel Yaron [Sat, 24 Jun 2023 07:38:49 +0000 (10:38 +0300)]
* sweeprolog.el: Reorganizes 'defface's

16 months ago* sweeprolog-pce-theme.el: Reformat
Eshel Yaron [Sat, 24 Jun 2023 07:37:07 +0000 (10:37 +0300)]
* sweeprolog-pce-theme.el: Reformat

16 months ago* README.org (PceEmacs Theme): Reword and fix typo
Eshel Yaron [Sat, 24 Jun 2023 07:32:57 +0000 (10:32 +0300)]
* README.org (PceEmacs Theme): Reword and fix typo

16 months agoMODIFIED: Replace "faces styles" with a theme emulating PceEmacs
Eshel Yaron [Fri, 23 Jun 2023 08:59:18 +0000 (11:59 +0300)]
MODIFIED: Replace "faces styles" with a theme emulating PceEmacs

This adds a custom theme called 'sweeprolog-pce' that mimics the
highlighting of SWI-Prolog's built-in editor, PceEmacs.  It obsoletes
the "faces styles" feature that Sweep provided thus far.  For backward
compatibility, The user option 'sweeprolog-faces-style' is retained
and mostly still respected.

Thanks to Stefan Monnier for suggesting this approach for simplifying
Sweep's code and making it more conformant with Emacs conventions.

* sweeprolog-pce-theme.el: New file.

* sweeprolog.el: Remove 'sweeprolog-defface' macro its
'sweeprolog-*-face' functions, use plain face definitions and refer to
them directly by their names instead.  Also extend
'custom-theme-load-path' to include the new sweeprolog-pce-theme.el.

* README.org (Semantic Highlighting): Replace "Available Styles"
subsection with new subsection "PceEmacs Theme".

16 months agoRefer to font-lock face directly instead of via variable
Eshel Yaron [Thu, 22 Jun 2023 08:01:13 +0000 (11:01 +0300)]
Refer to font-lock face directly instead of via variable

* sweeprolog.el (sweeprolog-predicate-modes-doc): Avoid using
deprecated "face variable".  Thanks to Stefan Monnier for suggesting
this improvement.

16 months agoDOC: Extend the "Overview" manual section
Eshel Yaron [Tue, 20 Jun 2023 11:21:38 +0000 (14:21 +0300)]
DOC: Extend the "Overview" manual section

* README.org (Main Features)
(Comparison with Emacs's built-in Prolog mode): New subsections.

16 months agoAnnounce recent changes in NEWS.org and bump version to 0.20.0 V9.1.10-sweep-0.20.0
Eshel Yaron [Mon, 19 Jun 2023 06:01:49 +0000 (09:01 +0300)]
Announce recent changes in NEWS.org and bump version to 0.20.0

16 months agoImprove documentation for persistent top-level history
Eshel Yaron [Mon, 19 Jun 2023 05:57:08 +0000 (08:57 +0300)]
Improve documentation for persistent top-level history

16 months agoADDED: Persistent history for Sweep top-levels
Eshel Yaron [Sun, 18 Jun 2023 19:32:33 +0000 (22:32 +0300)]
ADDED: Persistent history for Sweep top-levels

This adds a new user option that controls the value of
'comint-input-ring-file-name' in Sweep top-level buffers.

* sweeprolog.el (sweeprolog-top-level-persistent-history): New user
option.
(sweeprolog-top-level-sentinel)
(sweeprolog-top-level-setup-history): New functions.
(sweeprolog-top-level-setup-buffer): Call
'sweeprolog-top-level-setup-history' when creating a new top-level
buffer.

16 months agoUse 'derived-mode-p' instead of checking 'major-mode' directly
Eshel Yaron [Sun, 18 Jun 2023 15:51:16 +0000 (18:51 +0300)]
Use 'derived-mode-p' instead of checking 'major-mode' directly

* sweeprolog.el (sweeprolog-restart, sweeprolog-top-level-buffer)
(sweeprolog-top-level, sweeprolog-menu)
(sweeprolog-analyze-fragment-to-faces, sweeprolog-load-buffer): Use
'derived-mode-p' instead of checking 'major-mode' directly.

16 months agoAnnounce recent changes in NEWS.org and bump version to 0.19.1 V9.1.10-sweep-0.19.1
Eshel Yaron [Wed, 14 Jun 2023 07:57:03 +0000 (10:57 +0300)]
Announce recent changes in NEWS.org and bump version to 0.19.1

16 months agoFIXED: Correctly recognize DCG grammar rules in 'C-c C-d'
Eshel Yaron [Wed, 14 Jun 2023 07:37:02 +0000 (10:37 +0300)]
FIXED: Correctly recognize DCG grammar rules in 'C-c C-d'

* sweeprolog.el (sweeprolog-beginning-of-predicate-at-point): Also
return the module and neck operator of the predicate at point.
(sweeprolog-insert-predicate-documentation)
(sweeprolog-read-predicate-documentation-function)
(sweeprolog-read-predicate-documentation-with-holes)
(sweeprolog-read-predicate-documentation-default-function)
(sweeprolog-read-predicate-documentation)
(sweeprolog-document-predicate-at-point): Adapt to support DCGs and
non-local predicates.

16 months agoSimplify 'sweeprolog-beginning-of-top-term'
Eshel Yaron [Tue, 13 Jun 2023 15:54:50 +0000 (18:54 +0300)]
Simplify 'sweeprolog-beginning-of-top-term'

Extract the core of 'sweeprolog-beginning-of-top-term' to
'sweeprolog-beginning-of-top-term-once' and make it leave point at the
very beginning of the top term, rather than at the following
character.

* sweeprolog.el (sweeprolog-beginning-of-top-term-once): New function.
(sweeprolog-beginning-of-top-term): Use it.
(sweeprolog-local-variables-collection)
(sweeprolog-analyze-term)
(sweeprolog-analyze-some-terms)
(sweeprolog-beginning-of-predicate-at-point)
(sweeprolog-terms-at-point): Adapt.

17 months agoENHANCED: Guess argument names for DCG grammar rules
Eshel Yaron [Sun, 11 Jun 2023 18:05:13 +0000 (21:05 +0300)]
ENHANCED: Guess argument names for DCG grammar rules

* sweeprolog.el (sweeprolog-predicate-completion-at-point)
(sweeprolog-insert-clause): Support guessing argument names from
documentation also for DCG grammar rules.

17 months agoENHANCED: Also highlight "undefined" head terms
Eshel Yaron [Sun, 11 Jun 2023 18:03:53 +0000 (21:03 +0300)]
ENHANCED: Also highlight "undefined" head terms

17 months agoENHANCED: 'sweeprolog-find-predicate/module' improvements
Eshel Yaron [Sun, 11 Jun 2023 17:56:40 +0000 (20:56 +0300)]
ENHANCED: 'sweeprolog-find-predicate/module' improvements

Allow finding modules and predicates in another window with prefix
argument.  Also improve prompt for 'sweeprolog-find-predicate'.

* sweeprolog.el (sweeprolog-read-predicate-prompt): Remove trailing
colon and space.
(sweeprolog-predicate-visible-p-function): New user option.
(sweeprolog-read-predicate): Use it, and format PROMPT with predicate
at point as the default argument.
(sweeprolog-find-module)
(sweeprolog-find-predicate): Add optional argument OTHER-WINDOW.
(sweeprolog-describe-predicate): Adapt PROMPT argument passed to
'sweeprolog-read-predicate'.

* README.org (Finding Prolog Code): Expand.

17 months ago* README.org (High-level Architecture): Minor tweaks.
Eshel Yaron [Sun, 11 Jun 2023 14:16:21 +0000 (17:16 +0300)]
* README.org (High-level Architecture): Minor tweaks.

17 months agoAnnounce recent changes in NEWS.org and bump version to 0.19.0 V9.1.10-sweep-0.19.0
Eshel Yaron [Thu, 8 Jun 2023 18:12:21 +0000 (21:12 +0300)]
Announce recent changes in NEWS.org and bump version to 0.19.0

17 months agoENHANCED: Improve DCG support
Eshel Yaron [Thu, 8 Jun 2023 17:46:45 +0000 (20:46 +0300)]
ENHANCED: Improve DCG support

Take into account DCG grammar rules and ensure they're supported all
around.  Crucially, allow 'sweeprolog-describe-predicate' to display
documentation for DCG grammar rules.

17 months agoFIXED: Don't change hooks globally
Eshel Yaron [Thu, 8 Jun 2023 17:37:13 +0000 (20:37 +0300)]
FIXED: Don't change hooks globally

* sweeprolog.el (sweeprolog-mode): Extend 'kill-buffer-hook' and
'context-menu-functions' locally rather than global.

17 months ago* sweeprolog.el (sweeprolog-context-menu-for-module): Fix typo
Eshel Yaron [Thu, 8 Jun 2023 17:35:32 +0000 (20:35 +0300)]
* sweeprolog.el (sweeprolog-context-menu-for-module): Fix typo

17 months agoGive a better name to 'sweeprolog--mfn-to-functor-arity'
Eshel Yaron [Thu, 8 Jun 2023 17:33:55 +0000 (20:33 +0300)]
Give a better name to 'sweeprolog--mfn-to-functor-arity'

* sweeprolog.el (sweeprolog--pi-to-functor-arity): New function,
renamed from 'sweeprolog--mfn-to-functor-arity'.
(sweeprolog-native-predicate-location): Use it.

17 months agoFix a couple of typos in docstrings
Eshel Yaron [Thu, 8 Jun 2023 17:29:58 +0000 (20:29 +0300)]
Fix a couple of typos in docstrings

* sweeprolog.el (sweeprolog-predicates-collection)
(sweeprolog-head-undefined-face): Fix typo in docstring.

17 months agoAnnounce recent changes in NEWS.org and bump version to 0.18.4 V9.1.10-sweep-0.18.4
Eshel Yaron [Tue, 6 Jun 2023 06:16:04 +0000 (09:16 +0300)]
Announce recent changes in NEWS.org and bump version to 0.18.4

17 months agoENHANCED: Add tooltip info for string-stye DCG terminals
Eshel Yaron [Tue, 6 Jun 2023 05:32:37 +0000 (08:32 +0300)]
ENHANCED: Add tooltip info for string-stye DCG terminals

17 months agoUse 'ignore-errors' instead of 'condition-case' with no handlers
Eshel Yaron [Tue, 6 Jun 2023 05:24:57 +0000 (08:24 +0300)]
Use 'ignore-errors' instead of 'condition-case' with no handlers

17 months agoAdd docstring for 'sweeprolog-definition-at-point'
Eshel Yaron [Tue, 6 Jun 2023 05:24:36 +0000 (08:24 +0300)]
Add docstring for 'sweeprolog-definition-at-point'

17 months agoENHANCED: Export DCG non-terminals as 'foo//N', not 'foo/N+2'
Eshel Yaron [Tue, 6 Jun 2023 05:17:33 +0000 (08:17 +0300)]
ENHANCED: Export DCG non-terminals as 'foo//N', not 'foo/N+2'

* sweep.pl (strip_det/2): Handle DCG non-terminals with determinism
specification.
(sweep_local_predicate_export_comment/2, sweep_exportable_predicates/2)
* sweeprolog.el (sweeprolog-local-export-comment)
(sweeprolog-local-export-comment): Adapt for DCG non-terminals.

17 months agoENHANCED: Highlight string-style DCG terminals
Eshel Yaron [Tue, 6 Jun 2023 05:16:11 +0000 (08:16 +0300)]
ENHANCED: Highlight string-style DCG terminals

17 months agoAnnounce recent changes in NEWS.org and bump version to 0.18.3
Eshel Yaron [Thu, 1 Jun 2023 17:17:03 +0000 (20:17 +0300)]
Announce recent changes in NEWS.org and bump version to 0.18.3

17 months agoAvoid using 'string-replace' for Emacs 27 compatibility
Eshel Yaron [Thu, 1 Jun 2023 15:46:23 +0000 (18:46 +0300)]
Avoid using 'string-replace' for Emacs 27 compatibility

* sweeprolog.el (sweeprolog-top-level-example-done): Refactor and use
'replace-regexp-in-string' instead of 'string-replace'.