* trivial bug of font-lock in Change Log mode.
@ 2005-05-26 1:00 Kenichi Handa
2005-05-26 14:54 ` Richard Stallman
2005-05-27 11:45 ` Juri Linkov
0 siblings, 2 replies; 8+ messages in thread
From: Kenichi Handa @ 2005-05-26 1:00 UTC (permalink / raw)
For instance, emacs/src/ChangeLog has this line near the
end.
See ChangeLog.9 for earlier changes.
When I visit this file and turn on font-lock mode, "See
Change" (the first 10 characters) gets change-log-data-face.
It seems that the attached change fix the problem, but, it
may fail if there are some other old style than these two:
Wed Aug 21 03:51:42 1996
2005-05-16
Could someone verify it?
---
Kenichi Handa
handa@m17n.org
*** add-log.el 12 May 2005 20:34:26 +0900 1.161
--- add-log.el 26 May 2005 09:56:08 +0900
***************
*** 217,223 ****
(defvar change-log-font-lock-keywords
'(;;
;; Date lines, new and old styles.
! ("^\\sw.........[0-9:+ ]*"
(0 'change-log-date-face)
;; Name and e-mail; some people put e-mail in parens, not angles.
("\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.-]+@[A-Za-z0-9_.-]+\\)[>)]" nil nil
--- 217,223 ----
(defvar change-log-font-lock-keywords
'(;;
;; Date lines, new and old styles.
! ("^\\([1-9][0-9][0-9][0-9]-[0-9-]+\\|\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\) \\sw\\sw\\sw\\)[0-9:+ ]*"
(0 'change-log-date-face)
;; Name and e-mail; some people put e-mail in parens, not angles.
("\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.-]+@[A-Za-z0-9_.-]+\\)[>)]" nil nil
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: trivial bug of font-lock in Change Log mode.
2005-05-26 1:00 trivial bug of font-lock in Change Log mode Kenichi Handa
@ 2005-05-26 14:54 ` Richard Stallman
2005-05-27 0:32 ` Kenichi Handa
2005-05-27 11:45 ` Juri Linkov
1 sibling, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2005-05-26 14:54 UTC (permalink / raw)
Cc: emacs-devel
;; Date lines, new and old styles.
! ("^\\([1-9][0-9][0-9][0-9]-[0-9-]+\\|\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\) \\sw\\sw\\sw\\)[0-9:+ ]*"
(0 'change-log-date-face)
Shouldn't that regexp end with + rather than *?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: trivial bug of font-lock in Change Log mode.
2005-05-26 14:54 ` Richard Stallman
@ 2005-05-27 0:32 ` Kenichi Handa
2005-05-27 14:20 ` Richard Stallman
0 siblings, 1 reply; 8+ messages in thread
From: Kenichi Handa @ 2005-05-27 0:32 UTC (permalink / raw)
Cc: emacs-devel
In article <E1DbJkb-0008KT-TG@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:
> ;; Date lines, new and old styles.
> ! ("^\\([1-9][0-9][0-9][0-9]-[0-9-]+\\|\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\) \\sw\\sw\\sw\\)[0-9:+ ]*"
> (0 'change-log-date-face)
> Shouldn't that regexp end with + rather than *?
The original regexp also ended with '*', and I don't know
all the variations of date line.
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: trivial bug of font-lock in Change Log mode.
2005-05-26 1:00 trivial bug of font-lock in Change Log mode Kenichi Handa
2005-05-26 14:54 ` Richard Stallman
@ 2005-05-27 11:45 ` Juri Linkov
1 sibling, 0 replies; 8+ messages in thread
From: Juri Linkov @ 2005-05-27 11:45 UTC (permalink / raw)
Cc: emacs-devel
> For instance, emacs/src/ChangeLog has this line near the
> end.
>
> See ChangeLog.9 for earlier changes.
>
> When I visit this file and turn on font-lock mode, "See
> Change" (the first 10 characters) gets change-log-data-face.
>
> It seems that the attached change fix the problem, but, it
> may fail if there are some other old style than these two:
>
> Wed Aug 21 03:51:42 1996
> 2005-05-16
>
> Could someone verify it?
This will cover most ChangeLog files, but I'd rather move your new
restricted date regexp to a new special variable `change-log-date-regexp'
(and using it in `change-log-font-lock-keywords'), thus allowing users
to override it by file local variables in ChangeLog files with a different
date format.
Also it seems that the format for arbitrary text in ChangeLog files is
a line beginning with two spaces. Look for example in the same file
emacs/src/ChangeLog for the copyright statement. It is indented with
two spaces, probably with the intention to not highlight it as a date:
Copyright (C) 2001, 02, 04 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted provided the copyright notice and this notice are preserved.
--
Juri Linkov
http://www.jurta.org/emacs/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: trivial bug of font-lock in Change Log mode.
2005-05-27 0:32 ` Kenichi Handa
@ 2005-05-27 14:20 ` Richard Stallman
2005-05-28 0:48 ` Kenichi Handa
0 siblings, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2005-05-27 14:20 UTC (permalink / raw)
Cc: emacs-devel
> ;; Date lines, new and old styles.
> ! ("^\\([1-9][0-9][0-9][0-9]-[0-9-]+\\|\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\) \\sw\\sw\\sw\\)[0-9:+ ]*"
> (0 'change-log-date-face)
> Shouldn't that regexp end with + rather than *?
The original regexp also ended with '*', and I don't know
all the variations of date line.
It seems to me that it could not be a valid date
if that match is empty. Don't you think so?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: trivial bug of font-lock in Change Log mode.
2005-05-27 14:20 ` Richard Stallman
@ 2005-05-28 0:48 ` Kenichi Handa
2005-05-28 11:52 ` Richard Stallman
0 siblings, 1 reply; 8+ messages in thread
From: Kenichi Handa @ 2005-05-28 0:48 UTC (permalink / raw)
Cc: emacs-devel
In article <E1DbfhE-0004ZY-JC@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:
>> ;; Date lines, new and old styles.
>> ! ("^\\([1-9][0-9][0-9][0-9]-[0-9-]+\\|\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\) \\sw\\sw\\sw\\)[0-9:+ ]*"
>> (0 'change-log-date-face)
>> Shouldn't that regexp end with + rather than *?
> The original regexp also ended with '*', and I don't know
> all the variations of date line.
> It seems to me that it could not be a valid date
> if that match is empty. Don't you think so?
The regexp always matches with non-empty text even if the
last is '*'. If we include the part "[0-9:+ ]*" in the
second paren part, then I agree that the last should be '+'
as this:
"^\\([1-9][0-9][0-9][0-9]-[0-9-]+\\|\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\) \\sw\\sw\\sw[0-9:+ ]+\\)"
But, then, we don't need the top-level paren and we can use this:
"^[1-9][0-9][0-9][0-9]-[0-9-]+\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\) \\sw\\sw\\sw[0-9:+ ]+"
Anyway, I think this kind of discussion is useless unless we
know what kind of date format we are going to support. For
instance, the current one doesn't handle this kind of date
format (note "JST"):
Sat May 28 09:41:40 JST 2005
I personally think that it's ok that we support only the
current format; something like "2005-05-13".
---
Kenichi Handa
handa@m17n.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: trivial bug of font-lock in Change Log mode.
2005-05-28 0:48 ` Kenichi Handa
@ 2005-05-28 11:52 ` Richard Stallman
2005-06-10 2:25 ` Kenichi Handa
0 siblings, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2005-05-28 11:52 UTC (permalink / raw)
Cc: emacs-devel
Anyway, I think this kind of discussion is useless unless we
know what kind of date format we are going to support. For
instance, the current one doesn't handle this kind of date
format (note "JST"):
Sat May 28 09:41:40 JST 2005
The idea is to handle date formats that were actually used in change
logs, now or in the past. We don't want to aim to handle all date formats
that people use in other contexts.
I recall that we did previously use a different date format.
I don't remember what it was, but maybe you can find it from
old versions of add-log.el.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: trivial bug of font-lock in Change Log mode.
2005-05-28 11:52 ` Richard Stallman
@ 2005-06-10 2:25 ` Kenichi Handa
0 siblings, 0 replies; 8+ messages in thread
From: Kenichi Handa @ 2005-06-10 2:25 UTC (permalink / raw)
Cc: emacs-devel
In article <E1Dbzs6-0004uY-VM@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> writes:
> Anyway, I think this kind of discussion is useless unless we
> know what kind of date format we are going to support. For
> instance, the current one doesn't handle this kind of date
> format (note "JST"):
> Sat May 28 09:41:40 JST 2005
> The idea is to handle date formats that were actually used in change
> logs, now or in the past. We don't want to aim to handle all date formats
> that people use in other contexts.
A user can use any kind of date formats in the context of
ChangeLog file by customizing add-log-time-format.
> I recall that we did previously use a different date format.
> I don't remember what it was, but maybe you can find it from
> old versions of add-log.el.
Yes, that's something like this:
Sat Jan 1 00:00:00 2000
If what you really mean is: "... handle the DEFAULT date
formats that were actually used in Emacs ...", I'd like to
install the attached patch.
---
Kenichi Handa
handa@m17n.org
Index: add-log.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/add-log.el,v
retrieving revision 1.163
diff -c -r1.163 add-log.el
*** add-log.el 29 May 2005 16:09:04 -0000 1.163
--- add-log.el 10 Jun 2005 02:20:26 -0000
***************
*** 216,223 ****
(defvar change-log-font-lock-keywords
'(;;
! ;; Date lines, new and old styles.
! ("^\\sw.........[0-9:+ ]*"
(0 'change-log-date-face)
;; Name and e-mail; some people put e-mail in parens, not angles.
("\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" nil nil
--- 216,227 ----
(defvar change-log-font-lock-keywords
'(;;
! ;; Date lines, new (2000-01-01) and old (Sat Jan 1 00:00:00 2000) styles.
! ;; Fixme: this regepx is just an approximate one and may match
! ;; wrongly with a non-date line existing as a random note. In
! ;; addition, using any kind of fixed setting like this doesn't
! ;; work if a user customizes add-log-time-format.
! ("^[0-9-]+ +\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\) [A-z][a-z][a-z] [0-9:+ ]+"
(0 'change-log-date-face)
;; Name and e-mail; some people put e-mail in parens, not angles.
("\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" nil nil
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-06-10 2:25 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-26 1:00 trivial bug of font-lock in Change Log mode Kenichi Handa
2005-05-26 14:54 ` Richard Stallman
2005-05-27 0:32 ` Kenichi Handa
2005-05-27 14:20 ` Richard Stallman
2005-05-28 0:48 ` Kenichi Handa
2005-05-28 11:52 ` Richard Stallman
2005-06-10 2:25 ` Kenichi Handa
2005-05-27 11:45 ` Juri Linkov
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).