From f3471ff11210507b38c09f0e57df1bd601f629a5 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 26 Aug 2023 09:56:45 +0100 Subject: gentoo auto-resync : 26:08:2023 - 09:56:44 --- eclass/Manifest.gz | Bin 38509 -> 38496 bytes eclass/elisp-common.eclass | 95 ++++++++++++++++++++++++++++++++------------- 2 files changed, 69 insertions(+), 26 deletions(-) (limited to 'eclass') diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz index 38832690c610..504414ada6f5 100644 Binary files a/eclass/Manifest.gz and b/eclass/Manifest.gz differ diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass index 1958b4a07e18..a40c9f63007d 100644 --- a/eclass/elisp-common.eclass +++ b/eclass/elisp-common.eclass @@ -348,17 +348,51 @@ elisp-make-autoload-file() { eend $? "elisp-make-autoload-file: batch-update-autoloads failed" || die } +# @FUNCTION: elisp-org-export-to +# @USAGE: +# @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 # @USAGE: [test-subdirectory] [test-runner-opts] ... # @DESCRIPTION: # Run ELisp package tests using the "buttercup" test runner. # -# The option "test-subdirectory" may be given any number of times, it should -# be given as though it was passed to Emacs or the test tool, not as a string. +# The option "test-subdirectory" may be given any number of times, +# 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, -# but if "test-runner-opts" needs to be provided also "test-subdirectory" has -# to be specified. +# but if "test-runner-opts" needs to be provided also "test-subdirectory" +# has to be specified. elisp-test-buttercup() { debug-print-function ${FUNCNAME} "$@" @@ -382,12 +416,13 @@ elisp-test-buttercup() { # @DESCRIPTION: # Run ELisp package tests using the "ert-runner" test runner. # -# The option "test-subdirectory" may be given any number of times, it should -# be given as though it was passed to Emacs or the test tool, not as a string. +# The option "test-subdirectory" may be given any number of times, +# 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, -# but if "test-runner-opts" needs to be provided also "test-subdirectory" has -# to be specified. +# but if "test-runner-opts" needs to be provided also "test-subdirectory" +# has to be specified. elisp-test-ert-runner() { debug-print-function ${FUNCNAME} "$@" @@ -412,12 +447,13 @@ elisp-test-ert-runner() { # @DESCRIPTION: # 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 -# be given as though it was passed to Emacs or the test tool, not as a string. +# The option "test-subdirectory" may be given any number of times, +# 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, -# but if "test-runner-opts" needs to be provided also "test-subdirectory" has -# to be specified. +# but if "test-runner-opts" needs to be provided also "test-subdirectory" +# has to be specified. elisp-test-ert() { debug-print-function ${FUNCNAME} "$@" @@ -449,8 +485,8 @@ elisp-test-ert() { # @FUNCTION: elisp-enable-tests # @USAGE: [--optional] [test-runner-options] ... # @DESCRIPTION: -# Set up IUSE, RESTRICT, BDEPEND and test runner function for running tests -# with the specified test runner. +# Set up IUSE, RESTRICT, BDEPEND and test runner function for running +# tests with the specified test runner. # # The test-runner argument must be one of: # @@ -460,18 +496,19 @@ elisp-test-ert() { # # - ert: for built-in GNU Emacs test utility # -# If the "--optional" flag is passed (before specifying the test runner), -# then it is assumed that the ELisp package is a part of some project that -# optionally enables GNU Emacs support. -# This will correctly set up the test and Emacs dependencies. +# If the "--optional" flag is passed (before specifying the test +# runner), then it is assumed that the ELisp package is a part of some +# some project that optionally enables GNU Emacs support. This will +# correctly set up the test and Emacs dependencies. # -# Notice that the fist option passed to the "test-runner" is the directory -# and the rest are miscellaneous options applicable to that given runner. +# Notice that the fist option passed to the "test-runner" is the +# directory and the rest are miscellaneous options applicable to that +# given runner. # -# This function has to be called post inherit, specifically after "IUSE", -# "RESTRICT" and "BDEPEND" variables are assigned. -# It is advised to place this call right before (re)defining a given ebuild's -# phases. +# This function has to be called post inherit, specifically after +# "IUSE", "RESTRICT" and "BDEPEND" variables are assigned. +# It is advised to place this call right before (re)defining a given +# ebuild's phases. # # Example: # @CODE @@ -590,7 +627,13 @@ elisp-modules-install() { elisp-site-file-install() { 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 ]] \ || 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" [[ $1 == "${sf}" ]] || cp "$1" "${sf}" 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:@SITEETC@:${EPREFIX}${SITEETC}/${my_pn}:g" \ -e "s:@EMACSMODULES@:${EPREFIX}${modules}/${my_pn}:g;\$q" "${sf}" -- cgit v1.2.3