From 958cd5079447ba314baecb8429042942ff1b155e Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sun, 8 Nov 2020 18:02:53 -0600 Subject: [PATCH] Meta: Update makem.sh --- makem.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/makem.sh b/makem.sh index 91c3000..d110e2c 100755 --- a/makem.sh +++ b/makem.sh @@ -397,6 +397,27 @@ function ert-tests-p { grep "(ert-deftest" "${files_project_test[@]}" &>/dev/null } +function package-main-file { + # Echo the package's main file. Helpful for setting package-lint-main-file. + + file_pkg=$(git ls-files ./*-pkg.el 2>/dev/null) + + if [[ $file_pkg ]] + then + # Use *-pkg.el file if it exists. + echo "$file_pkg" + else + # Use shortest filename (a sloppy heuristic that will do for now). + for file in "${files_project_feature[@]}" + do + echo ${#file} "$file" + done \ + | sort -h \ + | head -n1 \ + | sed -r 's/^[[:digit:]]+ //' + fi +} + function dependencies { # Echo list of package dependencies. @@ -781,6 +802,7 @@ function lint-package { run_emacs \ --load package-lint \ + --eval "(setq package-lint-main-file \"$(package-main-file)\")" \ --funcall package-lint-batch-and-exit \ "${files_project_feature[@]}" \ && success "Linting package finished without errors." \ @@ -1022,6 +1044,7 @@ debug "EXCLUDING FILES: ${files_exclude[@]}" debug "FEATURE FILES: ${files_project_feature[@]}" debug "TEST FILES: ${files_project_test[@]}" debug "BYTE-COMPILE FILES: ${files_project_byte_compile[@]}" +debug "PACKAGE-MAIN-FILE: $(package-main-file)" if ! [[ ${files_project_feature[@]} ]] then