summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2014-05-28 23:45:29 -0400
committerKyle Meyer <kyle@kyleam.com>2015-07-26 23:28:25 -0400
commitd81e6b52b7a02bb3401f2f17dedc746b63eeecc7 (patch)
tree46b742f86ef08d8981078929cadc9cacad570d27
parenta55b5a4269e3d63bbf9b2264a92a50865da79929 (diff)
downloadorg-mode-d81e6b52b7a02bb3401f2f17dedc746b63eeecc7.tar.gz
Backport commit 6711a21 from Emacs master branch
* lisp/org-compat.el (org-font-lock-ensure): New function. * lisp/ox-odt.el (org-odt-do-format-code): * lisp/ox-html.el (org-html-fontify-code): * lisp/org.el (org-fontify-like-in-org-mode): * lisp/org-src.el (org-src-font-lock-fontify-block): * lisp/org-clock.el (org-clock-get-clocktable): Use it. * lisp/ox-org.el (org-org-publish-to-org): Use it. Avoid using find-file from Elisp. 6711a21f1125c0047c56eb266eb374c1ec90a967 Stefan Monnier Wed May 28 23:45:29 2014 -0400
-rw-r--r--lisp/org-clock.el2
-rw-r--r--lisp/org-compat.el5
-rw-r--r--lisp/org-src.el2
-rw-r--r--lisp/org.el2
-rw-r--r--lisp/ox-html.el2
-rw-r--r--lisp/ox-odt.el2
-rw-r--r--lisp/ox-org.el15
7 files changed, 19 insertions, 11 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 760b9a4..5b8243f 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1929,7 +1929,7 @@ fontified, and then returned."
(org-mode)
(org-create-dblock props)
(org-update-dblock)
- (font-lock-fontify-buffer)
+ (org-font-lock-ensure)
(forward-line 2)
(buffer-substring (point) (progn
(re-search-forward "^[ \t]*#\\+END" nil t)
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index decf76d..be1141d 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -474,6 +474,11 @@ LIMIT."
(looking-at (concat "\\(?:" regexp "\\)\\'")))))
(not (null pos)))))
+(defalias 'org-font-lock-ensure
+ (if (fboundp 'org-font-lock-ensure)
+ #'font-lock-ensure
+ (lambda (_beg _end) (font-lock-fontify-buffer))))
+
(defun org-floor* (x &optional y)
"Return a list of the floor of X and the fractional part of X.
With two arguments, return floor and remainder of their quotient."
diff --git a/lisp/org-src.el b/lisp/org-src.el
index 618ed9f..e31a39a 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -921,7 +921,7 @@ fontification of code blocks see `org-src-fontify-block' and
(delete-region (point-min) (point-max))
(insert string " ") ;; so there's a final property change
(unless (eq major-mode lang-mode) (funcall lang-mode))
- (font-lock-fontify-buffer)
+ (org-font-lock-ensure)
(setq pos (point-min))
(while (setq next (next-single-property-change pos 'face))
(put-text-property
diff --git a/lisp/org.el b/lisp/org.el
index 7faea3d..c2a5875 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6371,7 +6371,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-fontify-buffer)
+ (org-font-lock-ensure)
(buffer-string))))
(defvar org-m nil)
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 014a6e7..c952a82 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1855,7 +1855,7 @@ is the language used for CODE, as a string, or nil."
(funcall lang-mode)
(insert code)
;; Fontify buffer.
- (font-lock-fontify-buffer)
+ (org-font-lock-ensure)
;; Remove formatting on newline characters.
(save-excursion
(let ((beg (point-min))
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 95e73f5..4ccef1a 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -3139,7 +3139,7 @@ and prefix with \"OrgSrc\". For example,
(with-temp-buffer
(insert code)
(funcall lang-mode)
- (font-lock-fontify-buffer)
+ (org-font-lock-ensure)
(buffer-string))))
(fontifier (if use-htmlfontify-p 'org-odt-htmlfontify-string
'org-odt--encode-plain-text))
diff --git a/lisp/ox-org.el b/lisp/ox-org.el
index 195b9d7..4bee45a 100644
--- a/lisp/ox-org.el
+++ b/lisp/ox-org.el
@@ -251,12 +251,13 @@ Return output file name."
(html-ext (concat "." (or (plist-get plist :html-extension)
org-html-extension "html")))
(visitingp (find-buffer-visiting filename))
- (work-buffer (or visitingp (find-file filename)))
+ (work-buffer (or visitingp (find-file-noselect filename)))
newbuf)
- (font-lock-fontify-buffer)
- (show-all)
- (org-show-block-all)
- (setq newbuf (htmlize-buffer))
+ (with-current-buffer work-buffer
+ (org-font-lock-ensure)
+ (show-all)
+ (org-show-block-all)
+ (setq newbuf (htmlize-buffer)))
(with-current-buffer newbuf
(when org-org-htmlized-css-url
(goto-char (point-min))
@@ -265,10 +266,12 @@ Return output file name."
(replace-match
(format
"<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\">"
- org-org-htmlized-css-url) t t)))
+ org-org-htmlized-css-url)
+ t t)))
(write-file (concat pub-dir (file-name-nondirectory filename) html-ext)))
(kill-buffer newbuf)
(unless visitingp (kill-buffer work-buffer)))
+ ;; FIXME: Why? Which buffer is this supposed to apply to?
(set-buffer-modified-p nil)))