summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--smart-documents.org35
1 files changed, 34 insertions, 1 deletions
diff --git a/smart-documents.org b/smart-documents.org
index e724758..ddc0591 100644
--- a/smart-documents.org
+++ b/smart-documents.org
@@ -1296,6 +1296,15 @@ later keybinding definitions for two reasons:
This reimplements the most common Org mode export: Org \rightarrow
LaTeX \rightarrow PDF. The binding is defined in Section [[Export to
PDF]].
+This series of ~quick-export~ functions have one objective: harmonize
+the export of Emacs buffers to PDF. Org mode does this by design; we
+describe additional exports for other modes, most notably Nroff mode
+and Ledger mode.
+
+*** From Org mode
+
+This reimplements the most common Org mode export: Org \rightarrow LaTeX \rightarrow
+PDF. The binding is defined in Section [[Export to PDF]].
#+BEGIN_SRC emacs-lisp :tangle yes
(defun sd-quick-export--org ()
@@ -1318,14 +1327,38 @@ PDF]].
(newline)
(setq more-lines-p (= 0 (forward-line 1))))
(org-open-file (org-latex-export-to-pdf)))))
+#+END_SRC
+*** From Nroff mode
+
+#+BEGIN_SRC emacs-lisp :tangle yes
+ (defun sd-quick-export--nroff (macros)
+ "Export Nroff/Groff buffer to PDF, with specified macro set."
+ (let* ((file-exported-name
+ (concat (file-name-sans-extension buffer-file-name)
+ (format "-%s.pdf" macros)))
+ (command-export
+ (format "groff -%s -Tps %s | ps2pdf - > %s"
+ macros
+ (buffer-file-name)
+ file-exported-name)))
+ (shell-command command-export)
+ (org-open-file file-exported-name)))
+#+END_SRC
+
+*** Quick export
+
+#+BEGIN_SRC emacs-lisp :tangle yes
(defun sd-quick-export ()
"Quickly prettify and export current buffer to PDF."
(interactive)
(cond ((eq major-mode 'org-mode)
(sd-quick-export--org))
+ ((eq major-mode 'nroff-mode)
+ (sd-quick-export--nroff
+ (read-string "Macro set used (ms, me, mm...): ")))
((eq major-mode 'emacs-lisp-mode)
- (message "No quick-export implemented yet."))
+ (message "No quick-export implemented for emacs-lisp-mode yet."))
((eq major-mode 'ledger-report-mode)
(sd-quick-export--ledger-report))
(t (message (format "No sd-quick-export backend for %s."
Copyright 2019--2024 Marius PETER