emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [bug] "Invalid face" when exporting code block to HTML
@ 2012-01-05 22:06 Sebastien Vauban
  2012-01-05 23:18 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastien Vauban @ 2012-01-05 22:06 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

Not a good day for me, today...

* Summary

Quite "simple": the following block generates an "Invalid face" error when
exported to HTML.

#+begin_src sh
svn checkout http://svn/trunk/dev/ mydev
#+end_src

This worked yesterday. Does it ring a bell to someone? Could some recent
commit be responsible of this?

* Version info

GNU Emacs 24.0.92.1 (i386-mingw-nt5.1.2600) of 2011-12-07 on MARVIN

Org-mode version 7.8.03 (release_7.8.03.31.g28541)

* Backtrace

#+begin_src emacs-lisp
Debugger entered--Lisp error: (error "Invalid face")
  internal-get-lisp-face-attribute(nil :height nil)
  face-attribute(nil :height)
  (setq h (face-attribute f :height))
  (while (progn (setq f (if --cl-var-- face (face-attribute f :inherit))) (not (eq f (quote unspecified)))) (setq h (face-attribute f :height)) (push (if (eq h (quote unspecified)) nil h) --cl-var--) (setq --cl-var-- nil))
  (let* ((f nil) (h nil) (--cl-var-- nil) (--cl-var-- t)) (while (progn (setq f (if --cl-var-- face (face-attribute f :inherit))) (not (eq f (quote unspecified)))) (setq h (face-attribute f :height)) (push (if (eq h (quote unspecified)) nil h) --cl-var--) (setq --cl-var-- nil)) (nreverse --cl-var--))
  (catch (quote --cl-block-nil--) (let* ((f nil) (h nil) (--cl-var-- nil) (--cl-var-- t)) (while (progn (setq f (if --cl-var-- face (face-attribute f :inherit))) (not (eq f (quote unspecified)))) (setq h (face-attribute f :height)) (push (if (eq h (quote unspecified)) nil h) --cl-var--) (setq --cl-var-- nil)) (nreverse --cl-var--)))
  (cl-block-wrapper (catch (quote --cl-block-nil--) (let* ((f nil) (h nil) (--cl-var-- nil) (--cl-var-- t)) (while (progn (setq f (if --cl-var-- face (face-attribute f :inherit))) (not (eq f (quote unspecified)))) (setq h (face-attribute f :height)) (push (if (eq h (quote unspecified)) nil h) --cl-var--) (setq --cl-var-- nil)) (nreverse --cl-var--))))
  (block nil (let* ((f nil) (h nil) (--cl-var-- nil) (--cl-var-- t)) (while (progn (setq f (if --cl-var-- face (face-attribute f :inherit))) (not (eq f (quote unspecified)))) (setq h (face-attribute f :height)) (push (if (eq h (quote unspecified)) nil h) --cl-var--) (setq --cl-var-- nil)) (nreverse --cl-var--)))
  (loop for f = face then (face-attribute f :inherit) until (eq f (quote unspecified)) for h = (face-attribute f :height) collect (if (eq h (quote unspecified)) nil h))
  (let ((size-list (loop for f = face then (face-attribute f :inherit) until (eq f (quote unspecified)) for h = (face-attribute f :height) collect (if (eq h (quote unspecified)) nil h)))) (reduce (quote htmlize-merge-size) (cons nil size-list)))
  htmlize-face-size(default)
  (let ((size (htmlize-face-size face))) (unless (eql size 1.0) (setf (htmlize-fstruct-size fstruct) size)))
  (cond (htmlize-running-xemacs (let* ((font-instance (face-font-instance face)) (props (font-instance-properties font-instance))) (when (equalp (cdr (assq (quote WEIGHT_NAME) props)) "bold") (setf (htmlize-fstruct-boldp fstruct) t)) (when (or (equalp (cdr (assq ... props)) "i") (equalp (cdr (assq ... props)) "o")) (setf (htmlize-fstruct-italicp fstruct) t)) (setf (htmlize-fstruct-strikep fstruct) (face-strikethru-p face)) (setf (htmlize-fstruct-underlinep fstruct) (face-underline-p face)))) ((fboundp (quote face-attribute)) (dolist (attr (quote (:weight :slant :underline :overline :strike-through))) (let ((value (if (>= emacs-major-version 22) (face-attribute face attr nil t) (let ... ... ...)))) (when (and value (not (eq value ...))) (htmlize-face-emacs21-attr fstruct attr value)))) (let ((size (htmlize-face-size face))) (unless (eql size 1.0) (setf (htmlize-fstruct-size fstruct) size)))) (t (when (fboundp (quote face-bold-p)) (setf (htmlize-fstruct-boldp fstruct) (face-bold-p face))) (when (fboundp (quote face-italic-p)) (setf (htmlize-fstruct-italicp fstruct) (face-italic-p face))) (setf (htmlize-fstruct-underlinep fstruct) (face-underline-p face))))
  (let ((fstruct (make-htmlize-fstruct :foreground (htmlize-color-to-rgb (htmlize-face-foreground face)) :background (htmlize-color-to-rgb (htmlize-face-background face))))) (cond (htmlize-running-xemacs (let* ((font-instance (face-font-instance face)) (props (font-instance-properties font-instance))) (when (equalp (cdr (assq ... props)) "bold") (setf (htmlize-fstruct-boldp fstruct) t)) (when (or (equalp (cdr ...) "i") (equalp (cdr ...) "o")) (setf (htmlize-fstruct-italicp fstruct) t)) (setf (htmlize-fstruct-strikep fstruct) (face-strikethru-p face)) (setf (htmlize-fstruct-underlinep fstruct) (face-underline-p face)))) ((fboundp (quote face-attribute)) (dolist (attr (quote (:weight :slant :underline :overline :strike-through))) (let ((value (if ... ... ...))) (when (and value (not ...)) (htmlize-face-emacs21-attr fstruct attr value)))) (let ((size (htmlize-face-size face))) (unless (eql size 1.0) (setf (htmlize-fstruct-size fstruct) size)))) (t (when (fboundp (quote face-bold-p)) (setf (htmlize-fstruct-boldp fstruct) (face-bold-p face))) (when (fboundp (quote face-italic-p)) (setf (htmlize-fstruct-italicp fstruct) (face-italic-p face))) (setf (htmlize-fstruct-underlinep fstruct) (face-underline-p face)))) (setf (htmlize-fstruct-css-name fstruct) (let ((name (downcase (symbol-name face)))) (when (string-match "\\`font-lock-" name) (setq name (replace-match "" t t name))) (when (string-match "-face\\'" name) (setq name (replace-match "" t t name))) (while (string-match "[^-a-zA-Z0-9]" name) (setq name (replace-match "X" t t name))) (when (string-match "\\`[-0-9]" name) (setq name (concat "X" name))) (when (equal name "") (setq name "face")) (setq name (concat htmlize-css-name-prefix name)) name)) fstruct)
  htmlize-face-to-fstruct(default)
  (if (symbolp face) (htmlize-face-to-fstruct face) (htmlize-attrlist-to-fstruct face))
  (let ((fstruct (if (symbolp face) (htmlize-face-to-fstruct face) (htmlize-attrlist-to-fstruct face)))) (setf (gethash face face-map) fstruct) (let* ((css-name (htmlize-fstruct-css-name fstruct)) (new-name css-name) (i 0)) (while (member new-name css-names) (setq new-name (format "%s-%s" css-name (incf i)))) (unless (equal new-name css-name) (setf (htmlize-fstruct-css-name fstruct) new-name)) (push new-name css-names)))
  (if (gethash face face-map) nil (let ((fstruct (if (symbolp face) (htmlize-face-to-fstruct face) (htmlize-attrlist-to-fstruct face)))) (setf (gethash face face-map) fstruct) (let* ((css-name (htmlize-fstruct-css-name fstruct)) (new-name css-name) (i 0)) (while (member new-name css-names) (setq new-name (format "%s-%s" css-name (incf i)))) (unless (equal new-name css-name) (setf (htmlize-fstruct-css-name fstruct) new-name)) (push new-name css-names))))
  (unless (gethash face face-map) (let ((fstruct (if (symbolp face) (htmlize-face-to-fstruct face) (htmlize-attrlist-to-fstruct face)))) (setf (gethash face face-map) fstruct) (let* ((css-name (htmlize-fstruct-css-name fstruct)) (new-name css-name) (i 0)) (while (member new-name css-names) (setq new-name (format "%s-%s" css-name (incf i)))) (unless (equal new-name css-name) (setf (htmlize-fstruct-css-name fstruct) new-name)) (push new-name css-names))))
  (while --cl-dolist-temp-- (setq face (car --cl-dolist-temp--)) (unless (gethash face face-map) (let ((fstruct (if (symbolp face) (htmlize-face-to-fstruct face) (htmlize-attrlist-to-fstruct face)))) (setf (gethash face face-map) fstruct) (let* ((css-name (htmlize-fstruct-css-name fstruct)) (new-name css-name) (i 0)) (while (member new-name css-names) (setq new-name (format "%s-%s" css-name (incf i)))) (unless (equal new-name css-name) (setf (htmlize-fstruct-css-name fstruct) new-name)) (push new-name css-names)))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--)))
  (let ((--cl-dolist-temp-- faces) face) (while --cl-dolist-temp-- (setq face (car --cl-dolist-temp--)) (unless (gethash face face-map) (let ((fstruct (if (symbolp face) (htmlize-face-to-fstruct face) (htmlize-attrlist-to-fstruct face)))) (setf (gethash face face-map) fstruct) (let* ((css-name (htmlize-fstruct-css-name fstruct)) (new-name css-name) (i 0)) (while (member new-name css-names) (setq new-name (format "%s-%s" css-name ...))) (unless (equal new-name css-name) (setf (htmlize-fstruct-css-name fstruct) new-name)) (push new-name css-names)))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))))
  (catch (quote --cl-block-nil--) (let ((--cl-dolist-temp-- faces) face) (while --cl-dolist-temp-- (setq face (car --cl-dolist-temp--)) (unless (gethash face face-map) (let ((fstruct (if ... ... ...))) (setf (gethash face face-map) fstruct) (let* ((css-name ...) (new-name css-name) (i 0)) (while (member new-name css-names) (setq new-name ...)) (unless (equal new-name css-name) (setf ... new-name)) (push new-name css-names)))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--)))))
  (cl-block-wrapper (catch (quote --cl-block-nil--) (let ((--cl-dolist-temp-- faces) face) (while --cl-dolist-temp-- (setq face (car --cl-dolist-temp--)) (unless (gethash face face-map) (let ((fstruct ...)) (setf (gethash face face-map) fstruct) (let* (... ... ...) (while ... ...) (unless ... ...) (push new-name css-names)))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))))))
  (block nil (let ((--cl-dolist-temp-- faces) face) (while --cl-dolist-temp-- (setq face (car --cl-dolist-temp--)) (unless (gethash face face-map) (let ((fstruct (if ... ... ...))) (setf (gethash face face-map) fstruct) (let* ((css-name ...) (new-name css-name) (i 0)) (while (member new-name css-names) (setq new-name ...)) (unless (equal new-name css-name) (setf ... new-name)) (push new-name css-names)))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--)))))
  (dolist (face faces) (unless (gethash face face-map) (let ((fstruct (if (symbolp face) (htmlize-face-to-fstruct face) (htmlize-attrlist-to-fstruct face)))) (setf (gethash face face-map) fstruct) (let* ((css-name (htmlize-fstruct-css-name fstruct)) (new-name css-name) (i 0)) (while (member new-name css-names) (setq new-name (format "%s-%s" css-name (incf i)))) (unless (equal new-name css-name) (setf (htmlize-fstruct-css-name fstruct) new-name)) (push new-name css-names)))))
  (let ((face-map (make-hash-table :test (quote equal))) css-names) (dolist (face faces) (unless (gethash face face-map) (let ((fstruct (if (symbolp face) (htmlize-face-to-fstruct face) (htmlize-attrlist-to-fstruct face)))) (setf (gethash face face-map) fstruct) (let* ((css-name (htmlize-fstruct-css-name fstruct)) (new-name css-name) (i 0)) (while (member new-name css-names) (setq new-name (format "%s-%s" css-name ...))) (unless (equal new-name css-name) (setf (htmlize-fstruct-css-name fstruct) new-name)) (push new-name css-names))))) face-map)
  htmlize-make-face-map((default (:foreground "black" :background "#FF993F") (:foreground "black" :background "#FFF33F") (:foreground "black" :background "#B0FF3F") (:foreground "black" :background "#4BFF4B") (:foreground "black" :background "#3FFFB0") (:foreground "black" :background "#3FF3FF") (:foreground "black" :background "#3F99FF") (:foreground "white" :background "#3F3FFF")))
  (let* ((buffer-faces (htmlize-faces-in-buffer)) (face-map (htmlize-make-face-map (adjoin (quote default) buffer-faces))) (htmlbuf (generate-new-buffer (if (buffer-file-name) (htmlize-make-file-name (file-name-nondirectory (buffer-file-name))) "*html*"))) (places (quote (nil nil))) (title (if (buffer-file-name) (file-name-nondirectory (buffer-file-name)) (buffer-name)))) (with-current-buffer htmlbuf (buffer-disable-undo) (insert (htmlize-method doctype) 10 (format "<!-- Created by htmlize-%s in %s mode. -->\n" htmlize-version htmlize-output-type) "<html>\n  ") (plist-put places (quote head-start) (point-marker)) (insert "<head>\n" "    <title>" (htmlize-protect-string title) "</title>\n" (if htmlize-html-charset (format (concat "    <meta http-equiv=\"Content-Type\" " "content=\"text/html; charset=%s\">\n") htmlize-html-charset) "") htmlize-head-tags) (htmlize-method insert-head buffer-faces face-map) (insert "  </head>") (plist-put places (quote head-end) (point-marker)) (insert "\n  ") (plist-put places (quote body-start) (point-marker)) (insert (htmlize-method body-tag face-map) "\n    ") (plist-put places (quote content-start) (point-marker)) (insert "<pre>\n")) (let ((insert-text-method (htmlize-method-function (quote insert-text))) next-change text face-list fstruct-list trailing-ellipsis) (goto-char (point-min)) (while (not (eobp)) (setq next-change (htmlize-next-change (point) (quote face))) (setq face-list (htmlize-faces-at-point) fstruct-list (delq nil (mapcar (lambda (f) (gethash f face-map)) face-list))) (setq text (htmlize-buffer-substring-no-invisible (point) next-change)) (when trailing-ellipsis (setq text (htmlize-trim-ellipsis text))) (when (> (length text) 0) (setq trailing-ellipsis (get-text-property (1- (length text)) (quote htmlize-ellipsis) text))) (setq text (htmlize-untabify text (current-column))) (setq text (htmlize-protect-string text)) (when (> (length text) 0) (funcall insert-text-method text fstruct-list htmlbuf)) (goto-char next-change))) (with-current-buffer htmlbuf (insert "</pre>") (plist-put places (quote content-end) (point-marker)) (insert "\n  </body>") (plist-put places (quote body-end) (point-marker)) (insert "\n</html>\n") (when htmlize-generate-hyperlinks (htmlize-make-hyperlinks)) (htmlize-defang-local-variables) (when htmlize-replace-form-feeds (goto-char (point-min)) (let ((source (htmlize-protect-string "\n\f")) (replacement (if (stringp htmlize-replace-form-feeds) htmlize-replace-form-feeds "</pre><hr /><pre>"))) (while (search-forward source nil t) (replace-match replacement t t)))) (goto-char (point-min)) (when htmlize-html-major-mode (funcall htmlize-html-major-mode)) (set (make-local-variable (quote htmlize-buffer-places)) places) (run-hooks (quote htmlize-after-hook)) (buffer-enable-undo)) htmlbuf)
  (save-excursion (save-excursion (run-hooks (quote htmlize-before-hook))) (htmlize-ensure-fontified) (clrhash htmlize-extended-character-cache) (clrhash htmlize-memoization-table) (let* ((buffer-faces (htmlize-faces-in-buffer)) (face-map (htmlize-make-face-map (adjoin (quote default) buffer-faces))) (htmlbuf (generate-new-buffer (if (buffer-file-name) (htmlize-make-file-name (file-name-nondirectory ...)) "*html*"))) (places (quote (nil nil))) (title (if (buffer-file-name) (file-name-nondirectory (buffer-file-name)) (buffer-name)))) (with-current-buffer htmlbuf (buffer-disable-undo) (insert (htmlize-method doctype) 10 (format "<!-- Created by htmlize-%s in %s mode. -->\n" htmlize-version htmlize-output-type) "<html>\n  ") (plist-put places (quote head-start) (point-marker)) (insert "<head>\n" "    <title>" (htmlize-protect-string title) "</title>\n" (if htmlize-html-charset (format (concat "    <meta http-equiv=\"Content-Type\" " "content=\"text/html; charset=%s\">\n") htmlize-html-charset) "") htmlize-head-tags) (htmlize-method insert-head buffer-faces face-map) (insert "  </head>") (plist-put places (quote head-end) (point-marker)) (insert "\n  ") (plist-put places (quote body-start) (point-marker)) (insert (htmlize-method body-tag face-map) "\n    ") (plist-put places (quote content-start) (point-marker)) (insert "<pre>\n")) (let ((insert-text-method (htmlize-method-function (quote insert-text))) next-change text face-list fstruct-list trailing-ellipsis) (goto-char (point-min)) (while (not (eobp)) (setq next-change (htmlize-next-change (point) (quote face))) (setq face-list (htmlize-faces-at-point) fstruct-list (delq nil (mapcar (lambda ... ...) face-list))) (setq text (htmlize-buffer-substring-no-invisible (point) next-change)) (when trailing-ellipsis (setq text (htmlize-trim-ellipsis text))) (when (> (length text) 0) (setq trailing-ellipsis (get-text-property (1- ...) (quote htmlize-ellipsis) text))) (setq text (htmlize-untabify text (current-column))) (setq text (htmlize-protect-string text)) (when (> (length text) 0) (funcall insert-text-method text fstruct-list htmlbuf)) (goto-char next-change))) (with-current-buffer htmlbuf (insert "</pre>") (plist-put places (quote content-end) (point-marker)) (insert "\n  </body>") (plist-put places (quote body-end) (point-marker)) (insert "\n</html>\n") (when htmlize-generate-hyperlinks (htmlize-make-hyperlinks)) (htmlize-defang-local-variables) (when htmlize-replace-form-feeds (goto-char (point-min)) (let ((source (htmlize-protect-string "\n\f")) (replacement (if ... htmlize-replace-form-feeds "</pre><hr /><pre>"))) (while (search-forward source nil t) (replace-match replacement t t)))) (goto-char (point-min)) (when htmlize-html-major-mode (funcall htmlize-html-major-mode)) (set (make-local-variable (quote htmlize-buffer-places)) places) (run-hooks (quote htmlize-after-hook)) (buffer-enable-undo)) htmlbuf))
  htmlize-buffer-1()
  (save-restriction (narrow-to-region beg end) (htmlize-buffer-1))
  (let ((htmlbuf (save-restriction (narrow-to-region beg end) (htmlize-buffer-1)))) (when (interactive-p) (switch-to-buffer htmlbuf)) htmlbuf)
  htmlize-region(1 42)
  (let* ((htmlize-output-type org-export-htmlize-output-type) (htmlize-css-name-prefix org-export-htmlize-css-font-prefix) (htmlbuf (htmlize-region beg end))) (unwind-protect (with-current-buffer htmlbuf (buffer-substring (plist-get htmlize-buffer-places (quote content-start)) (plist-get htmlize-buffer-places (quote content-end)))) (kill-buffer htmlbuf)))
  org-export-htmlize-region-for-paste(1 42)
  (progn (insert rtn) (if (functionp mode) (funcall mode) (fundamental-mode)) (font-lock-fontify-buffer) (org-remove-formatting-on-newlines-in-region (point-min) (point-max)) (org-src-mode) (set-buffer-modified-p nil) (org-export-htmlize-region-for-paste (point-min) (point-max)))
  (unwind-protect (progn (insert rtn) (if (functionp mode) (funcall mode) (fundamental-mode)) (font-lock-fontify-buffer) (org-remove-formatting-on-newlines-in-region (point-min) (point-max)) (org-src-mode) (set-buffer-modified-p nil) (org-export-htmlize-region-for-paste (point-min) (point-max))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert rtn) (if (functionp mode) (funcall mode) (fundamental-mode)) (font-lock-fontify-buffer) (org-remove-formatting-on-newlines-in-region (point-min) (point-max)) (org-src-mode) (set-buffer-modified-p nil) (org-export-htmlize-region-for-paste (point-min) (point-max))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (with-current-buffer temp-buffer (unwind-protect (progn (insert rtn) (if (functionp mode) (funcall mode) (fundamental-mode)) (font-lock-fontify-buffer) (org-remove-formatting-on-newlines-in-region (point-min) (point-max)) (org-src-mode) (set-buffer-modified-p nil) (org-export-htmlize-region-for-paste (point-min) (point-max))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (with-current-buffer temp-buffer (unwind-protect (progn (insert rtn) (if (functionp mode) (funcall mode) (fundamental-mode)) (font-lock-fontify-buffer) (org-remove-formatting-on-newlines-in-region (point-min) (point-max)) (org-src-mode) (set-buffer-modified-p nil) (org-export-htmlize-region-for-paste (point-min) (point-max))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
  (with-temp-buffer (insert rtn) (if (functionp mode) (funcall mode) (fundamental-mode)) (font-lock-fontify-buffer) (org-remove-formatting-on-newlines-in-region (point-min) (point-max)) (org-src-mode) (set-buffer-modified-p nil) (org-export-htmlize-region-for-paste (point-min) (point-max)))
  (setq rtn (with-temp-buffer (insert rtn) (if (functionp mode) (funcall mode) (fundamental-mode)) (font-lock-fontify-buffer) (org-remove-formatting-on-newlines-in-region (point-min) (point-max)) (org-src-mode) (set-buffer-modified-p nil) (org-export-htmlize-region-for-paste (point-min) (point-max))))
  (let* ((lang-m (when lang (or (cdr (assoc lang org-src-lang-modes)) lang))) (mode (and lang-m (intern (concat (if (symbolp lang-m) (symbol-name lang-m) lang-m) "-mode")))) (org-inhibit-startup t) (org-startup-folded nil)) (setq rtn (with-temp-buffer (insert rtn) (if (functionp mode) (funcall mode) (fundamental-mode)) (font-lock-fontify-buffer) (org-remove-formatting-on-newlines-in-region (point-min) (point-max)) (org-src-mode) (set-buffer-modified-p nil) (org-export-htmlize-region-for-paste (point-min) (point-max)))) (if (string-match "<pre\\([^>]*\\)>\n*" rtn) (setq rtn (concat (if caption (concat "<div class=\"org-src-container\">" (format "<label class=\"org-src-name\">%s</label>" caption)) "") (replace-match (format "<pre class=\"src src-%s\">\n" lang) t t rtn) (if caption "</div>" "")))))
  (if lang (let* ((lang-m (when lang (or (cdr (assoc lang org-src-lang-modes)) lang))) (mode (and lang-m (intern (concat (if ... ... lang-m) "-mode")))) (org-inhibit-startup t) (org-startup-folded nil)) (setq rtn (with-temp-buffer (insert rtn) (if (functionp mode) (funcall mode) (fundamental-mode)) (font-lock-fontify-buffer) (org-remove-formatting-on-newlines-in-region (point-min) (point-max)) (org-src-mode) (set-buffer-modified-p nil) (org-export-htmlize-region-for-paste (point-min) (point-max)))) (if (string-match "<pre\\([^>]*\\)>\n*" rtn) (setq rtn (concat (if caption (concat "<div class=\"org-src-container\">" (format "<label class=\"org-src-name\">%s</label>" caption)) "") (replace-match (format "<pre class=\"src src-%s\">\n" lang) t t rtn) (if caption "</div>" ""))))) (if textareap (setq rtn (concat (format "<p>\n<textarea cols=\"%d\" rows=\"%d\">" cols rows) rtn "</textarea>\n</p>\n")) (with-temp-buffer (insert rtn) (goto-char (point-min)) (while (re-search-forward "[<>&]" nil t) (replace-match (cdr (assq (char-before) (quote ...))) t t)) (setq rtn (buffer-string))) (setq rtn (concat "<pre class=\"example\">\n" rtn "</pre>\n"))))
  (cond (backend-formatter (funcall backend-formatter rtn lang caption textareap cols rows num cont rpllbl fmt)) ((eq org-export-current-backend (quote docbook)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (concat "<programlisting><![CDATA[" rtn "]]></programlisting>\n")) ((eq org-export-current-backend (quote html)) (when lang (if (featurep (quote xemacs)) (require (quote htmlize)) (require (quote htmlize) nil t)) (when (not (fboundp (quote htmlize-region-for-paste))) (setq lang nil) (message "htmlize.el 1.34 or later is needed for source code formatting"))) (if lang (let* ((lang-m (when lang (or ... lang))) (mode (and lang-m (intern ...))) (org-inhibit-startup t) (org-startup-folded nil)) (setq rtn (with-temp-buffer (insert rtn) (if (functionp mode) (funcall mode) (fundamental-mode)) (font-lock-fontify-buffer) (org-remove-formatting-on-newlines-in-region (point-min) (point-max)) (org-src-mode) (set-buffer-modified-p nil) (org-export-htmlize-region-for-paste (point-min) (point-max)))) (if (string-match "<pre\\([^>]*\\)>\n*" rtn) (setq rtn (concat (if caption ... "") (replace-match ... t t rtn) (if caption "</div>" ""))))) (if textareap (setq rtn (concat (format "<p>\n<textarea cols=\"%d\" rows=\"%d\">" cols rows) rtn "</textarea>\n</p>\n")) (with-temp-buffer (insert rtn) (goto-char (point-min)) (while (re-search-forward "[<>&]" nil t) (replace-match (cdr ...) t t)) (setq rtn (buffer-string))) (setq rtn (concat "<pre class=\"example\">\n" rtn "</pre>\n")))) (unless textareap (setq rtn (org-export-number-lines rtn 1 1 num cont rpllbl fmt))) (if (string-match "\\(\\`<[^>]*>\\)\n" rtn) (setq rtn (replace-match "\\1" t nil rtn))) rtn) ((eq org-export-current-backend (quote latex)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (cond ((and lang org-export-latex-listings) (flet ((make-option-string (pair) (concat ... ...))) (let* ((lang-sym ...) (minted-p ...) (listings-p ...) (backend-lang ...) (custom-environment ...)) (concat (when ... ...) (when ... ...) (cond ... ... ...))))) (t (concat (car org-export-latex-verbatim-wrap) rtn (cdr org-export-latex-verbatim-wrap))))) ((eq org-export-current-backend (quote ascii)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (concat caption "\n" (concat (mapconcat (lambda (l) (concat "  " l)) (org-split-string rtn "\n") "\n") "\n"))) (t (error "Don't know how to markup source or example block in %s" (upcase backend-name))))
  (setq rtn (cond (backend-formatter (funcall backend-formatter rtn lang caption textareap cols rows num cont rpllbl fmt)) ((eq org-export-current-backend (quote docbook)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (concat "<programlisting><![CDATA[" rtn "]]></programlisting>\n")) ((eq org-export-current-backend (quote html)) (when lang (if (featurep (quote xemacs)) (require (quote htmlize)) (require (quote htmlize) nil t)) (when (not (fboundp (quote htmlize-region-for-paste))) (setq lang nil) (message "htmlize.el 1.34 or later is needed for source code formatting"))) (if lang (let* ((lang-m (when lang ...)) (mode (and lang-m ...)) (org-inhibit-startup t) (org-startup-folded nil)) (setq rtn (with-temp-buffer (insert rtn) (if ... ... ...) (font-lock-fontify-buffer) (org-remove-formatting-on-newlines-in-region ... ...) (org-src-mode) (set-buffer-modified-p nil) (org-export-htmlize-region-for-paste ... ...))) (if (string-match "<pre\\([^>]*\\)>\n*" rtn) (setq rtn (concat ... ... ...)))) (if textareap (setq rtn (concat (format "<p>\n<textarea cols=\"%d\" rows=\"%d\">" cols rows) rtn "</textarea>\n</p>\n")) (with-temp-buffer (insert rtn) (goto-char (point-min)) (while (re-search-forward "[<>&]" nil t) (replace-match ... t t)) (setq rtn (buffer-string))) (setq rtn (concat "<pre class=\"example\">\n" rtn "</pre>\n")))) (unless textareap (setq rtn (org-export-number-lines rtn 1 1 num cont rpllbl fmt))) (if (string-match "\\(\\`<[^>]*>\\)\n" rtn) (setq rtn (replace-match "\\1" t nil rtn))) rtn) ((eq org-export-current-backend (quote latex)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (cond ((and lang org-export-latex-listings) (flet ((make-option-string ... ...)) (let* (... ... ... ... ...) (concat ... ... ...)))) (t (concat (car org-export-latex-verbatim-wrap) rtn (cdr org-export-latex-verbatim-wrap))))) ((eq org-export-current-backend (quote ascii)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (concat caption "\n" (concat (mapconcat (lambda (l) (concat "  " l)) (org-split-string rtn "\n") "\n") "\n"))) (t (error "Don't know how to markup source or example block in %s" (upcase backend-name)))))
  (let* ((backend-name (symbol-name org-export-current-backend)) (backend-formatter (intern (format "org-%s-format-source-code-or-example" backend-name))) (backend-feature (intern (concat "org-" backend-name))) (backend-formatter (and (require (intern (concat "org-" backend-name)) nil) (fboundp backend-formatter) backend-formatter)) num cont rtn rpllbl keepp textareap preserve-indentp cols rows fmt) (setq opts (or opts "") num (string-match "[-+]n\\>" opts) cont (string-match "\\+n\\>" opts) rpllbl (string-match "-r\\>" opts) keepp (string-match "-k\\>" opts) textareap (string-match "-t\\>" opts) preserve-indentp (or org-src-preserve-indentation (string-match "-i\\>" opts)) cols (if (string-match "-w[ 	]+\\([0-9]+\\)" opts) (string-to-number (match-string 1 opts)) 80) rows (if (string-match "-h[ 	]+\\([0-9]+\\)" opts) (string-to-number (match-string 1 opts)) (org-count-lines code)) fmt (if (string-match "-l[ 	]+\"\\([^\"\n]+\\)\"" opts) (match-string 1 opts))) (when (and textareap (eq org-export-current-backend (quote html))) (setq num nil cont nil lang nil)) (if keepp (setq rpllbl (quote keep))) (setq rtn (if preserve-indentp code (org-remove-indentation code))) (when (string-match "^," rtn) (setq rtn (with-temp-buffer (insert rtn) (goto-char (point-min)) (while (re-search-forward "^," nil t) (if (or (equal lang "org") (save-match-data ...)) (replace-match "")) (end-of-line 1)) (buffer-string)))) (setq rtn (cond (backend-formatter (funcall backend-formatter rtn lang caption textareap cols rows num cont rpllbl fmt)) ((eq org-export-current-backend (quote docbook)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (concat "<programlisting><![CDATA[" rtn "]]></programlisting>\n")) ((eq org-export-current-backend (quote html)) (when lang (if (featurep (quote xemacs)) (require (quote htmlize)) (require (quote htmlize) nil t)) (when (not (fboundp ...)) (setq lang nil) (message "htmlize.el 1.34 or later is needed for source code formatting"))) (if lang (let* ((lang-m ...) (mode ...) (org-inhibit-startup t) (org-startup-folded nil)) (setq rtn (with-temp-buffer ... ... ... ... ... ... ...)) (if (string-match "<pre\\([^>]*\\)>\n*" rtn) (setq rtn ...))) (if textareap (setq rtn (concat ... rtn "</textarea>\n</p>\n")) (with-temp-buffer (insert rtn) (goto-char ...) (while ... ...) (setq rtn ...)) (setq rtn (concat "<pre class=\"example\">\n" rtn "</pre>\n")))) (unless textareap (setq rtn (org-export-number-lines rtn 1 1 num cont rpllbl fmt))) (if (string-match "\\(\\`<[^>]*>\\)\n" rtn) (setq rtn (replace-match "\\1" t nil rtn))) rtn) ((eq org-export-current-backend (quote latex)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (cond ((and lang org-export-latex-listings) (flet (...) (let* ... ...))) (t (concat (car org-export-latex-verbatim-wrap) rtn (cdr org-export-latex-verbatim-wrap))))) ((eq org-export-current-backend (quote ascii)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (concat caption "\n" (concat (mapconcat (lambda ... ...) (org-split-string rtn "\n") "\n") "\n"))) (t (error "Don't know how to markup source or example block in %s" (upcase backend-name))))) (setq rtn (concat "\n#+BEGIN_" backend-name "\n" (org-add-props rtn (quote (org-protected t org-example t org-native-text t))) "\n#+END_" backend-name "\n")) (org-add-props rtn nil (quote original-indentation) indent))
  (progn (let* ((backend-name (symbol-name org-export-current-backend)) (backend-formatter (intern (format "org-%s-format-source-code-or-example" backend-name))) (backend-feature (intern (concat "org-" backend-name))) (backend-formatter (and (require (intern (concat "org-" backend-name)) nil) (fboundp backend-formatter) backend-formatter)) num cont rtn rpllbl keepp textareap preserve-indentp cols rows fmt) (setq opts (or opts "") num (string-match "[-+]n\\>" opts) cont (string-match "\\+n\\>" opts) rpllbl (string-match "-r\\>" opts) keepp (string-match "-k\\>" opts) textareap (string-match "-t\\>" opts) preserve-indentp (or org-src-preserve-indentation (string-match "-i\\>" opts)) cols (if (string-match "-w[ 	]+\\([0-9]+\\)" opts) (string-to-number (match-string 1 opts)) 80) rows (if (string-match "-h[ 	]+\\([0-9]+\\)" opts) (string-to-number (match-string 1 opts)) (org-count-lines code)) fmt (if (string-match "-l[ 	]+\"\\([^\"\n]+\\)\"" opts) (match-string 1 opts))) (when (and textareap (eq org-export-current-backend (quote html))) (setq num nil cont nil lang nil)) (if keepp (setq rpllbl (quote keep))) (setq rtn (if preserve-indentp code (org-remove-indentation code))) (when (string-match "^," rtn) (setq rtn (with-temp-buffer (insert rtn) (goto-char (point-min)) (while (re-search-forward "^," nil t) (if (or ... ...) (replace-match "")) (end-of-line 1)) (buffer-string)))) (setq rtn (cond (backend-formatter (funcall backend-formatter rtn lang caption textareap cols rows num cont rpllbl fmt)) ((eq org-export-current-backend (quote docbook)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (concat "<programlisting><![CDATA[" rtn "]]></programlisting>\n")) ((eq org-export-current-backend (quote html)) (when lang (if (featurep ...) (require ...) (require ... nil t)) (when (not ...) (setq lang nil) (message "htmlize.el 1.34 or later is needed for source code formatting"))) (if lang (let* (... ... ... ...) (setq rtn ...) (if ... ...)) (if textareap (setq rtn ...) (with-temp-buffer ... ... ... ...) (setq rtn ...))) (unless textareap (setq rtn (org-export-number-lines rtn 1 1 num cont rpllbl fmt))) (if (string-match "\\(\\`<[^>]*>\\)\n" rtn) (setq rtn (replace-match "\\1" t nil rtn))) rtn) ((eq org-export-current-backend (quote latex)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (cond ((and lang org-export-latex-listings) (flet ... ...)) (t (concat ... rtn ...)))) ((eq org-export-current-backend (quote ascii)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (concat caption "\n" (concat (mapconcat ... ... "\n") "\n"))) (t (error "Don't know how to markup source or example block in %s" (upcase backend-name))))) (setq rtn (concat "\n#+BEGIN_" backend-name "\n" (org-add-props rtn (quote (org-protected t org-example t org-native-text t))) "\n#+END_" backend-name "\n")) (org-add-props rtn nil (quote original-indentation) indent)))
  (unwind-protect (progn (let* ((backend-name (symbol-name org-export-current-backend)) (backend-formatter (intern (format "org-%s-format-source-code-or-example" backend-name))) (backend-feature (intern (concat "org-" backend-name))) (backend-formatter (and (require (intern ...) nil) (fboundp backend-formatter) backend-formatter)) num cont rtn rpllbl keepp textareap preserve-indentp cols rows fmt) (setq opts (or opts "") num (string-match "[-+]n\\>" opts) cont (string-match "\\+n\\>" opts) rpllbl (string-match "-r\\>" opts) keepp (string-match "-k\\>" opts) textareap (string-match "-t\\>" opts) preserve-indentp (or org-src-preserve-indentation (string-match "-i\\>" opts)) cols (if (string-match "-w[ 	]+\\([0-9]+\\)" opts) (string-to-number (match-string 1 opts)) 80) rows (if (string-match "-h[ 	]+\\([0-9]+\\)" opts) (string-to-number (match-string 1 opts)) (org-count-lines code)) fmt (if (string-match "-l[ 	]+\"\\([^\"\n]+\\)\"" opts) (match-string 1 opts))) (when (and textareap (eq org-export-current-backend (quote html))) (setq num nil cont nil lang nil)) (if keepp (setq rpllbl (quote keep))) (setq rtn (if preserve-indentp code (org-remove-indentation code))) (when (string-match "^," rtn) (setq rtn (with-temp-buffer (insert rtn) (goto-char (point-min)) (while (re-search-forward "^," nil t) (if ... ...) (end-of-line 1)) (buffer-string)))) (setq rtn (cond (backend-formatter (funcall backend-formatter rtn lang caption textareap cols rows num cont rpllbl fmt)) ((eq org-export-current-backend (quote docbook)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (concat "<programlisting><![CDATA[" rtn "]]></programlisting>\n")) ((eq org-export-current-backend (quote html)) (when lang (if ... ... ...) (when ... ... ...)) (if lang (let* ... ... ...) (if textareap ... ... ...)) (unless textareap (setq rtn ...)) (if (string-match "\\(\\`<[^>]*>\\)\n" rtn) (setq rtn ...)) rtn) ((eq org-export-current-backend (quote latex)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (cond (... ...) (t ...))) ((eq org-export-current-backend (quote ascii)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (concat caption "\n" (concat ... "\n"))) (t (error "Don't know how to markup source or example block in %s" (upcase backend-name))))) (setq rtn (concat "\n#+BEGIN_" backend-name "\n" (org-add-props rtn (quote (org-protected t org-example t org-native-text t))) "\n#+END_" backend-name "\n")) (org-add-props rtn nil (quote original-indentation) indent))) (set-match-data save-match-data-internal (quote evaporate)))
  (let ((save-match-data-internal (match-data))) (unwind-protect (progn (let* ((backend-name (symbol-name org-export-current-backend)) (backend-formatter (intern (format "org-%s-format-source-code-or-example" backend-name))) (backend-feature (intern (concat "org-" backend-name))) (backend-formatter (and (require ... nil) (fboundp backend-formatter) backend-formatter)) num cont rtn rpllbl keepp textareap preserve-indentp cols rows fmt) (setq opts (or opts "") num (string-match "[-+]n\\>" opts) cont (string-match "\\+n\\>" opts) rpllbl (string-match "-r\\>" opts) keepp (string-match "-k\\>" opts) textareap (string-match "-t\\>" opts) preserve-indentp (or org-src-preserve-indentation (string-match "-i\\>" opts)) cols (if (string-match "-w[ 	]+\\([0-9]+\\)" opts) (string-to-number (match-string 1 opts)) 80) rows (if (string-match "-h[ 	]+\\([0-9]+\\)" opts) (string-to-number (match-string 1 opts)) (org-count-lines code)) fmt (if (string-match "-l[ 	]+\"\\([^\"\n]+\\)\"" opts) (match-string 1 opts))) (when (and textareap (eq org-export-current-backend (quote html))) (setq num nil cont nil lang nil)) (if keepp (setq rpllbl (quote keep))) (setq rtn (if preserve-indentp code (org-remove-indentation code))) (when (string-match "^," rtn) (setq rtn (with-temp-buffer (insert rtn) (goto-char ...) (while ... ... ...) (buffer-string)))) (setq rtn (cond (backend-formatter (funcall backend-formatter rtn lang caption textareap cols rows num cont rpllbl fmt)) ((eq org-export-current-backend ...) (setq rtn ...) (concat "<programlisting><![CDATA[" rtn "]]></programlisting>\n")) ((eq org-export-current-backend ...) (when lang ... ...) (if lang ... ...) (unless textareap ...) (if ... ...) rtn) ((eq org-export-current-backend ...) (setq rtn ...) (cond ... ...)) ((eq org-export-current-backend ...) (setq rtn ...) (concat caption "\n" ...)) (t (error "Don't know how to markup source or example block in %s" ...)))) (setq rtn (concat "\n#+BEGIN_" backend-name "\n" (org-add-props rtn (quote ...)) "\n#+END_" backend-name "\n")) (org-add-props rtn nil (quote original-indentation) indent))) (set-match-data save-match-data-internal (quote evaporate))))
  (save-match-data (let* ((backend-name (symbol-name org-export-current-backend)) (backend-formatter (intern (format "org-%s-format-source-code-or-example" backend-name))) (backend-feature (intern (concat "org-" backend-name))) (backend-formatter (and (require (intern (concat "org-" backend-name)) nil) (fboundp backend-formatter) backend-formatter)) num cont rtn rpllbl keepp textareap preserve-indentp cols rows fmt) (setq opts (or opts "") num (string-match "[-+]n\\>" opts) cont (string-match "\\+n\\>" opts) rpllbl (string-match "-r\\>" opts) keepp (string-match "-k\\>" opts) textareap (string-match "-t\\>" opts) preserve-indentp (or org-src-preserve-indentation (string-match "-i\\>" opts)) cols (if (string-match "-w[ 	]+\\([0-9]+\\)" opts) (string-to-number (match-string 1 opts)) 80) rows (if (string-match "-h[ 	]+\\([0-9]+\\)" opts) (string-to-number (match-string 1 opts)) (org-count-lines code)) fmt (if (string-match "-l[ 	]+\"\\([^\"\n]+\\)\"" opts) (match-string 1 opts))) (when (and textareap (eq org-export-current-backend (quote html))) (setq num nil cont nil lang nil)) (if keepp (setq rpllbl (quote keep))) (setq rtn (if preserve-indentp code (org-remove-indentation code))) (when (string-match "^," rtn) (setq rtn (with-temp-buffer (insert rtn) (goto-char (point-min)) (while (re-search-forward "^," nil t) (if (or ... ...) (replace-match "")) (end-of-line 1)) (buffer-string)))) (setq rtn (cond (backend-formatter (funcall backend-formatter rtn lang caption textareap cols rows num cont rpllbl fmt)) ((eq org-export-current-backend (quote docbook)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (concat "<programlisting><![CDATA[" rtn "]]></programlisting>\n")) ((eq org-export-current-backend (quote html)) (when lang (if (featurep ...) (require ...) (require ... nil t)) (when (not ...) (setq lang nil) (message "htmlize.el 1.34 or later is needed for source code formatting"))) (if lang (let* (... ... ... ...) (setq rtn ...) (if ... ...)) (if textareap (setq rtn ...) (with-temp-buffer ... ... ... ...) (setq rtn ...))) (unless textareap (setq rtn (org-export-number-lines rtn 1 1 num cont rpllbl fmt))) (if (string-match "\\(\\`<[^>]*>\\)\n" rtn) (setq rtn (replace-match "\\1" t nil rtn))) rtn) ((eq org-export-current-backend (quote latex)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (cond ((and lang org-export-latex-listings) (flet ... ...)) (t (concat ... rtn ...)))) ((eq org-export-current-backend (quote ascii)) (setq rtn (org-export-number-lines rtn 0 0 num cont rpllbl fmt)) (concat caption "\n" (concat (mapconcat ... ... "\n") "\n"))) (t (error "Don't know how to markup source or example block in %s" (upcase backend-name))))) (setq rtn (concat "\n#+BEGIN_" backend-name "\n" (org-add-props rtn (quote (org-protected t org-example t org-native-text t))) "\n#+END_" backend-name "\n")) (org-add-props rtn nil (quote original-indentation) indent)))
  org-export-format-source-code-or-example("sh" "svn checkout http://svn/trunk/dev/ mydev\n" " " 0 nil)
  (setq trans (org-export-format-source-code-or-example lang code opts indent caption))
  (while (re-search-forward "\\(^\\([ 	]*\\)#\\+BEGIN_SRC:?\\([ 	]+\\([^ 	\n]+\\)\\)?\\(.*\\)\n\\([^]+?\n\\)[ 	]*#\\+END_SRC.*\n?\\)\\|\\(^\\([ 	]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ 	]+\\(.*\\)\\)?\n\\([^]+?\n\\)[ 	]*#\\+END_EXAMPLE.*\n?\\)" nil t) (if (match-end 1) (if (not (match-string 4)) (error "Source block missing language specification: %s" (let* ((body (match-string 6)) (nothing (message "body:%s" body)) (preview (or ... body))) (if (> (length preview) 35) (concat (substring preview 0 32) "...") preview))) (setq lang (match-string 4) opts (match-string 5) code (match-string 6) indent (length (match-string 2)) caption (get-text-property 0 (quote org-caption) (match-string 0)))) (setq lang nil opts (match-string 9) code (match-string 10) indent (length (match-string 8)) caption (get-text-property 0 (quote org-caption) (match-string 0)))) (setq trans (org-export-format-source-code-or-example lang code opts indent caption)) (replace-match trans t t))
  (let ((case-fold-search t) lang code trans opts indent caption) (goto-char (point-min)) (while (re-search-forward "\\(^\\([ 	]*\\)#\\+BEGIN_SRC:?\\([ 	]+\\([^ 	\n]+\\)\\)?\\(.*\\)\n\\([^]+?\n\\)[ 	]*#\\+END_SRC.*\n?\\)\\|\\(^\\([ 	]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ 	]+\\(.*\\)\\)?\n\\([^]+?\n\\)[ 	]*#\\+END_EXAMPLE.*\n?\\)" nil t) (if (match-end 1) (if (not (match-string 4)) (error "Source block missing language specification: %s" (let* ((body ...) (nothing ...) (preview ...)) (if (> ... 35) (concat ... "...") preview))) (setq lang (match-string 4) opts (match-string 5) code (match-string 6) indent (length (match-string 2)) caption (get-text-property 0 (quote org-caption) (match-string 0)))) (setq lang nil opts (match-string 9) code (match-string 10) indent (length (match-string 8)) caption (get-text-property 0 (quote org-caption) (match-string 0)))) (setq trans (org-export-format-source-code-or-example lang code opts indent caption)) (replace-match trans t t)))
  org-export-replace-src-segments-and-examples()
  ...
#+end_src

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug] "Invalid face" when exporting code block to HTML
  2012-01-05 22:06 [bug] "Invalid face" when exporting code block to HTML Sebastien Vauban
@ 2012-01-05 23:18 ` Nick Dokos
  2012-01-06 13:28   ` Sebastien Vauban
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2012-01-05 23:18 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: nicholas.dokos, emacs-orgmode

Sebastien Vauban <wxhgmqzgwmuf@spammotel.com> wrote:

> Hello,
> 
> Not a good day for me, today...
> 
> * Summary
> 
> Quite "simple": the following block generates an "Invalid face" error when
> exported to HTML.
> 
> #+begin_src sh
> svn checkout http://svn/trunk/dev/ mydev
> #+end_src
> 
> This worked yesterday. Does it ring a bell to someone? Could some recent
> commit be responsible of this?
> 

Can't reproduce it either with a slightly earlier version of org (.19)
or latest (.44 - note that I'm ahead of origin/master by 3 commits).

Try evaluating this expression which is the one that gave you the error:

(htmlize-face-size 'default)

I get 113 in my setup, so this looks like an htmlize error. I don't
understand where the nil face (which is indeed invalid) comes from.

Also htmlize-face-size wraps the face-attribute call inside an
(ignore-errors ...)  form, so it should *not* blow up. Are you using
some old outdated htmlize code by any chance?

Nick

> * Version info
> 
> GNU Emacs 24.0.92.1 (i386-mingw-nt5.1.2600) of 2011-12-07 on MARVIN
> 
> Org-mode version 7.8.03 (release_7.8.03.31.g28541)
> 
> * Backtrace
> 
> #+begin_src emacs-lisp
> Debugger entered--Lisp error: (error "Invalid face")
>   internal-get-lisp-face-attribute(nil :height nil)
>   face-attribute(nil :height)
>   ...
>   htmlize-face-size(default)
>   ...

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug] "Invalid face" when exporting code block to HTML
  2012-01-05 23:18 ` Nick Dokos
@ 2012-01-06 13:28   ` Sebastien Vauban
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastien Vauban @ 2012-01-06 13:28 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Nick,

Nick Dokos wrote:
> Sebastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> wrote:
>> Quite "simple": the following block generates an "Invalid face" error when
>> exported to HTML.
>>
>> #+begin_src sh
>> svn checkout http://svn/trunk/dev/ mydev
>> #+end_src
>>
>> This worked yesterday. Does it ring a bell to someone? Could some recent
>> commit be responsible of this?
>
> Can't reproduce it either with a slightly earlier version of org (.19)
> or latest (.44 - note that I'm ahead of origin/master by 3 commits).
>
> Try evaluating this expression which is the one that gave you the error:
>
> (htmlize-face-size 'default)
>
> I get 113 in my setup, so this looks like an htmlize error.

Indeed:

#+begin_src emacs-lisp
Debugger entered--Lisp error: (void-function htmlize-face-size)
  (htmlize-face-size (quote default))
  eval((htmlize-face-size (quote default)) nil)
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
#+end_src

> I don't understand where the nil face (which is indeed invalid) comes from.
>
> Also htmlize-face-size wraps the face-attribute call inside an
> (ignore-errors ...)  form, so it should *not* blow up.

I don't understand, as I did not do any Emacs changes lately in that area.

> Are you using some old outdated htmlize code by any chance?

Library is file `~/Downloads/emacs/site-lisp/htmlize.el', where I have all
independent package files downloaded from the Web.

Wait... That should be `~/src/org-mode/contrib/lisp/htmlize.el', right?
                              ^^^^^^^^^^^^^^^^
So, I have 2 `htmlize' files, and the Org-compliant one is only located in the
second best place.

I have -- still! -- absolutely no idea why the original `htmlize' file worked
for me so far, and why it suddenly stopped working yesterday (I did no change
of load-paths, neither did I save that file there... it must be a very old
reminiscence).

I still have found out that -- with the original (non-Org) `htmlize' file --,
I need to have a declaration like this:

#+begin_src emacs-lisp
       (default ((t (nil))))
#+end_src

in my color theme.

With the Org flavor of `htmlize', that line is not needed.

For sure, yesterday, I played with that line, *after* things had gone wrong,
as I wondered whether such a line, with `nil', was good or not to have.

Now, there are 2 ways to solve my problem for sure:

- putting the original `htmlize' after the Org paths,
- removing it.

The first solution does not feel natural to me: I need having the proper
load-paths set up for Org in my stub .emacs (calling my tangled, huge file
full of Emacs customizations). It's because ~/Downloads/emacs/site-lisp/ is
added to the load-path in that huge .emacs file that it's finally in front of
Org git directories, as the append is done upfront -- no prepend.

Now, I really don't need to have conflicting versions of `htmlize', so I
simply deleted that file -- whose I ignored the existence up to now --, and
all is so far so good.

Thanks (a lot) for putting me right on track!

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-06 13:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-05 22:06 [bug] "Invalid face" when exporting code block to HTML Sebastien Vauban
2012-01-05 23:18 ` Nick Dokos
2012-01-06 13:28   ` Sebastien Vauban

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).