[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r104104: Small diary-lib.el font-lock
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r104104: Small diary-lib.el font-locking fix. |
Date: |
Tue, 03 May 2011 19:06:28 -0700 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 104104
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Tue 2011-05-03 19:06:28 -0700
message:
Small diary-lib.el font-locking fix.
* lisp/calendar/diary-lib.el (diary-fancy-date-pattern):
Turn it into a function, so it follows changes in calendar-date-style.
(diary-fancy-date-matcher): New function.
(diary-fancy-font-lock-keywords): Use diary-fancy-date-matcher.
(diary-fancy-font-lock-fontify-region-function):
Use diary-fancy-date-pattern as a function.
modified:
lisp/ChangeLog
lisp/calendar/diary-lib.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-05-04 02:03:30 +0000
+++ b/lisp/ChangeLog 2011-05-04 02:06:28 +0000
@@ -1,5 +1,12 @@
2011-05-04 Glenn Morris <address@hidden>
+ * calendar/diary-lib.el (diary-fancy-date-pattern): Turn it into a
+ function, so it follows changes in calendar-date-style.
+ (diary-fancy-date-matcher): New function.
+ (diary-fancy-font-lock-keywords): Use diary-fancy-date-matcher.
+ (diary-fancy-font-lock-fontify-region-function):
+ Use diary-fancy-date-pattern as a function.
+
* calendar/diary-lib.el (diary-fancy-date-pattern): Do not use
non-numbers for `year' etc pseudo-variables. (Bug#8583)
=== modified file 'lisp/calendar/diary-lib.el'
--- a/lisp/calendar/diary-lib.el 2011-05-04 02:03:30 +0000
+++ b/lisp/calendar/diary-lib.el 2011-05-04 02:06:28 +0000
@@ -2364,8 +2364,9 @@
;;; Fancy Diary Mode.
-;; FIXME does not update upon changes to the name-arrays.
-(defvar diary-fancy-date-pattern
+(defun diary-fancy-date-pattern ()
+ "Return a regexp matching the first line of a fancy diary date header.
+This depends on the calendar date style."
(concat
(let ((dayname (diary-name-pattern calendar-day-name-array nil t))
(monthname (diary-name-pattern calendar-month-name-array nil t))
@@ -2381,26 +2382,27 @@
(mapconcat 'eval calendar-date-display-form "")
nil t))
;; Optional ": holiday name" after the date.
- "\\(: .*\\)?")
- "Regular expression matching the first line of a fancy diary date header.")
+ "\\(: .*\\)?"))
+
+(defun diary-fancy-date-matcher (limit)
+ "Search for a fancy diary data header, up to LIMIT."
+ ;; Any number of " other holiday name" lines, followed by "==" line.
+ (when (re-search-forward
+ (format "%s\\(\n +.*\\)*\n=+$" (diary-fancy-date-pattern)) limit t)
+ (put-text-property (match-beginning 0) (match-end 0) 'font-lock-multiline
t)
+ t))
(define-obsolete-variable-alias 'fancy-diary-font-lock-keywords
'diary-fancy-font-lock-keywords "23.1")
(defvar diary-fancy-font-lock-keywords
- (list
- (list
- ;; Any number of " other holiday name" lines, followed by "==" line.
- (concat diary-fancy-date-pattern "\\(\n +.*\\)*\n=+$")
- '(0 (progn (put-text-property (match-beginning 0) (match-end 0)
- 'font-lock-multiline t)
- diary-face)))
- '("^.*\\([aA]nniversary\\|[bB]irthday\\).*$" . 'diary-anniversary)
- '("^.*Yahrzeit.*$" . font-lock-reference-face)
- '("^\\(Erev \\)?Rosh Hodesh.*" . font-lock-function-name-face)
- '("^Day.*omer.*$" . font-lock-builtin-face)
- '("^Parashat.*$" . font-lock-comment-face)
- `(,(format "\\(^\\|\\s-\\)%s\\(-%s\\)?" diary-time-regexp
+ `((diary-fancy-date-matcher . diary-face)
+ ("^.*\\([aA]nniversary\\|[bB]irthday\\).*$" . 'diary-anniversary)
+ ("^.*Yahrzeit.*$" . font-lock-reference-face)
+ ("^\\(Erev \\)?Rosh Hodesh.*" . font-lock-function-name-face)
+ ("^Day.*omer.*$" . font-lock-builtin-face)
+ ("^Parashat.*$" . font-lock-comment-face)
+ (,(format "\\(^\\|\\s-\\)%s\\(-%s\\)?" diary-time-regexp
diary-time-regexp) . 'diary-time))
"Keywords to highlight in fancy diary display.")
@@ -2416,7 +2418,7 @@
(while (and (looking-at " +[^ ]")
(zerop (forward-line -1))))
;; This check not essential.
- (if (looking-at diary-fancy-date-pattern)
+ (if (looking-at (diary-fancy-date-pattern))
(setq beg (line-beginning-position)))
(goto-char end)
(forward-line 0)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r104104: Small diary-lib.el font-locking fix.,
Glenn Morris <=