[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13072: 24.3.50; Fancy Diary display fontification failures
From: |
Stephen Berman |
Subject: |
bug#13072: 24.3.50; Fancy Diary display fontification failures |
Date: |
Fri, 21 Aug 2020 16:46:52 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
On Fri, 21 Aug 2020 14:35:08 +0200 Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Stephen Berman <stephen.berman@gmx.net> 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))