Commit 2ca695f2 authored by Glenn Morris's avatar Glenn Morris
Browse files

(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.
parent 2f4dfc5c
...@@ -263,6 +263,16 @@ search." ...@@ -263,6 +263,16 @@ search."
(setq attr-list (cdr attr-list))))) (setq attr-list (cdr attr-list)))))
(list entry ret-attr)))) (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 ;; This can be removed once the kill/yank treatment of invisible text
;; (see etc/TODO) is fixed. -- gm ;; (see etc/TODO) is fixed. -- gm
...@@ -309,17 +319,6 @@ Only used if `diary-header-line-flag' is non-nil." ...@@ -309,17 +319,6 @@ Only used if `diary-header-line-flag' is non-nil."
(and diary-file (and diary-file
(find-buffer-visiting (substitute-in-file-name 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 (defcustom number-of-diary-entries 1
"Specifies how many days of diary entries are to be displayed initially. "Specifies how many days of diary entries are to be displayed initially.
This variable affects the diary display when the command \\[diary] is used, This variable affects the diary display when the command \\[diary] is used,
...@@ -1996,51 +1995,53 @@ names." ...@@ -1996,51 +1995,53 @@ names."
(eval-when-compile (require 'cal-hebrew) (eval-when-compile (require 'cal-hebrew)
(require 'cal-islam)) (require 'cal-islam))
(defvar diary-font-lock-keywords (defun diary-font-lock-keywords ()
(append "Return a value for the variable `diary-font-lock-keywords'."
(diary-font-lock-date-forms calendar-month-name-array (append
nil calendar-month-abbrev-array) (diary-font-lock-date-forms calendar-month-name-array
(when (or (memq 'mark-hebrew-diary-entries nil calendar-month-abbrev-array)
nongregorian-diary-marking-hook) (when (or (memq 'mark-hebrew-diary-entries
(memq 'list-hebrew-diary-entries nongregorian-diary-marking-hook)
nongregorian-diary-listing-hook)) (memq 'list-hebrew-diary-entries
(require 'cal-hebrew) nongregorian-diary-listing-hook))
(diary-font-lock-date-forms (require 'cal-hebrew)
calendar-hebrew-month-name-array-leap-year (diary-font-lock-date-forms
hebrew-diary-entry-symbol)) calendar-hebrew-month-name-array-leap-year
(when (or (memq 'mark-islamic-diary-entries hebrew-diary-entry-symbol))
nongregorian-diary-marking-hook) (when (or (memq 'mark-islamic-diary-entries
(memq 'list-islamic-diary-entries nongregorian-diary-marking-hook)
nongregorian-diary-listing-hook)) (memq 'list-islamic-diary-entries
(require 'cal-islam) nongregorian-diary-listing-hook))
(diary-font-lock-date-forms (require 'cal-islam)
calendar-islamic-month-name-array (diary-font-lock-date-forms
islamic-diary-entry-symbol)) calendar-islamic-month-name-array
(list islamic-diary-entry-symbol))
(cons (list
(concat "^" (regexp-quote diary-include-string) ".*$") (cons
'font-lock-keyword-face) (concat "^" (regexp-quote diary-include-string) ".*$")
(cons 'font-lock-keyword-face)
(concat "^" (regexp-quote diary-nonmarking-symbol) (cons
"?\\(" (regexp-quote sexp-diary-entry-symbol) "\\)") (concat "^" (regexp-quote diary-nonmarking-symbol)
'(1 font-lock-reference-face)) "?\\(" (regexp-quote sexp-diary-entry-symbol) "\\)")
(cons '(1 font-lock-reference-face))
(concat "^" (regexp-quote diary-nonmarking-symbol)) (cons
'font-lock-reference-face) (concat "^" (regexp-quote diary-nonmarking-symbol))
(cons 'font-lock-reference-face)
(concat "^" (regexp-quote diary-nonmarking-symbol) (cons
"?\\(" (regexp-quote hebrew-diary-entry-symbol) "\\)") (concat "^" (regexp-quote diary-nonmarking-symbol)
'(1 font-lock-reference-face)) "?\\(" (regexp-quote hebrew-diary-entry-symbol) "\\)")
(cons '(1 font-lock-reference-face))
(concat "^" (regexp-quote diary-nonmarking-symbol) (cons
"?\\(" (regexp-quote islamic-diary-entry-symbol) "\\)") (concat "^" (regexp-quote diary-nonmarking-symbol)
'(1 font-lock-reference-face)) "?\\(" (regexp-quote islamic-diary-entry-symbol) "\\)")
'(diary-font-lock-sexps . font-lock-keyword-face) '(1 font-lock-reference-face))
`(,(concat "\\(^\\|\\s-\\)" '(diary-font-lock-sexps . font-lock-keyword-face)
diary-time-regexp "\\(-" diary-time-regexp "\\)?") `(,(concat "\\(^\\|\\s-\\)"
. 'diary-time))) diary-time-regexp "\\(-" diary-time-regexp "\\)?")
"Forms to highlight in `diary-mode'.") . 'diary-time))))
(defvar diary-font-lock-keywords (diary-font-lock-keywords)
"Forms to highlight in `diary-mode'.")
;; Following code from Dave Love <fx@gnu.org>. ;; Following code from Dave Love <fx@gnu.org>.
;; Import Outlook-format appointments from mail messages in Gnus or ;; Import Outlook-format appointments from mail messages in Gnus or
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment