【问题标题】:ox-hugo github actions : Debugger entered--Lisp error: (void-function org-hugo-export-wim-to-md) Error: Process completed with exit code 255ox-hugo github 操作:调试器进入--Lisp 错误:(void-function org-hugo-export-wim-to-md) 错误:进程已完成,退出代码为 255
【发布时间】:2022-12-11 02:25:01
【问题描述】:
我正在尝试在 github 操作上部署我的 hugo 站点。我使用以下 github 操作执行以下操作:
1.在Ubuntu上
2.设置emacs
3.git克隆ox-hugo包
4.ox-hugo 包应该将我的 .org 文件转换为 .md
- 使用 Hugo 设置和构建并部署
https://gist.github.com/shwetarkadam/d890b7054b65fe21b63609ca03650bdc
我在第 4 步遇到问题,在 GitHub 操作中遇到以下错误:
Run emacs ./config.org --batch -L ./ox-hugo -L ox-hugo.el --eval="(org-hugo-export-wim-to-md t)" --kill
Debugger entered--Lisp error: (void-function org-hugo-export-wim-to-md)
(org-hugo-export-wim-to-md t)
eval((org-hugo-export-wim-to-md t) t)
command-line-1(("./config.org" "-L" "./ox-hugo" "-L" "ox-hugo.el" "--eval=(org-hugo-export-wim-to-md t)" "--kill"))
command-line()
normal-top-level()
到目前为止尝试过的方法:
- 将 (org-hugo-export-wim-to-md t) 更改为 (org-hugo-export-wim-to-md :all-subtrees)
- 在单引号和双引号中添加表达式 (org-hugo-export-wim-to-md :all-subtrees)。
【问题讨论】:
标签:
emacs
github-actions
hugo
【解决方案1】:
我今天碰巧正在处理类似的问题。我搜索了有关它的指导,然后偶然发现了Batch export of org-mode files from the command line,这使我找到了fniessen/orgmk,尤其是orgmk.el。
在我的 *scratch* 缓冲区中进行试验并向 Emacs 的各种帮助工具询问了几个问题后,我大刀阔斧地找到了一个包含 Emacs Lisp 代码的独立文件,该文件似乎独立于我的初始化文件工作。
$ touch export.el
$ emacs -q --batch -l export.el
Designating package sites
Designating package site melpa-stable => https://stable.melpa.org/packages/
Designating package site melpa => https://melpa.org/packages/
Designating package site gnu => https://elpa.gnu.org/packages/
Installing package ox-hugo
Setting ‘package-selected-packages’ temporarily since "emacs -q" would overwrite customizations
‘ox-hugo’ is already installed
Exporting org subtrees to hugo from content.org
1 files scanned, 0 files contains IDs, and 0 IDs found.
[ox-hugo] 1/ Exporting ‘Redacted site title’ ..
[ox-hugo] 2/ Exporting ‘Posts’ ..
[ox-hugo] 3/ Exporting ‘Redacted post title’ ..
[ox-hugo] Exported 3 subtrees from content.org in 0.510s (0.170s avg)
Exporting all org subtrees in all files in /redacted/directory
$ find content -newer export.el
content
content/_index.md
content/posts
content/posts/redacted-post-title.md
content/posts/_index.md
(有些名字已经更改以保护有罪的人,嗯,我的意思是无辜的。)
文件export.el 包含:
(defvar my/package-archives
(list
(cons "melpa-stable" "https://stable.melpa.org/packages/")
(cons "melpa" "https://melpa.org/packages/")
(cons "gnu" "https://elpa.gnu.org/packages/")))
(defvar my/packages-to-install '(ox-hugo))
(defun my/designate-package-site (site)
(message "Designating package site %s => %s" (car site) (cdr site))
(add-to-list 'package-archives site t))
(defun my/designate-package-sites ()
(message "Designating package sites")
(mapcar #'my/designate-package-site my/package-archives))
(defun my/install-package (pkg)
(message "Installing package %s" pkg)
(ignore-errors (package-install pkg)))
(when (locate-library "package")
(require 'package)
(my/designate-package-sites)
(package-initialize)
(unless package-archive-contents (package-refresh-contents))
(mapcar #'my/install-package my/packages-to-install))
(defun my/batch-ox-hugo-file (file)
(message "Exporting org subtrees to hugo from %s" file)
(let ((all-subtrees t)
(any-visibility nil))
(with-current-buffer (find-file-noselect file)
(org-hugo-export-wim-to-md all-subtrees any-visibility))))
(defun my/batch-ox-hugo-directory (directory)
(message "Exporting all org subtrees in all files in %s" directory
(let ((default-directory (expand-file-name directory)))
(mapcar #'my/batch-ox-hugo-file
(file-expand-wildcards "*.org")))))
(my/batch-ox-hugo-directory default-directory)
我开发这个的执行环境是Emacs 28.2 on FreeBSD 13.1。
我还没有尝试使用 Github Actions,但这是我的下一步。