;;; diary-lib.el --- diary functions
-;; Copyright (C) 1989-1990, 1992-1995, 2001-2012
-;; Free Software Foundation, Inc.
+;; Copyright (C) 1989-1990, 1992-1995, 2001-2015 Free Software
+;; Foundation, Inc.
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
;; Maintainer: Glenn Morris <rgm@gnu.org>
:type 'boolean
:group 'diary)
-(defcustom diary-face 'diary
- "Face name to use for diary entries."
- :type 'face
- :group 'calendar-faces)
-(make-obsolete-variable 'diary-face "customize the face `diary' instead."
- "23.1")
-
(defface diary-anniversary '((t :inherit font-lock-keyword-face))
"Face used for anniversaries in the fancy diary display."
:version "22.1"
:version "22.1"
:group 'calendar-faces)
-(define-obsolete-face-alias 'diary-button-face 'diary-button "22.1")
-
;; Face markup of calendar and diary displays: Any entry line that
;; ends with [foo:value] where foo is a face attribute (except :box
;; :stipple) or with [face:blah] tags, will have these values applied
:type 'function
:group 'diary)
-(define-obsolete-variable-alias 'sexp-diary-entry-symbol
- 'diary-sexp-entry-symbol "23.1")
-
(defcustom diary-sexp-entry-symbol "%%"
"The string used to indicate a sexp diary entry in `diary-file'.
See the documentation for the function `diary-list-sexp-entries'."
:type 'hook
:group 'diary)
-(define-obsolete-variable-alias 'diary-display-hook 'diary-display-function
- "23.1")
-
(defcustom diary-display-function 'diary-fancy-display
"Function used to display the diary.
The two standard options are `diary-fancy-display' and `diary-simple-display'.
-For historical reasons, `nil' is the same as `diary-simple-display'
-\(so you must use `ignore' for no display). Also for historical
-reasons, this variable can be a list of functions to run. These
-uses are not recommended and may be removed at some point.
-
When this function is called, the variable `diary-entries-list'
is a list, in order by date, of all relevant diary entries in the
form of ((MONTH DAY YEAR) STRING), where string is the diary
holidays), or hard copy output."
:type '(choice (const diary-fancy-display :tag "Fancy display")
(const diary-simple-display :tag "Basic display")
- (const ignore :tag "No display")
- (const nil :tag "Obsolete way to choose basic display")
- (hook :tag "Obsolete form with list of display functions"))
+ (const :tag "No display" ignore)
+ (function :tag "User-specified function"))
:initialize 'custom-initialize-default
:set 'diary-set-maybe-redraw
:version "23.2" ; simple->fancy
:group 'diary)
-(define-obsolete-variable-alias 'list-diary-entries-hook
- 'diary-list-entries-hook "23.1")
-
(defcustom diary-list-entries-hook nil
"Hook run after diary file is culled for relevant entries.
:options '(diary-include-other-diary-files diary-sort-entries)
:group 'diary)
-(define-obsolete-variable-alias 'mark-diary-entries-hook
- 'diary-mark-entries-hook "23.1")
-
(defcustom diary-mark-entries-hook nil
"List of functions called after marking diary entries in the calendar.
You might wish to add `diary-mark-included-diary-files', in which case
:options '(diary-mark-included-diary-files)
:group 'diary)
-(define-obsolete-variable-alias 'nongregorian-diary-listing-hook
- 'diary-nongregorian-listing-hook "23.1")
-
(defcustom diary-nongregorian-listing-hook nil
"List of functions called for listing diary file and included files.
As the files are processed for diary entries, these functions are used
diary-islamic-list-entries)
:group 'diary)
-(define-obsolete-variable-alias 'nongregorian-diary-marking-hook
- 'diary-nongregorian-marking-hook "23.1")
-
(defcustom diary-nongregorian-marking-hook nil
"List of functions called for marking diary file and included files.
As the files are processed for diary entries, these functions are used
diary-islamic-mark-entries)
:group 'diary)
-(define-obsolete-variable-alias 'print-diary-entries-hook
- 'diary-print-entries-hook "23.1")
-
(defcustom diary-print-entries-hook 'lpr-buffer
"Run by `diary-print-entries' after preparing a temporary diary buffer.
The buffer shows only the diary entries currently visible in the
:type 'sexp
:group 'diary)
-(define-obsolete-variable-alias 'abbreviated-calendar-year
- 'diary-abbreviated-year-flag "23.1")
-
(defcustom diary-abbreviated-year-flag t
"Interpret a two-digit year DD in a diary entry as either 19DD or 20DD.
This applies to the Gregorian, Hebrew, Islamic, and Bahá'í calendars.
;; use the standard function calendar-date-string.
(concat (if month
(calendar-date-string (list month (string-to-number day)
- (string-to-number year)))
+ (string-to-number year)) nil t)
(cond ((eq calendar-date-style 'iso) "\\3 \\1 \\2") ; YMD
((eq calendar-date-style 'european) "\\2 \\1 \\3") ; DMY
(t "\\1 \\2 \\3"))) ; MDY
(defcustom diary-header-line-format
'(:eval (calendar-string-spread
(list (if diary-selective-display
- "Some text is hidden - press \"s\" in calendar \
-before edit/copy"
+ "Some text is hidden - press \"C-c C-s\" before edit/copy"
"Diary"))
?\s (window-width)))
"Format of the header line displayed by `diary-simple-display'.
;; just visiting the diary-file. This is i) unlikely, and ii) no great loss.
;;;###cal-autoload
(defun diary-live-p ()
- "Return non-nil if the diary is being displayed."
+ "Return non-nil if the diary is being displayed.
+The actual return value is a diary buffer."
(or (get-buffer diary-fancy-buffer)
(and diary-file (find-buffer-visiting diary-file))))
;; Note this assumes diary was called without prefix arg.
(diary))))
-(define-obsolete-variable-alias 'number-of-diary-entries
- 'diary-number-of-entries "23.1")
-
(defcustom diary-number-of-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
(let ((diary-file dfile))
(diary-view-entries arg)))
-;;;###cal-autoload
-(define-obsolete-function-alias 'view-other-diary-entries
- 'diary-view-other-diary-entries "23.1")
-
(defvar diary-syntax-table
(let ((st (copy-syntax-table (standard-syntax-table))))
(modify-syntax-entry ?* "w" st)
(list marker dfile literal)
globcolor)))))))
-(define-obsolete-function-alias 'add-to-diary-list 'diary-add-to-list "23.1")
-
(defun diary-list-entries-2 (date mark globattr list-only
&optional months symbol gdate)
"Internal subroutine of `diary-list-entries'.
;;; (diary-include-other-diary-files) ; recurse
;;; (run-hooks 'diary-list-entries-hook))
(unless list-only
- (if (and diary-display-function
- (listp diary-display-function))
- ;; Backwards compatibility.
- (run-hooks 'diary-display-function)
- (funcall (or diary-display-function
- 'diary-simple-display))))
+ ;; Avoid M-x diary; M-x calendar; M-x diary
+ ;; clobbering the calendar window.
+ ;; FIXME this is not the right solution.
+ (let ((display-buffer-fallback-action
+ (list (delq
+ 'display-buffer-in-previous-window
+ (copy-sequence
+ (car display-buffer-fallback-action))))))
+ (funcall diary-display-function)))
(run-hooks 'diary-hook)))))
(and temp-buff (buffer-name temp-buff) (kill-buffer temp-buff)))
(or d-incp (message "Preparing diary...done"))
See also `diary-mark-included-diary-files'."
(diary-include-files))
-(define-obsolete-function-alias 'include-other-diary-files
- 'diary-include-other-diary-files "23.1")
-
(defvar date-string) ; bound in diary-list-entries
(defun diary-display-no-entries ()
in the mode line. This is an option for `diary-display-function'."
;; If selected window is dedicated (to the calendar), need a new one
;; to display the diary.
- (let* ((pop-up-frames (or pop-up-frames
- (window-dedicated-p (selected-window))))
+ (let* ((pop-up-frames (or pop-up-frames (window-dedicated-p)))
(dbuff (find-buffer-visiting diary-file))
(empty (diary-display-no-entries)))
;; This may be too wide, but when simple diary is used there is
(set-window-point window diary-saved-point)
(set-window-start window (point-min)))))))
-(define-obsolete-function-alias 'simple-diary-display
- 'diary-simple-display "23.1")
+(defvar diary-goto-entry-function 'diary-goto-entry
+ "Function called to jump to a diary entry.
+Modes that require special handling of the included file
+containing the diary entry can assign a suitable function to this
+variable.")
-(define-button-type 'diary-entry 'action #'diary-goto-entry
+(define-button-type 'diary-entry
+ 'action (lambda (button) (funcall diary-goto-entry-function button))
'face 'diary-button 'help-echo "Find this diary entry"
'follow-link t)
(diary-fancy-display-mode))
(calendar-set-mode-line date-string))))
-(define-obsolete-function-alias 'fancy-diary-display
- 'diary-fancy-display "23.1")
-
;; FIXME modernize?
(defun diary-print-entries ()
"Print a hard copy of the diary display.
(run-hooks 'diary-print-entries-hook)
(kill-buffer temp-buffer))))
-(define-obsolete-function-alias 'print-diary-entries
- 'diary-print-entries "23.1")
-
;;;###cal-autoload
(defun diary-show-all-entries ()
"Show all of the diary entries in the diary file.
is created."
(interactive)
(let* ((d-file (diary-check-diary-file))
- (pop-up-frames (or pop-up-frames
- (window-dedicated-p (selected-window))))
+ (pop-up-frames (or pop-up-frames (window-dedicated-p)))
(win (selected-window))
(height (window-height)))
(with-current-buffer (or (find-buffer-visiting d-file)
(and temp-buff (buffer-name temp-buff) (kill-buffer temp-buff)))
(or d-incp (message "Marking diary entries...done"))))
-;;;###cal-autoload
-(define-obsolete-function-alias 'mark-diary-entries 'diary-mark-entries "23.1")
-
(defun diary-sexp-entry (sexp entry date)
"Process a SEXP diary ENTRY for DATE."
(let ((result (if calendar-debug-sexp
(or (cadr (diary-pull-attrs entry file-glob-attrs))
(if (consp mark) (car mark)))))))))
-(define-obsolete-function-alias 'mark-sexp-diary-entries
- 'diary-mark-sexp-entries "23.1")
-
(defun diary-mark-included-diary-files ()
"Mark diary entries from included diary files.
To use, add this function to `diary-mark-entries-hook'.
See also `diary-include-other-diary-files'."
(diary-include-files t))
-(define-obsolete-function-alias 'mark-included-diary-files
- 'diary-mark-included-diary-files "23.1")
-
(defun calendar-mark-days-named (dayname &optional color)
"Mark all dates in the calendar window that are day DAYNAME of the week.
0 means all Sundays, 1 means all Mondays, and so on.
color)
(setq day (+ day 7))))))
-(define-obsolete-function-alias 'mark-calendar-days-named
- 'calendar-mark-days-named "23.1")
-
(defun calendar-mark-month (month year p-month p-day p-year &optional color)
"Mark dates in the MONTH/YEAR that conform to pattern P-MONTH/P-DAY/P-YEAR.
A value of 0 in any position of the pattern is a wildcard.
(calendar-mark-visible-date (list month (1+ i) year) color))
(calendar-mark-visible-date (list month p-day year) color))))
-(define-obsolete-function-alias 'mark-calendar-month
- 'calendar-mark-month "23.1")
-
(defun calendar-mark-date-pattern (month day year &optional color)
"Mark all dates in the calendar window that conform to MONTH/DAY/YEAR.
A value of 0 in any position is a wildcard. Optional argument COLOR is
(calendar-mark-month m y month day year color)
(calendar-increment-month m y 1)))))
-(define-obsolete-function-alias 'mark-calendar-date-pattern
- 'calendar-mark-date-pattern "23.1")
-
;; Bahai, Hebrew, Islamic.
(defun calendar-mark-complex (month day year fromabs &optional color)
"Mark dates in the calendar conforming to MONTH DAY YEAR of some system.
(setq date (calendar-gregorian-from-absolute
(funcall toabs (list month day y)))))
(calendar-mark-visible-date date color)))))
- (calendar-mark-complex month day year
- 'calendar-bahai-from-absolute color))))
+ (calendar-mark-complex month day year fromabs color))))
(defun diary-entry-time (s)
entries, or change the order."
(setq diary-entries-list (sort diary-entries-list 'diary-entry-compare)))
-(define-obsolete-function-alias 'sort-diary-entries 'diary-sort-entries "23.1")
-
(defun diary-list-sexp-entries (date)
"Add sexp entries for DATE from the diary file to `diary-entries-list'.
(setq entry-found (or entry-found diary-entry)))
entry-found))
-(define-obsolete-function-alias 'list-sexp-diary-entries
- 'diary-list-sexp-entries "23.1")
-
(defun diary-make-date (a b c)
"Convert A B C into the internal calendar date form.
The expected order of the inputs depends on `calendar-date-style',
"Insert a diary entry STRING which may be NONMARKING in FILE.
If omitted, NONMARKING defaults to nil and FILE defaults to
`diary-file'."
- (let ((pop-up-frames (or pop-up-frames
- (window-dedicated-p (selected-window)))))
+ (let ((pop-up-frames (or pop-up-frames (window-dedicated-p))))
(find-file-other-window (or file diary-file)))
(when (eq major-mode (default-value 'major-mode)) (diary-mode))
(widen)
(if nonmarking diary-nonmarking-symbol "")
string " "))
-;;;###cal-autoload
-(define-obsolete-function-alias 'make-diary-entry 'diary-make-entry "23.1")
-
;;;###cal-autoload
(defun diary-insert-entry (arg &optional event)
"Insert a diary entry for the date indicated by point.
(diary-make-entry (calendar-date-string (calendar-cursor-to-date t event) t t)
arg))
-;;;###cal-autoload
-(define-obsolete-function-alias 'insert-diary-entry 'diary-insert-entry "23.1")
-
;;;###cal-autoload
(defun diary-insert-weekly-entry (arg)
"Insert a weekly diary entry for the day of the week indicated by point.
(diary-make-entry (calendar-day-name (calendar-cursor-to-date t))
arg))
-;;;###cal-autoload
-(define-obsolete-function-alias 'insert-weekly-diary-entry
- 'diary-insert-weekly-entry "23.1")
-
(defun diary-date-display-form (&optional type)
"Return value for `calendar-date-display-form' using `calendar-date-style'.
Optional symbol TYPE is either `monthly' or `yearly'."
(interactive "P")
(diary-insert-entry-1 'monthly arg))
-;;;###cal-autoload
-(define-obsolete-function-alias 'insert-monthly-diary-entry
- 'diary-insert-monthly-entry "23.1")
-
;;;###cal-autoload
(defun diary-insert-yearly-entry (arg)
"Insert an annual diary entry for the day of the year indicated by point.
(interactive "P")
(diary-insert-entry-1 'yearly arg))
-;;;###cal-autoload
-(define-obsolete-function-alias 'insert-yearly-diary-entry
- 'diary-insert-yearly-entry "23.1")
-
;;;###cal-autoload
(defun diary-insert-anniversary-entry (arg)
"Insert an anniversary diary entry for the date given by point.
(calendar-date-string (calendar-cursor-to-date t) nil t))
arg)))
-;;;###cal-autoload
-(define-obsolete-function-alias 'insert-anniversary-diary-entry
- 'diary-insert-anniversary-entry "23.1")
-
;;;###cal-autoload
(defun diary-insert-block-entry (arg)
"Insert a block diary entry for the days between the point and marked date.
(calendar-date-string end nil t))
arg)))
-;;;###cal-autoload
-(define-obsolete-function-alias 'insert-block-diary-entry
- 'diary-insert-block-entry "23.1")
-
;;;###cal-autoload
(defun diary-insert-cyclic-entry (arg)
"Insert a cyclic diary entry starting at the date given by point.
(calendar-date-string (calendar-cursor-to-date t) nil t))
arg)))
-;;;###cal-autoload
-(define-obsolete-function-alias 'insert-cyclic-diary-entry
- 'diary-insert-cyclic-entry "23.1")
-
;;; Diary mode.
(defun diary-redraw-calendar ()
(if (equal (car x) 'backup)
(concat "\\)" (eval (car (reverse x))))
"\\)"))
- '(1 diary-face)))
+ '(1 'diary)))
diary-date-forms)))
(defmacro diary-font-lock-keywords-1 (markfunc listfunc feature months symbol)
(defvar calendar-hebrew-month-name-array-leap-year)
(defvar calendar-islamic-month-name-array)
(defvar calendar-bahai-month-name-array)
+(defvar calendar-chinese-month-name-array)
;;;###cal-autoload
(defun diary-font-lock-keywords ()
cal-bahai
calendar-bahai-month-name-array
diary-bahai-entry-symbol)
+ (diary-font-lock-keywords-1 diary-chinese-mark-entries
+ diary-chinese-list-entries
+ cal-china
+ calendar-chinese-month-name-array
+ diary-chinese-entry-symbol)
(list
(cons
(format "^%s.*$" (regexp-quote diary-include-string))
(regexp-opt (mapcar 'regexp-quote
(list diary-hebrew-entry-symbol
diary-islamic-entry-symbol
- diary-bahai-entry-symbol))
+ diary-bahai-entry-symbol
+ diary-chinese-entry-symbol))
t))
'(1 font-lock-constant-face))
'(diary-font-lock-sexps . font-lock-keyword-face)
(put-text-property (match-beginning 0) (match-end 0) 'font-lock-multiline t)
t))
-(define-obsolete-variable-alias 'fancy-diary-font-lock-keywords
- 'diary-fancy-font-lock-keywords "23.1")
-
(defvar diary-fancy-font-lock-keywords
- `((diary-fancy-date-matcher . diary-face)
+ `((diary-fancy-date-matcher . 'diary)
("^.*\\([aA]nniversary\\|[bB]irthday\\).*$" . 'diary-anniversary)
("^.*Yahrzeit.*$" . font-lock-constant-face)
("^\\(Erev \\)?Rosh Hodesh.*" . font-lock-function-name-face)
(list (cons t diary-fancy-overriding-map)))
(view-mode 1))
-(define-obsolete-function-alias 'fancy-diary-display-mode
- 'diary-fancy-display-mode "23.1")
-
;; Following code from Dave Love <fx@gnu.org>.
;; Import Outlook-format appointments from mail messages in Gnus or
;; Rmail using command `diary-from-outlook'. This, or the specialized
(diary-from-outlook-internal subject body)
(message "Diary entry added"))))))
+(defvar diary-from-outlook-function nil
+ "If non-nil, a function of one argument for `diary-from-outlook' to call.
+If the current buffer contains an Outlook-style appointment message,
+this function should extract it into a diary entry. If the argument is
+nil, it should ask for confirmation before adding this entry to the diary.
+For examples, see `diary-from-outlook-rmail' and `diary-from-outlook-gnus'.")
+
(defun diary-from-outlook (&optional noconfirm)
"Maybe snarf diary entry from current Outlook-generated message.
-Currently knows about Gnus and Rmail modes. Unless the optional
-argument NOCONFIRM is non-nil (which is the case when this
-function is called interactively), then if an entry is found the
-user is asked to confirm its addition."
+Uses `diary-from-outlook-function' if that is non-nil, else
+`diary-from-outlook-rmail' for Rmail or `diary-from-outlook-gnus' for Gnus.
+Unless the optional argument NOCONFIRM is non-nil (which is the
+case when this function is called interactively), then if an
+entry is found the user is asked to confirm its addition."
(interactive "p")
(let ((func (cond
+ (diary-from-outlook-function)
((eq major-mode 'rmail-mode)
#'diary-from-outlook-rmail)
((memq major-mode '(gnus-summary-mode gnus-article-mode))