From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Frank Fischer Newsgroups: gmane.emacs.bugs Subject: bug#15155: 24.3; wrap-prefix in adaptive-wrap-prefix-mode with variable-pitch has wrong face Date: Fri, 23 Aug 2013 15:17:58 +0200 Organization: Chemnitz University of Technology Message-ID: <20130823151758.4b4c3f8a@mawo> References: <87ob8q4y67.fsf@mathematik.tu-chemnitz.de> <5215B7EC.10808@mathematik.tu-chemnitz.de> <838uztkc80.fsf@gnu.org> <52162DBA.2040905@mathematik.tu-chemnitz.de> <831u5lk909.fsf@gnu.org> <52163919.7080505@mathematik.tu-chemnitz.de> <83zjs9is0q.fsf@gnu.org> <20130822223246.07dbc5a6@mawo> <83txigj4ea.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1377263959 14458 80.91.229.3 (23 Aug 2013 13:19:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 23 Aug 2013 13:19:19 +0000 (UTC) Cc: 15155@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 23 15:19:21 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 1VCrGn-00014T-AK for geb-bug-gnu-emacs@m.gmane.org; Fri, 23 Aug 2013 15:19:17 +0200 Original-Received: from localhost ([::1]:36976 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCrGm-0008Aj-Ta for geb-bug-gnu-emacs@m.gmane.org; Fri, 23 Aug 2013 09:19:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCrGf-0008Ad-6A for bug-gnu-emacs@gnu.org; Fri, 23 Aug 2013 09:19:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCrGY-0001rG-KI for bug-gnu-emacs@gnu.org; Fri, 23 Aug 2013 09:19:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCrGY-0001r4-Gi for bug-gnu-emacs@gnu.org; Fri, 23 Aug 2013 09:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VCrGX-0003Co-NT for bug-gnu-emacs@gnu.org; Fri, 23 Aug 2013 09:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Frank Fischer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Aug 2013 13:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15155 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15155-submit@debbugs.gnu.org id=B15155.137726389612262 (code B ref 15155); Fri, 23 Aug 2013 13:19:01 +0000 Original-Received: (at 15155) by debbugs.gnu.org; 23 Aug 2013 13:18:16 +0000 Original-Received: from localhost ([127.0.0.1]:49812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VCrFl-0003Bf-8a for submit@debbugs.gnu.org; Fri, 23 Aug 2013 09:18:16 -0400 Original-Received: from nick.hrz.tu-chemnitz.de ([134.109.228.11]:34740) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VCrFh-0003BU-SM for 15155@debbugs.gnu.org; Fri, 23 Aug 2013 09:18:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tu-chemnitz.de; s=dkim2010; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=FCN41MK1BTCcmpwDqr/XQFszhud5/Ro+FBhlH7+7zM8=; b=BnFkYliSm4Eur92M4iedrB/QIzCSOjzreaTHBOlEKgPvxbPX0ze36eBHUyOej3A6OWyJLYyUIEvFgL43ac3F/YGPWUwvlKa0uiR0t/d3lgPsJ0nDuC7mJNWTB3yOp51wxNSTw1xdg6u9/8lUi0jOX49HrREWe/JT9nBrOzYHaSU=; Original-Received: from i59f6a61a.versanet.de ([89.246.166.26] helo=mawo) by nick.hrz.tu-chemnitz.de with esmtpsa (SSLv3:DHE-RSA-AES128-SHA:128) (Exim 4.80.1) (envelope-from ) id 1VCrFe-0004po-Az; Fri, 23 Aug 2013 15:18:07 +0200 In-Reply-To: <83txigj4ea.fsf@gnu.org> X-Mailer: Claws Mail 3.9.1 (GTK+ 2.24.17; x86_64-pc-linux-gnu) X-purgate: clean X-purgate-type: clean X-purgate-ID: 154106::1377263886-000004FE-36E0F57B/0-0/0-0 X-Scan-AV: nick.hrz.tu-chemnitz.de; 2013-08-23 15:18:06; 1c5fe50c83cfe80a40435d3ba50d6689 X-Scan-SA: nick.hrz.tu-chemnitz.de; 2013-08-23 15:18:07; efc8bd3ba3412a63f68a4b991e65b9cb X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.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:77647 Archived-At: Am Fri, 23 Aug 2013 09:41:01 +0300 schrieb Eli Zaretskii : > > Date: Thu, 22 Aug 2013 22:32:46 +0200 > > From: Frank Fischer > > Cc: monnier@iro.umontreal.ca, 15155@debbugs.gnu.org > > > > Am Thu, 22 Aug 2013 19:56:05 +0300 > > schrieb Eli Zaretskii : > > > > > Can you build Emacs from the trunk? I would like to ask you to > > > try a patch that might fix this in your use case. > > > > Sure, I'd be happy to help ;) > > Thank you. Please try the patch below. It should solve the problem > with the font; you will still need to make sure on the Lisp level that > the prefix has the right face, to get the color you want. That patch seems to work, thank you. I have only one (very) minor issue left: depending on the mode the wrap-prefix may contain characters with different faces (e.g. in emacs-lisp mode !!!;;; would be a correct prefix, the first three characters with default face, the latter three with comment-face), hence there is not really "the one" correct face to assign 'wrap-prefix with `propertize`. That why I tried the variant (setq adaptive-fill-function (lambda () (and adaptive-fill-regexp (looking-at adaptive-fill-regexp) (match-string 0)))) hoping that (match-string 0) returns the whole prefix with the correct fontification. However, there are situations where this does not work: for example if one has a (very long) wrapped line without comment and then inserts a semicolon (only one) at the beginning of that line to comment it out, then the wrap-prefix does not get comment face (to be precise, it has the correct font, thus your patch works, but not the correct color). But if one inserts a second semicolon then the wrap-prefix gets the correct color. I assume this happens because the wrap-prefix is set before font-lock changed the face of inserted semicolon. Perhaps this is a more an issue of adaptive-wrap-mode, I don't know. If my guess is correct, is it possible to run the appropriate hooks (I think adaptive-wrap uses `jit-lock-register`) *after* font-lock changed the face? Or is there another, better way to detect the correct face? If you don't have a solution to this question, don't worry. I'm quite happy with your patch and it does already what I want ;) Thank you again, Frank