Show
Ignore:
Timestamp:
2007年04月07日 15時49分28秒 (2 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/calendar/diary-lib.el

    r4196 r4200  
    268268;; (see etc/TODO) is fixed. -- gm 
    269269(defcustom diary-header-line-flag t 
    270   "If non-nil, `diary-simple-display' will show a header line. 
     270  "If non-nil, `simple-diary-display' will show a header line. 
    271271The format of the header is specified by `diary-header-line-format'." 
    272272  :group   'diary 
    273273  :type    'boolean 
     274  :initialize 'custom-initialize-default 
     275  :set 'diary-set-maybe-redraw 
    274276  :version "22.1") 
    275277 
     
    283285                   "Diary")) 
    284286           ?\s (frame-width))) 
    285   "Format of the header line displayed by `diary-simple-display'. 
     287  "Format of the header line displayed by `simple-diary-display'. 
    286288Only used if `diary-header-line-flag' is non-nil." 
    287289  :group   'diary 
     
    291293(defvar diary-saved-point)              ; internal 
    292294 
     295;; The first version of this also checked for diary-selective-display 
     296;; in the non-fancy case. This was an attempt to distinguish between 
     297;; displaying the diary and just visiting the diary file. However, 
     298;; when using fancy diary, calling diary when there are no entries to 
     299;; display does not create the fancy buffer, nor does it switch on 
     300;; selective-display in the diary buffer. This means some 
     301;; customizations will not take effect, eg: 
     302;; http://lists.gnu.org/archive/html/emacs-pretest-bug/2007-03/msg00466.html 
     303;; So the check for selective-display was dropped. This means the 
     304;; diary will be displayed if one customizes a diary variable while 
     305;; just visiting the diary-file. This is i) unlikely, and ii) no great loss. 
    293306(defun diary-live-p () 
    294   "Return non-nil if the diary is being displayed. 
    295 This is not the same as just visiting the `diary-file'." 
     307  "Return non-nil if the diary is being displayed." 
    296308  (or (get-buffer fancy-diary-buffer) 
    297       (when diary-file 
    298         (let ((dbuff (find-buffer-visiting 
    299                       (substitute-in-file-name diary-file)))) 
    300           (when dbuff 
    301             (with-current-buffer dbuff 
    302               diary-selective-display)))))) 
     309      (and diary-file 
     310           (find-buffer-visiting (substitute-in-file-name diary-file))))) 
     311 
     312(defun diary-set-maybe-redraw (symbol value) 
     313  "Set SYMBOL's value to VALUE, and redraw the diary if necessary. 
     314Redraws the diary if it is being displayed (note this is not the same as 
     315just visiting the `diary-file'), and SYMBOL's value is to be changed." 
     316  (let ((oldvalue (eval symbol))) 
     317    (custom-set-default symbol value) 
     318    (and (not (equal value oldvalue)) 
     319         (diary-live-p) 
     320         ;; Note this assumes diary was called without prefix arg. 
     321         (diary)))) 
    303322 
    304323(defcustom number-of-diary-entries 1 
     
    329348                         (integer :tag "Saturday"))) 
    330349  :initialize 'custom-initialize-default 
    331   ;; Redraw a live diary buffer if necessary. Note this assumes diary 
    332   ;; was not called with a prefix arg. 
    333   :set (lambda (symbol value) 
    334          (let ((oldvalue number-of-diary-entries)) 
    335            (custom-set-default symbol value) 
    336            (and (not (equal value oldvalue)) 
    337                 (diary-live-p) 
    338                 (diary)))) 
     350  :set 'diary-set-maybe-redraw 
    339351  :group 'diary) 
    340352 
     
    430442                (revert-buffer t t)))) 
    431443        ;; Setup things like the header-line-format and invisibility-spec. 
    432         (when (eq major-mode default-major-mode) (diary-mode)) 
     444        ;; This used to only run if the major-mode was default-major-mode, 
     445        ;; but that meant eg changes to header-line-format did not 
     446        ;; take effect from one diary invocation to the next. 
     447        (diary-mode) 
    433448        ;; d-s-p is passed to the diary display function. 
    434449        (let ((diary-saved-point (point)))