mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-19 13:31:28 +02:00
eclass/elisp-common: Sync with Gentoo
It's from Gentoo commit 0da55ff6f4be98d9f9443c987fb7ee641f3ddeb2.
This commit is contained in:
parent
b38bba3218
commit
f0ac212c0e
@ -348,17 +348,51 @@ elisp-make-autoload-file() {
|
|||||||
eend $? "elisp-make-autoload-file: batch-update-autoloads failed" || die
|
eend $? "elisp-make-autoload-file: batch-update-autoloads failed" || die
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# @FUNCTION: elisp-org-export-to
|
||||||
|
# @USAGE: <export file type> <Org file path>
|
||||||
|
# @DESCRIPTION:
|
||||||
|
# Use Emacs Org "export-to" functions to convert a given Org file to a
|
||||||
|
# picked format.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# @CODE
|
||||||
|
# elisp-org-export-to texinfo README.org
|
||||||
|
# mv README.texi ${PN}.texi || die
|
||||||
|
# @CODE
|
||||||
|
|
||||||
|
elisp-org-export-to() {
|
||||||
|
local export_format="${1}"
|
||||||
|
local org_file_path="${2}"
|
||||||
|
|
||||||
|
local export_group
|
||||||
|
case ${export_format} in
|
||||||
|
info) export_group=texinfo ;; # Straight to ".info".
|
||||||
|
markdown) export_group=md ;;
|
||||||
|
pdf) export_group=latex ;;
|
||||||
|
*) export_group=${export_format} ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# export_format = texinfo => org-texinfo-export-to-texinfo
|
||||||
|
# export_format = pdf => org-latex-export-to-pdf
|
||||||
|
|
||||||
|
local export_function=org-${export_group}-export-to-${export_format}
|
||||||
|
|
||||||
|
${EMACS} ${EMACSFLAGS} "${org_file_path}" -f "${export_function}" \
|
||||||
|
|| die "Org export to ${export_format} failed"
|
||||||
|
}
|
||||||
|
|
||||||
# @FUNCTION: elisp-test-buttercup
|
# @FUNCTION: elisp-test-buttercup
|
||||||
# @USAGE: [test-subdirectory] [test-runner-opts] ...
|
# @USAGE: [test-subdirectory] [test-runner-opts] ...
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# Run ELisp package tests using the "buttercup" test runner.
|
# Run ELisp package tests using the "buttercup" test runner.
|
||||||
#
|
#
|
||||||
# The option "test-subdirectory" may be given any number of times, it should
|
# The option "test-subdirectory" may be given any number of times,
|
||||||
# be given as though it was passed to Emacs or the test tool, not as a string.
|
# it should be given as though it was passed to Emacs or the test tool,
|
||||||
|
# not as a string.
|
||||||
#
|
#
|
||||||
# The options "test-subdirectory" and "test-runner-opts" are optional,
|
# The options "test-subdirectory" and "test-runner-opts" are optional,
|
||||||
# but if "test-runner-opts" needs to be provided also "test-subdirectory" has
|
# but if "test-runner-opts" needs to be provided also "test-subdirectory"
|
||||||
# to be specified.
|
# has to be specified.
|
||||||
|
|
||||||
elisp-test-buttercup() {
|
elisp-test-buttercup() {
|
||||||
debug-print-function ${FUNCNAME} "$@"
|
debug-print-function ${FUNCNAME} "$@"
|
||||||
@ -382,12 +416,13 @@ elisp-test-buttercup() {
|
|||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# Run ELisp package tests using the "ert-runner" test runner.
|
# Run ELisp package tests using the "ert-runner" test runner.
|
||||||
#
|
#
|
||||||
# The option "test-subdirectory" may be given any number of times, it should
|
# The option "test-subdirectory" may be given any number of times,
|
||||||
# be given as though it was passed to Emacs or the test tool, not as a string.
|
# it should be given as though it was passed to Emacs or the test tool,
|
||||||
|
# not as a string.
|
||||||
#
|
#
|
||||||
# The options "test-subdirectory" and "test-runner-opts" are optional,
|
# The options "test-subdirectory" and "test-runner-opts" are optional,
|
||||||
# but if "test-runner-opts" needs to be provided also "test-subdirectory" has
|
# but if "test-runner-opts" needs to be provided also "test-subdirectory"
|
||||||
# to be specified.
|
# has to be specified.
|
||||||
|
|
||||||
elisp-test-ert-runner() {
|
elisp-test-ert-runner() {
|
||||||
debug-print-function ${FUNCNAME} "$@"
|
debug-print-function ${FUNCNAME} "$@"
|
||||||
@ -412,12 +447,13 @@ elisp-test-ert-runner() {
|
|||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# Run ELisp package tests using "ert", the Emacs's built-in test runner.
|
# Run ELisp package tests using "ert", the Emacs's built-in test runner.
|
||||||
#
|
#
|
||||||
# The option "test-subdirectory" may be given any number of times, it should
|
# The option "test-subdirectory" may be given any number of times,
|
||||||
# be given as though it was passed to Emacs or the test tool, not as a string.
|
# it should be given as though it was passed to Emacs or the test tool,
|
||||||
|
# not as a string.
|
||||||
#
|
#
|
||||||
# The options "test-subdirectory" and "test-runner-opts" are optional,
|
# The options "test-subdirectory" and "test-runner-opts" are optional,
|
||||||
# but if "test-runner-opts" needs to be provided also "test-subdirectory" has
|
# but if "test-runner-opts" needs to be provided also "test-subdirectory"
|
||||||
# to be specified.
|
# has to be specified.
|
||||||
|
|
||||||
elisp-test-ert() {
|
elisp-test-ert() {
|
||||||
debug-print-function ${FUNCNAME} "$@"
|
debug-print-function ${FUNCNAME} "$@"
|
||||||
@ -449,8 +485,8 @@ elisp-test-ert() {
|
|||||||
# @FUNCTION: elisp-enable-tests
|
# @FUNCTION: elisp-enable-tests
|
||||||
# @USAGE: [--optional] <test-runner> [test-runner-options] ...
|
# @USAGE: [--optional] <test-runner> [test-runner-options] ...
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# Set up IUSE, RESTRICT, BDEPEND and test runner function for running tests
|
# Set up IUSE, RESTRICT, BDEPEND and test runner function for running
|
||||||
# with the specified test runner.
|
# tests with the specified test runner.
|
||||||
#
|
#
|
||||||
# The test-runner argument must be one of:
|
# The test-runner argument must be one of:
|
||||||
#
|
#
|
||||||
@ -460,18 +496,19 @@ elisp-test-ert() {
|
|||||||
#
|
#
|
||||||
# - ert: for built-in GNU Emacs test utility
|
# - ert: for built-in GNU Emacs test utility
|
||||||
#
|
#
|
||||||
# If the "--optional" flag is passed (before specifying the test runner),
|
# If the "--optional" flag is passed (before specifying the test
|
||||||
# then it is assumed that the ELisp package is a part of some project that
|
# runner), then it is assumed that the ELisp package is a part of some
|
||||||
# optionally enables GNU Emacs support.
|
# some project that optionally enables GNU Emacs support. This will
|
||||||
# This will correctly set up the test and Emacs dependencies.
|
# correctly set up the test and Emacs dependencies.
|
||||||
#
|
#
|
||||||
# Notice that the fist option passed to the "test-runner" is the directory
|
# Notice that the first option passed to the "test-runner" is the
|
||||||
# and the rest are miscellaneous options applicable to that given runner.
|
# directory and the rest are miscellaneous options applicable to that
|
||||||
|
# given runner.
|
||||||
#
|
#
|
||||||
# This function has to be called post inherit, specifically after "IUSE",
|
# This function has to be called post inherit, specifically after
|
||||||
# "RESTRICT" and "BDEPEND" variables are assigned.
|
# "IUSE", "RESTRICT" and "BDEPEND" variables are assigned.
|
||||||
# It is advised to place this call right before (re)defining a given ebuild's
|
# It is advised to place this call right before (re)defining a given
|
||||||
# phases.
|
# ebuild's phases.
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# @CODE
|
# @CODE
|
||||||
@ -590,7 +627,13 @@ elisp-modules-install() {
|
|||||||
|
|
||||||
elisp-site-file-install() {
|
elisp-site-file-install() {
|
||||||
local sf="${1##*/}" my_pn="${2:-${PN}}" modules ret
|
local sf="${1##*/}" my_pn="${2:-${PN}}" modules ret
|
||||||
local header=";;; ${PN} site-lisp configuration"
|
local add_header="1 {
|
||||||
|
# Find first non-empty line
|
||||||
|
:x; /^\$/ { n; bx; }
|
||||||
|
# Insert a header, unless we already look at one
|
||||||
|
/^;.*${PN}/I! s/^/;;; ${PN} site-lisp configuration\n\n/
|
||||||
|
1 s/^/\n/
|
||||||
|
}"
|
||||||
|
|
||||||
[[ ${sf} == [0-9][0-9]*-gentoo*.el ]] \
|
[[ ${sf} == [0-9][0-9]*-gentoo*.el ]] \
|
||||||
|| ewarn "elisp-site-file-install: bad name of site-init file"
|
|| ewarn "elisp-site-file-install: bad name of site-init file"
|
||||||
@ -599,7 +642,7 @@ elisp-site-file-install() {
|
|||||||
ebegin "Installing site initialisation file for GNU Emacs"
|
ebegin "Installing site initialisation file for GNU Emacs"
|
||||||
[[ $1 == "${sf}" ]] || cp "$1" "${sf}"
|
[[ $1 == "${sf}" ]] || cp "$1" "${sf}"
|
||||||
modules=${EMACSMODULES//@libdir@/$(get_libdir)}
|
modules=${EMACSMODULES//@libdir@/$(get_libdir)}
|
||||||
sed -i -e "1{:x;/^\$/{n;bx;};/^;.*${PN}/I!s:^:${header}\n\n:;1s:^:\n:;}" \
|
sed -i -e "${add_header}" \
|
||||||
-e "s:@SITELISP@:${EPREFIX}${SITELISP}/${my_pn}:g" \
|
-e "s:@SITELISP@:${EPREFIX}${SITELISP}/${my_pn}:g" \
|
||||||
-e "s:@SITEETC@:${EPREFIX}${SITEETC}/${my_pn}:g" \
|
-e "s:@SITEETC@:${EPREFIX}${SITEETC}/${my_pn}:g" \
|
||||||
-e "s:@EMACSMODULES@:${EPREFIX}${modules}/${my_pn}:g;\$q" "${sf}"
|
-e "s:@EMACSMODULES@:${EPREFIX}${modules}/${my_pn}:g;\$q" "${sf}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user