unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stephen Berman <stephen.berman@gmx.net>
Cc: 13072@debbugs.gnu.org
Subject: bug#13072: 24.3.50; Fancy Diary display fontification failures
Date: Fri, 21 Aug 2020 14:35:08 +0200	[thread overview]
Message-ID: <87v9hc5g8z.fsf@gnus.org> (raw)
In-Reply-To: <87k3sybs8k.fsf@rosalinde.fritz.box> (Stephen Berman's message of "Tue, 04 Dec 2012 01:01:15 +0100")

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?

diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index da98e44926..8ea831554b 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -2406,9 +2406,18 @@ diary-fancy-date-pattern
      ;; string form"; eg the iso version calls string-to-number on some.
      ;; Therefore we cannot eg just let day = "[0-9]+".  (Bug#8583).
      ;; Assumes no integers in c-day/month-name-array.
-     (replace-regexp-in-string "[0-9]+" "[0-9]+"
-                               (mapconcat #'eval calendar-date-display-form "")
-                               nil t))
+      (replace-regexp-in-string
+       "[0-9]+" "[0-9]+"
+       (mapconcat (lambda (x)
+                    (if (or (atom x) (eq (car x) 'format))
+ 			(eval x)
+ 		      (catch 'end
+ 			(while (consp x)
+ 			  (let ((y (pop x)))
+ 			    (when (or (eq y 'year) (eq y 'month) (eq y 'day))
+ 			      (throw 'end (eval y))))))))
+ 		  calendar-date-display-form "")
+       nil t))
    ;; Optional ": holiday name" after the date.
    "\\(: .*\\)?"))
 


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2020-08-21 12:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-04  0:01 bug#13072: 24.3.50; Fancy Diary display fontification failures Stephen Berman
2020-08-21 12:35 ` Lars Ingebrigtsen [this message]
2020-08-21 14:46   ` Stephen Berman
2020-08-22 13:26     ` Lars Ingebrigtsen
2020-08-25 18:02       ` Stephen Berman
2020-08-25 19:02         ` Lars Ingebrigtsen
2020-10-13  2:11         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v9hc5g8z.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=13072@debbugs.gnu.org \
    --cc=stephen.berman@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).