{ "name": "emacs", "version": "31.1", "summary": "GNU Emacs for the terminal, with TLS (GnuTLS), libxml2, SQLite, tree-sitter and JSON", "category": "editor", "license": "GPL-3.0-or-later", "homepage": "https://www.gnu.org/software/emacs/", "source": { "url": "https://mirrors.kernel.org/gnu/emacs/emacs-31.1.tar.xz", "sha256": "1da5790d9580c81932b5bf700633114468da7b3412d69faa767daebf974f4586" }, "watch": {"kind": "index", "url": "https://mirrors.kernel.org/gnu/emacs/", "regex": "emacs-([0-9]+\\.[0-9]+)\\.tar\\.xz"}, "deps": [ "ncurses", "gnutls", "libxml2", "sqlite", "tree-sitter", "zlib", "gmp" ], "env_packages": [], "static": true, "nss": true, "check": "t=$(mktemp -d) && P=$(free_port) && bin/emacs --version | first | has -x 'GNU Emacs 31.1' && cd \"$t\" && \"$PREFIX/bin/certtool\" --generate-privkey --key-type ed25519 --outfile key.pem 2>/dev/null && printf '%s\\n' 'cn = localhost' 'dns_name = localhost' 'expiration_days = 2' 'tls_www_server' 'signing_key' 'ca' 'cert_signing_key' > tpl && \"$PREFIX/bin/certtool\" --generate-self-signed --load-privkey key.pem --template tpl --outfile cert.pem 2>/dev/null && { \"$PREFIX/bin/gnutls-serv\" --x509certfile cert.pem --x509keyfile key.pem -p \"$P\" --echo > serv.log 2>&1 & echo $! > pid; } && wait_port \"$P\" && printf 'bvs zlib\\n' | gzip > z.gz && printf '%s\\n' '(require (quote gnutls))' '(setq gnutls-verify-error t network-security-level (quote low) gnutls-trustfiles (list (getenv \"CERT\")))' '(let ((r nil) (p (open-network-stream \"bvs\" (get-buffer-create \"*bvs*\") \"localhost\" (string-to-number (getenv \"P\")) :type (quote tls))))' ' (push (format \"emacs %s\" emacs-version) r)' ' (process-send-string p \"bvs emacs\\n\")' ' (with-timeout (10 nil)' ' (while (not (string-match-p \"bvs emacs\" (with-current-buffer \"*bvs*\" (buffer-string))))' ' (accept-process-output p 0.2)))' ' (push (format \"tls %s %s\" (plist-get (gnutls-peer-status p) :protocol) (string-trim (with-current-buffer \"*bvs*\" (buffer-string)))) r)' ' (delete-process p)' ' (push (format \"xml %s\" (with-temp-buffer (insert \"bvs\") (libxml-parse-xml-region (point-min) (point-max)))) r)' ' (let ((db (sqlite-open)))' ' (sqlite-execute db \"create table t (n int)\")' ' (sqlite-execute db \"insert into t values (40), (2)\")' ' (push (format \"sqlite %s\" (car (car (sqlite-select db \"select sum(n) from t\")))) r))' ' (push (format \"treesit %s\" (treesit-available-p)) r)' ' (push (format \"json %s\" (json-serialize (json-parse-string \"{\\\"a\\\":[1,2]}\"))) r)' ' (push (format \"bignum %s\" (expt 3 100)) r)' ' (push (format \"zlib %s\" (with-temp-buffer (set-buffer-multibyte nil) (insert-file-contents-literally (getenv \"GZ\")) (zlib-decompress-region (point-min) (point-max)) (string-trim (buffer-string)))) r)' ' (princ (concat (mapconcat (function identity) (nreverse r) \", \") \"\\n\")))' > c.el && HOME=\"$t\" CERT=\"$t/cert.pem\" GZ=\"$t/z.gz\" P=\"$P\" timeout 60 \"$PREFIX/bin/emacs\" --batch -Q -l c.el > out 2> err && has -xF 'emacs 31.1, tls TLS1.3 bvs emacs, xml (a nil (b nil bvs)), sqlite 42, treesit t, json {\"a\":[1,2]}, bignum 515377520732011331036461129765621272702107522001, zlib bvs zlib' < out && echo \"GNU Emacs 31.1 (terminal): a TLS 1.3 echo through GnuTLS (gnutls-serv on port $P, certificate checked), libxml2, SQLite, tree-sitter, JSON, a bignum through GMP and zlib from emacs --batch\"; r=$?; [ $r = 0 ] || cat \"$t/out\" \"$t/err\" >&2; [ -f \"$t/pid\" ] && kill \"$(cat \"$t/pid\")\" 2>/dev/null; rm -rf -- \"${t:?}\"; exit $r" }