diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/hugo-config.el | 4 | ||||
| -rw-r--r-- | modules/org-export-config.el | 2 | ||||
| -rw-r--r-- | modules/org-reveal-config.el | 11 | ||||
| -rw-r--r-- | modules/org-webclipper.el | 3 |
4 files changed, 20 insertions, 0 deletions
diff --git a/modules/hugo-config.el b/modules/hugo-config.el index 94be9dd5..7afa45a7 100644 --- a/modules/hugo-config.el +++ b/modules/hugo-config.el @@ -109,6 +109,8 @@ new file with Hugo front matter keywords pre-filled." ((env-macos-p) "open") ((env-windows-p) "explorer.exe") (t "xdg-open")))) + (unless (executable-find cmd) + (user-error "Cannot open blog dir: file-manager opener %S not found on PATH" cmd)) (start-process "hugo-file-manager" nil cmd cj/hugo-content-org-dir))) ;; ----------------------------- Draft Management ------------------------------ @@ -215,6 +217,8 @@ a template error), the sentinel reports the failure." (kill-process cj/hugo--preview-process) (setq cj/hugo--preview-process nil) (message "hugo server stopped")) + (unless (executable-find "hugo") + (user-error "Cannot start preview: hugo binary not found on PATH")) (let ((default-directory website-dir)) (setq cj/hugo--preview-process (start-process "hugo-server" "*hugo-server*" diff --git a/modules/org-export-config.el b/modules/org-export-config.el index 493316f9..5a6f09fc 100644 --- a/modules/org-export-config.el +++ b/modules/org-export-config.el @@ -98,6 +98,8 @@ (defun my/org-pandoc-export-to-pdf-and-open () "Export to PDF via pandoc and open with Zathura." (interactive) + (unless (executable-find "zathura") + (user-error "Cannot open the exported PDF: zathura is not installed or not on PATH")) (let ((pdf-file (org-pandoc-export-to-latex-pdf))) (when pdf-file (start-process "zathura-pdf" nil "zathura" pdf-file) diff --git a/modules/org-reveal-config.el b/modules/org-reveal-config.el index bc002276..be702bf7 100644 --- a/modules/org-reveal-config.el +++ b/modules/org-reveal-config.el @@ -129,6 +129,15 @@ Returns the number of lines removed." (delete-char 1))) removed)) +(defun cj/--reveal-ensure-root () + "Signal a `user-error' when the local reveal.js checkout is missing. +Export needs the clone at `cj/reveal-root', installed by +scripts/setup-reveal.sh. Without it the exporter produces a broken +presentation, so fail early with an actionable message." + (unless (file-directory-p cj/reveal-root) + (user-error "Local reveal.js not found at %s — run scripts/setup-reveal.sh" + cj/reveal-root))) + (defun cj/--reveal-preview-export-on-save () "Export current org buffer to reveal.js HTML silently. Intended for use as a buffer-local `after-save-hook'." @@ -152,6 +161,7 @@ Intended for use as a buffer-local `after-save-hook'." (interactive) (unless (derived-mode-p 'org-mode) (user-error "Not in an Org buffer")) + (cj/--reveal-ensure-root) (let ((html-file (org-reveal-export-to-html))) (when html-file (browse-url-of-file html-file) @@ -164,6 +174,7 @@ re-export silently; refresh the browser to see changes." (interactive) (unless (derived-mode-p 'org-mode) (user-error "Not in an Org buffer")) + (cj/--reveal-ensure-root) (add-hook 'after-save-hook #'cj/--reveal-preview-export-on-save nil t) (let ((html-file (org-reveal-export-to-html))) (when html-file diff --git a/modules/org-webclipper.el b/modules/org-webclipper.el index 9c2f1061..99e837e6 100644 --- a/modules/org-webclipper.el +++ b/modules/org-webclipper.el @@ -168,6 +168,9 @@ It fetches the page content and converts it to Org format." ;; and fail with a `void-variable widget-field-keymap' error from ;; the customize machinery loading lazily. (require 'org-web-tools) + (unless (executable-find "pandoc") + (user-error + "pandoc not found on PATH; it is required to convert the clipped page to Org")) (setq org-web-tools-pandoc-sleep-time 0.5) (let ((url cj/--webclip-url) |
