From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kyle Meyer Newsgroups: gmane.emacs.bugs Subject: bug#22399: org-mode fontification Date: Tue, 19 Jan 2016 01:32:49 -0500 Message-ID: <8737tu13la.fsf@kyleam.com> References: <87oacjng36.fsf@russet.org.uk> <87ziw36khb.fsf@gmx.us> <87a8o2zrtm.fsf@russet.org.uk> <87bn8i7mha.fsf@gmx.us> <87d1syvgc7.fsf@kyleam.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1453185202 22673 80.91.229.3 (19 Jan 2016 06:33:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Jan 2016 06:33:22 +0000 (UTC) Cc: 22399@debbugs.gnu.org To: phillip.lord@russet.org.uk Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 19 07:33:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aLPqp-0003u1-Gu for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Jan 2016 07:33:11 +0100 Original-Received: from localhost ([::1]:35253 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLPqo-0004DR-Jy for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Jan 2016 01:33:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLPqi-00048j-00 for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2016 01:33:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLPqg-0004b6-BV for bug-gnu-emacs@gnu.org; Tue, 19 Jan 2016 01:33:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLPqg-0004b2-8x; Tue, 19 Jan 2016 01:33:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aLPqg-00085j-1W; Tue, 19 Jan 2016 01:33:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Kyle Meyer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, emacs-orgmode@gnu.org Resent-Date: Tue, 19 Jan 2016 06:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22399 X-GNU-PR-Package: emacs,org-mode X-GNU-PR-Keywords: X-Debbugs-Original-Cc: 22399@debbugs.gnu.org, Org Mode Original-Received: via spool by 22399-submit@debbugs.gnu.org id=B22399.145318517731092 (code B ref 22399); Tue, 19 Jan 2016 06:33:01 +0000 Original-Received: (at 22399) by debbugs.gnu.org; 19 Jan 2016 06:32:57 +0000 Original-Received: from localhost ([127.0.0.1]:53317 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aLPqb-00085Q-Gc for submit@debbugs.gnu.org; Tue, 19 Jan 2016 01:32:57 -0500 Original-Received: from pb-smtp0.int.icgroup.com ([208.72.237.35]:61935 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aLPqZ-00085I-HY for 22399@debbugs.gnu.org; Tue, 19 Jan 2016 01:32:56 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-smtp0.pobox.com (Postfix) with ESMTP id 08A1A38C1C; Tue, 19 Jan 2016 01:32:54 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=HpGqarmycKpzvBZbM466yNsxiso=; b=cJsWlT qAUtT+8swQrP86UU+OACYgr6D2fuB5+igZI0c+Yf9ecUlc49YOGxmoWcicKBNgkZ tVCEy0bvopz/f9bcTuzZyuIVR7v3Wahk4NXKSJ/nuB1ksAIFQV6wN2M3/jT0keuv TozXLzS0uvYRidI9Zbx+/eVDuLRTjQ1BbVa2s= Original-Received: from pb-smtp0.int.icgroup.com (unknown [127.0.0.1]) by pb-smtp0.pobox.com (Postfix) with ESMTP id F381538C1B; Tue, 19 Jan 2016 01:32:53 -0500 (EST) Original-Received: from localhost (unknown [24.60.167.92]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pb-smtp0.pobox.com (Postfix) with ESMTPSA id 938FD38C1A; Tue, 19 Jan 2016 01:32:53 -0500 (EST) X-Attribution: Kyle In-Reply-To: <87d1syvgc7.fsf@kyleam.com> (Kyle Meyer's message of "Mon, 18 Jan 2016 14:27:04 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-Pobox-Relay-ID: 782B10F8-BE76-11E5-84F7-6BD26AB36C07-24757444!pb-smtp0.pobox.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:111732 Archived-At: --=-=-= Content-Type: text/plain Kyle Meyer writes: > Rasmus writes: > > [...] > >> Note, this change only lives it the Emacs version of Org. It was added in >> this commit: >> >> 6711a21f1125c0047c56eb266eb374c1ec90a967 [...] > > This commit was backported in Org commit d81e6b5, and then followed up > by c115c7b (org-compat: Use different font-lock-ensure alias, > 2015-07-26), which defined the alias as > > (unless (fboundp 'font-lock-ensure) > (defalias 'font-lock-ensure 'font-lock-fontify-buffer)) I've attached two patches against emacs-25 that would get the Org and Emacs repos in similar states wrt font-lock-ensure. The first patch replaces the font-lock-ensure compatibility alias from 6711a21f1 with the one currently used in the Org repo (from commit e6883dd03). The new alias is limited to being called with no arguments, but, at the moment, no Org code calls font-lock-ensure with any arguments. The second patch reverts a part of 6711a21f1 that modified org-src-font-lock-fontify-block to use font-lock-ensure rather than font-lock-fontify-buffer. In this particular case, using font-lock-ensure instead of font-lock-fontify-buffer fails to highlight the source block. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-org-compat-Use-different-font-lock-ensure-alias.patch >From 6072152a45bcdebbadbe7ec8f7589fce4bc341f2 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 26 Jul 2015 23:29:14 -0400 Subject: [PATCH 1/2] org-compat: Use different font-lock-ensure alias * lisp/org/org-compat.el (org-font-lock-ensure): Remove in favor of font-lock-ensure alias from Org's e6883dd. (Bug#22399) * lisp/org/org-clock.el (org-clock-get-clocktable): * lisp/org/org-src.el (org-src-font-lock-fontify-block): * lisp/org/org.el (org-fontify-like-in-org-mode): * lisp/org/ox-html.el (org-html-fontify-code): * lisp/org/ox-odt.el (org-odt-do-format-code): * lisp/org/ox-org.el (org-org-publish-to-org): Use new alias. Instead of org-font-lock-ensure alias introduced in 6711a21, use font-lock-ensure alias added in Org's e6883dd ("org-compat: Provide compatibility definition for font-lock-ensure", 2014-06-01). This corresponds to c115c7b4e86b68fe4f903636252a8b22b46a044f in the Org repo. --- lisp/org/org-clock.el | 2 +- lisp/org/org-compat.el | 7 +++---- lisp/org/org-src.el | 2 +- lisp/org/org.el | 2 +- lisp/org/ox-html.el | 2 +- lisp/org/ox-odt.el | 2 +- lisp/org/ox-org.el | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 9374f5f..217e97e 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -1931,7 +1931,7 @@ org-clock-get-clocktable (org-mode) (org-create-dblock props) (org-update-dblock) - (org-font-lock-ensure) + (font-lock-ensure) (forward-line 2) (buffer-substring (point) (progn (re-search-forward "^[ \t]*#\\+END" nil t) diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index 6403d4d..863197b 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el @@ -478,10 +478,9 @@ org-no-popups (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)))) +;; `font-lock-ensure' is only available from 24.4.50 on +(unless (fboundp 'font-lock-ensure) + (defalias 'font-lock-ensure 'font-lock-fontify-buffer)) (defun org-floor* (x &optional y) "Return a list of the floor of X and the fractional part of X. diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index 8e06aaa..1bcc202 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el @@ -916,7 +916,7 @@ org-src-font-lock-fontify-block (delete-region (point-min) (point-max)) (insert string " ") ;; so there's a final property change (unless (eq major-mode lang-mode) (funcall lang-mode)) - (org-font-lock-ensure) + (font-lock-ensure) (setq pos (point-min)) (while (setq next (next-single-property-change pos 'face)) (put-text-property diff --git a/lisp/org/org.el b/lisp/org/org.el index 960b874..bb3a89e 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -6375,7 +6375,7 @@ org-fontify-like-in-org-mode (insert s) (let ((org-odd-levels-only odd-levels)) (org-mode) - (org-font-lock-ensure) + (font-lock-ensure) (buffer-string)))) (defvar org-m nil) diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el index 1ca360c..b229423 100644 --- a/lisp/org/ox-html.el +++ b/lisp/org/ox-html.el @@ -1855,7 +1855,7 @@ org-html-fontify-code (funcall lang-mode) (insert code) ;; Fontify buffer. - (org-font-lock-ensure) + (font-lock-ensure) ;; Remove formatting on newline characters. (save-excursion (let ((beg (point-min)) diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el index f2b0c91..4f9760d 100644 --- a/lisp/org/ox-odt.el +++ b/lisp/org/ox-odt.el @@ -3140,7 +3140,7 @@ org-odt-do-format-code (with-temp-buffer (insert code) (funcall lang-mode) - (org-font-lock-ensure) + (font-lock-ensure) (buffer-string)))) (fontifier (if use-htmlfontify-p 'org-odt-htmlfontify-string 'org-odt--encode-plain-text)) diff --git a/lisp/org/ox-org.el b/lisp/org/ox-org.el index 6221c70..bc4eff9 100644 --- a/lisp/org/ox-org.el +++ b/lisp/org/ox-org.el @@ -254,7 +254,7 @@ org-org-publish-to-org (work-buffer (or visitingp (find-file-noselect filename))) newbuf) (with-current-buffer work-buffer - (org-font-lock-ensure) + (font-lock-ensure) (show-all) (org-show-block-all) (setq newbuf (htmlize-buffer))) -- 2.7.0 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0002-org-src-Use-font-lock-fontify-buffer-for-blocks.patch >From 212c3131def8d765e7ae4698f931530033cb9144 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Tue, 4 Aug 2015 23:50:59 -0400 Subject: [PATCH 2/2] org-src: Use font-lock-fontify-buffer for blocks * lisp/org/org-src.el (org-src-font-lock-fontify-block): Use font-lock-fontify-buffer because font-lock-ensure does not display source block fonts. This corresponds to 003a0f10695f035e844d844eacb1a86a6d2df934 in the Org repo. --- lisp/org/org-src.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index 1bcc202..5548f52 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el @@ -916,7 +916,9 @@ org-src-font-lock-fontify-block (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-ensure) + ;; Avoid `font-lock-ensure', which does not display fonts in + ;; source block. + (font-lock-fontify-buffer) (setq pos (point-min)) (while (setq next (next-single-property-change pos 'face)) (put-text-property -- 2.7.0 --=-=-= Content-Type: text/plain -- Kyle --=-=-=--