From: Glenn Morris Date: Sat, 7 Apr 2007 21:53:17 +0000 (+0000) Subject: (diary-set-maybe-redraw): Move definition before first use. X-Git-Tag: emacs-pretest-22.0.98~213 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2ca695f23af1698dace6a90294e9cc69f1d81fa8;p=emacs.git (diary-set-maybe-redraw): Move definition before first use. (diary-font-lock-keywords): New function with old code for initialization of variable of same name. --- diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index a128e50a0fb..2adec8750c3 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -263,6 +263,16 @@ search." (setq attr-list (cdr attr-list))))) (list entry ret-attr)))) +(defun diary-set-maybe-redraw (symbol value) + "Set SYMBOL's value to VALUE, and redraw the diary if necessary. +Redraws the diary if it is being displayed (note this is not the same as +just visiting the `diary-file'), and SYMBOL's value is to be changed." + (let ((oldvalue (eval symbol))) + (custom-set-default symbol value) + (and (not (equal value oldvalue)) + (diary-live-p) + ;; Note this assumes diary was called without prefix arg. + (diary)))) ;; This can be removed once the kill/yank treatment of invisible text ;; (see etc/TODO) is fixed. -- gm @@ -309,17 +319,6 @@ Only used if `diary-header-line-flag' is non-nil." (and diary-file (find-buffer-visiting (substitute-in-file-name diary-file))))) -(defun diary-set-maybe-redraw (symbol value) - "Set SYMBOL's value to VALUE, and redraw the diary if necessary. -Redraws the diary if it is being displayed (note this is not the same as -just visiting the `diary-file'), and SYMBOL's value is to be changed." - (let ((oldvalue (eval symbol))) - (custom-set-default symbol value) - (and (not (equal value oldvalue)) - (diary-live-p) - ;; Note this assumes diary was called without prefix arg. - (diary)))) - (defcustom number-of-diary-entries 1 "Specifies how many days of diary entries are to be displayed initially. This variable affects the diary display when the command \\[diary] is used, @@ -1996,51 +1995,53 @@ names." (eval-when-compile (require 'cal-hebrew) (require 'cal-islam)) -(defvar diary-font-lock-keywords - (append - (diary-font-lock-date-forms calendar-month-name-array - nil calendar-month-abbrev-array) - (when (or (memq 'mark-hebrew-diary-entries - nongregorian-diary-marking-hook) - (memq 'list-hebrew-diary-entries - nongregorian-diary-listing-hook)) - (require 'cal-hebrew) - (diary-font-lock-date-forms - calendar-hebrew-month-name-array-leap-year - hebrew-diary-entry-symbol)) - (when (or (memq 'mark-islamic-diary-entries - nongregorian-diary-marking-hook) - (memq 'list-islamic-diary-entries - nongregorian-diary-listing-hook)) - (require 'cal-islam) - (diary-font-lock-date-forms - calendar-islamic-month-name-array - islamic-diary-entry-symbol)) - (list - (cons - (concat "^" (regexp-quote diary-include-string) ".*$") - 'font-lock-keyword-face) - (cons - (concat "^" (regexp-quote diary-nonmarking-symbol) - "?\\(" (regexp-quote sexp-diary-entry-symbol) "\\)") - '(1 font-lock-reference-face)) - (cons - (concat "^" (regexp-quote diary-nonmarking-symbol)) - 'font-lock-reference-face) - (cons - (concat "^" (regexp-quote diary-nonmarking-symbol) - "?\\(" (regexp-quote hebrew-diary-entry-symbol) "\\)") - '(1 font-lock-reference-face)) - (cons - (concat "^" (regexp-quote diary-nonmarking-symbol) - "?\\(" (regexp-quote islamic-diary-entry-symbol) "\\)") - '(1 font-lock-reference-face)) - '(diary-font-lock-sexps . font-lock-keyword-face) - `(,(concat "\\(^\\|\\s-\\)" - diary-time-regexp "\\(-" diary-time-regexp "\\)?") - . 'diary-time))) - "Forms to highlight in `diary-mode'.") - +(defun diary-font-lock-keywords () + "Return a value for the variable `diary-font-lock-keywords'." + (append + (diary-font-lock-date-forms calendar-month-name-array + nil calendar-month-abbrev-array) + (when (or (memq 'mark-hebrew-diary-entries + nongregorian-diary-marking-hook) + (memq 'list-hebrew-diary-entries + nongregorian-diary-listing-hook)) + (require 'cal-hebrew) + (diary-font-lock-date-forms + calendar-hebrew-month-name-array-leap-year + hebrew-diary-entry-symbol)) + (when (or (memq 'mark-islamic-diary-entries + nongregorian-diary-marking-hook) + (memq 'list-islamic-diary-entries + nongregorian-diary-listing-hook)) + (require 'cal-islam) + (diary-font-lock-date-forms + calendar-islamic-month-name-array + islamic-diary-entry-symbol)) + (list + (cons + (concat "^" (regexp-quote diary-include-string) ".*$") + 'font-lock-keyword-face) + (cons + (concat "^" (regexp-quote diary-nonmarking-symbol) + "?\\(" (regexp-quote sexp-diary-entry-symbol) "\\)") + '(1 font-lock-reference-face)) + (cons + (concat "^" (regexp-quote diary-nonmarking-symbol)) + 'font-lock-reference-face) + (cons + (concat "^" (regexp-quote diary-nonmarking-symbol) + "?\\(" (regexp-quote hebrew-diary-entry-symbol) "\\)") + '(1 font-lock-reference-face)) + (cons + (concat "^" (regexp-quote diary-nonmarking-symbol) + "?\\(" (regexp-quote islamic-diary-entry-symbol) "\\)") + '(1 font-lock-reference-face)) + '(diary-font-lock-sexps . font-lock-keyword-face) + `(,(concat "\\(^\\|\\s-\\)" + diary-time-regexp "\\(-" diary-time-regexp "\\)?") + . 'diary-time)))) + +(defvar diary-font-lock-keywords (diary-font-lock-keywords) + "Forms to highlight in `diary-mode'.") ;; Following code from Dave Love . ;; Import Outlook-format appointments from mail messages in Gnus or