From f2fd1851753c8727407d794e63ebe91a01426c05 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 6 Apr 2013 17:31:56 +0200 Subject: [PATCH] ox: Inhibit startup process when calling `org-mode' * lisp/ox.el (org-export--get-inbuffer-options, org-export--list-bound-variables, org-export--generate-copy-script, org-export-string-as, org-export-expand-include-keyword, org-export--prepare-file-contents): Inhibit startup process when calling `org-mode'. --- lisp/ox.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index e2c1b5b7a..cf569b5a5 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -1623,7 +1623,7 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored." (unless (member file files) (with-temp-buffer (insert (org-file-contents file 'noerror)) - (org-mode) + (let ((org-inhibit-startup t)) (org-mode)) (setq plist (funcall get-options (cons file files) plist)))))) ((equal key "OPTIONS") @@ -1754,7 +1754,7 @@ an alist where associations are (VARIABLE-NAME VALUE)." (org-remove-double-quotes val)))) (unless (member file files) (with-temp-buffer - (org-mode) + (let ((org-inhibit-startup t)) (org-mode)) (insert (org-file-contents file 'noerror)) (setq alist (funcall collect-bind @@ -2811,7 +2811,7 @@ The function assumes BUFFER's major mode is `org-mode'." (let ((inhibit-modification-hooks t)) ;; Set major mode. Ignore `org-mode-hook' as it has been run ;; already in BUFFER. - (let ((org-mode-hook nil)) (org-mode)) + (let ((org-mode-hook nil) (org-inhibit-startup t)) (org-mode)) ;; Copy specific buffer local variables and variables set ;; through BIND keywords. ,@(let ((bound-variables (org-export--list-bound-variables)) @@ -3053,7 +3053,7 @@ still inferior to file-local settings. Return code as a string." (with-temp-buffer (insert string) - (org-mode) + (let ((org-inhibit-startup t)) (org-mode)) (org-export-as backend nil nil body-only ext-plist))) ;;;###autoload @@ -3278,7 +3278,7 @@ paths." (t (insert (with-temp-buffer - (org-mode) + (let ((org-inhibit-startup t)) (org-mode)) (insert (org-export--prepare-file-contents file lines ind minlevel)) (org-export-expand-include-keyword @@ -3330,7 +3330,8 @@ file should have." ;; If IND is set, preserve indentation of include keyword until ;; the first headline encountered. (when ind - (unless (eq major-mode 'org-mode) (org-mode)) + (unless (eq major-mode 'org-mode) + (let ((org-inhibit-startup t)) (org-mode))) (goto-char (point-min)) (let ((ind-str (make-string ind ? ))) (while (not (or (eobp) (looking-at org-outline-regexp-bol))) @@ -3344,7 +3345,8 @@ file should have." ;; in the file (CUR-MIN), and remove stars to each headline so ;; that headlines with minimal level have a level of MINLEVEL. (when minlevel - (unless (eq major-mode 'org-mode) (org-mode)) + (unless (eq major-mode 'org-mode) + (let ((org-inhibit-startup t)) (org-mode))) (org-with-limited-levels (let ((levels (org-map-entries (lambda () (org-reduced-level (org-current-level))))))