]> code.delx.au - gnu-emacs/blobdiff - lisp/calendar/diary-lib.el
Merge from emacs-24; up to 2014-06-22T05:00:14Z!dmantipov@yandex.ru
[gnu-emacs] / lisp / calendar / diary-lib.el
index 2cc381122b7da2abd37b4afcf2e4e464bd4a5b09..a4e36d9abe8fb20e95eeffe3e51a8220ec773fde 100644 (file)
@@ -1,6 +1,6 @@
 ;;; diary-lib.el --- diary functions
 
-;; Copyright (C) 1989-1990, 1992-1995, 2001-2013 Free Software
+;; Copyright (C) 1989-1990, 1992-1995, 2001-2014 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
@@ -366,7 +366,7 @@ Returns a string using match elements 1-5, where:
     ;; 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
@@ -1011,8 +1011,7 @@ Entries that do not apply are made invisible.  Holidays are shown
 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
@@ -1032,7 +1031,14 @@ in the mode line.  This is an option for `diary-display-function'."
 (define-obsolete-function-alias 'simple-diary-display
   'diary-simple-display "23.1")
 
-(define-button-type 'diary-entry 'action #'diary-goto-entry
+(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 (lambda (button) (funcall diary-goto-entry-function button))
   'face 'diary-button 'help-echo "Find this diary entry"
   'follow-link t)
 
@@ -1209,8 +1215,7 @@ all entries, not just some, are visible.  If there is no diary buffer, one
 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)
@@ -2109,8 +2114,7 @@ calendar."
   "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)
@@ -2370,6 +2374,7 @@ return a font-lock pattern matching array of MONTHS and marking 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 ()
@@ -2392,6 +2397,11 @@ return a font-lock pattern matching array of MONTHS and marking SYMBOL."
                                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))
@@ -2408,7 +2418,8 @@ return a font-lock pattern matching array of MONTHS and marking SYMBOL."
              (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)