]> git.eshelyaron.com Git - sweep.git/log
sweep.git
17 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

17 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

17 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

17 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.

17 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.

17 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.

17 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.

17 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'.

18 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

18 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.

18 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

18 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.

18 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.

18 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

18 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

18 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

18 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

18 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".

18 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.

18 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.

18 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

18 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

18 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.

18 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.

18 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

18 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.

18 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.

18 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.

18 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

18 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.

18 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.

18 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

18 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.

18 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.

18 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

18 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.

18 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.

18 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

18 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

18 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

18 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'

18 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.

18 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

18 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

18 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'.

18 months agoTest 'sweeprolog-make-example-usage-comment'
Eshel Yaron [Thu, 1 Jun 2023 15:26:47 +0000 (18:26 +0300)]
Test 'sweeprolog-make-example-usage-comment'

18 months agoADDED: highlighting and tooltip info for declaration options
Eshel Yaron [Thu, 1 Jun 2023 11:23:11 +0000 (14:23 +0300)]
ADDED: highlighting and tooltip info for declaration options

* sweep.pl (sweep_color_normalized_/4): Handle 'decl_option/1'
fragments.

* sweeprolog.el (sweeprolog-declaration-option): New face, used in...
(sweeprolog-analyze-fragment-to-faces): ...for 'decl_option' frags.
(sweeprolog--help-echo-for-declaration-option): New function.
(sweeprolog-analyze-fragment-help-echo): Use it.

18 months ago* README.org (Example Usage Comments): improve wording
Eshel Yaron [Thu, 1 Jun 2023 11:21:09 +0000 (14:21 +0300)]
* README.org (Example Usage Comments): improve wording

18 months agoAnnounce recent changes in NEWS.org and bump version to 0.18.2
Eshel Yaron [Tue, 30 May 2023 19:34:37 +0000 (22:34 +0300)]
Announce recent changes in NEWS.org and bump version to 0.18.2

18 months agoADDED: command for inserting example usage comments
Eshel Yaron [Tue, 30 May 2023 19:29:34 +0000 (22:29 +0300)]
ADDED: command for inserting example usage comments

* sweeprolog.el (sweeprolog-top-level-example-mode): New minor mode.
(sweeprolog-make-example-usage-comment): New command.
(sweeprolog-mode-map): Bind it.

* README.org (Example Usage Comments): New section.

19 months agoAnnounce recent changes in NEWS.org and bump version to 0.18.1
Eshel Yaron [Fri, 26 May 2023 09:24:53 +0000 (12:24 +0300)]
Announce recent changes in NEWS.org and bump version to 0.18.1

19 months agoADDED: New command for expanding macros
Eshel Yaron [Fri, 26 May 2023 07:56:15 +0000 (10:56 +0300)]
ADDED: New command for expanding macros

* sweep.pl (sweep_expand_macro/2): New predicate.
* sweeprolog.el (sweeprolog-expand-macro-at-pos): New function.
(sweeprolog-expand-macro-at-point): New command.
(sweeprolog-context-menu-functions): Add...
(sweeprolog-context-menu-for-macro): New function.
* README.org (Macro Expansion): New section.

19 months agoADDED: Highlighting and tooltip info for macros
Eshel Yaron [Fri, 26 May 2023 07:51:57 +0000 (10:51 +0300)]
ADDED: Highlighting and tooltip info for macros

* sweep.pl (sweep_color_normalized_/4): Handle 'macro(String)' terms.
* sweeprolog.el (sweeprolog-macro): New face.
(sweeprolog-analyze-fragment-to-faces)
(sweeprolog-analyze-fragment-help-echo): Handle 'macro' fragments.

19 months agoFIXED: tokenizing adjacent operators
Eshel Yaron [Fri, 26 May 2023 07:18:38 +0000 (10:18 +0300)]
FIXED: tokenizing adjacent operators

Make Sweep's Prolog tokenization functions more careful in their
handling of unrelated adjacent operators.  This fixes an issue that
affects term-based movement commands and other commands that rely on
'sweeprolog--forward-sexp' and friends.

* sweeprolog.el (sweeprolog-next-token-boundaries)
(sweeprolog-last-token-boundaries): Fix handling of
adjacent (distinct) operators.

* sweeprolog-tests.el
(forward-sexp-with-adjacent-operators): New test case.

19 months agoFix copy-paste error in NEWS.org
Eshel Yaron [Thu, 25 May 2023 07:10:23 +0000 (10:10 +0300)]
Fix copy-paste error in NEWS.org

19 months agoAnnounce recent changes in NEWS.org and bump version to 0.18.0 V9.1.10-sweep-0.18.0
Eshel Yaron [Wed, 24 May 2023 07:33:58 +0000 (10:33 +0300)]
Announce recent changes in NEWS.org and bump version to 0.18.0

19 months agoUse 'nil' for some 'defface's instead of ':inherit default'
Eshel Yaron [Wed, 24 May 2023 07:11:44 +0000 (10:11 +0300)]
Use 'nil' for some 'defface's instead of ':inherit default'

Change 'defface's that only specify inheritance from 'default' to
empty (nil) definitions, such that the appearance of text these with
faces can be determined by other faces applied to the same text.  This
is important, for example, when using Sweep in Org mode source blocks.

19 months agoMODIFIED: Remove '-face' suffix from face names
Eshel Yaron [Wed, 24 May 2023 07:10:40 +0000 (10:10 +0300)]
MODIFIED: Remove '-face' suffix from face names

Remove the '-face' suffix from the names of all defined faces as
prescribed in (info "(elisp)Defining Faces").

19 months agoENHANCED: faster completion-at-point for predicates
Eshel Yaron [Sat, 20 May 2023 14:52:17 +0000 (17:52 +0300)]
ENHANCED: faster completion-at-point for predicates

Filter predicate completion candidates according to the text near
point before formatting and computing argument names.  This makes
completion-at-point for predicates much faster when there are lots of
known predicates.

* sweeprolog.el (sweeprolog-predicate-completion-at-point): Pass
(partial) functor at point to...
* sweep.pl (sweep_predicate_completion_candidates/2): Filter
predicates based on new Sub argument.

19 months ago* sweeprolog.el (sweeprolog--load-module): Use 'module-load'.
Philip Kaludercic [Fri, 19 May 2023 06:08:27 +0000 (06:08 +0000)]
* sweeprolog.el (sweeprolog--load-module): Use 'module-load'.

22 months agoAnnounce recent changes in NEWS.org and bump version to 0.17.0 V9.1.10 V9.1.11 V9.1.12 V9.1.13 V9.1.6-sweep-0.17.0 V9.1.7 V9.1.8 V9.1.9
Eshel Yaron [Thu, 16 Feb 2023 13:45:25 +0000 (15:45 +0200)]
Announce recent changes in NEWS.org and bump version to 0.17.0

22 months agoFIXED: beginning-of-clause detection with quoted head functors
Eshel Yaron [Thu, 16 Feb 2023 13:00:49 +0000 (15:00 +0200)]
FIXED: beginning-of-clause detection with quoted head functors

* sweeprolog.el (sweeprolog-beginning-of-top-term): don't skip quoted
functors in clause heads.

22 months agoADDED: Support setting breakpoints in sweeprolog-mode
Eshel Yaron [Thu, 16 Feb 2023 12:54:44 +0000 (14:54 +0200)]
ADDED: Support setting breakpoints in sweeprolog-mode

* sweep.pl (sweep_set_breakpoint/2)
(sweep_delete_breakpoint/2)
(sweep_set_breakpoint_condition/2): new predicates.

* sweeprolog.el (sweeprolog-dependency-directive): update
package-version field.
(sweeprolog-set-breakpoint)
(sweeprolog-set-breakpoint-condition)
(sweeprolog-delete-breakpoint)
(sweeprolog-list-breakpoints): new commands.
(sweeprolog-highlight-breakpoints): new user option.
(sweeprolog-mode-map): bind sweeprolog-set-breakpoint.

* README.org (Setting Breakpoints): new manual section.

22 months agoADDED: mode line indication for loaded buffers
Eshel Yaron [Thu, 16 Feb 2023 12:34:45 +0000 (14:34 +0200)]
ADDED: mode line indication for loaded buffers

* sweep.pl (sweep_source_file_load_time/2): new predicate.
(sweep_load_buffer/2): also update source modification time based.
* sweeprolog.el (sweeprolog-buffer-load-time)
(sweeprolog-buffer-loaded-since-last-modification-p): new functions.
(sweeprolog-load-buffer): use it.
(sweeprolog-mode): add mode line indication if buffer is loaded.

22 months ago* (sweeprolog-context-menu-for-variable): fix docstring
Eshel Yaron [Thu, 16 Feb 2023 12:21:17 +0000 (14:21 +0200)]
* (sweeprolog-context-menu-for-variable): fix docstring

22 months agoMODIFIED: sweeprolog-update-dependencies choice of directives
Eshel Yaron [Mon, 13 Feb 2023 18:35:10 +0000 (20:35 +0200)]
MODIFIED: sweeprolog-update-dependencies choice of directives

* sweeprolog.el (sweeprolog-dependency-directive): New user option.
Determines which directive to use in...
(sweeprolog-update-dependencies): Fix edge cases in finding where to
insert new directives. Optionally infer directive to add based on
current buffer contents.

* README.org (Managing Dependencies): Update section.

22 months agoAnnounce recent changes in NEWS.org and bump version to 0.16.0 V9.1.4-sweep-0.16.0
Eshel Yaron [Sat, 11 Feb 2023 16:26:30 +0000 (18:26 +0200)]
Announce recent changes in NEWS.org and bump version to 0.16.0

22 months ago* (sweeprolog-insert-term-dwim): add undo-inhibit-region property
Eshel Yaron [Sat, 11 Feb 2023 11:59:43 +0000 (13:59 +0200)]
* (sweeprolog-insert-term-dwim): add undo-inhibit-region property

22 months ago* README.org (Discovering Sweep): new manual section
Eshel Yaron [Sat, 11 Feb 2023 11:58:55 +0000 (13:58 +0200)]
* README.org (Discovering Sweep): new manual section

22 months ago* sweeprolog.el: allow info-lookup to recognize Sweep commands
Eshel Yaron [Sat, 11 Feb 2023 11:57:53 +0000 (13:57 +0200)]
* sweeprolog.el: allow info-lookup to recognize Sweep commands

22 months ago* README.org: add explicit indexing directive
Eshel Yaron [Sat, 11 Feb 2023 11:57:30 +0000 (13:57 +0200)]
* README.org: add explicit indexing directive

22 months agoFIXED: end-of-term detection after a fullstop turns to a dict dot V9.1.5 V9.1.6
Eshel Yaron [Tue, 7 Feb 2023 20:16:44 +0000 (22:16 +0200)]
FIXED: end-of-term detection after a fullstop turns to a dict dot

This fixes an issue with finding clause bounds after changing e.g.:

    foo(Bar, Baz) :- Baz = Bar.
                              ^ read as fullstop

to:

    foo(Bar, Baz) :- Baz = Bar.foo.
                              ^ read as dict dot

22 months agoADDED: new commands for managing numbered variables
Eshel Yaron [Tue, 7 Feb 2023 19:57:30 +0000 (21:57 +0200)]
ADDED: new commands for managing numbered variables

* sweeprolog.el (sweeprolog-increment-numbered-variables)
(sweeprolog-decrement-numbered-variables): new commands.
(sweeprolog-mode-map): bind them to C-c C-+ and C-c C--.
(sweeprolog-context-menu-for-variable): allow calling these new
commands from context menus for numbered variables.
* sweeprolog-tests.el: add test for incrementing numbered variables.
* README.org (Numbered Variables): new manual section.

22 months ago* (sweeprolog-rename-variable-allow-existing): refine custom type
Eshel Yaron [Sun, 5 Feb 2023 09:41:15 +0000 (11:41 +0200)]
* (sweeprolog-rename-variable-allow-existing): refine custom type

22 months agoENHANCED: handle renaming variables to existing variable names
Eshel Yaron [Sat, 4 Feb 2023 21:09:23 +0000 (23:09 +0200)]
ENHANCED: handle renaming variables to existing variable names

* sweeprolog.el (sweeprolog-rename-variable-allow-existing): new user
option, used by...
(sweeprolog-read-new-variable-try): new command, exists the minibuffer
if it contains a valid variable name.  It checks if the selected
variable name already exists.  Used by...
(sweeprolog-read-new-variable): new function, reads a Prolog variable
name in the minibuffer with a dedicated exit command.
(sweeprolog-rename-variable): use it.

22 months agoAnnounce recent changes in NEWS.org and bump version to 0.15.0 V9.1.4-sweep-0.15.0
Eshel Yaron [Wed, 1 Feb 2023 18:21:54 +0000 (20:21 +0200)]
Announce recent changes in NEWS.org and bump version to 0.15.0

22 months agoAvoid moving cursor while renaming variables from context menu
Eshel Yaron [Wed, 1 Feb 2023 18:09:39 +0000 (20:09 +0200)]
Avoid moving cursor while renaming variables from context menu

* sweeprolog.el (sweeprolog-analyze-term-at-point): new optional
argument POINT.
(sweeprolog-rename-variable): use it instead of moving point during
prompting to avoid the cursor being displayed at the click position
when called from the context menu.

22 months ago* (xref-backend-references): report progress while formatting refs
Eshel Yaron [Wed, 1 Feb 2023 17:57:43 +0000 (19:57 +0200)]
* (xref-backend-references): report progress while formatting refs

22 months agoENHANCED: provide exact buffer positions for cross references
Eshel Yaron [Wed, 1 Feb 2023 16:28:09 +0000 (18:28 +0200)]
ENHANCED: provide exact buffer positions for cross references

* sweep.pl (reference_span/5): new predicate.
(sweep_predicate_references/2): use it to find exact character offset of
predicate references.
* sweeprolog.el (xref-backend-references): adapt accordingly.

22 months ago* (sweeprolog-rename-variable): report results if interactive
Eshel Yaron [Mon, 30 Jan 2023 06:43:09 +0000 (08:43 +0200)]
* (sweeprolog-rename-variable): report results if interactive

22 months agoADDED: command for renaming a variable in Prolog term
Eshel Yaron [Sun, 29 Jan 2023 21:35:33 +0000 (23:35 +0200)]
ADDED: command for renaming a variable in Prolog term

* sweeprolog.el (sweeprolog-rename-variable): new command.
(sweeprolog-context-menu-rename-variable): new command used in context
menus for variables.
(sweeprolog-context-menu-for-variable): new function, used in...
(sweeprolog-context-menu-functions): add it to the list.
(sweeprolog-mode-map): bind it to C-c C-r.
* README.org (Renaming Variables): new section.

22 months agoAnnounce recent changes in NEWS.org and bump version to 0.14.1 V9.1.4-sweep-0.14.1
Eshel Yaron [Sat, 28 Jan 2023 18:07:03 +0000 (20:07 +0200)]
Announce recent changes in NEWS.org and bump version to 0.14.1

22 months agoENHANCED: use docs from the SWI-Prolog manual to guess hole names
Eshel Yaron [Sat, 28 Jan 2023 16:38:00 +0000 (18:38 +0200)]
ENHANCED: use docs from the SWI-Prolog manual to guess hole names

* sweep.pl (predicate_argument_names/2): also consult the SWI-Prolog
manual via pldoc_man:load_man_object/4 to find argument names for
built-in predicates.

22 months agoADDED: numeric argument for sweeprolog-forward/backward-hole
Eshel Yaron [Thu, 26 Jan 2023 15:21:09 +0000 (17:21 +0200)]
ADDED: numeric argument for sweeprolog-forward/backward-hole

* sweeprolog.el (sweeprolog-count-holes): new command, counts holes
in the current buffer.
(sweeprolog-forward-hole, sweeprolog-backward-hole): new numeric
argument, corresponding to the prefix argument when called
interactively.  With positive/negative numeric argument, move over
that many holes.  With zero numeric argument, call
sweeprolog-count-holes instead.

23 months agoDOC: improve documentation for holes V9.0.4 V9.1.4
Eshel Yaron [Mon, 23 Jan 2023 20:33:15 +0000 (22:33 +0200)]
DOC: improve documentation for holes

23 months ago* README.org (Holes): Fix wording and index directives
Eshel Yaron [Mon, 23 Jan 2023 18:35:15 +0000 (20:35 +0200)]
* README.org (Holes): Fix wording and index directives

23 months agoyank holes back as plain variables
Eshel Yaron [Mon, 23 Jan 2023 18:20:02 +0000 (20:20 +0200)]
yank holes back as plain variables

* sweeprolog.el (sweeprolog-mode): add sweeprolog-hole to
yank-excluded-properties buffer-locally.
* sweeprolog-tests.el: test it.
* README.org (Holes): mention it.

23 months agoAdd sweeprolog-view-news command and bump version to 0.14.0 V9.1.3-sweep-0.14.0
Eshel Yaron [Mon, 23 Jan 2023 09:07:22 +0000 (11:07 +0200)]
Add sweeprolog-view-news command and bump version to 0.14.0

* sweeprolog.el (sweeprolog-view-news): new command for viewing the
Sweep News file.

23 months agoDocument sweeprolog-file-at-point, file-name-at-point-functions
Eshel Yaron [Sun, 22 Jan 2023 20:04:15 +0000 (22:04 +0200)]
Document sweeprolog-file-at-point, file-name-at-point-functions

23 months ago* (sweeprolog-xref-project-source-files): add progress reporting
Eshel Yaron [Sun, 22 Jan 2023 19:05:01 +0000 (21:05 +0200)]
* (sweeprolog-xref-project-source-files): add progress reporting

23 months agodon't use file-name-split for compatibility with older Emacsen
Eshel Yaron [Sun, 22 Jan 2023 08:20:13 +0000 (10:20 +0200)]
don't use file-name-split for compatibility with older Emacsen

23 months ago* sweeprolog.el: capitalize "Sweep" in major mode names
Eshel Yaron [Sun, 22 Jan 2023 06:24:40 +0000 (08:24 +0200)]
* sweeprolog.el: capitalize "Sweep" in major mode names

23 months agoADDED: command to pipe output of Prolog goals to Emacs buffers
Eshel Yaron [Sun, 22 Jan 2023 06:13:15 +0000 (08:13 +0200)]
ADDED: command to pipe output of Prolog goals to Emacs buffers

* sweep.c (sweep_open_channel(), sweep_fd_open()): new helper
functions for obtaining Prolog streams from Emacs pipe buffers.
* sweep.pl (sweep_async_goal/2, sweep_interrupt_async_goal/2): new
predicates.
* sweeprolog.el (sweeprolog-async-goal): new command, executes a goal
in a separate thread and redirects its output to a buffer with mode..
(sweeprolog-async-goal-output-mode): new major mode, derived from
Compilation mode.
(sweeprolog-mode-map, sweeprolog-prefix-map, sweeprolog-menu): bind
sweeprolog-async-goal.
* README.org (Executing Prolog Asynchronously): new manual section.

23 months agoFIXED: possible race condition when signaling new top-level threads
Eshel Yaron [Sat, 21 Jan 2023 20:46:35 +0000 (22:46 +0200)]
FIXED: possible race condition when signaling new top-level threads

23 months agoAnnounce recent changes in NEWS.org and bump version to 0.13.0 V9.1.3-sweep-0.13.0
Eshel Yaron [Fri, 20 Jan 2023 19:47:47 +0000 (21:47 +0200)]
Announce recent changes in NEWS.org and bump version to 0.13.0

23 months agoENHANCED: consult with library index for finding predicate defs
Eshel Yaron [Fri, 20 Jan 2023 18:45:14 +0000 (20:45 +0200)]
ENHANCED: consult with library index for finding predicate defs

* sweep.pl (sweep_predicate_location_/4): also check library_index/3.
* sweeprolog-tests.el: add test for finding the source location of a
predicate in the package clib.

23 months agoexpose new arithmetic functions support in library(prolog_colour)
Eshel Yaron [Fri, 20 Jan 2023 11:50:55 +0000 (13:50 +0200)]
expose new arithmetic functions support in library(prolog_colour)

23 months agoFIXED: stale xref data when jumping across files with M-.
Eshel Yaron [Fri, 20 Jan 2023 11:49:51 +0000 (13:49 +0200)]
FIXED: stale xref data when jumping across files with M-.

23 months agoADDED: right-click context menus in sweeprolog-mode
Eshel Yaron [Thu, 19 Jan 2023 09:15:35 +0000 (11:15 +0200)]
ADDED: right-click context menus in sweeprolog-mode

* sweeprolog.el (sweeprolog-context-menu-find-module)
(sweeprolog-context-menu-find-module-other-window)
(sweeprolog-context-menu-describe-module)
(sweeprolog-context-menu-find-file)
(sweeprolog-context-menu-find-file-other-window)
(sweeprolog-context-menu-describe-predicate): new commands, add to context menus by...
(sweeprolog-context-menu-for-predicate)
(sweeprolog-context-menu-for-module)
(sweeprolog-context-menu-for-file): new functions, used in...
(sweeprolog-context-menu-functions): new abnormal hook, used by...
(sweeprolog-context-menu-function): new function.
(sweeprolog-mode): add it to context-menu-functions.

* README.org (Context Menu): new section.

23 months agoAnnounce recent changes in NEWS.org and bump version to 0.12.0 V9.1.3-sweep-0.12.0
Eshel Yaron [Mon, 16 Jan 2023 21:12:24 +0000 (23:12 +0200)]
Announce recent changes in NEWS.org and bump version to 0.12.0