branch: elpa/emacsql
commit 8f3d0d4b81e17a0aac0449ca10fafa679cb6deec
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    Use font-lock-flush and font-lock-ensure if available
    
    `font-lock-fontity-buffer' is only intended for interactive use.  Emacs
    v25.1 adds `font-lock-flush' and `font-lock-ensure' as replacements.  A
    lot of reading revealed that we actually have to call both functions.
---
 emacsql.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/emacsql.el b/emacsql.el
index 33402820d2..ea6ba3094b 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -340,7 +340,14 @@ Each column must be a plain symbol, no expressions allowed 
here."
            (sql-mode)
            (with-no-warnings ;; autoloaded by previous line
              (sql-highlight-sqlite-keywords))
-           (font-lock-fontify-buffer)
+           (if (and (fboundp 'font-lock-flush)
+                    (fboundp 'font-lock-ensure))
+               (save-restriction
+                 (widen)
+                 (font-lock-flush)
+                 (font-lock-ensure))
+             (with-no-warnings
+               (font-lock-fontify-buffer)))
            (emacsql--indent)
            (buffer-string))))
     (with-current-buffer (get-buffer-create emacsql-show-buffer-name)

Reply via email to