Changeset 4200 for trunk/lisp/calendar/diary-lib.el
- Timestamp:
- 2007年04月07日 15時49分28秒 (2 years ago)
- Files:
-
- trunk/lisp/calendar/diary-lib.el (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lisp/calendar/diary-lib.el
r4196 r4200 268 268 ;; (see etc/TODO) is fixed. -- gm 269 269 (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. 271 271 The format of the header is specified by `diary-header-line-format'." 272 272 :group 'diary 273 273 :type 'boolean 274 :initialize 'custom-initialize-default 275 :set 'diary-set-maybe-redraw 274 276 :version "22.1") 275 277 … … 283 285 "Diary")) 284 286 ?\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'. 286 288 Only used if `diary-header-line-flag' is non-nil." 287 289 :group 'diary … … 291 293 (defvar diary-saved-point) ; internal 292 294 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. 293 306 (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." 296 308 (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. 314 Redraws the diary if it is being displayed (note this is not the same as 315 just 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)))) 303 322 304 323 (defcustom number-of-diary-entries 1 … … 329 348 (integer :tag "Saturday"))) 330 349 :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 339 351 :group 'diary) 340 352 … … 430 442 (revert-buffer t t)))) 431 443 ;; 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) 433 448 ;; d-s-p is passed to the diary display function. 434 449 (let ((diary-saved-point (point)))
