# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=emacs-howdoyou
pkgver=0_git20230927
_gitrev=10f31a10803c3fd4c304f3a4495d57a0b9cf9ab5
pkgrel=0
_pkgreal=howdoyou
pkgdesc="Search StackOverflow & display results in an Org-mode buffer"
url="https://github.com/thanhvg/emacs-howdoyou"
arch="noarch"
license="GPL-3.0-or-later"
depends="
	cmd:emacs
	emacs-promise
	emacs-request
	"
makedepends="emacs-nox"
checkdepends="
	cmd:curl
	emacs-ert-async
	emacs-f
	"
source="https://github.com/thanhvg/emacs-howdoyou/archive/$_gitrev/emacs-howdoyou-$_gitrev.tar.gz
	dont-test-against-google.patch
	"
builddir="$srcdir/$pkgname-$_gitrev"
options="!check" # tests may fail due to cloudflare protection

build() {
	emacs -batch -q -no-site-file -L . \
		-f batch-byte-compile \
		./*.el
}

check() {
	emacs -batch -q -no-site-file -L . -L test \
		-l test-helper -l howdoyou-test \
		-f ert-run-tests-batch-and-exit
}

package() {
	install -Dvm644 ./*.el ./*.elc \
		-t "$pkgdir"/usr/share/emacs/site-lisp/

	cd "$pkgdir"/usr/share/emacs/site-lisp
	emacs -batch -q -no-site-file \
		-eval "(loaddefs-generate \".\" \"$_pkgreal-loaddefs.el\")"
}

sha512sums="
e5b763e0078eb53e1f21434df037ae7f9b56a5e88ba157ac147056c2af3653b229ebceee88153e98e84699dae60366de4c8d64e68f74100c3ce04038f282d91b  emacs-howdoyou-10f31a10803c3fd4c304f3a4495d57a0b9cf9ab5.tar.gz
c5eb2d7d87b865fae34c203397cb630060db0bd8bb5da553c2241d7f896c5685fe9117bb4002ab5700980b584924ee1c22c87a458833c6b4ac71a8534f2367f5  dont-test-against-google.patch
"
