Skip to content

Commit

Permalink
moved major mode selecting to a separate function
Browse files Browse the repository at this point in the history
  • Loading branch information
DoMiNela10 committed Sep 25, 2016
1 parent 24d48e9 commit 9f56bb1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ox-sfhp.el
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,11 @@ exist."
org-sfhp-protected-characters)
text)

(defun org-sfhp-run-appropriate-mode ()
(if (fboundp 'web-mode)
(web-mode) ; web-mode is better at indenting
(set-auto-mode t)))

;;; export functions
;;;###autoload
(defun org-sfhp-export-to-buffer
Expand All @@ -667,9 +672,8 @@ exist."
(interactive)
(org-export-to-buffer 'sfhp "*Org SFHP Export*"
async subtreep visible-only body-only ext-plist
(lambda () (if (fboundp 'web-mode)
(web-mode)
(set-auto-mode t)))))
'org-sfhp-run-appropriate-mode))


;;;###autoload
(defun org-sfhp-export-to-file
Expand Down Expand Up @@ -703,9 +707,7 @@ and open it."
"Intent filter for ox-sfhp."
(with-temp-buffer
(insert contents)
(if (fboundp 'web-mode) ; web-mode is better at indenting multi-language HTML files
(web-mode)
(set-auto-mode t))
(org-sfhp-run-appropriate-mode)
(indent-region (point-min) (point-max))
(buffer-substring-no-properties (point-min) (point-max))))

Expand Down

0 comments on commit 9f56bb1

Please sign in to comment.