A major mode for editing Potassco Answer Set Programs files (.lp
).
From the Potassco website:
Answer Set Programming (ASP) offers a simple and powerful modeling language to solve combinatorial problems. With our tools you can concentrate on an actual problem, rather than a smart way of implementing it.
- Syntax highlighting
- Commenting functionality
- Run clingo from emacs
- Some smart indentation (inherited from parent prolog-mode)
C-c C-b
Call clingo with the current bufferC-c C-e
Call clingo with the current buffer as encoding and some user provided instanceC-c C-r
Call clingo with the currently selected region
The above will all prompt for clingo command-line options (e.g., -c n=3 -n 0
, etc.). If there is one, the prompt will show the previous options string used, and will use that by default if an empty string is input (ie just return with no input). To run with no options, ignoring any default, a space can be entered here.
C-c C-c
Comment regionC-c C-u
Uncomment region
clingo-mode
is available through the https://github.com/melpa/melpa repository.
This is the recommended way to install.
You can either install clingo-mode
by hand with:
M-x package-install [RET] clingo-mode [RET]
or place the following snippet into your Emacs init file:
(unless (package-installed-p 'clingo-mode)
(package-refresh-contents)
(package-install 'clingo-mode))
The package can also be installed with use-package
:
(use-package clingo-mode)
Download the clingo-mode.el
file from this repository.
Either put it into your emacs load path and call (require 'clingo-mode)
in your init file or load it directly with (load "~/path/to/clingo-mode.el")
Afterwards opening an .lp
file triggers clingo-mode
or
call M-x clingo-mode
within an open asp file.
- IMPORTANT
clingo-run-region
is currently unsafe. The region is sent to clingo as a string, so any quotes or escape characters will affect what reaches clingo. - Smart indentation based on nesting depth
- Refactoring of predicates/variables (complete buffer and #program parts)
- Color compilation output
- Smart rearrangement of compilation output (predicates separated, table…)
- yas-snippet for rules; constraints; soft constraints; generation?
- sync as much as possible with vim-syntax-clingo
- integrations with org-mode, company, etc.
Contributions, via issues, ideas and pull requests, are very welcome!
Copyright (c) 2020 by Ivan Uemlianin
Copyright (c) 2017 by Henrik Jürges
Distributed under the GNU General Public License v3; see LICENSE or type C-h C-c
to view it.