From: Eshel Yaron Date: Tue, 6 Dec 2022 19:50:08 +0000 (+0200) Subject: Announce recent changes in NEWS.org and bump version to 0.9.4 X-Git-Tag: V9.1.1-sweep-0.9.4 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0e324b3216ff031104fefbdb23e081d88ed1e7f6;p=sweep.git Announce recent changes in NEWS.org and bump version to 0.9.4 --- diff --git a/NEWS.org b/NEWS.org index 0d1a0eb..8f785a5 100644 --- a/NEWS.org +++ b/NEWS.org @@ -11,6 +11,23 @@ SWI-Prolog in Emacs. For further details, please consult the manual: . +* Version 0.9.4 on 2022-12-06 + +** New minor mode for moving to holes with ~TAB~ + +This version introduces a new minor mode +~sweeprolog-forward-hole-on-tab-mode~, which binds ~TAB~ to a command that +moves either indents the current line or moves to the next hole in the +buffer, in a DWIM fashion. + +** Fixes and minor improvements + +- Automatic indentation is improved to accommodate for DCG RHS + contexts and SSU guards. +- ~sweeprolog-identifier-at-point~ now qualifies head terms with + according to the current module (e.g. ~foo:bar/2~ is returned when + point is over ~bar(_, _)~ in module ~foo~). + * Version 0.9.3 on 2022-11-27 ** Added repeat keymap for ~sweeprolog-forward-hole~ (Emacs 28+) diff --git a/README.org b/README.org index 03115c0..e3b19e9 100644 --- a/README.org +++ b/README.org @@ -158,9 +158,8 @@ corresponds to =argv[0]=. #+VINDEX: sweeprolog-init-args ~sweep~ loads and initializes Prolog on-demand at the first invocation of a command that requires the embedded Prolog. The arguments used to -initialize Prolog in case are determined by the value of the -user-option ~sweeprolog-init-args~ which the user is free to extend with -e.g.: +initialize Prolog are then determined by the value of the user-option +~sweeprolog-init-args~ which the user is free to extend with e.g.: #+begin_src emacs-lisp (add-to-list 'sweeprolog-init-args "--stack-limit=512m") @@ -171,6 +170,31 @@ The default value of ~sweeprolog-init-args~ is set to load the Prolog helper library =sweep.pl= and to create a boolean Prolog flag ~sweep~, set to ~true~, which indicates to SWI-Prolog that it is running under ~sweep~. +#+CINDEX: command line arguments +#+FINDEX: sweeprolog-handle-command-line-args +It is also possible to specify initialization arguments to SWI-Prolog +by passing them as command line arguments to Emacs, which can be +convenient when using Emacs and =sweep= as an alternative for the common +shell-based interaction with SWI-Prolog. This is achieved by adding +the flag ~--swipl-args~ followed by any number of arguments intended for +SWI-Prolog, with a single semicolon (";") argument marking the end of +the SWI-Prolog arguments, after which further arguments are processed +by Emacs as usual (see [[info:emacs#Emacs Invocation][Emacs Invocation]] for more information about +Emacs's command line options), for example: + +#+begin_src sh + emacs --some-emacs-option --swipl-args -l foobar.pl \; --more-emacs-options +#+end_src + +In order for =sweep= to be able to handle Emacs's command line +arguments, the function ~sweeprolog-handle-command-line-args~ must be +called before Emacs processes the ~--swipl-args~ argument. This can be +ensured by calling it from the command line as well: + +#+begin_src sh + emacs -f sweeprolog-handle-command-line-args --swipl-args -l foobar.pl \; +#+end_src + #+FINDEX: sweeprolog-restart The embedded Prolog runtime can be reset using the command ~sweeprolog-restart~. This command cleans up the the Prolog state and @@ -1712,12 +1736,6 @@ there some further improvements that we want to pursue: directories containing SWI-Prolog =pack.pl= package definitions as root project directories. -- Add command line arguments handling for Prolog flags :: ~sweep~ should - make it easy to specify Prolog initialization arguments (see [[#prolog-init][Prolog - initialization and cleanup]]) already in the Emacs command line - invocation. One way to achieve that would be to extend - ~command-line-functions~ with a custom command line arguments handler. - - Extend the provided Elisp-Prolog interface :: Currently, the Elisp interface that ~sweep~ provides for querying Prolog only allows calling directly to predicates of arity 2 (see [[#querying-prolog][Querying Prolog]]), diff --git a/sweeprolog-tests.el b/sweeprolog-tests.el index 46a4c61..43abff1 100644 --- a/sweeprolog-tests.el +++ b/sweeprolog-tests.el @@ -762,6 +762,38 @@ bar(X) :- permutation(X, [1,2,3]). " )))) +(ert-deftest update-dependencies-autoload-from-package () + "Tests making implicit autoloads from a package explicit." + (let ((temp (make-temp-file "sweeprolog-test" + nil + "pl" + " +:- module(foo, [bar/1]). + +/** Foo + +*/ + +bar(X) :- http_open(X, X, X). +" + ))) + (find-file-literally temp) + (sweeprolog-mode) + (call-interactively #'sweeprolog-update-dependencies) + (should (string= (buffer-string) + " +:- module(foo, [bar/1]). + +/** Foo + +*/ + +:- autoload(library(http/http_open), [ http_open/3 + ]). + +bar(X) :- http_open(X, X, X). +")))) + (ert-deftest update-dependencies () "Tests making implicit autoloads explicit." (let ((temp (make-temp-file "sweeprolog-test" diff --git a/sweeprolog.el b/sweeprolog.el index 88fde91..3fd1765 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -6,7 +6,7 @@ ;; Maintainer: Eshel Yaron <~eshel/dev@lists.sr.ht> ;; Keywords: prolog languages extensions ;; URL: https://git.sr.ht/~eshel/sweep -;; Package-Version: 0.9.3 +;; Package-Version: 0.9.4 ;; Package-Requires: ((emacs "28.1")) ;; This file is NOT part of GNU Emacs.