Add example of installation on Doomemacs and fix the stringp nil in error handling
This commit is contained in:
parent
a616da6a1d
commit
3eedcc534a
|
@ -1,5 +1,5 @@
|
|||
* ob-pasp
|
||||
Org-Babel mode to execute Clingo Potassco code within Org-mode
|
||||
Org-Babel mode to execute Potassco Answer Set Programming code within Org-mode with =clingo=.
|
||||
|
||||
#+begin_src pasp
|
||||
child(C, P) :- parent(P, C).
|
||||
|
@ -21,3 +21,25 @@ Calls : 1
|
|||
Time : 0.000s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)
|
||||
CPU Time : 0.000s
|
||||
#+end_example
|
||||
|
||||
** Installation
|
||||
|
||||
The package is not (yet) available on MELPA, so the package should be installed from github directly.
|
||||
|
||||
*** Dependencies
|
||||
|
||||
To be able to use =ob-pasp= you will need to install =clingo= cli.
|
||||
|
||||
|
||||
*** Doomemacs
|
||||
|
||||
In your =$DOOMDIR/package.el= file, you might want to set up the following:
|
||||
#+begin_src emacs-lisp
|
||||
(package! pasp-mode) ;; Add syntax highlighting for Potassco ASP
|
||||
(package! ob-pasp
|
||||
:recipe (:host github :repo "UncleSamulus/ob-pasp"))
|
||||
#+end_src
|
||||
|
||||
|
||||
** TODO Spacemacs
|
||||
** TODO =use-package= / =straight=
|
||||
|
|
|
@ -138,7 +138,7 @@ This function is called by `org-babel-execute-src-block'"
|
|||
(vars (org-babel--get-vars processed-params))
|
||||
(result-params (assq :result-params processed-params))
|
||||
;; either OUTPUT or VALUE which should behave as described above
|
||||
(result-type (assq :result-type processed-params))
|
||||
(result-type "output"); (assq :result-type processed-params))
|
||||
;; expand the body with `org-babel-expand-body:pasp'
|
||||
(full-body (org-babel-expand-body:pasp
|
||||
body params processed-params))
|
||||
|
@ -146,7 +146,7 @@ This function is called by `org-babel-execute-src-block'"
|
|||
(clingo (executable-find "clingo"))
|
||||
(cmd (concat (shell-quote-argument (expand-file-name clingo))
|
||||
(when models
|
||||
(concat " -n " models))
|
||||
(concat " -n " (int-to-string models)))
|
||||
" " (org-babel-process-file-name temp-file))))
|
||||
;; actually execute the source-code block either in a session or
|
||||
;; possibly by dropping it to a temporary file and evaluating the
|
||||
|
@ -165,7 +165,7 @@ This function is called by `org-babel-execute-src-block'"
|
|||
|
||||
;; ref. https://github.com/arnm/ob-mermaid
|
||||
(unless (file-executable-p clingo)
|
||||
(error "Cannot find or execute %s, please check `clingo`" clingo))
|
||||
(error "Cannot find or execute `clingo', please check it is installed and in PATH"))
|
||||
(with-temp-file temp-file (insert full-body))
|
||||
(message "%s" cmd)
|
||||
(org-babel-eval cmd "")
|
||||
|
|
Loading…
Reference in New Issue