Browse Source

org-compat: Update font-lock-ensure alias

* lisp/org-compat.el (org-font-lock-ensure): Add new alias that accepts
  the same number of arguments as font-lock-ensure does.  Use an org-
  prefix.
* lisp/org-clock.el (org-clock-get-clocktable):
* lisp/org.el (org-fontify-like-in-org-mode):
* lisp/ox-html.el (org-html-fontify-code):
* lisp/ox-odt.el (org-odt-do-format-code):
* lisp/ox-org.el (org-org-publish-to-org): Use org-font-lock-ensure.

See Emacs's bug#22399.
Kyle Meyer 3 years ago
parent
commit
a4edee4069
6 changed files with 9 additions and 7 deletions
  1. 1 1
      lisp/org-clock.el
  2. 4 2
      lisp/org-compat.el
  3. 1 1
      lisp/org.el
  4. 1 1
      lisp/ox-html.el
  5. 1 1
      lisp/ox-odt.el
  6. 1 1
      lisp/ox-org.el

+ 1 - 1
lisp/org-clock.el

@@ -2031,7 +2031,7 @@ fontified, and then returned."
     (org-mode)
     (org-create-dblock props)
     (org-update-dblock)
-    (font-lock-ensure)
+    (org-font-lock-ensure)
     (forward-line 2)
     (buffer-substring (point) (progn
 				(re-search-forward "^[ \t]*#\\+END" nil t)

+ 4 - 2
lisp/org-compat.el

@@ -409,8 +409,10 @@ Pass BUFFER to the XEmacs version of `move-to-column'."
   (defalias 'format-message 'format))
 
 ;; `font-lock-ensure' is only available from 24.4.50 on
-(unless (fboundp 'font-lock-ensure)
-  (defalias 'font-lock-ensure 'font-lock-fontify-buffer))
+(defalias 'org-font-lock-ensure
+  (if (fboundp 'font-lock-ensure)
+      #'font-lock-ensure
+    (lambda (&optional _beg _end) (font-lock-fontify-buffer))))
 
 (defmacro org-no-popups (&rest body)
   "Suppress popup windows.

+ 1 - 1
lisp/org.el

@@ -6497,7 +6497,7 @@ needs to be inserted at a specific position in the font-lock sequence.")
     (insert s)
     (let ((org-odd-levels-only odd-levels))
       (org-mode)
-      (font-lock-ensure)
+      (org-font-lock-ensure)
       (buffer-string))))
 
 (defvar org-m nil)

+ 1 - 1
lisp/ox-html.el

@@ -2047,7 +2047,7 @@ is the language used for CODE, as a string, or nil."
 		    (funcall lang-mode)
 		    (insert code)
 		    ;; Fontify buffer.
-		    (font-lock-ensure)
+		    (org-font-lock-ensure)
 		    ;; Remove formatting on newline characters.
 		    (save-excursion
 		      (let ((beg (point-min))

+ 1 - 1
lisp/ox-odt.el

@@ -3167,7 +3167,7 @@ and prefix with \"OrgSrc\".  For example,
 		 (with-temp-buffer
 		   (insert code)
 		   (funcall lang-mode)
-		   (font-lock-ensure)
+		   (org-font-lock-ensure)
 		   (buffer-string))))
 	 (fontifier (if use-htmlfontify-p 'org-odt-htmlfontify-string
 		      'org-odt--encode-plain-text))

+ 1 - 1
lisp/ox-org.el

@@ -297,7 +297,7 @@ Return output file name."
 	   (work-buffer (or visitingp (find-file-noselect filename)))
 	   newbuf)
       (with-current-buffer work-buffer
-        (font-lock-ensure)
+        (org-font-lock-ensure)
         (outline-show-all)
         (org-show-block-all)
         (setq newbuf (htmlize-buffer)))