From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Conflicting overlays and the 'priority property Date: Sun, 17 Jan 2010 19:04:49 +0100 Message-ID: <87hbqk620u.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1263751590 495 80.91.229.12 (17 Jan 2010 18:06:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 17 Jan 2010 18:06:30 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 17 19:06:23 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NWZW1-0000AS-85 for ged-emacs-devel@m.gmane.org; Sun, 17 Jan 2010 19:06:21 +0100 Original-Received: from localhost ([127.0.0.1]:59436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWZW1-0007G6-UZ for ged-emacs-devel@m.gmane.org; Sun, 17 Jan 2010 13:06:21 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NWZUe-0006qQ-3Y for emacs-devel@gnu.org; Sun, 17 Jan 2010 13:04:56 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NWZUZ-0006nI-NQ for emacs-devel@gnu.org; Sun, 17 Jan 2010 13:04:55 -0500 Original-Received: from [199.232.76.173] (port=35142 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWZUZ-0006n7-A5 for emacs-devel@gnu.org; Sun, 17 Jan 2010 13:04:51 -0500 Original-Received: from out2.smtp.messagingengine.com ([66.111.4.26]:37788) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NWZUY-0007rN-Ox for emacs-devel@gnu.org; Sun, 17 Jan 2010 13:04:50 -0500 Original-Received: from compute2.internal (compute2.internal [10.202.2.42]) by gateway1.messagingengine.com (Postfix) with ESMTP id 786B3CD203 for ; Sun, 17 Jan 2010 13:04:50 -0500 (EST) Original-Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute2.internal (MEProxy); Sun, 17 Jan 2010 13:04:50 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=from:to:subject:date:message-id:mime-version:content-type; s=smtpout; bh=2Zq4GyS+OeZD3NUg3ceUE2dncaw=; b=qtbOdID2yjFaZpqNk6GNKIOjdf4HRPy0ACHR7IfOceL5znF71hg/IABb3hPScYid9U7ut7vDZgeCbk9dw0IRuY6MTkXDKs9FdxSu46TDP9W/OOz5VyptP//+9x/KZur8uofkZT0qhSrvShe0rKyiorvLrrmFcYpBEPlwEjxxBqE= X-Sasl-enc: C41ZdDvwN8nUTxxhiBJvxacbMbZQSGBbgGQ3CAlSeulK 1263751489 Original-Received: from thinkpad.tsdh.de (p54AF2B7E.dip0.t-ipconnect.de [84.175.43.126]) by mail.messagingengine.com (Postfix) with ESMTPA id 907D6AB66 for ; Sun, 17 Jan 2010 13:04:49 -0500 (EST) Mail-Copies-To: never Mail-Followup-To: emacs-devel@gnu.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:120168 Archived-At: Hi all, I use Nicolaj Schumacher's highlight-symbol.el, which highlights the symbol at point or some selected symbol by using hi-lock to add a colorized background. Now the problem is that this background change is not visible on the current line, iff hl-line-mode is enabled. Both use overlays, the former via hi-lock, the latter manually. So there is an overlay for the whole line, and in that line there's another overlay for one symbol. Both specify a face property with some background color. Ok, so there is a conflict. It seems, that hl-line always wins. Reading the elisp manual, there is: ,----[ (info "(elisp)Overlay Properties") ] | `priority' | This property's value (which should be a nonnegative integer | number) determines the priority of the overlay. No priority, or | `nil', means zero. | | The priority matters when two or more overlays cover the same | character and both specify the same property; the one whose | `priority' value is larger overrides the other. For the `face' | property, the higher priority overlay's value does not completely | override the other value; instead, its face attributes override | the face attributes of the lower priority `face' property. `---- So I tried use that. I changed hi-lock like this: --8<---------------cut here---------------start------------->8--- diff -u -L /usr/share/emacs/23.1.91/lisp/hi-lock.el.gz -L /tmp/buffer-content-5991ty0 /tmp/jka-com5991f8D /tmp/buffer-content-5991ty0 --- /usr/share/emacs/23.1.91/lisp/hi-lock.el.gz +++ /tmp/buffer-content-5991ty0 @@ -568,7 +568,7 @@ "Inhibit the action of `hi-lock-font-lock-hook'. This is used by `hi-lock-set-pattern'.") -(defun hi-lock-set-pattern (regexp face) +(defun hi-lock-set-pattern (regexp face &optional priority) "Highlight REGEXP with face FACE." (let ((pattern (list regexp (list 0 (list 'quote face) t))) ;; The call to `font-lock-add-keywords' below might disable @@ -596,7 +596,8 @@ (let ((overlay (make-overlay (match-beginning 0) (match-end 0)))) (overlay-put overlay 'hi-lock-overlay t) (overlay-put overlay 'hi-lock-overlay-regexp serial) - (overlay-put overlay 'face face)) + (overlay-put overlay 'face face) + (overlay-put overlay 'priority priority)) (goto-char (match-end 0))))))))) (defun hi-lock-set-file-patterns (patterns) Diff finished. Sun Jan 17 18:55:02 2010 --8<---------------cut here---------------end--------------->8--- Then I changed highlight-symbol.el to call that function with a priority value of 9999. Unfortunately, that doesn't change anything. Still hl-line-mode's overlay takes precedence over the symbol overlay from highlight-symbol / hi-lock. But hl-line mode does not use the priority property, so I'm pretty sure that the background face property applied by highlight-symbol should take precedence over that of hl-line, at least that would comply with the docs. Am I doing something wrong, or is that a bug? Bye, Tassilo