diff options
| author | Stefan Monnier | 2005-09-12 21:21:42 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-09-12 21:21:42 +0000 |
| commit | 01a7778ef4902c697e7578ae085a0ee3772b212a (patch) | |
| tree | 4214711be9013acb49af9b515fe5359072584404 | |
| parent | 5874a24c2d252c2bee65469f60081a865cec802c (diff) | |
| download | emacs-01a7778ef4902c697e7578ae085a0ee3772b212a.tar.gz emacs-01a7778ef4902c697e7578ae085a0ee3772b212a.zip | |
Use with-current-buffer, match-string.
(diary-list-entries): Use with-syntax-table and dolist.
Rename from list-diary-entries.
Use number-of-diary-entries if `number' is nil.
(diary, diary-view-entries): Use this new name and new nil arg value.
(number-of-diary-entries): Move from calendar.el.
(diary-unhide-everything): New function.
(include-other-diary-files, fancy-diary-display)
(diary-show-all-entries, make-diary-entry): Use it.
(diary-mail-entries): Use buffer-string.
(mark-diary-entries): Fix long standing paren typo.
(diary-sexp-entry): Use count-lines.
(make-diary-entry): Avoid `previous-line'.
(diary-mode-map): New var.
(diary-mode): Redraw cal after saving. Setup header-line.
(fancy-diary-display-mode): Use local-set-key.
| -rw-r--r-- | lisp/calendar/diary-lib.el | 434 |
1 files changed, 210 insertions, 224 deletions
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 1501131c2ae..b35b7287a44 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el | |||
| @@ -58,21 +58,17 @@ does nothing. This function is suitable for execution in a `.emacs' file." | |||
| 58 | (interactive "P") | 58 | (interactive "P") |
| 59 | (diary-check-diary-file) | 59 | (diary-check-diary-file) |
| 60 | (let ((date (calendar-current-date))) | 60 | (let ((date (calendar-current-date))) |
| 61 | (list-diary-entries | 61 | (diary-list-entries date (if arg (prefix-numeric-value arg))))) |
| 62 | date | 62 | |
| 63 | (cond (arg (prefix-numeric-value arg)) | 63 | (define-obsolete-function-alias 'view-diary-entries 'diary-view-entries) |
| 64 | ((vectorp number-of-diary-entries) | 64 | (defun diary-view-entries (&optional arg) |
| 65 | (aref number-of-diary-entries (calendar-day-of-week date))) | ||
| 66 | (t number-of-diary-entries))))) | ||
| 67 | |||
| 68 | (defun view-diary-entries (arg) | ||
| 69 | "Prepare and display a buffer with diary entries. | 65 | "Prepare and display a buffer with diary entries. |
| 70 | Searches the file named in `diary-file' for entries that | 66 | Searches the file named in `diary-file' for entries that |
| 71 | match ARG days starting with the date indicated by the cursor position | 67 | match ARG days starting with the date indicated by the cursor position |
| 72 | in the displayed three-month calendar." | 68 | in the displayed three-month calendar." |
| 73 | (interactive "p") | 69 | (interactive "p") |
| 74 | (diary-check-diary-file) | 70 | (diary-check-diary-file) |
| 75 | (list-diary-entries (calendar-cursor-to-date t) arg)) | 71 | (diary-list-entries (calendar-cursor-to-date t) arg)) |
| 76 | 72 | ||
| 77 | (defun view-other-diary-entries (arg d-file) | 73 | (defun view-other-diary-entries (arg d-file) |
| 78 | "Prepare and display buffer of diary entries from an alternative diary file. | 74 | "Prepare and display buffer of diary entries from an alternative diary file. |
| @@ -182,14 +178,15 @@ The holidays are those in the list `calendar-holidays'.") | |||
| 182 | "Local time of candle lighting diary entry--applies if date is a Friday. | 178 | "Local time of candle lighting diary entry--applies if date is a Friday. |
| 183 | No diary entry if there is no sunset on that date.") | 179 | No diary entry if there is no sunset on that date.") |
| 184 | 180 | ||
| 185 | (defvar diary-syntax-table (copy-syntax-table (standard-syntax-table)) | 181 | (defvar diary-syntax-table |
| 182 | (let ((st (copy-syntax-table (standard-syntax-table)))) | ||
| 183 | (modify-syntax-entry ?* "w" st) | ||
| 184 | (modify-syntax-entry ?: "w" st) | ||
| 185 | st) | ||
| 186 | "The syntax table used when parsing dates in the diary file. | 186 | "The syntax table used when parsing dates in the diary file. |
| 187 | It is the standard syntax table used in Fundamental mode, but with the | 187 | It is the standard syntax table used in Fundamental mode, but with the |
| 188 | syntax of `*' and `:' changed to be word constituents.") | 188 | syntax of `*' and `:' changed to be word constituents.") |
| 189 | 189 | ||
| 190 | (modify-syntax-entry ?* "w" diary-syntax-table) | ||
| 191 | (modify-syntax-entry ?: "w" diary-syntax-table) | ||
| 192 | |||
| 193 | (defvar diary-entries-list) | 190 | (defvar diary-entries-list) |
| 194 | (defvar displayed-year) | 191 | (defvar displayed-year) |
| 195 | (defvar displayed-month) | 192 | (defvar displayed-month) |
| @@ -243,9 +240,7 @@ search." | |||
| 243 | regexp (concat diary-glob-file-regexp-prefix regexp)) | 240 | regexp (concat diary-glob-file-regexp-prefix regexp)) |
| 244 | (setq attrvalue nil) | 241 | (setq attrvalue nil) |
| 245 | (if (re-search-forward regexp (point-max) t) | 242 | (if (re-search-forward regexp (point-max) t) |
| 246 | (setq attrvalue (buffer-substring-no-properties | 243 | (setq attrvalue (match-string-no-properties regnum))) |
| 247 | (match-beginning regnum) | ||
| 248 | (match-end regnum)))) | ||
| 249 | (if (and attrvalue | 244 | (if (and attrvalue |
| 250 | (setq attrvalue (diary-attrtype-convert attrvalue type))) | 245 | (setq attrvalue (diary-attrtype-convert attrvalue type))) |
| 251 | (setq ret-attr (append ret-attr (list attrname attrvalue)))) | 246 | (setq ret-attr (append ret-attr (list attrname attrvalue)))) |
| @@ -264,9 +259,7 @@ search." | |||
| 264 | (setq attrvalue nil) | 259 | (setq attrvalue nil) |
| 265 | (if (string-match regexp entry) | 260 | (if (string-match regexp entry) |
| 266 | (progn | 261 | (progn |
| 267 | (setq attrvalue (substring-no-properties entry | 262 | (setq attrvalue (match-string-no-properties regnum entry)) |
| 268 | (match-beginning regnum) | ||
| 269 | (match-end regnum))) | ||
| 270 | (setq entry (replace-match "" t t entry)))) | 263 | (setq entry (replace-match "" t t entry)))) |
| 271 | (if (and attrvalue | 264 | (if (and attrvalue |
| 272 | (setq attrvalue (diary-attrtype-convert attrvalue type))) | 265 | (setq attrvalue (diary-attrtype-convert attrvalue type))) |
| @@ -299,8 +292,38 @@ Only used if `diary-header-line-flag' is non-nil." | |||
| 299 | 292 | ||
| 300 | (defvar diary-saved-point) ; internal | 293 | (defvar diary-saved-point) ; internal |
| 301 | 294 | ||
| 302 | (defun list-diary-entries (date number) | 295 | |
| 303 | "Create and display a buffer containing the relevant lines in diary-file. | 296 | (defcustom number-of-diary-entries 1 |
| 297 | "Specifies how many days of diary entries are to be displayed initially. | ||
| 298 | This variable affects the diary display when the command \\[diary] is used, | ||
| 299 | or if the value of the variable `view-diary-entries-initially' is t. For | ||
| 300 | example, if the default value 1 is used, then only the current day's diary | ||
| 301 | entries will be displayed. If the value 2 is used, then both the current | ||
| 302 | day's and the next day's entries will be displayed. | ||
| 303 | |||
| 304 | The value can also be a vector such as [0 2 2 2 2 4 1]; this value | ||
| 305 | says to display no diary entries on Sunday, the display the entries | ||
| 306 | for the current date and the day after on Monday through Thursday, | ||
| 307 | display Friday through Monday's entries on Friday, and display only | ||
| 308 | Saturday's entries on Saturday. | ||
| 309 | |||
| 310 | This variable does not affect the diary display with the `d' command | ||
| 311 | from the calendar; in that case, the prefix argument controls the | ||
| 312 | number of days of diary entries displayed." | ||
| 313 | :type '(choice (integer :tag "Entries") | ||
| 314 | (vector :value [0 0 0 0 0 0 0] | ||
| 315 | (integer :tag "Sunday") | ||
| 316 | (integer :tag "Monday") | ||
| 317 | (integer :tag "Tuesday") | ||
| 318 | (integer :tag "Wednesday") | ||
| 319 | (integer :tag "Thursday") | ||
| 320 | (integer :tag "Friday") | ||
| 321 | (integer :tag "Saturday"))) | ||
| 322 | :group 'diary) | ||
| 323 | |||
| 324 | (define-obsolete-function-alias 'list-diary-entries 'diary-list-entries) | ||
| 325 | (defun diary-list-entries (date number) | ||
| 326 | "Create and display a buffer containing the relevant lines in `diary-file'. | ||
| 304 | The arguments are DATE and NUMBER; the entries selected are those | 327 | The arguments are DATE and NUMBER; the entries selected are those |
| 305 | for NUMBER days starting with date DATE. The other entries are hidden | 328 | for NUMBER days starting with date DATE. The other entries are hidden |
| 306 | using selective display. If NUMBER is less than 1, this function does nothing. | 329 | using selective display. If NUMBER is less than 1, this function does nothing. |
| @@ -332,10 +355,12 @@ These hooks have the following distinct roles: | |||
| 332 | 355 | ||
| 333 | `diary-hook' is run last. This can be used for an appointment | 356 | `diary-hook' is run last. This can be used for an appointment |
| 334 | notification function." | 357 | notification function." |
| 335 | 358 | (unless number | |
| 359 | (setq number (if (vectorp number-of-diary-entries) | ||
| 360 | (aref number-of-diary-entries (calendar-day-of-week date)) | ||
| 361 | number-of-diary-entries))) | ||
| 336 | (when (> number 0) | 362 | (when (> number 0) |
| 337 | (let ((original-date date);; save for possible use in the hooks | 363 | (let ((original-date date);; save for possible use in the hooks |
| 338 | old-diary-syntax-table | ||
| 339 | diary-entries-list | 364 | diary-entries-list |
| 340 | file-glob-attrs | 365 | file-glob-attrs |
| 341 | (date-string (calendar-date-string date)) | 366 | (date-string (calendar-date-string date)) |
| @@ -356,100 +381,94 @@ These hooks have the following distinct roles: | |||
| 356 | (setq selective-display-ellipses nil) | 381 | (setq selective-display-ellipses nil) |
| 357 | (if diary-header-line-flag | 382 | (if diary-header-line-flag |
| 358 | (setq header-line-format diary-header-line-format)) | 383 | (setq header-line-format diary-header-line-format)) |
| 359 | (setq old-diary-syntax-table (syntax-table)) | 384 | (with-syntax-table diary-syntax-table |
| 360 | (set-syntax-table diary-syntax-table) | 385 | (let ((buffer-read-only nil) |
| 361 | (unwind-protect | 386 | (diary-modified (buffer-modified-p)) |
| 362 | (let ((buffer-read-only nil) | 387 | (mark (regexp-quote diary-nonmarking-symbol))) |
| 363 | (diary-modified (buffer-modified-p)) | 388 | ;; First and last characters must be ^M or \n for |
| 364 | (mark (regexp-quote diary-nonmarking-symbol))) | 389 | ;; selective display to work properly |
| 365 | ;; First and last characters must be ^M or \n for | 390 | (goto-char (1- (point-max))) |
| 366 | ;; selective display to work properly | 391 | (if (not (looking-at "\^M\\|\n")) |
| 367 | (goto-char (1- (point-max))) | 392 | (progn |
| 368 | (if (not (looking-at "\^M\\|\n")) | 393 | (goto-char (point-max)) |
| 369 | (progn | 394 | (insert "\^M"))) |
| 370 | (goto-char (point-max)) | 395 | (goto-char (point-min)) |
| 371 | (insert "\^M"))) | 396 | (if (not (looking-at "\^M\\|\n")) |
| 372 | (goto-char (point-min)) | 397 | (insert "\^M")) |
| 373 | (if (not (looking-at "\^M\\|\n")) | 398 | (subst-char-in-region (point-min) (point-max) ?\n ?\^M t) |
| 374 | (insert "\^M")) | 399 | (calendar-for-loop |
| 375 | (subst-char-in-region (point-min) (point-max) ?\n ?\^M t) | 400 | i from 1 to number do |
| 376 | (calendar-for-loop | 401 | (let ((month (extract-calendar-month date)) |
| 377 | i from 1 to number do | 402 | (day (extract-calendar-day date)) |
| 378 | (let ((d diary-date-forms) | 403 | (year (extract-calendar-year date)) |
| 379 | (month (extract-calendar-month date)) | 404 | (entry-found (list-sexp-diary-entries date))) |
| 380 | (day (extract-calendar-day date)) | 405 | (dolist (date-form diary-date-forms) |
| 381 | (year (extract-calendar-year date)) | 406 | (let* |
| 382 | (entry-found (list-sexp-diary-entries date))) | 407 | ((backup (when (eq (car date-form) 'backup) |
| 383 | (while d | 408 | (setq date-form (cdr date-form)) |
| 384 | (let* | 409 | t)) |
| 385 | ((date-form (if (equal (car (car d)) 'backup) | 410 | (dayname |
| 386 | (cdr (car d)) | 411 | (format "%s\\|%s\\.?" |
| 387 | (car d))) | 412 | (calendar-day-name date) |
| 388 | (backup (equal (car (car d)) 'backup)) | 413 | (calendar-day-name date 'abbrev))) |
| 389 | (dayname | 414 | (monthname |
| 390 | (format "%s\\|%s\\.?" | 415 | (format "\\*\\|%s\\|%s\\.?" |
| 391 | (calendar-day-name date) | 416 | (calendar-month-name month) |
| 392 | (calendar-day-name date 'abbrev))) | 417 | (calendar-month-name month 'abbrev))) |
| 393 | (monthname | 418 | (month (concat "\\*\\|0*" (int-to-string month))) |
| 394 | (format "\\*\\|%s\\|%s\\.?" | 419 | (day (concat "\\*\\|0*" (int-to-string day))) |
| 395 | (calendar-month-name month) | 420 | (year |
| 396 | (calendar-month-name month 'abbrev))) | 421 | (concat |
| 397 | (month (concat "\\*\\|0*" (int-to-string month))) | 422 | "\\*\\|0*" (int-to-string year) |
| 398 | (day (concat "\\*\\|0*" (int-to-string day))) | 423 | (if abbreviated-calendar-year |
| 399 | (year | 424 | (concat "\\|" (format "%02d" (% year 100))) |
| 400 | (concat | 425 | ""))) |
| 401 | "\\*\\|0*" (int-to-string year) | 426 | (regexp |
| 402 | (if abbreviated-calendar-year | 427 | (concat |
| 403 | (concat "\\|" (format "%02d" (% year 100))) | 428 | "\\(\\`\\|\^M\\|\n\\)" mark "?\\(" |
| 404 | ""))) | 429 | (mapconcat 'eval date-form "\\)\\(") |
| 405 | (regexp | 430 | "\\)")) |
| 406 | (concat | 431 | (case-fold-search t)) |
| 407 | "\\(\\`\\|\^M\\|\n\\)" mark "?\\(" | 432 | (goto-char (point-min)) |
| 408 | (mapconcat 'eval date-form "\\)\\(") | 433 | (while (re-search-forward regexp nil t) |
| 409 | "\\)")) | 434 | (if backup (re-search-backward "\\<" nil t)) |
| 410 | (case-fold-search t)) | 435 | (if (and (or (char-equal (preceding-char) ?\^M) |
| 411 | (goto-char (point-min)) | 436 | (char-equal (preceding-char) ?\n)) |
| 412 | (while (re-search-forward regexp nil t) | 437 | (not (looking-at " \\|\^I"))) |
| 413 | (if backup (re-search-backward "\\<" nil t)) | 438 | ;; Diary entry that consists only of date. |
| 414 | (if (and (or (char-equal (preceding-char) ?\^M) | 439 | (backward-char 1) |
| 415 | (char-equal (preceding-char) ?\n)) | 440 | ;; Found a nonempty diary entry--make it |
| 416 | (not (looking-at " \\|\^I"))) | 441 | ;; visible and add it to the list. |
| 417 | ;; Diary entry that consists only of date. | 442 | (setq entry-found t) |
| 418 | (backward-char 1) | 443 | (let ((entry-start (point)) |
| 419 | ;; Found a nonempty diary entry--make it | 444 | date-start temp) |
| 420 | ;; visible and add it to the list. | 445 | (re-search-backward "\^M\\|\n\\|\\`") |
| 421 | (setq entry-found t) | 446 | (setq date-start (point)) |
| 422 | (let ((entry-start (point)) | 447 | (re-search-forward "\^M\\|\n" nil t 2) |
| 423 | date-start temp) | 448 | (while (looking-at " \\|\^I") |
| 424 | (re-search-backward "\^M\\|\n\\|\\`") | 449 | (re-search-forward "\^M\\|\n" nil t)) |
| 425 | (setq date-start (point)) | 450 | (backward-char 1) |
| 426 | (re-search-forward "\^M\\|\n" nil t 2) | 451 | (subst-char-in-region date-start |
| 427 | (while (looking-at " \\|\^I") | 452 | (point) ?\^M ?\n t) |
| 428 | (re-search-forward "\^M\\|\n" nil t)) | 453 | (setq entry (buffer-substring entry-start (point)) |
| 429 | (backward-char 1) | 454 | temp (diary-pull-attrs entry file-glob-attrs) |
| 430 | (subst-char-in-region date-start | 455 | entry (nth 0 temp)) |
| 431 | (point) ?\^M ?\n t) | 456 | (add-to-diary-list |
| 432 | (setq entry (buffer-substring entry-start (point)) | 457 | date |
| 433 | temp (diary-pull-attrs entry file-glob-attrs) | 458 | entry |
| 434 | entry (nth 0 temp)) | 459 | (buffer-substring |
| 435 | (add-to-diary-list | 460 | (1+ date-start) (1- entry-start)) |
| 436 | date | 461 | (copy-marker entry-start) (nth 1 temp))))))) |
| 437 | entry | 462 | (or entry-found |
| 438 | (buffer-substring | 463 | (not diary-list-include-blanks) |
| 439 | (1+ date-start) (1- entry-start)) | 464 | (setq diary-entries-list |
| 440 | (copy-marker entry-start) (nth 1 temp)))))) | 465 | (append diary-entries-list |
| 441 | (setq d (cdr d))) | 466 | (list (list date "" "" "" ""))))) |
| 442 | (or entry-found | 467 | (setq date |
| 443 | (not diary-list-include-blanks) | 468 | (calendar-gregorian-from-absolute |
| 444 | (setq diary-entries-list | 469 | (1+ (calendar-absolute-from-gregorian date)))) |
| 445 | (append diary-entries-list | 470 | (setq entry-found nil))) |
| 446 | (list (list date "" "" "" ""))))) | 471 | (set-buffer-modified-p diary-modified))) |
| 447 | (setq date | ||
| 448 | (calendar-gregorian-from-absolute | ||
| 449 | (1+ (calendar-absolute-from-gregorian date)))) | ||
| 450 | (setq entry-found nil))) | ||
| 451 | (set-buffer-modified-p diary-modified)) | ||
| 452 | (set-syntax-table old-diary-syntax-table)) | ||
| 453 | (goto-char (point-min)) | 472 | (goto-char (point-min)) |
| 454 | (run-hooks 'nongregorian-diary-listing-hook | 473 | (run-hooks 'nongregorian-diary-listing-hook |
| 455 | 'list-diary-entries-hook) | 474 | 'list-diary-entries-hook) |
| @@ -459,6 +478,14 @@ These hooks have the following distinct roles: | |||
| 459 | (run-hooks 'diary-hook) | 478 | (run-hooks 'diary-hook) |
| 460 | diary-entries-list)))))) | 479 | diary-entries-list)))))) |
| 461 | 480 | ||
| 481 | (defun diary-unhide-everything () | ||
| 482 | (setq selective-display nil) | ||
| 483 | (let ((inhibit-read-only t) | ||
| 484 | (modified (buffer-modified-p))) | ||
| 485 | (subst-char-in-region (point-min) (point-max) ?\^M ?\n t) | ||
| 486 | (set-buffer-modified-p modified)) | ||
| 487 | (kill-local-variable 'mode-line-format)) | ||
| 488 | |||
| 462 | (defun include-other-diary-files () | 489 | (defun include-other-diary-files () |
| 463 | "Include the diary entries from other diary files with those of diary-file. | 490 | "Include the diary entries from other diary files with those of diary-file. |
| 464 | This function is suitable for use in `list-diary-entries-hook'; | 491 | This function is suitable for use in `list-diary-entries-hook'; |
| @@ -471,34 +498,24 @@ changing the variable `diary-include-string'." | |||
| 471 | (goto-char (point-min)) | 498 | (goto-char (point-min)) |
| 472 | (while (re-search-forward | 499 | (while (re-search-forward |
| 473 | (concat | 500 | (concat |
| 474 | "\\(\\`\\|\^M\\|\n\\)" | 501 | "\\(?:\\`\\|\^M\\|\n\\)" |
| 475 | (regexp-quote diary-include-string) | 502 | (regexp-quote diary-include-string) |
| 476 | " \"\\([^\"]*\\)\"") | 503 | " \"\\([^\"]*\\)\"") |
| 477 | nil t) | 504 | nil t) |
| 478 | (let* ((diary-file (substitute-in-file-name | 505 | (let* ((diary-file (substitute-in-file-name |
| 479 | (buffer-substring-no-properties | 506 | (match-string-no-properties 1))) |
| 480 | (match-beginning 2) (match-end 2)))) | ||
| 481 | (diary-list-include-blanks nil) | 507 | (diary-list-include-blanks nil) |
| 482 | (list-diary-entries-hook 'include-other-diary-files) | 508 | (list-diary-entries-hook 'include-other-diary-files) |
| 483 | (diary-display-hook 'ignore) | 509 | (diary-display-hook 'ignore) |
| 484 | (diary-hook nil) | 510 | (diary-hook nil)) |
| 485 | (d-buffer (find-buffer-visiting diary-file)) | ||
| 486 | (diary-modified (if d-buffer | ||
| 487 | (save-excursion | ||
| 488 | (set-buffer d-buffer) | ||
| 489 | (buffer-modified-p))))) | ||
| 490 | (if (file-exists-p diary-file) | 511 | (if (file-exists-p diary-file) |
| 491 | (if (file-readable-p diary-file) | 512 | (if (file-readable-p diary-file) |
| 492 | (unwind-protect | 513 | (unwind-protect |
| 493 | (setq diary-entries-list | 514 | (setq diary-entries-list |
| 494 | (append diary-entries-list | 515 | (append diary-entries-list |
| 495 | (list-diary-entries original-date number))) | 516 | (list-diary-entries original-date number))) |
| 496 | (save-excursion | 517 | (with-current-buffer (find-buffer-visiting diary-file) |
| 497 | (set-buffer (find-buffer-visiting diary-file)) | 518 | (diary-unhide-everything))) |
| 498 | (let ((inhibit-read-only t)) | ||
| 499 | (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)) | ||
| 500 | (setq selective-display nil) | ||
| 501 | (set-buffer-modified-p diary-modified))) | ||
| 502 | (beep) | 519 | (beep) |
| 503 | (message "Can't read included diary file %s" diary-file) | 520 | (message "Can't read included diary file %s" diary-file) |
| 504 | (sleep-for 2)) | 521 | (sleep-for 2)) |
| @@ -564,13 +581,9 @@ changing the variable `diary-include-string'." | |||
| 564 | (defun fancy-diary-display () | 581 | (defun fancy-diary-display () |
| 565 | "Prepare a diary buffer with relevant entries in a fancy, noneditable form. | 582 | "Prepare a diary buffer with relevant entries in a fancy, noneditable form. |
| 566 | This function is provided for optional use as the `diary-display-hook'." | 583 | This function is provided for optional use as the `diary-display-hook'." |
| 567 | (save-excursion;; Turn off selective-display in the diary file's buffer. | 584 | (with-current-buffer ;; Turn off selective-display in the diary file's buffer. |
| 568 | (set-buffer (find-buffer-visiting (substitute-in-file-name diary-file))) | 585 | (find-buffer-visiting (substitute-in-file-name diary-file)) |
| 569 | (let ((diary-modified (buffer-modified-p))) | 586 | (diary-unhide-everything)) |
| 570 | (subst-char-in-region (point-min) (point-max) ?\^M ?\n t) | ||
| 571 | (setq selective-display nil) | ||
| 572 | (kill-local-variable 'mode-line-format) | ||
| 573 | (set-buffer-modified-p diary-modified))) | ||
| 574 | (if (or (not diary-entries-list) | 587 | (if (or (not diary-entries-list) |
| 575 | (and (not (cdr diary-entries-list)) | 588 | (and (not (cdr diary-entries-list)) |
| 576 | (string-equal (car (cdr (car diary-entries-list))) ""))) | 589 | (string-equal (car (cdr (car diary-entries-list))) ""))) |
| @@ -740,7 +753,8 @@ the actual printing." | |||
| 740 | (kill-buffer temp-buffer))) | 753 | (kill-buffer temp-buffer))) |
| 741 | (error "You don't have a diary buffer!"))))) | 754 | (error "You don't have a diary buffer!"))))) |
| 742 | 755 | ||
| 743 | (defun show-all-diary-entries () | 756 | (define-obsolete-function-alias 'show-all-diary-entries 'diary-show-all-entries) |
| 757 | (defun diary-show-all-entries () | ||
| 744 | "Show all of the diary entries in the diary file. | 758 | "Show all of the diary entries in the diary file. |
| 745 | This function gets rid of the selective display of the diary file so that | 759 | This function gets rid of the selective display of the diary file so that |
| 746 | all entries, not just some, are visible. If there is no diary buffer, one | 760 | all entries, not just some, are visible. If there is no diary buffer, one |
| @@ -748,16 +762,9 @@ is created." | |||
| 748 | (interactive) | 762 | (interactive) |
| 749 | (let ((d-file (diary-check-diary-file)) | 763 | (let ((d-file (diary-check-diary-file)) |
| 750 | (pop-up-frames (window-dedicated-p (selected-window)))) | 764 | (pop-up-frames (window-dedicated-p (selected-window)))) |
| 751 | (save-excursion | 765 | (with-current-buffer (or (find-buffer-visiting d-file) |
| 752 | (set-buffer (or (find-buffer-visiting d-file) | 766 | (find-file-noselect d-file t)) |
| 753 | (find-file-noselect d-file t))) | 767 | (diary-unhide-everything)))) |
| 754 | (let ((buffer-read-only nil) | ||
| 755 | (diary-modified (buffer-modified-p))) | ||
| 756 | (subst-char-in-region (point-min) (point-max) ?\^M ?\n t) | ||
| 757 | (setq selective-display nil | ||
| 758 | mode-line-format default-mode-line-format) | ||
| 759 | (display-buffer (current-buffer)) | ||
| 760 | (set-buffer-modified-p diary-modified))))) | ||
| 761 | 768 | ||
| 762 | (defcustom diary-mail-addr | 769 | (defcustom diary-mail-addr |
| 763 | (if (boundp 'user-mail-address) user-mail-address "") | 770 | (if (boundp 'user-mail-address) user-mail-address "") |
| @@ -807,9 +814,7 @@ to run it every morning at 1am." | |||
| 807 | (calendar-date-string (calendar-current-date)))) | 814 | (calendar-date-string (calendar-current-date)))) |
| 808 | (insert | 815 | (insert |
| 809 | (if (get-buffer fancy-diary-buffer) | 816 | (if (get-buffer fancy-diary-buffer) |
| 810 | (save-excursion | 817 | (with-current-buffer fancy-diary-buffer (buffer-string)) |
| 811 | (set-buffer fancy-diary-buffer) | ||
| 812 | (buffer-substring (point-min) (point-max))) | ||
| 813 | "No entries found")) | 818 | "No entries found")) |
| 814 | (call-interactively (get mail-user-agent 'sendfunc)))) | 819 | (call-interactively (get mail-user-agent 'sendfunc)))) |
| 815 | 820 | ||
| @@ -844,7 +849,7 @@ marked. After the entries are marked, the hooks | |||
| 844 | `nongregorian-diary-marking-hook' and `mark-diary-entries-hook' | 849 | `nongregorian-diary-marking-hook' and `mark-diary-entries-hook' |
| 845 | are run. If the optional argument REDRAW is non-nil (which is | 850 | are run. If the optional argument REDRAW is non-nil (which is |
| 846 | the case interactively, for example) then any existing diary | 851 | the case interactively, for example) then any existing diary |
| 847 | marks are first removed. This is intended to deal with deleted | 852 | marks are first removed. This is intended to deal with deleted |
| 848 | diary entries." | 853 | diary entries." |
| 849 | (interactive "p") | 854 | (interactive "p") |
| 850 | ;; To remove any deleted diary entries. Do not redraw when: | 855 | ;; To remove any deleted diary entries. Do not redraw when: |
| @@ -858,8 +863,7 @@ diary entries." | |||
| 858 | (redraw-calendar)) | 863 | (redraw-calendar)) |
| 859 | (let ((marking-diary-entries t) | 864 | (let ((marking-diary-entries t) |
| 860 | file-glob-attrs marks) | 865 | file-glob-attrs marks) |
| 861 | (save-excursion | 866 | (with-current-buffer (find-file-noselect (diary-check-diary-file) t) |
| 862 | (set-buffer (find-file-noselect (diary-check-diary-file) t)) | ||
| 863 | (setq mark-diary-entries-in-calendar t) | 867 | (setq mark-diary-entries-in-calendar t) |
| 864 | (message "Marking diary entries...") | 868 | (message "Marking diary entries...") |
| 865 | (setq file-glob-attrs (nth 1 (diary-pull-attrs nil '()))) | 869 | (setq file-glob-attrs (nth 1 (diary-pull-attrs nil '()))) |
| @@ -902,30 +906,20 @@ diary entries." | |||
| 902 | (while (re-search-forward regexp nil t) | 906 | (while (re-search-forward regexp nil t) |
| 903 | (let* ((dd-name | 907 | (let* ((dd-name |
| 904 | (if d-name-pos | 908 | (if d-name-pos |
| 905 | (buffer-substring-no-properties | 909 | (match-string-no-properties d-name-pos))) |
| 906 | (match-beginning d-name-pos) | ||
| 907 | (match-end d-name-pos)))) | ||
| 908 | (mm-name | 910 | (mm-name |
| 909 | (if m-name-pos | 911 | (if m-name-pos |
| 910 | (buffer-substring-no-properties | 912 | (match-string-no-properties m-name-pos))) |
| 911 | (match-beginning m-name-pos) | ||
| 912 | (match-end m-name-pos)))) | ||
| 913 | (mm (string-to-number | 913 | (mm (string-to-number |
| 914 | (if m-pos | 914 | (if m-pos |
| 915 | (buffer-substring-no-properties | 915 | (match-string-no-properties m-pos) |
| 916 | (match-beginning m-pos) | ||
| 917 | (match-end m-pos)) | ||
| 918 | ""))) | 916 | ""))) |
| 919 | (dd (string-to-number | 917 | (dd (string-to-number |
| 920 | (if d-pos | 918 | (if d-pos |
| 921 | (buffer-substring-no-properties | 919 | (match-string-no-properties d-pos) |
| 922 | (match-beginning d-pos) | ||
| 923 | (match-end d-pos)) | ||
| 924 | ""))) | 920 | ""))) |
| 925 | (y-str (if y-pos | 921 | (y-str (if y-pos |
| 926 | (buffer-substring-no-properties | 922 | (match-string-no-properties y-pos))) |
| 927 | (match-beginning y-pos) | ||
| 928 | (match-end y-pos)))) | ||
| 929 | (yy (if (not y-str) | 923 | (yy (if (not y-str) |
| 930 | 0 | 924 | 0 |
| 931 | (if (and (= (length y-str) 2) | 925 | (if (and (= (length y-str) 2) |
| @@ -941,13 +935,13 @@ diary entries." | |||
| 941 | (if (> (- current-y y) 50) | 935 | (if (> (- current-y y) 50) |
| 942 | (+ y 100) | 936 | (+ y 100) |
| 943 | y))) | 937 | y))) |
| 944 | (string-to-number y-str)))) | 938 | (string-to-number y-str))))) |
| 945 | (save-excursion | 939 | (save-excursion |
| 946 | (setq entry (buffer-substring-no-properties | 940 | (setq entry (buffer-substring-no-properties |
| 947 | (point) (line-end-position)) | 941 | (point) (line-end-position)) |
| 948 | temp (diary-pull-attrs entry file-glob-attrs) | 942 | temp (diary-pull-attrs entry file-glob-attrs) |
| 949 | entry (nth 0 temp) | 943 | entry (nth 0 temp) |
| 950 | marks (nth 1 temp)))) | 944 | marks (nth 1 temp))) |
| 951 | (if dd-name | 945 | (if dd-name |
| 952 | (mark-calendar-days-named | 946 | (mark-calendar-days-named |
| 953 | (cdr (assoc-string | 947 | (cdr (assoc-string |
| @@ -982,8 +976,7 @@ is marked. See the documentation for the function `list-sexp-diary-entries'." | |||
| 982 | sexp-mark "(diary-remind\\)")) | 976 | sexp-mark "(diary-remind\\)")) |
| 983 | (file-glob-attrs (nth 1 (diary-pull-attrs nil '()))) | 977 | (file-glob-attrs (nth 1 (diary-pull-attrs nil '()))) |
| 984 | m y first-date last-date mark file-glob-attrs) | 978 | m y first-date last-date mark file-glob-attrs) |
| 985 | (save-excursion | 979 | (with-current-buffer calendar-buffer |
| 986 | (set-buffer calendar-buffer) | ||
| 987 | (setq m displayed-month) | 980 | (setq m displayed-month) |
| 988 | (setq y displayed-year)) | 981 | (setq y displayed-year)) |
| 989 | (increment-calendar-month m y -1) | 982 | (increment-calendar-month m y -1) |
| @@ -1048,12 +1041,12 @@ changing the variable `diary-include-string'." | |||
| 1048 | (goto-char (point-min)) | 1041 | (goto-char (point-min)) |
| 1049 | (while (re-search-forward | 1042 | (while (re-search-forward |
| 1050 | (concat | 1043 | (concat |
| 1051 | "\\(\\`\\|\^M\\|\n\\)" | 1044 | "\\(?:\\`\\|\^M\\|\n\\)" |
| 1052 | (regexp-quote diary-include-string) | 1045 | (regexp-quote diary-include-string) |
| 1053 | " \"\\([^\"]*\\)\"") | 1046 | " \"\\([^\"]*\\)\"") |
| 1054 | nil t) | 1047 | nil t) |
| 1055 | (let* ((diary-file (substitute-in-file-name | 1048 | (let* ((diary-file (substitute-in-file-name |
| 1056 | (match-string-no-properties 2))) | 1049 | (match-string-no-properties 1))) |
| 1057 | (mark-diary-entries-hook 'mark-included-diary-files) | 1050 | (mark-diary-entries-hook 'mark-included-diary-files) |
| 1058 | (dbuff (find-buffer-visiting diary-file))) | 1051 | (dbuff (find-buffer-visiting diary-file))) |
| 1059 | (if (file-exists-p diary-file) | 1052 | (if (file-exists-p diary-file) |
| @@ -1073,8 +1066,7 @@ changing the variable `diary-include-string'." | |||
| 1073 | (defun mark-calendar-days-named (dayname &optional color) | 1066 | (defun mark-calendar-days-named (dayname &optional color) |
| 1074 | "Mark all dates in the calendar window that are day DAYNAME of the week. | 1067 | "Mark all dates in the calendar window that are day DAYNAME of the week. |
| 1075 | 0 means all Sundays, 1 means all Mondays, and so on." | 1068 | 0 means all Sundays, 1 means all Mondays, and so on." |
| 1076 | (save-excursion | 1069 | (with-current-buffer calendar-buffer |
| 1077 | (set-buffer calendar-buffer) | ||
| 1078 | (let ((prev-month displayed-month) | 1070 | (let ((prev-month displayed-month) |
| 1079 | (prev-year displayed-year) | 1071 | (prev-year displayed-year) |
| 1080 | (succ-month displayed-month) | 1072 | (succ-month displayed-month) |
| @@ -1094,8 +1086,7 @@ changing the variable `diary-include-string'." | |||
| 1094 | (defun mark-calendar-date-pattern (month day year &optional color) | 1086 | (defun mark-calendar-date-pattern (month day year &optional color) |
| 1095 | "Mark all dates in the calendar window that conform to MONTH/DAY/YEAR. | 1087 | "Mark all dates in the calendar window that conform to MONTH/DAY/YEAR. |
| 1096 | A value of 0 in any position is a wildcard." | 1088 | A value of 0 in any position is a wildcard." |
| 1097 | (save-excursion | 1089 | (with-current-buffer calendar-buffer |
| 1098 | (set-buffer calendar-buffer) | ||
| 1099 | (let ((m displayed-month) | 1090 | (let ((m displayed-month) |
| 1100 | (y displayed-year)) | 1091 | (y displayed-year)) |
| 1101 | (increment-calendar-month m y -1) | 1092 | (increment-calendar-month m y -1) |
| @@ -1152,22 +1143,17 @@ be used instead of a colon (:) to separate the hour and minute parts." | |||
| 1152 | (cond ((string-match ; Military time | 1143 | (cond ((string-match ; Military time |
| 1153 | "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)[:.]?\\([0-9][0-9]\\)\\(\\>\\|[^ap]\\)" | 1144 | "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)[:.]?\\([0-9][0-9]\\)\\(\\>\\|[^ap]\\)" |
| 1154 | s) | 1145 | s) |
| 1155 | (+ (* 100 (string-to-number | 1146 | (+ (* 100 (string-to-number (match-string 1 s))) |
| 1156 | (substring s (match-beginning 1) (match-end 1)))) | 1147 | (string-to-number (match-string 2 s)))) |
| 1157 | (string-to-number (substring s (match-beginning 2) (match-end 2))))) | ||
| 1158 | ((string-match ; Hour only XXam or XXpm | 1148 | ((string-match ; Hour only XXam or XXpm |
| 1159 | "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)\\([ap]\\)m\\>" s) | 1149 | "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)\\([ap]\\)m\\>" s) |
| 1160 | (+ (* 100 (% (string-to-number | 1150 | (+ (* 100 (% (string-to-number (match-string 1 s)) 12)) |
| 1161 | (substring s (match-beginning 1) (match-end 1))) | ||
| 1162 | 12)) | ||
| 1163 | (if (equal ?a (downcase (aref s (match-beginning 2)))) | 1151 | (if (equal ?a (downcase (aref s (match-beginning 2)))) |
| 1164 | 0 1200))) | 1152 | 0 1200))) |
| 1165 | ((string-match ; Hour and minute XX:XXam or XX:XXpm | 1153 | ((string-match ; Hour and minute XX:XXam or XX:XXpm |
| 1166 | "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)[:.]\\([0-9][0-9]\\)\\([ap]\\)m\\>" s) | 1154 | "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)[:.]\\([0-9][0-9]\\)\\([ap]\\)m\\>" s) |
| 1167 | (+ (* 100 (% (string-to-number | 1155 | (+ (* 100 (% (string-to-number (match-string 1 s)) 12)) |
| 1168 | (substring s (match-beginning 1) (match-end 1))) | 1156 | (string-to-number (match-string 2 s)) |
| 1169 | 12)) | ||
| 1170 | (string-to-number (substring s (match-beginning 2) (match-end 2))) | ||
| 1171 | (if (equal ?a (downcase (aref s (match-beginning 3)))) | 1157 | (if (equal ?a (downcase (aref s (match-beginning 3)))) |
| 1172 | 0 1200))) | 1158 | 0 1200))) |
| 1173 | (t diary-unknown-time)))) ; Unrecognizable | 1159 | (t diary-unknown-time)))) ; Unrecognizable |
| @@ -1404,14 +1390,7 @@ best if they are nonmarking." | |||
| 1404 | (error | 1390 | (error |
| 1405 | (beep) | 1391 | (beep) |
| 1406 | (message "Bad sexp at line %d in %s: %s" | 1392 | (message "Bad sexp at line %d in %s: %s" |
| 1407 | (save-excursion | 1393 | (count-lines (point-min) (point)) |
| 1408 | (save-restriction | ||
| 1409 | (narrow-to-region 1 (point)) | ||
| 1410 | (goto-char (point-min)) | ||
| 1411 | (let ((lines 1)) | ||
| 1412 | (while (re-search-forward "\n\\|\^M" nil t) | ||
| 1413 | (setq lines (1+ lines))) | ||
| 1414 | lines))) | ||
| 1415 | diary-file sexp) | 1394 | diary-file sexp) |
| 1416 | (sleep-for 2)))))) | 1395 | (sleep-for 2)))))) |
| 1417 | (cond ((stringp result) result) | 1396 | (cond ((stringp result) result) |
| @@ -1688,12 +1667,9 @@ If omitted, NONMARKING defaults to nil and FILE defaults to | |||
| 1688 | redrawn with the new entry marked, if necessary." | 1667 | redrawn with the new entry marked, if necessary." |
| 1689 | (let ((pop-up-frames (window-dedicated-p (selected-window)))) | 1668 | (let ((pop-up-frames (window-dedicated-p (selected-window)))) |
| 1690 | (find-file-other-window (substitute-in-file-name (or file diary-file)))) | 1669 | (find-file-other-window (substitute-in-file-name (or file diary-file)))) |
| 1691 | (add-hook 'write-contents-functions 'diary-redraw-calendar nil t) | 1670 | (add-hook 'after-save-hook 'diary-redraw-calendar nil t) |
| 1692 | (when selective-display | ||
| 1693 | (subst-char-in-region (point-min) (point-max) ?\^M ?\n t) | ||
| 1694 | (setq selective-display nil) | ||
| 1695 | (kill-local-variable 'mode-line-format)) | ||
| 1696 | (widen) | 1671 | (widen) |
| 1672 | (diary-unhide-everything) | ||
| 1697 | (goto-char (point-max)) | 1673 | (goto-char (point-max)) |
| 1698 | (when (let ((case-fold-search t)) | 1674 | (when (let ((case-fold-search t)) |
| 1699 | (search-backward "Local Variables:" | 1675 | (search-backward "Local Variables:" |
| @@ -1701,7 +1677,7 @@ redrawn with the new entry marked, if necessary." | |||
| 1701 | t)) | 1677 | t)) |
| 1702 | (beginning-of-line) | 1678 | (beginning-of-line) |
| 1703 | (insert "\n") | 1679 | (insert "\n") |
| 1704 | (previous-line 1)) | 1680 | (forward-line -1)) |
| 1705 | (insert | 1681 | (insert |
| 1706 | (if (bolp) "" "\n") | 1682 | (if (bolp) "" "\n") |
| 1707 | (if nonmarking diary-nonmarking-symbol "") | 1683 | (if nonmarking diary-nonmarking-symbol "") |
| @@ -1798,19 +1774,29 @@ Prefix arg will make the entry nonmarking." | |||
| 1798 | (calendar-date-string (calendar-cursor-to-date t) nil t)) | 1774 | (calendar-date-string (calendar-cursor-to-date t) nil t)) |
| 1799 | arg))) | 1775 | arg))) |
| 1800 | 1776 | ||
| 1777 | (defvar diary-mode-map | ||
| 1778 | (let ((map (make-sparse-keymap))) | ||
| 1779 | (define-key map "\C-c\C-s" 'diary-show-all-entries) | ||
| 1780 | (define-key map "\C-c\C-q" 'quit-window) | ||
| 1781 | map) | ||
| 1782 | "Keymap for `diary-mode'.") | ||
| 1783 | |||
| 1801 | ;;;###autoload | 1784 | ;;;###autoload |
| 1802 | (define-derived-mode diary-mode fundamental-mode | 1785 | (define-derived-mode diary-mode fundamental-mode "Diary" |
| 1803 | "Diary" | ||
| 1804 | "Major mode for editing the diary file." | 1786 | "Major mode for editing the diary file." |
| 1805 | (set (make-local-variable 'font-lock-defaults) | 1787 | (set (make-local-variable 'font-lock-defaults) |
| 1806 | '(diary-font-lock-keywords t))) | 1788 | '(diary-font-lock-keywords t)) |
| 1789 | (add-to-invisibility-spec '(diary . nil)) | ||
| 1790 | (add-hook 'after-save-hook 'diary-redraw-calendar nil t) | ||
| 1791 | (if diary-header-line-flag | ||
| 1792 | (setq header-line-format diary-header-line-format))) | ||
| 1807 | 1793 | ||
| 1808 | (define-derived-mode fancy-diary-display-mode fundamental-mode | 1794 | (define-derived-mode fancy-diary-display-mode fundamental-mode |
| 1809 | "Diary" | 1795 | "Diary" |
| 1810 | "Major mode used while displaying diary entries using Fancy Display." | 1796 | "Major mode used while displaying diary entries using Fancy Display." |
| 1811 | (set (make-local-variable 'font-lock-defaults) | 1797 | (set (make-local-variable 'font-lock-defaults) |
| 1812 | '(fancy-diary-font-lock-keywords t)) | 1798 | '(fancy-diary-font-lock-keywords t)) |
| 1813 | (define-key (current-local-map) "q" 'quit-window)) | 1799 | (local-set-key "q" 'quit-window)) |
| 1814 | 1800 | ||
| 1815 | 1801 | ||
| 1816 | (defvar fancy-diary-font-lock-keywords | 1802 | (defvar fancy-diary-font-lock-keywords |
| @@ -1836,7 +1822,7 @@ Prefix arg will make the entry nonmarking." | |||
| 1836 | "Keywords to highlight in fancy diary display") | 1822 | "Keywords to highlight in fancy diary display") |
| 1837 | 1823 | ||
| 1838 | 1824 | ||
| 1839 | (defun font-lock-diary-sexps (limit) | 1825 | (defun diary-font-lock-sexps (limit) |
| 1840 | "Recognize sexp diary entry for font-locking." | 1826 | "Recognize sexp diary entry for font-locking." |
| 1841 | (if (re-search-forward | 1827 | (if (re-search-forward |
| 1842 | (concat "^" (regexp-quote diary-nonmarking-symbol) | 1828 | (concat "^" (regexp-quote diary-nonmarking-symbol) |
| @@ -1851,7 +1837,7 @@ Prefix arg will make the entry nonmarking." | |||
| 1851 | t)) | 1837 | t)) |
| 1852 | (error t)))) | 1838 | (error t)))) |
| 1853 | 1839 | ||
| 1854 | (defun font-lock-diary-date-forms (month-array &optional symbol abbrev-array) | 1840 | (defun diary-font-lock-date-forms (month-array &optional symbol abbrev-array) |
| 1855 | "Create font-lock patterns for `diary-date-forms' using MONTH-ARRAY. | 1841 | "Create font-lock patterns for `diary-date-forms' using MONTH-ARRAY. |
| 1856 | If given, optional SYMBOL must be a prefix to entries. | 1842 | If given, optional SYMBOL must be a prefix to entries. |
| 1857 | If optional ABBREV-ARRAY is present, the abbreviations constructed | 1843 | If optional ABBREV-ARRAY is present, the abbreviations constructed |
| @@ -1865,7 +1851,7 @@ names." | |||
| 1865 | (month "\\([0-9]+\\|\\*\\)") | 1851 | (month "\\([0-9]+\\|\\*\\)") |
| 1866 | (day "\\([0-9]+\\|\\*\\)") | 1852 | (day "\\([0-9]+\\|\\*\\)") |
| 1867 | (year "-?\\([0-9]+\\|\\*\\)")) | 1853 | (year "-?\\([0-9]+\\|\\*\\)")) |
| 1868 | (mapcar '(lambda (x) | 1854 | (mapcar (lambda (x) |
| 1869 | (cons | 1855 | (cons |
| 1870 | (concat "^" (regexp-quote diary-nonmarking-symbol) "?" | 1856 | (concat "^" (regexp-quote diary-nonmarking-symbol) "?" |
| 1871 | (if symbol (regexp-quote symbol) "") "\\(" | 1857 | (if symbol (regexp-quote symbol) "") "\\(" |
| @@ -1873,7 +1859,7 @@ names." | |||
| 1873 | ;; If backup, omit first item (backup) | 1859 | ;; If backup, omit first item (backup) |
| 1874 | ;; and last item (not part of date) | 1860 | ;; and last item (not part of date) |
| 1875 | (if (equal (car x) 'backup) | 1861 | (if (equal (car x) 'backup) |
| 1876 | (reverse (cdr (reverse (cdr x)))) | 1862 | (nreverse (cdr (reverse (cdr x)))) |
| 1877 | x) | 1863 | x) |
| 1878 | "") | 1864 | "") |
| 1879 | ;; With backup, last item is not part of date | 1865 | ;; With backup, last item is not part of date |
| @@ -1888,14 +1874,14 @@ names." | |||
| 1888 | 1874 | ||
| 1889 | (defvar diary-font-lock-keywords | 1875 | (defvar diary-font-lock-keywords |
| 1890 | (append | 1876 | (append |
| 1891 | (font-lock-diary-date-forms calendar-month-name-array | 1877 | (diary-font-lock-date-forms calendar-month-name-array |
| 1892 | nil calendar-month-abbrev-array) | 1878 | nil calendar-month-abbrev-array) |
| 1893 | (when (or (memq 'mark-hebrew-diary-entries | 1879 | (when (or (memq 'mark-hebrew-diary-entries |
| 1894 | nongregorian-diary-marking-hook) | 1880 | nongregorian-diary-marking-hook) |
| 1895 | (memq 'list-hebrew-diary-entries | 1881 | (memq 'list-hebrew-diary-entries |
| 1896 | nongregorian-diary-listing-hook)) | 1882 | nongregorian-diary-listing-hook)) |
| 1897 | (require 'cal-hebrew) | 1883 | (require 'cal-hebrew) |
| 1898 | (font-lock-diary-date-forms | 1884 | (diary-font-lock-date-forms |
| 1899 | calendar-hebrew-month-name-array-leap-year | 1885 | calendar-hebrew-month-name-array-leap-year |
| 1900 | hebrew-diary-entry-symbol)) | 1886 | hebrew-diary-entry-symbol)) |
| 1901 | (when (or (memq 'mark-islamic-diary-entries | 1887 | (when (or (memq 'mark-islamic-diary-entries |
| @@ -1903,7 +1889,7 @@ names." | |||
| 1903 | (memq 'list-islamic-diary-entries | 1889 | (memq 'list-islamic-diary-entries |
| 1904 | nongregorian-diary-listing-hook)) | 1890 | nongregorian-diary-listing-hook)) |
| 1905 | (require 'cal-islam) | 1891 | (require 'cal-islam) |
| 1906 | (font-lock-diary-date-forms | 1892 | (diary-font-lock-date-forms |
| 1907 | calendar-islamic-month-name-array | 1893 | calendar-islamic-month-name-array |
| 1908 | islamic-diary-entry-symbol)) | 1894 | islamic-diary-entry-symbol)) |
| 1909 | (list | 1895 | (list |
| @@ -1925,10 +1911,10 @@ names." | |||
| 1925 | (concat "^" (regexp-quote diary-nonmarking-symbol) | 1911 | (concat "^" (regexp-quote diary-nonmarking-symbol) |
| 1926 | "?\\(" (regexp-quote islamic-diary-entry-symbol) "\\)") | 1912 | "?\\(" (regexp-quote islamic-diary-entry-symbol) "\\)") |
| 1927 | '(1 font-lock-reference-face)) | 1913 | '(1 font-lock-reference-face)) |
| 1928 | '(font-lock-diary-sexps . font-lock-keyword-face) | 1914 | '(diary-font-lock-sexps . font-lock-keyword-face) |
| 1929 | '("[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)\\(-[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)\\)?" | 1915 | '("[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)\\(-[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)\\)?" |
| 1930 | . font-lock-function-name-face))) | 1916 | . font-lock-function-name-face))) |
| 1931 | "Forms to highlight in diary-mode") | 1917 | "Forms to highlight in `diary-mode'.") |
| 1932 | 1918 | ||
| 1933 | 1919 | ||
| 1934 | ;; Following code from Dave Love <fx@gnu.org>. | 1920 | ;; Following code from Dave Love <fx@gnu.org>. |
| @@ -2087,5 +2073,5 @@ user is asked to confirm its addition." | |||
| 2087 | 2073 | ||
| 2088 | (provide 'diary-lib) | 2074 | (provide 'diary-lib) |
| 2089 | 2075 | ||
| 2090 | ;;; arch-tag: 22dd506e-2e33-410d-9ae1-095a0c1b2010 | 2076 | ;; arch-tag: 22dd506e-2e33-410d-9ae1-095a0c1b2010 |
| 2091 | ;;; diary-lib.el ends here | 2077 | ;;; diary-lib.el ends here |