Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Causes error with htmlize-merge-two-faces #15

Open
emsenn opened this issue Jun 16, 2019 · 2 comments
Open

Causes error with htmlize-merge-two-faces #15

emsenn opened this issue Jun 16, 2019 · 2 comments

Comments

@emsenn
Copy link

emsenn commented Jun 16, 2019

Hey there,

This might not be a bug with your theme at all; I'm too novice of an Emacs user to be sure, but:

When I try and export a buffer containing a source block which is set to a mode which uses variable pitch font itself (such as an org-mode source block), I receive the following error upon attempting to export to HTML

htmlize-merge-two-faces: Wrong type argument: number-or-marker-p, (lambda (base) (truncate (* (face-attribute (quote fixed-pitch) :height nil (quote default)) 1.23)))

This only occurs on buffers containing variable-width source blocks; I've tested it against a markdown and org-mode source block.

Let me know if there's any more info I can provide.

(Also, while I'm here, you've made an amazing theme.)

@kunalb
Copy link
Owner

kunalb commented Jun 16, 2019

Thanks for the report! I've noticed that one – and dug into it a little a few days ago – and it's an htmlize bug unfortunately; it can't handle dynamic font-face sizes and tries to multiply the lambda with a base value =/. I had to use lambdas to account for a different bug where font sizes aren't available for emacs instances started as a server, so they need to be updated when the first client is created.

I should get around to doing an explicit bug report to htmlize at some point.

Quick alternatives to unblock you:

  • htmlfontify.
  • Alternatively, as a hack – you could replace the sizes explicitly with the size you'd like to see

@emsenn
Copy link
Author

emsenn commented Jun 16, 2019

Thanks for the quick response and suggested answers. Since this bug lies outside this repository, I'd recommend giving it a tag such as "upstream-bug" to indicate its unfixable nature, and perhaps closing it.

kunalb added a commit to kunalb/emacs-htmlize that referenced this issue May 31, 2020
:height can be a function instead of an explicit number, which I rely on in my theme (eg. https://github.com/kunalb/poet/blob/master/poet-theme.el#L207). 

With this change the function is applied on the previous size ("A function value is called with one argument, the height of the underlying face, and returns the height of the new face" -- https://www.gnu.org/software/emacs/manual/html_node/elisp/Face-Attributes.html). I'm not sure if "merged" is the best argument to pass here but I can't think of any alternatives.

Without this change htmlize on a buffer fails with an error around next not being a valid value type.
`htmlize-merge-two-faces: Wrong type argument: number-or-marker-p, (lambda (base) (truncate (* (face-attribute (quote fixed-pitch) :height nil (quote default)) 1.23)))`

Tested by running htmlize-buffer with poet enabled, output seems sane and it doesn't fail.

Bug report: kunalb/poet#15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants