Re: [O] [bug] "Invalid face" when exporting code block to HTML

2012-01-06 Thread Sebastien Vauban
Hi Nick,

Nick Dokos wrote:
> Sebastien Vauban  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




Re: [O] [bug] "Invalid face" when exporting code block to HTML

2012-01-05 Thread Nick Dokos
Sebastien Vauban  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)
>   ...



[O] [bug] "Invalid face" when exporting code block to HTML

2012-01-05 Thread Sebastien Vauban
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 fstru