sd-quick-export *chef's kiss*

Commit
88761b748c7ecd2145c86d1d2c3f69fb6932b605
Author
Marius Peter <marius.peter@tutanota.com>
Author date
Committer
Marius Peter <marius.peter@tutanota.com>
Committer date
smart-documents.org
index e7247588..ddc05917 100644..100644
@@ -1296,7 +1296,16 @@
1296 1296 This reimplements the most common Org mode export: Org \rightarrow
1297 1297 LaTeX \rightarrow PDF. The binding is defined in Section [[Export to
1298 1298 PDF]].
1299 Added: This series of ~quick-export~ functions have one objective: harmonize
1300 Added: the export of Emacs buffers to PDF. Org mode does this by design; we
1301 Added: describe additional exports for other modes, most notably Nroff mode
1302 Added: and Ledger mode.
1299 1303
1304 Added: *** From Org mode
1305 Added:
1306 Added: This reimplements the most common Org mode export: Org \rightarrow LaTeX \rightarrow
1307 Added: PDF. The binding is defined in Section [[Export to PDF]].
1308 Added:
1300 1309 #+BEGIN_SRC emacs-lisp :tangle yes
1301 1310 (defun sd-quick-export--org ()
1302 1311 "Org mode async export to PDF and open.
@@ -1318,14 +1327,38 @@
1318 1327 (newline)
1319 1328 (setq more-lines-p (= 0 (forward-line 1))))
1320 1329 (org-open-file (org-latex-export-to-pdf)))))
1330 Added: #+END_SRC
1321 1331
1332 Added: *** From Nroff mode
1333 Added:
1334 Added: #+BEGIN_SRC emacs-lisp :tangle yes
1335 Added: (defun sd-quick-export--nroff (macros)
1336 Added: "Export Nroff/Groff buffer to PDF, with specified macro set."
1337 Added: (let* ((file-exported-name
1338 Added: (concat (file-name-sans-extension buffer-file-name)
1339 Added: (format "-%s.pdf" macros)))
1340 Added: (command-export
1341 Added: (format "groff -%s -Tps %s | ps2pdf - > %s"
1342 Added: macros
1343 Added: (buffer-file-name)
1344 Added: file-exported-name)))
1345 Added: (shell-command command-export)
1346 Added: (org-open-file file-exported-name)))
1347 Added: #+END_SRC
1348 Added:
1349 Added: *** Quick export
1350 Added:
1351 Added: #+BEGIN_SRC emacs-lisp :tangle yes
1322 1352 (defun sd-quick-export ()
1323 1353 "Quickly prettify and export current buffer to PDF."
1324 1354 (interactive)
1325 1355 (cond ((eq major-mode 'org-mode)
1326 1356 (sd-quick-export--org))
1357 Added: ((eq major-mode 'nroff-mode)
1358 Added: (sd-quick-export--nroff
1359 Added: (read-string "Macro set used (ms, me, mm...): ")))
1327 1360 ((eq major-mode 'emacs-lisp-mode)
1328 Removed: (message "No quick-export implemented yet."))
1361 Added: (message "No quick-export implemented for emacs-lisp-mode yet."))
1329 1362 ((eq major-mode 'ledger-report-mode)
1330 1363 (sd-quick-export--ledger-report))
1331 1364 (t (message (format "No sd-quick-export backend for %s."