On Tuesday, 4 Aug 2015 at 17:09, Nicolas Goaziou wrote: [...]
> Not really, although I would write it like the following instead: > > (let ((output-type org-html-htmlize-output-type) > (font-prefix org-html-htmlize-font-prefix)) > (with-temp-buffer > ... > ;; Htmlize region. > (let ((org-html-htmlize-output-type output-type) > (org-html-htmlize-font-prefix font-prefix)) > (org-html-htmlize-region-for-paste > (point-min) (point-max))))) Thanks Nicolas. This works! (diffs attached) At least with the output type set as a local variable but not with #+bind which is perfectly fine as local variable use is what I would prefer. And thank you to Rasmus as well as I would imagine the suggested code changes would work as well. -- : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3beta-1315-ga3b2b7
diff --git a/lisp/ox-html.el b/lisp/ox-html.el index d454fab..82e3b76 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2041,25 +2041,29 @@ is the language used for CODE, as a string, or nil." ;; Case 2: Default. Fontify code. (t ;; htmlize - (setq code (with-temp-buffer - ;; Switch to language-specific mode. - (funcall lang-mode) - (insert code) - ;; Fontify buffer. - (font-lock-ensure) - ;; Remove formatting on newline characters. - (save-excursion - (let ((beg (point-min)) - (end (point-max))) - (goto-char beg) - (while (progn (end-of-line) (< (point) end)) - (put-text-property (point) (1+ (point)) 'face nil) - (forward-char 1)))) - (org-src-mode) - (set-buffer-modified-p nil) - ;; Htmlize region. - (org-html-htmlize-region-for-paste - (point-min) (point-max)))) + (let ((output-type org-html-htmlize-output-type) + (font-prefix org-html-htmlize-font-prefix)) + (setq code (with-temp-buffer + ;; Switch to language-specific mode. + (funcall lang-mode) + (insert code) + ;; Fontify buffer. + (font-lock-ensure) + ;; Remove formatting on newline characters. + (save-excursion + (let ((beg (point-min)) + (end (point-max))) + (goto-char beg) + (while (progn (end-of-line) (< (point) end)) + (put-text-property (point) (1+ (point)) 'face nil) + (forward-char 1)))) + (org-src-mode) + (set-buffer-modified-p nil) + ;; Htmlize region. + (let ((org-html-htmlize-output-type output-type) + (org-html-htmlize-font-prefix font-prefix)) + (org-html-htmlize-region-for-paste + (point-min) (point-max)))))) ;; Strip any enclosing <pre></pre> tags. (let* ((beg (and (string-match "\\`<pre[^>]*>\n*" code) (match-end 0))) (end (and beg (string-match "</pre>\\'" code))))