unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#40642: 27.0.90; htmlfontify's hfy-force-fontification misusing jit-lock-fontify-now
@ 2020-04-15 14:07 Amin Bandali
  2020-04-15 15:01 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Amin Bandali @ 2020-04-15 14:07 UTC (permalink / raw)
  To: 40642


It seems that htmlfontify's `hfy-force-fontification' uses
`jit-lock-fontify-now' without first checking if `jit-lock' is activated
in the buffer.

Symptoms of this bug include errors like this:

jit-lock-fontify-now: Wrong type argument: number-or-marker-p, nil

The above is triggered when calling the scpaste-index command from a
recent version of scpaste [0] that uses the `htmlfontify-buffer'
function from htmlfontify when htmlize is not available [1].

[0]: https://github.com/technomancy/scpaste
[1]: https://github.com/technomancy/scpaste/commit/ca95a8d

Excerpt from *Backtrace*:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  jit-lock--run-functions(1 10813)
  jit-lock-fontify-now()
  hfy-force-fontification()
  htmlfontify-buffer()
  scpaste("index")
  scpaste-index()
  funcall-interactively(scpaste-index)
  call-interactively(scpaste-index record nil)
  command-execute(scpaste-index record)
  counsel-M-x-action("scpaste-index")

In GNU Emacs 27.0.90 (build 3, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2020-04-15 built on darrud
Repository revision: 485f24223fdca91d439b7beaaac33f66cb3bc2af
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)





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

* bug#40642: 27.0.90; htmlfontify's hfy-force-fontification misusing jit-lock-fontify-now
  2020-04-15 14:07 bug#40642: 27.0.90; htmlfontify's hfy-force-fontification misusing jit-lock-fontify-now Amin Bandali
@ 2020-04-15 15:01 ` Stefan Monnier
  2020-04-15 15:10   ` Amin Bandali
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2020-04-15 15:01 UTC (permalink / raw)
  To: Amin Bandali; +Cc: 40642

Hi Amin,

> Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
>   jit-lock--run-functions(1 10813)
>   jit-lock-fontify-now()
>   hfy-force-fontification()
>   htmlfontify-buffer()
>   scpaste("index")
>   scpaste-index()
>   funcall-interactively(scpaste-index)
>   call-interactively(scpaste-index record nil)
>   command-execute(scpaste-index record)
>   counsel-M-x-action("scpaste-index")

Does the simple patch below fix your problem?


        Stefan


diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index c0012427ae..08e52d63a2 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -1837,7 +1837,8 @@ hfy-force-fontification
       (when font-lock-defaults
         ; Silence "interactive use only" warning on Emacs >= 25.1.
         (with-no-warnings (font-lock-fontify-buffer)))))
-   ((fboundp #'jit-lock-fontify-now)
+   ((and (fboundp #'jit-lock-fontify-now)
+         (bound-and-true-p jit-lock-mode))
     (message "hfy jit-lock mode (%S %S)" window-system major-mode)
     (jit-lock-fontify-now))
    (t






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

* bug#40642: 27.0.90; htmlfontify's hfy-force-fontification misusing jit-lock-fontify-now
  2020-04-15 15:01 ` Stefan Monnier
@ 2020-04-15 15:10   ` Amin Bandali
  2020-04-15 16:18     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Amin Bandali @ 2020-04-15 15:10 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 40642

[-- Attachment #1: Type: text/plain, Size: 205 bytes --]

Hi Stefan,

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Hi Amin,
>
[...]
>
> Does the simple patch below fix your problem?
>
>
>         Stefan
>
>
[...]

Yes, it does.  Thanks for the quick fix!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]

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

* bug#40642: 27.0.90; htmlfontify's hfy-force-fontification misusing jit-lock-fontify-now
  2020-04-15 15:10   ` Amin Bandali
@ 2020-04-15 16:18     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2020-04-15 16:18 UTC (permalink / raw)
  To: Amin Bandali; +Cc: 40642-done

Version: 27.1

>> Does the simple patch below fix your problem?
> Yes, it does.  Thanks for the quick fix!

Thank you.  Pushed to `emacs-27`.


        Stefan






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

end of thread, other threads:[~2020-04-15 16:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-15 14:07 bug#40642: 27.0.90; htmlfontify's hfy-force-fontification misusing jit-lock-fontify-now Amin Bandali
2020-04-15 15:01 ` Stefan Monnier
2020-04-15 15:10   ` Amin Bandali
2020-04-15 16:18     ` Stefan Monnier

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

	https://git.savannah.gnu.org/cgit/emacs.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).