From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#41810: 28.0.50; [ELPA] adaptive-wrap: Fontify wrap-prefix Date: Fri, 12 Jun 2020 11:33:25 -0400 Message-ID: References: <87k10d7f2v.fsf@gmail.com> <87bllovfb5.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="74332"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 41810@debbugs.gnu.org, Stephen Berman To: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 12 17:34:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jjlh4-000JDf-UZ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Jun 2020 17:34:11 +0200 Original-Received: from localhost ([::1]:47388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjlh4-00068B-0c for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Jun 2020 11:34:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjlgw-00066a-4h for bug-gnu-emacs@gnu.org; Fri, 12 Jun 2020 11:34:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57149) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jjlgv-0001yl-Qi for bug-gnu-emacs@gnu.org; Fri, 12 Jun 2020 11:34:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jjlgv-0006SG-Lh for bug-gnu-emacs@gnu.org; Fri, 12 Jun 2020 11:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Jun 2020 15:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41810 X-GNU-PR-Package: emacs Original-Received: via spool by 41810-submit@debbugs.gnu.org id=B41810.159197601724781 (code B ref 41810); Fri, 12 Jun 2020 15:34:01 +0000 Original-Received: (at 41810) by debbugs.gnu.org; 12 Jun 2020 15:33:37 +0000 Original-Received: from localhost ([127.0.0.1]:40462 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjlgX-0006Rd-Dl for submit@debbugs.gnu.org; Fri, 12 Jun 2020 11:33:37 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:20800) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjlgV-0006RQ-OL for 41810@debbugs.gnu.org; Fri, 12 Jun 2020 11:33:36 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 374AE80A55; Fri, 12 Jun 2020 11:33:30 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 53DB48097F; Fri, 12 Jun 2020 11:33:28 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1591976008; bh=c9R2KNcHQQ+FpP87adSRgW5P4cy4oPYlpSpEiaXxGnA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=i3R17exy82lIDJg7/0v8fobzOVfCxdrfbwoxzqGExZKHvyQnAOa9T7r76mFjByS/2 vQJ1z2D09aobP+FHSN0loLAY9o+mr5JQtq/vM3Cf38eyEWvkScyI+Xq4yCGmGccXef gqvg9kpLi2BsEoM7RjNgi0DVV3+AlhpV6ci1iQE8DoKQxGJzo5hVLoeDaZweXRsiRJ E6lmIwFqUfWDiFHY9UPyb1I0XKiAF3/AzqzlFFAMW91gwdROGjOQyT2uSPTPgyXd7P 3YJXua13NMyJcRUrfWR3t8RgPXorZUJxMWYS6vTgfapqCJz9BMIUOljiDeJ2MfCS0M h05Rqe5GL0Pjw== Original-Received: from alfajor (unknown [216.154.55.41]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id F38B71203B5; Fri, 12 Jun 2020 11:33:27 -0400 (EDT) In-Reply-To: <87bllovfb5.fsf@gmail.com> ("=?UTF-8?Q?K=C3=A9vin?= Le Gouguec"'s message of "Fri, 12 Jun 2020 10:50:06 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181892 Archived-At: > Or has it? The string returned by fill-context-prefix *has* the correct > face, that's why the first two semicolons are fontified IIUC; only the > *extra* padding characters are unfontified, those that we generate with: > > #+begin_src > ;; Reconstructed from `adaptive-wrap-fill-context-prefix': > (make-string > adaptive-wrap-extra-indent > (string-to-char (substring (fill-context-prefix beg end) -1))) > #+end_src Ah, indeed, it's because we go through `string-to-char` which has no way to preserve the text properties. Yes, we should fix that to just concatenate `adaptive-wrap-extra-indent` times the string returned by (substring (fill-context-prefix beg end) -1). > I think I narrowed it down to this condition in fill-context-prefix: > > #+begin_src > (if (or (and first-line-regexp > (string-match first-line-regexp > first-line-prefix)) > (and comment-start-skip > (string-match comment-start-skip > first-line-prefix))) > first-line-prefix > (make-string (string-width first-line-prefix) ?\s)) > #+end_src > > In the *scratch* buffer, the condition holds true, so first-line-prefix > is returned, text properties and all: that's why the first two > semicolons are fontified. > > In a diff buffer, > > 1. for removed lines, the condition is false, so we make a new, > unfontified string, without the diff-removed face, We should be able to make this work by trying to preserve `first-line-prefix`s text properties somehow. > 2. for added lines and headers, there is no prefix at all, so > fill-context-prefix has nothing to tell us about what faces to apply. > > I don't know if the fix belongs in fill-context-prefix, or if it should > be adaptive-wrap-fill-context-prefix's job to fixup faces=E2=80=A6 I don't think it could be fixed in `fill-context-prefix`. I guess we could try and fix it in `adaptive-wrap-fill-context-prefix` by trying to preserve any face that covers the whole line (including the final newline). I'm glad I'm not the one who'll write the code ;-) Stefan