Revert "Move auto-export on save stuff to new ox-hugo-sugar.el"

This reverts commit 4e93151345.

This move needs to be better planned out.. this commit broke
auto-loading of ox-hugo using org-hugo-export-wim-to-md-after-save.
master
Kaushal Modi 8 years ago
parent 0e9c312cdd
commit 358929bc6e
  1. 44
      ox-hugo-sugar.el
  2. 30
      ox-hugo.el

@ -1,44 +0,0 @@
;;; ox-hugo-sugar.el --- Sugar functions to improve ox-hugo experience -*- lexical-binding: t -*-
;; Authors: Kaushal Modi <kaushal.mod@gmail.com>
;; URL: https://ox-hugo.scripter.co
;;; Commentary:
;; *This is NOT a stand-alone package.*
;;
;; It is used by ox-hugo.
;;; Code:
(defvar org-hugo-allow-export-after-save t
"Enable flag for `org-hugo-export-wim-to-md-after-save'.
When nil, the above function will not export the Org file to
Hugo-compatible Markdown.
This variable is usually set to nil by the user in
`org-capture-before-finalize-hook' and set to t again in
`org-capture-after-finalize-hook', so that the export does not
happen as soon as a new post is created using Org capture.
Note that the export after save will not work until
`org-hugo-export-wim-to-md-after-save' is added to the
`after-save-hook' by the user.")
;;;###autoload
(defun org-hugo-export-wim-to-md-after-save ()
"Fn for `after-save-hook' to run `org-hugo-export-wim-to-md'.
The export is also skipped if `org-hugo-allow-export-after-save'
is nil. This variable is intended to be toggled dynamically in
`org-capture-before-finalize-hook' and
`org-capture-after-finalize-hook' hooks. See the Auto-export on
Saving section in this package's documentation for an example."
(save-excursion
(when org-hugo-allow-export-after-save
(org-hugo-export-wim-to-md))))
(provide 'ox-hugo-sugar)
;;; ox-hugo-sugar.el ends here

@ -77,10 +77,9 @@
(require 'ob-core) ;For `org-babel-parse-header-arguments'
(declare-function org-hugo-pandoc-cite--parse-citations-maybe "ox-hugo-pandoc-cite")
(require 'ox-hugo-sugar)
(defvar ffap-url-regexp) ;Silence byte-compiler
;; Using the correct function for getting inherited Org tags.
;; Starting Org 9.2, `org-get-tags' returns all the inherited tags
;; instead of returning only the local tags i.e. only the current
@ -137,6 +136,20 @@ Pandoc understands meta-data only in YAML format. So when Pandoc
Citations are enabled, Pandoc is handed over the file with this
YAML front-matter.")
(defvar org-hugo-allow-export-after-save t
"Enable flag for `org-hugo-export-wim-to-md-after-save'.
When nil, the above function will not export the Org file to
Hugo-compatible Markdown.
This variable is usually set to nil by the user in
`org-capture-before-finalize-hook' and set to t again in
`org-capture-after-finalize-hook', so that the export does not
happen as soon as a new post is created using Org capture.
Note that the export after save will not work until
`org-hugo-export-wim-to-md-after-save' is added to the
`after-save-hook' by the user.")
(defvar org-hugo-blackfriday-options
'("taskLists"
"smartypants"
@ -3649,6 +3662,19 @@ approach)."
(when do-export
(org-hugo-export-to-md async subtree visible-only)))))))))
;;;###autoload
(defun org-hugo-export-wim-to-md-after-save ()
"Fn for `after-save-hook' to run `org-hugo-export-wim-to-md'.
The export is also skipped if `org-hugo-allow-export-after-save'
is nil. This variable is intended to be toggled dynamically in
`org-capture-before-finalize-hook' and
`org-capture-after-finalize-hook' hooks. See the Auto-export on
Saving section in this package's documentation for an example."
(save-excursion
(when org-hugo-allow-export-after-save
(org-hugo-export-wim-to-md))))
;;;###autoload
(defun org-hugo-debug-info ()
"Get Emacs, Org and Hugo version and ox-hugo customization info.

Loading…
Cancel
Save