From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: E Sabof Newsgroups: gmane.emacs.bugs Subject: bug#14179: [PATCH] hi-lock: more appropriate use of font-locking Date: Thu, 11 Apr 2013 05:19:13 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf3074d3d2d1246c04da0e16bc X-Trace: ger.gmane.org 1365654026 4162 80.91.229.3 (11 Apr 2013 04:20:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Apr 2013 04:20:26 +0000 (UTC) To: 14179@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Apr 11 06:20:29 2013 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 1UQ8zp-0008RM-TH for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Apr 2013 06:20:26 +0200 Original-Received: from localhost ([::1]:35649 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ8zp-0004Xe-1S for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Apr 2013 00:20:25 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ8zj-0004XO-9I for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2013 00:20:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQ8zg-0008Mj-L0 for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2013 00:20:19 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ8zg-0008Ma-HL for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2013 00:20:16 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UQ93K-0003fV-Qs for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2013 00:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: E Sabof Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Apr 2013 04:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14179 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.136565419313836 (code B ref -1); Thu, 11 Apr 2013 04:24:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Apr 2013 04:23:13 +0000 Original-Received: from localhost ([127.0.0.1]:44541 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UQ92W-0003b2-T4 for submit@debbugs.gnu.org; Thu, 11 Apr 2013 00:23:13 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52215) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UQ92U-0003am-Ez for submit@debbugs.gnu.org; Thu, 11 Apr 2013 00:23:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQ8ym-000863-Ef for submit@debbugs.gnu.org; Thu, 11 Apr 2013 00:19:23 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:45103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ8ym-00085z-CX for submit@debbugs.gnu.org; Thu, 11 Apr 2013 00:19:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35327) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ8yj-00041J-3v for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2013 00:19:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQ8yg-00085C-KB for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2013 00:19:17 -0400 Original-Received: from mail-qa0-f54.google.com ([209.85.216.54]:46887) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQ8yg-000852-C0 for bug-gnu-emacs@gnu.org; Thu, 11 Apr 2013 00:19:14 -0400 Original-Received: by mail-qa0-f54.google.com with SMTP id o13so78375qaj.6 for ; Wed, 10 Apr 2013 21:19:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=VIAJ5J3HusvQwR9x2TISb+9QRc6m0QWgpJb1fSdz8QM=; b=yZrtu/Dn0PagKaMvvWQbinuOOB5KRTWxE+b7DOElJ6lo8i8hb7mK2aiv7MPn8jAo3O 7MsrxXuIi6CGp5F9mt7wqh+/2AYNfwEWf/gs/25b9ZCCzCxNpseGYqoBCrCkmy6EJxnR Fd7iGXd4/o/N8jwvM7lbyEoik+tioIjmMQYmqXI0288ArREXRvyD7+iB1O9YhuBmqUYL ZHu/FJTxwaHL20q8nC47d6hFXsESYWkl4dKJSXn6KnGgSXjIUp0ir21QtuMkRhbrAZdg a6vlM+X8EPf7kYbtrpZBb68iNt73NXojYHdXNB2KrenqvYoWrM9KujlGUn+hdApvMISU xMKA== X-Received: by 10.224.60.15 with SMTP id n15mr5542368qah.45.1365653954043; Wed, 10 Apr 2013 21:19:14 -0700 (PDT) Original-Received: by 10.49.2.164 with HTTP; Wed, 10 Apr 2013 21:19:13 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.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:73323 Archived-At: --20cf3074d3d2d1246c04da0e16bc Content-Type: text/plain; charset=ISO-8859-1 Most modes that use custom fontification (ex occur-mode), won't turn the font-lock-mode off. So hi-lock would add a keyword, and remove all existing fontification. The below patch fixes this behaviour. Evgeni Modified lisp/hi-lock.el diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index e2dc4ea..e16ed76 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -689,7 +689,7 @@ Otherwise, read face name from minibuffer with completion and history." ;; Refuse to highlight a text that is already highlighted. (unless (assoc regexp hi-lock-interactive-patterns) (push pattern hi-lock-interactive-patterns) - (if font-lock-mode + (if (and font-lock-mode (font-lock-specified-p major-mode)) (progn (font-lock-add-keywords nil (list pattern) t) (font-lock-fontify-buffer)) --20cf3074d3d2d1246c04da0e16bc Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Most= modes that use custom fontification (ex occur-mode), won't turn the fo= nt-lock-mode off. So hi-lock would add a keyword, and remove all existing f= ontification. The below patch fixes this behaviour.

Evgeni
<= span class=3D"" style=3D"white-space:pre">
Modified =A0 lisp/hi-lock.el
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index e2dc4ea= ..e16ed76 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lo= ck.el
@@ -689,7 +689,7 @@ Otherwise, read face name from minibuff= er with completion and history."
=A0 =A0 =A0;; Refuse to highlight a text that is already highlighted.<= /div>
=A0 =A0 =A0(unless (assoc regexp hi-lock-interactive-patterns)
=A0 =A0 =A0 =A0(push pattern hi-lock-interactive-patterns)
- =A0 =A0 =A0(if font-lock-mode
+ =A0 =A0 =A0(if (and font-lock-mode (font-lock-specified-p major-mode= ))
=A0 =A0(pro= gn
=A0 =A0 =A0= (font-lock-add-keywords nil (list pattern) t)
=A0 =A0 =A0(font-lo= ck-fontify-buffer))

--20cf3074d3d2d1246c04da0e16bc--