From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#13072: 24.3.50; Fancy Diary display fontification failures Date: Fri, 21 Aug 2020 16:46:52 +0200 Message-ID: <87r1s0m4yr.fsf@gmx.net> References: <87k3sybs8k.fsf@rosalinde.fritz.box> <87v9hc5g8z.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11008"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 13072@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 21 16:49:01 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 1k98Ll-0002ky-4T for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 21 Aug 2020 16:49:01 +0200 Original-Received: from localhost ([::1]:35148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k98Lk-0002PF-0k for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 21 Aug 2020 10:49:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k98Ko-0001yJ-5l for bug-gnu-emacs@gnu.org; Fri, 21 Aug 2020 10:48:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36458) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k98Kn-0001Dx-RZ for bug-gnu-emacs@gnu.org; Fri, 21 Aug 2020 10:48:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k98Kn-0002Qq-Pt for bug-gnu-emacs@gnu.org; Fri, 21 Aug 2020 10:48:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 Aug 2020 14:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13072 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 13072-submit@debbugs.gnu.org id=B13072.15980212237230 (code B ref 13072); Fri, 21 Aug 2020 14:48:01 +0000 Original-Received: (at 13072) by debbugs.gnu.org; 21 Aug 2020 14:47:03 +0000 Original-Received: from localhost ([127.0.0.1]:47995 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k98Jr-0001sG-5d for submit@debbugs.gnu.org; Fri, 21 Aug 2020 10:47:03 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:54023) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k98Jn-0001kl-S1 for 13072@debbugs.gnu.org; Fri, 21 Aug 2020 10:47:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1598021213; bh=JalsOmw0XNZ6wQBFGiY3bVQdrJPsG/f3zU4Z5ZtdDM8=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=A/BpnVRQWFvfTrrhXvbXoi5afu4CtEYY5nfQig2ygAn0eE2ESACO97Hb/mqU4cJlc v/JzirHkiLDabW5/AX/gtJf3HHlu2xPyi7ci2ndzaqW8k818s4aB50zQEcIWb+6ooJ cKgRsE59TrjLrYhDpSonqhYtB/8qA/Su78X3Zd0E= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from strobe-jhalfs ([178.1.122.94]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MQ5vc-1kMFJd1rZA-00M7ZS; Fri, 21 Aug 2020 16:46:53 +0200 In-Reply-To: <87v9hc5g8z.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 21 Aug 2020 14:35:08 +0200") X-Provags-ID: V03:K1:bdP1Cj0Rlu6/mh3VmU2dsujrst3XmoMXIujppMr2cxyFHKbGnCd YYZxlm4j4nKpeWKuu52jCBBdkfkl5jMUjqOm/0M/p6vfXOVPPuc9KowDdSkAHycBH8pLnx6 NBfJN9A79xIWT72CHiJW6VQGJ74p2y22fmjSVVSleUNUyEWgTK+KIyOeQSQi77ID7sWBW6a n4rIVWIMDGhPEmTxj5K2A== X-UI-Out-Filterresults: notjunk:1;V03:K0:y3ICzstBo2c=:bFbFPlxy5FMhnxklOmo+x5 700NEVaOSuGKDzcoOdJjed6qO7rm+eeL07XKAXij+ENvOmYUK0Fjei1ONwI7u5GNMSAJ0gHM1 jGK2SPwDz5pHItpurxwm45yfoM6F9THdHTXKdMGoi326+vXN5sLmZx+v8fJaM5BFbJzL1II6J FZh65+AQ8n6JCsR2Qb1T/5PGMfkcBUhAeVv3OqqH3IBsAOSnY7BVVKZ06nKDW6SPgFktqQxc4 xV+6/lA0gvoTmc1c1htftoNRdp9HRUry2z9tg/YR3zq38/xoXpn+hYumLbfYgOW1gunqOB2KD PwwgPtNKv9M0C3sFz81bxEaRhLeWTuNykyh3C1gMGbWTmVIFHjF2DUfZaIrb1EchNS9oGckcE zVk65GaiKc+EdLhs65ey1eM394lZjNgGtMjXAHwQBYkrWXbspLg4P+Bph2QgwDmDhjlH3Yma0 p6cSw5DoDYiELbvb+9gJbacY21t9loEZofFqIK0oOtaqPzx511oFPXJAEeJGxq5jXoN2rIYiD QH7X5Z8bjb6qf4MSXT/OVY9HuLxdNXw4TDWSkEJqAfdFwIxQOA28dLC13cuXcQS2lfmG4aJP0 oh6ShsmfCevVqE72adypHTGOg1Wtoe8eLpTMArgdxOqH2FqkpEZQLevYbEXmeehYYDZMFJDLW 4UbkIQ/4R/S3FOfM7LSQKJxinMmFhmH3Tb80BZGx4oTSYGO8JOFG6OZIavwX6D6L/WQ9LWdlh dTGKfZjTyg+VEjFmBIgXxke7Vyfe1kZzEzF+wvOHgOCXF+Ucr5QQ026O4WCGEaK/fK0z0bq0 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:185881 Archived-At: On Fri, 21 Aug 2020 14:35:08 +0200 Lars Ingebrigtsen wrote: > Stephen Berman writes: > >> The doc string of calendar-date-display-form says: >> >> For example, a typical American form would be >> '(month "/" day "/" (substring year -2)) >> whereas >> '((format "%9s, %9s %2s, %4s" dayname monthname day year)) >> would give the usual American style in fixed-length fields. >> >> But if you set calendar-date-display-form to either of these values >> (either via setq in your user-init-file or via the Custom interface), >> then in the Fancy Diary display the date header line is not fontified. > > I've respun your patch for Emacs 28... > > However, I'm not really sure why Fancy Diary Mode is doing any of > this -- it seems kinda misguided, and as you say, your patch only fixes > half of the problem. > > Instead of inserting the heading, and then trying to make a regexp to > match the heading and letting font-lock fontize, why doesn't it just put > the correct face on the heading when it inserts it? Because trying to > make that regexp is bound to have strange edge cases. > > Historical reasons? I don't know, but a first rough implementation of your suggestion seems promising: with the patch below, when using either of the above values of calendar-date-display-form, the date strings are fontified. A complete fix should go through the code carefully, checking for possible corner cases. Glenn Morris probably knows best if such an approach is worth pursuing. Steve Berman diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index da98e44926..2d024c04d9 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -1092,7 +1092,8 @@ diary-fancy-display (if (calendar-date-equal date (car h)) (setq date-holiday-list (append date-holiday-list (cdr h))))) - (insert (if (bobp) "" ?\n) (calendar-date-string date)) + (insert (if (bobp) "" ?\n) + (propertize (calendar-date-string date) 'face 'diary)) (if date-holiday-list (insert ": ")) (setq cc (current-column)) (insert (mapconcat (lambda (x) @@ -2460,11 +2461,6 @@ diary-fancy-overriding-map (define-derived-mode diary-fancy-display-mode special-mode "Diary" "Major mode used while displaying diary entries using Fancy Display." - (set (make-local-variable 'font-lock-defaults) - '(diary-fancy-font-lock-keywords - t nil nil nil - (font-lock-fontify-region-function - . diary-fancy-font-lock-fontify-region-function))) (set (make-local-variable 'minor-mode-overriding-map-alist) (list (cons t diary-fancy-overriding-map))) (view-mode 1))