emacs-htmlize icon indicating copy to clipboard operation
emacs-htmlize copied to clipboard

All colouring lost.

Open tecosaur opened this issue 4 years ago • 3 comments

If I run htmlize-{buffer,file} on any of my files, the result has no syntax highlighting.

Additionally, if I turn on debug-on-error I find the following

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("[\11\n]" nil 0)
  htmlize-untabify-string(nil 0)
  htmlize-extract-text(1 2 nil)
  ...
  htmlize-buffer-1()
  htmlize-region(1 1817)
  org-html-htmlize-region-for-paste(1 1817)

Here's an example output: colophon.zip

I use Emacs27.1 with Doom, which uses the latest version of Htmlize, and does not appear to modify the settings/behaviour.

tecosaur avatar Sep 13 '20 08:09 tecosaur

Thanks for the report. Here are some steps to debug the issue:

  • Does htmlize work for you outside of org mode? For example, if you visit a file and type M-x htmlize-buffer RET?
  • If you get the same error, does it work if you use emacs -q?
  • What is the output of M-: (htmlize-buffer-substring-no-invisible 1 2) RET in the buffer where htmlize doesn't work?

hniksic avatar Sep 27 '20 09:09 hniksic

Sorry for the delay, I'll try doing emacs -Q shortly.

  • Calling htmlize-file on a non-org file produces the same result (see below)
  • (htmlize-buffer-substring-no-invisible 1 2) gives "["

In Emacs

image

Htmlized

image

tecosaur avatar Oct 07 '20 03:10 tecosaur

I am getting an output of non-formatted code after htmlize-file, while htmlize-buffer delivers the desired output with different text colours.

ipofanes avatar Sep 07 '21 11:09 ipofanes