summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiliana Marie Prikler <liliana.prikler@gmail.com>2023-02-11 16:15:00 +0100
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2023-02-19 08:16:47 +0100
commit243eb86c6ffa9d0a5665d90e33f788e2aac8dab5 (patch)
treeba14f0f41459b84f3ce4bef933b865ea42cd9d7b
parenteb96e148ca50fde3068f365ab4ebb6ab6dbf3dea (diff)
gnu: Add emacs-pasp-mode.
* gnu/packages/patches/emacs-pasp-mode-quote-file-names.patch: New file. * gnu/local.mk: Register it here. * gnu/packages/emacs-xyz.scm (emacs-pasp-mode): New variable.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/emacs-xyz.scm48
-rw-r--r--gnu/packages/patches/emacs-pasp-mode-quote-file-names.patch20
3 files changed, 69 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index b2033a5460..5da09a8e79 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1071,6 +1071,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-highlight-stages-add-gexp.patch \
%D%/packages/patches/emacs-lispy-fix-thread-last-test.patch \
%D%/packages/patches/emacs-native-comp-driver-options.patch \
+ %D%/packages/patches/emacs-pasp-mode-quote-file-names.patch \
%D%/packages/patches/emacs-polymode-fix-lexical-variable-error.patch \
%D%/packages/patches/emacs-source-date-epoch.patch \
%D%/packages/patches/emacs-telega-path-placeholder.patch \
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 4592a9c3ae..4e40b22426 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -201,6 +201,7 @@
#:use-module (gnu packages lisp-xyz)
#:use-module (gnu packages lsof)
#:use-module (gnu packages lua)
+ #:use-module (gnu packages maths)
#:use-module (gnu packages music)
#:use-module (gnu packages version-control)
#:use-module (gnu packages imagemagick)
@@ -4389,6 +4390,53 @@ written text. Unlike dynamic abbreviation, the text is analysed
during idle time, while Emacs is doing nothing else.")
(license license:gpl3+)))
+(define-public emacs-pasp-mode
+ (let ((commit "59385eb0e8ebcfc8c11dd811fb145d4b0fa3cc92")
+ (revision "1"))
+ (package
+ (name "emacs-pasp-mode")
+ (version (git-version "0.1.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/santifa/pasp-mode")
+ (commit commit)))
+ (patches
+ (search-patches "emacs-pasp-mode-quote-file-names.patch"))
+ (sha256
+ (base32
+ "1ar4vws3izzmir7m870mccci620ns3c5j26dcmwaxavhgw45wcmf"))))
+ (build-system emacs-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'defconst-version
+ (lambda _
+ (emacs-batch-edit-file "pasp-mode.el"
+ '(progn
+ (search-forward-regexp "(defcustom pasp-mode-version")
+ (forward-sexp)
+ (kill-sexp)
+ (backward-sexp)
+ (beginning-of-line)
+ (kill-sexp)
+ (insert (format "(defconst emacs-pasp-version \"%s\" %s)"
+ #$version (cadr kill-ring)))
+ (basic-save-buffer)))))
+ (add-after 'unpack 'hardcode-clingo
+ (lambda* (#:key inputs #:allow-other-keys)
+ (emacs-substitute-variables "pasp-mode.el"
+ ("pasp-clingo-path"
+ (search-input-file inputs "/bin/clingo"))))))))
+ (inputs (list clingo))
+ (home-page "https://github.com/santifa/pasp-mode")
+ (synopsis "Major mode for editing answer set programs")
+ (description
+ "This package provides a major mode for editing answer set programs,
+in particular ones that can be solved by @command{clingo}.")
+ (license license:gpl3+))))
+
(define-public emacs-pdf-tools
(package
(name "emacs-pdf-tools")
diff --git a/gnu/packages/patches/emacs-pasp-mode-quote-file-names.patch b/gnu/packages/patches/emacs-pasp-mode-quote-file-names.patch
new file mode 100644
index 0000000000..39dc5d0253
--- /dev/null
+++ b/gnu/packages/patches/emacs-pasp-mode-quote-file-names.patch
@@ -0,0 +1,20 @@
+diff --git a/pasp-mode.el b/pasp-mode.el
+index 7f83645..5daf08e 100644
+--- a/pasp-mode.el
++++ b/pasp-mode.el
+@@ -199,9 +199,12 @@
+ Argument ENCODING The current buffer which holds the problem encoding.
+ Optional argument INSTANCE The problem instance which is solved by the encoding.
+ If no instance it is assumed to be also in the encoding file."
+- (if 'instance
+- (concat pasp-clingo-path " " pasp-clingo-options " " encoding " " instance)
+- (concat pasp-clingo-path " " pasp-clingo-options " " encoding)))
++ (if instance
++ (concat pasp-clingo-path " " pasp-clingo-options " "
++ (shell-quote-argument encoding) " "
++ (shell-quote-argument instance))
++ (concat pasp-clingo-path " " pasp-clingo-options " "
++ (shell-quote-argument encoding))))
+
+ (defun pasp-run-clingo (encoding &optional instance)
+ "Run Clingo with some ASP input files.