Mercurial > emacs
comparison lisp/calendar/diary-lib.el @ 89943:4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-218
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-220
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-221
Restore deleted tagline in etc/TUTORIAL.ru
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-222
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-228
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-229
Remove TeX output files from the archive
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-230
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-247
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-248
src/lisp.h (CYCLE_CHECK): Macro moved from xfaces.c
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-249
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-256
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-258
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-263
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-264
Update from CVS: lispref/display.texi: emacs -> Emacs.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-265
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-274
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-275
Update from CVS: man/makefile.w32-in: Revert last change
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-276
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-295
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-296
Allow restarting an existing debugger session that's exited
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-297
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-299
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-300
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-327
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-328
Update from CVS: src/.gdbinit (xsymbol): Fix last change.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-329
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-344
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-345
Tweak source regexps so that building in place won't cause problems
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-346
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-351
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-352
Update from CVS: lisp/flymake.el: New file.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-353
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-361
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-362
Support " [...]" style defaults in minibuffer-electric-default-mode
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-363
(read-number): Use canonical format for default in prompt.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-364
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-367
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-368
Improve display-supports-face-attributes-p on non-ttys
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-369
Rewrite face-differs-from-default-p
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Move `display-supports-face-attributes-p' entirely into C code
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-371
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Simplify face-differs-from-default-p; don't consider :stipple.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-373
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
(tty_supports_face_attributes_p): Ensure attributes differ from default
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-375
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-376
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377
(Fdisplay_supports_face_attributes_p): Work around bootstrapping problem
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-378
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-380
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Face merging cleanups
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-382
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-384
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-385
src/xfaces.c (push_named_merge_point): Return 0 if a cycle is detected
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-386
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-395
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-396
Tweak arch tagging to make build/install-in-place less annoying
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-397
Work around vc-arch problems when building eshell
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-398
Tweak permissions
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-399
Tweak directory permissions
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-400
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-401
More build-in-place tweaking of arch tagging
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-402
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-403
Yet more build-in-place tweaking of arch tagging
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-404
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-409
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-410
Make sure image types are initialized for lookup too
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-411
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-416
Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 28 Jun 2004 07:56:49 +0000 |
parents | 68c22ea6027c b278cb498cc8 |
children | e23928ac5a97 |
comparison
equal
deleted
inserted
replaced
89942:9cb747ae49af | 89943:4c90ffeb71c5 |
---|---|
120 (autoload 'mark-islamic-diary-entries "cal-islam" | 120 (autoload 'mark-islamic-diary-entries "cal-islam" |
121 "Mark days in the calendar window that have Islamic date diary entries.") | 121 "Mark days in the calendar window that have Islamic date diary entries.") |
122 | 122 |
123 (autoload 'mark-islamic-calendar-date-pattern "cal-islam" | 123 (autoload 'mark-islamic-calendar-date-pattern "cal-islam" |
124 "Mark dates in calendar window that conform to Islamic date MONTH/DAY/YEAR.") | 124 "Mark dates in calendar window that conform to Islamic date MONTH/DAY/YEAR.") |
125 | |
126 (autoload 'diary-bahai-date "cal-bahai" | |
127 "Baha'i calendar equivalent of date diary entry." | |
128 t) | |
129 | |
130 (autoload 'list-bahai-diary-entries "cal-bahai" | |
131 "Add any Baha'i date entries from the diary file to `diary-entries-list'." | |
132 t) | |
133 | |
134 (autoload 'mark-bahai-diary-entries "cal-bahai" | |
135 "Mark days in the calendar window that have Baha'i date diary entries." | |
136 t) | |
137 | |
138 (autoload 'mark-bahai-calendar-date-pattern "cal-bahai" | |
139 "Mark dates in calendar window that conform to Baha'i date MONTH/DAY/YEAR." | |
140 t) | |
125 | 141 |
126 (autoload 'diary-hebrew-date "cal-hebrew" | 142 (autoload 'diary-hebrew-date "cal-hebrew" |
127 "Hebrew calendar equivalent of date diary entry.") | 143 "Hebrew calendar equivalent of date diary entry.") |
128 | 144 |
129 (autoload 'diary-omer "cal-hebrew" | 145 (autoload 'diary-omer "cal-hebrew" |
1127 (string-to-int (substring s (match-beginning 2) (match-end 2))) | 1143 (string-to-int (substring s (match-beginning 2) (match-end 2))) |
1128 (if (equal ?a (downcase (aref s (match-beginning 3)))) | 1144 (if (equal ?a (downcase (aref s (match-beginning 3)))) |
1129 0 1200))) | 1145 0 1200))) |
1130 (t diary-unknown-time)))) ; Unrecognizable | 1146 (t diary-unknown-time)))) ; Unrecognizable |
1131 | 1147 |
1148 ;; Unrecognizable | |
1149 | |
1132 (defun list-sexp-diary-entries (date) | 1150 (defun list-sexp-diary-entries (date) |
1133 "Add sexp entries for DATE from the diary file to `diary-entries-list'. | 1151 "Add sexp entries for DATE from the diary file to `diary-entries-list'. |
1134 Also, Make them visible in the diary file. Returns t if any entries were | 1152 Also, Make them visible in the diary file. Returns t if any entries were |
1135 found. | 1153 found. |
1136 | 1154 |
1857 '("[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)\\(-[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)\\)?" | 1875 '("[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)\\(-[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)\\)?" |
1858 . font-lock-function-name-face))) | 1876 . font-lock-function-name-face))) |
1859 "Forms to highlight in diary-mode") | 1877 "Forms to highlight in diary-mode") |
1860 | 1878 |
1861 | 1879 |
1880 ;; Following code from Dave Love <fx@gnu.org>. | |
1881 ;; Import Outlook-format appointments from mail messages in Gnus or | |
1882 ;; Rmail using command `diary-from-outlook'. This, or the specialized | |
1883 ;; functions `diary-from-outlook-gnus' and `diary-from-outlook-rmail', | |
1884 ;; could be run from hooks to notice appointments automatically (in | |
1885 ;; which case they will prompt about adding to the diary). The | |
1886 ;; message formats recognized are customizable through | |
1887 ;; `diary-outlook-formats'. | |
1888 | |
1889 (defcustom diary-outlook-formats | |
1890 '( | |
1891 ;; When: 11 October 2001 12:00-14:00 (GMT) Greenwich Mean Time : Dublin, ... | |
1892 ;; [Current UK format? The timezone is meaningless. Sometimes the | |
1893 ;; Where is missing.] | |
1894 ("When: \\([0-9]+ [[:alpha:]]+ [0-9]+\\) \ | |
1895 \\([^ ]+\\) [^\n]+ | |
1896 \[^\n]+ | |
1897 \\(?:Where: \\([^\n]+\\)\n+\\)? | |
1898 \\*~\\*~\\*~\\*~\\*~\\*~\\*~\\*~\\*~\\*" | |
1899 . "\\1\n \\2 %s, \\3") | |
1900 ;; When: Tuesday, April 30, 2002 03:00 PM-03:30 PM (GMT) Greenwich Mean ... | |
1901 ;; [Old UK format?] | |
1902 ("^When: [[:alpha:]]+, \\([[:alpha:]]+\\) \\([0-9][0-9]*\\), \\([0-9]\\{4\\}\\) \ | |
1903 \\([^ ]+\\) [^\n]+ | |
1904 \[^\n]+ | |
1905 \\(?:Where: \\([^\n]+\\)\\)?\n+" | |
1906 . "\\2 \\1 \\3\n \\4 %s, \\5") | |
1907 ( | |
1908 ;; German format, apparently. | |
1909 "^Zeit: [^ ]+, +\\([0-9]+\\)\. +\\([[:upper:]][[:lower:]][[:lower:]]\\)[^ ]* +\\([0-9]+\\) +\\([^ ]+\\).*$" | |
1910 . "\\1 \\2 \\3\n \\4 %s")) | |
1911 "Alist of regexps matching message text and replacement text. | |
1912 | |
1913 The regexp must match the start of the message text containing an | |
1914 appointment, but need not include a leading `^'. If it matches the | |
1915 current message, a diary entry is made from the corresponding | |
1916 template. If the template is a string, it should be suitable for | |
1917 passing to `replace-match', and so will have occurrences of `\\D' to | |
1918 substitute the match for the Dth subexpression. It must also contain | |
1919 a single `%s' which will be replaced with the text of the message's | |
1920 Subject field. Any other `%' characters must be doubled, so that the | |
1921 template can be passed to `format'. | |
1922 | |
1923 If the template is actually a function, it is called with the message | |
1924 body text as argument, and may use `match-string' etc. to make a | |
1925 template following the rules above." | |
1926 :type '(alist :key-type (regexp :tag "Regexp matching time/place") | |
1927 :value-type (choice | |
1928 (string :tag "Template for entry") | |
1929 (function :tag "Unary function providing template"))) | |
1930 :version "21.4" | |
1931 :group 'diary) | |
1932 | |
1933 | |
1934 ;; Dynamically bound. | |
1935 (defvar body) | |
1936 (defvar subject) | |
1937 | |
1938 (defun diary-from-outlook-internal (&optional test-only) | |
1939 "Snarf a diary entry from a message assumed to be from MS Outlook. | |
1940 Assumes `body' is bound to a string comprising the body of the message and | |
1941 `subject' is bound to a string comprising its subject. | |
1942 Arg TEST-ONLY non-nil means return non-nil if and only if the | |
1943 message contains an appointment, don't make a diary entry." | |
1944 (catch 'finished | |
1945 (let (format-string) | |
1946 (dotimes (i (length diary-outlook-formats)) | |
1947 (when (eq 0 (string-match (car (nth i diary-outlook-formats)) | |
1948 body)) | |
1949 (unless test-only | |
1950 (setq format-string (cdr (nth i diary-outlook-formats))) | |
1951 (save-excursion | |
1952 (save-window-excursion | |
1953 ;; Fixme: References to optional fields in the format | |
1954 ;; are treated literally, not replaced by the empty | |
1955 ;; string. I think this is an Emacs bug. | |
1956 (make-diary-entry | |
1957 (format (replace-match (if (functionp format-string) | |
1958 (funcall format-string body) | |
1959 format-string) | |
1960 t nil (match-string 0 body)) | |
1961 subject)) | |
1962 (save-buffer)))) | |
1963 (throw 'finished t)))) | |
1964 nil)) | |
1965 | |
1966 (defun diary-from-outlook () | |
1967 "Maybe snarf diary entry from current Outlook-generated message. | |
1968 Currently knows about Gnus and Rmail modes." | |
1969 (interactive) | |
1970 (let ((func (cond | |
1971 ((eq major-mode 'rmail-mode) | |
1972 #'diary-from-outlook-rmail) | |
1973 ((memq major-mode '(gnus-summary-mode gnus-article-mode)) | |
1974 #'diary-from-outlook-gnus) | |
1975 (t (error "Don't know how to snarf in `%s'" major-mode))))) | |
1976 (if (interactive-p) | |
1977 (call-interactively func) | |
1978 (funcall func)))) | |
1979 | |
1980 | |
1981 (defvar gnus-article-mime-handles) | |
1982 (defvar gnus-article-buffer) | |
1983 | |
1984 (autoload 'gnus-fetch-field "gnus-util") | |
1985 (autoload 'gnus-narrow-to-body "gnus") | |
1986 (autoload 'mm-get-part "mm-decode") | |
1987 | |
1988 (defun diary-from-outlook-gnus () | |
1989 "Maybe snarf diary entry from Outlook-generated message in Gnus. | |
1990 Add this to `gnus-article-prepare-hook' to notice appointments | |
1991 automatically." | |
1992 (interactive) | |
1993 (with-current-buffer gnus-article-buffer | |
1994 (let ((subject (gnus-fetch-field "subject")) | |
1995 (body (if gnus-article-mime-handles | |
1996 ;; We're multipart. Don't get confused by part | |
1997 ;; buttons &c. Assume info is in first part. | |
1998 (mm-get-part (nth 1 gnus-article-mime-handles)) | |
1999 (save-restriction | |
2000 (gnus-narrow-to-body) | |
2001 (buffer-string))))) | |
2002 (when (diary-from-outlook-internal t) | |
2003 (when (or (interactive-p) | |
2004 (y-or-n-p "Snarf diary entry? ")) | |
2005 (diary-from-outlook-internal) | |
2006 (message "Diary entry added")))))) | |
2007 | |
2008 (custom-add-option 'gnus-article-prepare-hook 'diary-from-outlook-gnus) | |
2009 | |
2010 | |
2011 (defvar rmail-buffer) | |
2012 | |
2013 (defun diary-from-outlook-rmail () | |
2014 "Maybe snarf diary entry from Outlook-generated message in Rmail." | |
2015 (interactive) | |
2016 (with-current-buffer rmail-buffer | |
2017 (let ((subject (mail-fetch-field "subject")) | |
2018 (body (buffer-substring (save-excursion | |
2019 (rfc822-goto-eoh) | |
2020 (point)) | |
2021 (point-max)))) | |
2022 (when (diary-from-outlook-internal t) | |
2023 (when (or (interactive-p) | |
2024 (y-or-n-p "Snarf diary entry? ")) | |
2025 (diary-from-outlook-internal) | |
2026 (message "Diary entry added")))))) | |
2027 | |
2028 | |
1862 (provide 'diary-lib) | 2029 (provide 'diary-lib) |
1863 | 2030 |
1864 ;;; arch-tag: 22dd506e-2e33-410d-9ae1-095a0c1b2010 | 2031 ;;; arch-tag: 22dd506e-2e33-410d-9ae1-095a0c1b2010 |
1865 ;;; diary-lib.el ends here | 2032 ;;; diary-lib.el ends here |