diff options
| author | Glenn Morris | 2008-04-02 03:34:23 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-04-02 03:34:23 +0000 |
| commit | 2e73c671d1fe6debc7ab9ae7479533554917d46a (patch) | |
| tree | ff7fee956c5ab1826b70f6d995a979e6d24523e0 | |
| parent | ff35f3b8500a68a242dc0d671da16183572726a4 (diff) | |
| download | emacs-2e73c671d1fe6debc7ab9ae7479533554917d46a.tar.gz emacs-2e73c671d1fe6debc7ab9ae7479533554917d46a.zip | |
(fancy-diary-display): Check for font-lock-mode before using faces.
(diary-list-entries, fancy-diary-display)
(print-diary-entries, mark-sexp-diary-entries, calendar-mark-complex)
(calendar-mark-1, list-sexp-diary-entries, diary-remind):
Reduce the number of lets.
(mark-sexp-diary-entries, calendar-mark-complex):
Expand calendar-for-loops.
| -rw-r--r-- | lisp/calendar/diary-lib.el | 326 |
1 files changed, 159 insertions, 167 deletions
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 4e4ae6d52de..1b1096bb6e1 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el | |||
| @@ -680,19 +680,18 @@ If LIST-ONLY is non-nil don't modify or display the buffer, only return a list." | |||
| 680 | (aref number-of-diary-entries (calendar-day-of-week date)) | 680 | (aref number-of-diary-entries (calendar-day-of-week date)) |
| 681 | number-of-diary-entries))) | 681 | number-of-diary-entries))) |
| 682 | (when (> number 0) | 682 | (when (> number 0) |
| 683 | (let ((original-date date) ; save for possible use in the hooks | 683 | (let* ((original-date date) ; save for possible use in the hooks |
| 684 | diary-entries-list | 684 | (date-string (calendar-date-string date)) |
| 685 | file-glob-attrs | 685 | (d-file (substitute-in-file-name diary-file)) |
| 686 | (date-string (calendar-date-string date)) | 686 | (diary-buffer (find-buffer-visiting d-file)) |
| 687 | (d-file (substitute-in-file-name diary-file))) | 687 | diary-entries-list file-glob-attrs) |
| 688 | (message "Preparing diary...") | 688 | (message "Preparing diary...") |
| 689 | (save-excursion | 689 | (save-excursion |
| 690 | (let ((diary-buffer (find-buffer-visiting d-file))) | 690 | (if (not diary-buffer) |
| 691 | (if (not diary-buffer) | 691 | (set-buffer (find-file-noselect d-file t)) |
| 692 | (set-buffer (find-file-noselect d-file t)) | 692 | (set-buffer diary-buffer) |
| 693 | (set-buffer diary-buffer) | 693 | (or (verify-visited-file-modtime diary-buffer) |
| 694 | (or (verify-visited-file-modtime diary-buffer) | 694 | (revert-buffer t t))) |
| 695 | (revert-buffer t t)))) | ||
| 696 | ;; Setup things like the header-line-format and invisibility-spec. | 695 | ;; Setup things like the header-line-format and invisibility-spec. |
| 697 | (if (eq major-mode default-major-mode) | 696 | (if (eq major-mode default-major-mode) |
| 698 | (diary-mode) | 697 | (diary-mode) |
| @@ -908,7 +907,8 @@ To use this function, add it to `diary-display-hook'." | |||
| 908 | (calendar-holiday-list))) | 907 | (calendar-holiday-list))) |
| 909 | (increment-calendar-month | 908 | (increment-calendar-month |
| 910 | holiday-list-last-month holiday-list-last-year 1)) | 909 | holiday-list-last-month holiday-list-last-year 1)) |
| 911 | (let (date-holiday-list) | 910 | (let ((longest 0) |
| 911 | date-holiday-list cc) | ||
| 912 | ;; Make a list of all holidays for date. | 912 | ;; Make a list of all holidays for date. |
| 913 | (dolist (h holiday-list) | 913 | (dolist (h holiday-list) |
| 914 | (if (calendar-date-equal date (car h)) | 914 | (if (calendar-date-equal date (car h)) |
| @@ -916,17 +916,15 @@ To use this function, add it to `diary-display-hook'." | |||
| 916 | (cdr h))))) | 916 | (cdr h))))) |
| 917 | (insert (if (bobp) "" ?\n) (calendar-date-string date)) | 917 | (insert (if (bobp) "" ?\n) (calendar-date-string date)) |
| 918 | (if date-holiday-list (insert ": ")) | 918 | (if date-holiday-list (insert ": ")) |
| 919 | (let ((l (current-column)) | 919 | (setq cc (current-column)) |
| 920 | (longest 0)) | 920 | (insert (mapconcat (lambda (x) |
| 921 | (insert (mapconcat (lambda (x) | 921 | (setq longest (max longest (length x))) |
| 922 | (if (< longest (length x)) | 922 | x) |
| 923 | (setq longest (length x))) | 923 | date-holiday-list |
| 924 | x) | 924 | (concat "\n" (make-string cc ?\s)))) |
| 925 | date-holiday-list | 925 | (insert ?\n (make-string (+ cc longest) ?=) ?\n))) |
| 926 | (concat "\n" (make-string l ? )))) | ||
| 927 | (insert ?\n (make-string (+ l longest) ?=) ?\n)))) | ||
| 928 | (let ((this-entry (cadr entry)) | 926 | (let ((this-entry (cadr entry)) |
| 929 | this-loc) | 927 | this-loc marks temp-face) |
| 930 | (unless (zerop (length this-entry)) | 928 | (unless (zerop (length this-entry)) |
| 931 | (if (setq this-loc (nth 3 entry)) | 929 | (if (setq this-loc (nth 3 entry)) |
| 932 | (insert-button (concat this-entry "\n") | 930 | (insert-button (concat this-entry "\n") |
| @@ -938,15 +936,14 @@ To use this function, add it to `diary-display-hook'." | |||
| 938 | (nth 1 entry))) | 936 | (nth 1 entry))) |
| 939 | :type 'diary-entry) | 937 | :type 'diary-entry) |
| 940 | (insert this-entry ?\n)) | 938 | (insert this-entry ?\n)) |
| 941 | (save-excursion | 939 | (and font-lock-mode |
| 942 | (let ((marks (nth 4 entry)) | 940 | (setq marks (nth 4 entry)) |
| 943 | temp-face) | 941 | (save-excursion |
| 944 | (when marks | 942 | (setq temp-face (calendar-make-temp-face marks)) |
| 945 | (setq temp-face (calendar-make-temp-face marks)) | 943 | (search-backward this-entry) |
| 946 | (search-backward this-entry) | 944 | (overlay-put |
| 947 | (overlay-put | 945 | (make-overlay (match-beginning 0) (match-end 0)) |
| 948 | (make-overlay (match-beginning 0) (match-end 0)) | 946 | 'face temp-face))))))) |
| 949 | 'face temp-face)))))))) | ||
| 950 | (fancy-diary-display-mode) | 947 | (fancy-diary-display-mode) |
| 951 | (calendar-set-mode-line date-string) | 948 | (calendar-set-mode-line date-string) |
| 952 | (message "Preparing diary...done")))) | 949 | (message "Preparing diary...done")))) |
| @@ -964,40 +961,37 @@ If the fancy diary display is being used, just print the buffer. | |||
| 964 | The hooks given by the variable `print-diary-entries-hook' are called to do | 961 | The hooks given by the variable `print-diary-entries-hook' are called to do |
| 965 | the actual printing." | 962 | the actual printing." |
| 966 | (interactive) | 963 | (interactive) |
| 967 | (if (bufferp (get-buffer fancy-diary-buffer)) | 964 | (let ((diary-buffer (get-buffer fancy-diary-buffer)) |
| 968 | (with-current-buffer (get-buffer fancy-diary-buffer) | 965 | temp-buffer heading start end) |
| 969 | (run-hooks 'print-diary-entries-hook)) | 966 | (if diary-buffer |
| 970 | (let ((diary-buffer | 967 | (with-current-buffer diary-buffer |
| 971 | (find-buffer-visiting (substitute-in-file-name diary-file)))) | 968 | (run-hooks 'print-diary-entries-hook)) |
| 972 | (if diary-buffer | 969 | (or (setq diary-buffer |
| 973 | ;; Name affects printing? | 970 | (find-buffer-visiting (substitute-in-file-name diary-file))) |
| 974 | (let ((temp-buffer (get-buffer-create " *Printable Diary Entries*")) | 971 | (error "You don't have a diary buffer!")) |
| 975 | heading) | 972 | ;; Name affects printing? |
| 976 | (with-current-buffer diary-buffer | 973 | (setq temp-buffer (get-buffer-create " *Printable Diary Entries*")) |
| 977 | (setq heading | 974 | (with-current-buffer diary-buffer |
| 978 | (if (not (stringp mode-line-format)) | 975 | (setq heading |
| 979 | "All Diary Entries" | 976 | (if (not (stringp mode-line-format)) |
| 980 | (string-match "^-*\\([^-].*[^-]\\)-*$" mode-line-format) | 977 | "All Diary Entries" |
| 981 | (match-string 1 mode-line-format))) | 978 | (string-match "^-*\\([^-].*[^-]\\)-*$" mode-line-format) |
| 982 | (let ((start (point-min)) | 979 | (match-string 1 mode-line-format)) |
| 983 | end) | 980 | start (point-min)) |
| 984 | (while | 981 | (while |
| 985 | (progn | 982 | (progn |
| 986 | (setq end (next-single-char-property-change | 983 | (setq end (next-single-char-property-change start 'invisible)) |
| 987 | start 'invisible)) | 984 | (unless (get-char-property start 'invisible) |
| 988 | (unless (get-char-property start 'invisible) | 985 | (with-current-buffer temp-buffer |
| 989 | (with-current-buffer temp-buffer | 986 | (insert-buffer-substring diary-buffer start end))) |
| 990 | (insert-buffer-substring diary-buffer | 987 | (setq start end) |
| 991 | start (or end (point-max))))) | 988 | (and end (< end (point-max)))))) |
| 992 | (setq start end) | 989 | (set-buffer temp-buffer) |
| 993 | (and end (< end (point-max)))))) | 990 | (goto-char (point-min)) |
| 994 | (set-buffer temp-buffer) | 991 | (insert heading "\n" |
| 995 | (goto-char (point-min)) | 992 | (make-string (length heading) ?=) "\n") |
| 996 | (insert heading "\n" | 993 | (run-hooks 'print-diary-entries-hook) |
| 997 | (make-string (length heading) ?=) "\n") | 994 | (kill-buffer temp-buffer)))) |
| 998 | (run-hooks 'print-diary-entries-hook) | ||
| 999 | (kill-buffer temp-buffer))) | ||
| 1000 | (error "You don't have a diary buffer!"))))) | ||
| 1001 | 995 | ||
| 1002 | (define-obsolete-function-alias 'show-all-diary-entries 'diary-show-all-entries) | 996 | (define-obsolete-function-alias 'show-all-diary-entries 'diary-show-all-entries) |
| 1003 | ;;;###cal-autoload | 997 | ;;;###cal-autoload |
| @@ -1245,13 +1239,14 @@ is marked. See the documentation for the function `list-sexp-diary-entries'." | |||
| 1245 | (regexp-quote diary-nonmarking-symbol) | 1239 | (regexp-quote diary-nonmarking-symbol) |
| 1246 | sexp-mark)) | 1240 | sexp-mark)) |
| 1247 | (file-glob-attrs (nth 1 (diary-pull-attrs nil '()))) | 1241 | (file-glob-attrs (nth 1 (diary-pull-attrs nil '()))) |
| 1248 | m y first-date last-date mark file-glob-attrs) | 1242 | m y first-date last-date date mark file-glob-attrs |
| 1243 | sexp-start sexp entry entry-start) | ||
| 1249 | (with-current-buffer calendar-buffer | 1244 | (with-current-buffer calendar-buffer |
| 1250 | (setq m displayed-month | 1245 | (setq m displayed-month |
| 1251 | y displayed-year)) | 1246 | y displayed-year)) |
| 1252 | (increment-calendar-month m y -1) | 1247 | (increment-calendar-month m y -1) |
| 1253 | (setq first-date | 1248 | (setq first-date (calendar-absolute-from-gregorian (list m 1 y)) |
| 1254 | (calendar-absolute-from-gregorian (list m 1 y))) | 1249 | date (1- first-date)) |
| 1255 | (increment-calendar-month m y 2) | 1250 | (increment-calendar-month m y 2) |
| 1256 | (setq last-date | 1251 | (setq last-date |
| 1257 | (calendar-absolute-from-gregorian | 1252 | (calendar-absolute-from-gregorian |
| @@ -1260,31 +1255,30 @@ is marked. See the documentation for the function `list-sexp-diary-entries'." | |||
| 1260 | (while (re-search-forward s-entry nil t) | 1255 | (while (re-search-forward s-entry nil t) |
| 1261 | (setq marking-diary-entry (char-equal (preceding-char) ?\()) | 1256 | (setq marking-diary-entry (char-equal (preceding-char) ?\()) |
| 1262 | (re-search-backward "(") | 1257 | (re-search-backward "(") |
| 1263 | (let ((sexp-start (point)) | 1258 | (setq sexp-start (point)) |
| 1264 | sexp entry entry-start) | 1259 | (forward-sexp) |
| 1265 | (forward-sexp) | 1260 | (setq sexp (buffer-substring-no-properties sexp-start (point))) |
| 1266 | (setq sexp (buffer-substring-no-properties sexp-start (point))) | 1261 | (forward-char 1) |
| 1267 | (forward-char 1) | 1262 | (if (and (bolp) (not (looking-at "[ \t]"))) |
| 1268 | (if (and (bolp) (not (looking-at "[ \t]"))) | 1263 | ;; Diary entry consists only of the sexp. |
| 1269 | ;; Diary entry consists only of the sexp. | 1264 | (progn |
| 1270 | (progn | 1265 | (backward-char 1) |
| 1271 | (backward-char 1) | 1266 | (setq entry "")) |
| 1272 | (setq entry "")) | 1267 | (setq entry-start (point)) |
| 1273 | (setq entry-start (point)) | 1268 | ;; Find end of entry. |
| 1274 | ;; Find end of entry. | 1269 | (forward-line 1) |
| 1275 | (forward-line 1) | 1270 | (while (looking-at "[ \t]") |
| 1276 | (while (looking-at "[ \t]") | 1271 | (forward-line 1)) |
| 1277 | (forward-line 1)) | 1272 | (if (bolp) (backward-char 1)) |
| 1278 | (if (bolp) (backward-char 1)) | 1273 | (setq entry (buffer-substring-no-properties entry-start (point)))) |
| 1279 | (setq entry (buffer-substring-no-properties entry-start (point)))) | 1274 | (while (<= (setq date (1+ date)) last-date) |
| 1280 | (calendar-for-loop date from first-date to last-date do | 1275 | (when (setq mark (diary-sexp-entry |
| 1281 | (when (setq mark (diary-sexp-entry | 1276 | sexp entry |
| 1282 | sexp entry | 1277 | (calendar-gregorian-from-absolute date))) |
| 1283 | (calendar-gregorian-from-absolute date))) | 1278 | (mark-visible-calendar-date |
| 1284 | (mark-visible-calendar-date | 1279 | (calendar-gregorian-from-absolute date) |
| 1285 | (calendar-gregorian-from-absolute date) | 1280 | (or (cadr (diary-pull-attrs entry file-glob-attrs)) |
| 1286 | (or (cadr (diary-pull-attrs entry file-glob-attrs)) | 1281 | (if (consp mark) (car mark))))))))) |
| 1287 | (if (consp mark) (car mark)))))))))) | ||
| 1288 | 1282 | ||
| 1289 | (defun mark-included-diary-files () | 1283 | (defun mark-included-diary-files () |
| 1290 | "Mark the diary entries from other diary files with those of the diary file. | 1284 | "Mark the diary entries from other diary files with those of the diary file. |
| @@ -1373,27 +1367,27 @@ Optional argument COLOR is passed to `mark-visible-calendar-date' as MARK." | |||
| 1373 | ;; Not one of the simple cases--check all visible dates for match. | 1367 | ;; Not one of the simple cases--check all visible dates for match. |
| 1374 | ;; Actually, the following code takes care of ALL of the cases, but | 1368 | ;; Actually, the following code takes care of ALL of the cases, but |
| 1375 | ;; it's much too slow to be used for the simple (common) cases. | 1369 | ;; it's much too slow to be used for the simple (common) cases. |
| 1376 | (let ((m displayed-month) | 1370 | (let* ((m displayed-month) |
| 1377 | (y displayed-year) | 1371 | (y displayed-year) |
| 1378 | first-date last-date) | 1372 | (first-date (progn |
| 1379 | (increment-calendar-month m y -1) | 1373 | (increment-calendar-month m y -1) |
| 1380 | (setq first-date (calendar-absolute-from-gregorian (list m 1 y))) | 1374 | (calendar-absolute-from-gregorian (list m 1 y)))) |
| 1381 | (increment-calendar-month m y 2) | 1375 | (last-date (progn |
| 1382 | (setq last-date (calendar-absolute-from-gregorian | 1376 | (increment-calendar-month m y 2) |
| 1383 | (list m (calendar-last-day-of-month m y) y))) | 1377 | (calendar-absolute-from-gregorian |
| 1384 | (calendar-for-loop date from first-date to last-date do | 1378 | (list m (calendar-last-day-of-month m y) y)))) |
| 1385 | (let* ((i-date (funcall fromabs date)) | 1379 | (date (1- first-date)) |
| 1386 | (i-month (extract-calendar-month i-date)) | 1380 | local-date) |
| 1387 | (i-day (extract-calendar-day i-date)) | 1381 | (while (<= (setq date (1+ date)) last-date) |
| 1388 | (i-year (extract-calendar-year i-date))) | 1382 | (setq local-date (funcall fromabs date)) |
| 1389 | (and (or (zerop month) | 1383 | (and (or (zerop month) |
| 1390 | (= month i-month)) | 1384 | (= month (extract-calendar-month local-date))) |
| 1391 | (or (zerop day) | 1385 | (or (zerop day) |
| 1392 | (= day i-day)) | 1386 | (= day (extract-calendar-day local-date))) |
| 1393 | (or (zerop year) | 1387 | (or (zerop year) |
| 1394 | (= year i-year)) | 1388 | (= year (extract-calendar-year local-date))) |
| 1395 | (mark-visible-calendar-date | 1389 | (mark-visible-calendar-date |
| 1396 | (calendar-gregorian-from-absolute date) color)))))) | 1390 | (calendar-gregorian-from-absolute date) color))))) |
| 1397 | 1391 | ||
| 1398 | ;; Bahai, Islamic. | 1392 | ;; Bahai, Islamic. |
| 1399 | (defun calendar-mark-1 (month day year fromabs toabs &optional color) | 1393 | (defun calendar-mark-1 (month day year fromabs toabs &optional color) |
| @@ -1419,11 +1413,11 @@ COLOR is passed to `mark-visible-calendar-date' as MARK." | |||
| 1419 | date) | 1413 | date) |
| 1420 | (unless (< m 1) ; calendar doesn't apply | 1414 | (unless (< m 1) ; calendar doesn't apply |
| 1421 | (increment-calendar-month m y (- 10 month)) | 1415 | (increment-calendar-month m y (- 10 month)) |
| 1422 | (if (> m 7) ; date might be visible | 1416 | (and (> m 7) ; date might be visible |
| 1423 | (let ((date (calendar-gregorian-from-absolute | 1417 | (calendar-date-is-visible-p |
| 1424 | (funcall toabs (list month day y))))) | 1418 | (setq date (calendar-gregorian-from-absolute |
| 1425 | (if (calendar-date-is-visible-p date) | 1419 | (funcall toabs (list month day y))))) |
| 1426 | (mark-visible-calendar-date date color))))))) | 1420 | (mark-visible-calendar-date date color))))) |
| 1427 | (calendar-mark-complex month day year | 1421 | (calendar-mark-complex month day year |
| 1428 | 'calendar-bahai-from-absolute color)))) | 1422 | 'calendar-bahai-from-absolute color)))) |
| 1429 | 1423 | ||
| @@ -1436,7 +1430,7 @@ Returns `diary-unknown-time' (default value -9999) if no time is recognized. | |||
| 1436 | The recognized forms are XXXX, X:XX, or XX:XX (military time), and XXam, | 1430 | The recognized forms are XXXX, X:XX, or XX:XX (military time), and XXam, |
| 1437 | XXAM, XXpm, XXPM, XX:XXam, XX:XXAM XX:XXpm, or XX:XXPM. A period (.) can | 1431 | XXAM, XXpm, XXPM, XX:XXam, XX:XXAM XX:XXpm, or XX:XXPM. A period (.) can |
| 1438 | be used instead of a colon (:) to separate the hour and minute parts." | 1432 | be used instead of a colon (:) to separate the hour and minute parts." |
| 1439 | (let ((case-fold-search nil)) | 1433 | (let (case-fold-search) |
| 1440 | (cond ((string-match ; military time | 1434 | (cond ((string-match ; military time |
| 1441 | "\\`[ \t\n]*\\([0-9]?[0-9]\\)[:.]?\\([0-9][0-9]\\)\\(\\>\\|[^ap]\\)" | 1435 | "\\`[ \t\n]*\\([0-9]?[0-9]\\)[:.]?\\([0-9][0-9]\\)\\(\\>\\|[^ap]\\)" |
| 1442 | s) | 1436 | s) |
| @@ -1582,51 +1576,48 @@ Marking these entries is *extremely* time consuming, so it is | |||
| 1582 | best if they are non-marking." | 1576 | best if they are non-marking." |
| 1583 | (let ((s-entry (format "^%s?%s(" (regexp-quote diary-nonmarking-symbol) | 1577 | (let ((s-entry (format "^%s?%s(" (regexp-quote diary-nonmarking-symbol) |
| 1584 | (regexp-quote sexp-diary-entry-symbol))) | 1578 | (regexp-quote sexp-diary-entry-symbol))) |
| 1585 | entry-found file-glob-attrs marks) | 1579 | entry-found file-glob-attrs marks |
| 1580 | sexp-start sexp entry specifier entry-start line-start | ||
| 1581 | diary-entry temp literal) | ||
| 1586 | (goto-char (point-min)) | 1582 | (goto-char (point-min)) |
| 1587 | (save-excursion | 1583 | (save-excursion |
| 1588 | (setq file-glob-attrs (nth 1 (diary-pull-attrs nil '())))) | 1584 | (setq file-glob-attrs (nth 1 (diary-pull-attrs nil '())))) |
| 1589 | (while (re-search-forward s-entry nil t) | 1585 | (while (re-search-forward s-entry nil t) |
| 1590 | (backward-char 1) | 1586 | (backward-char 1) |
| 1591 | (let ((sexp-start (point)) | 1587 | (setq sexp-start (point)) |
| 1592 | sexp entry specifier entry-start line-start) | 1588 | (forward-sexp) |
| 1593 | (forward-sexp) | 1589 | (setq sexp (buffer-substring-no-properties sexp-start (point)) |
| 1594 | (setq sexp (buffer-substring-no-properties sexp-start (point)) | 1590 | line-start (line-end-position 0) |
| 1595 | line-start (line-end-position 0) | 1591 | specifier |
| 1596 | specifier | 1592 | (buffer-substring-no-properties (1+ line-start) (point)) |
| 1597 | (buffer-substring-no-properties (1+ line-start) (point)) | 1593 | entry-start (1+ line-start)) |
| 1598 | entry-start (1+ line-start)) | 1594 | (forward-char 1) |
| 1599 | (forward-char 1) | 1595 | (if (and (bolp) (not (looking-at "[ \t]"))) |
| 1600 | (if (and (bolp) (not (looking-at "[ \t]"))) | 1596 | ;; Diary entry consists only of the sexp. |
| 1601 | ;; Diary entry consists only of the sexp. | 1597 | (progn |
| 1602 | (progn | 1598 | (backward-char 1) |
| 1603 | (backward-char 1) | 1599 | (setq entry "")) |
| 1604 | (setq entry "")) | 1600 | (setq entry-start (point)) |
| 1605 | (setq entry-start (point)) | 1601 | (forward-line 1) |
| 1606 | (forward-line 1) | 1602 | (while (looking-at "[ \t]") |
| 1607 | (while (looking-at "[ \t]") | 1603 | (forward-line 1)) |
| 1608 | (forward-line 1)) | 1604 | (backward-char 1) |
| 1609 | (backward-char 1) | 1605 | (setq entry (buffer-substring-no-properties entry-start (point)))) |
| 1610 | (setq entry (buffer-substring-no-properties entry-start (point)))) | 1606 | (setq diary-entry (diary-sexp-entry sexp entry date) |
| 1611 | (let ((diary-entry (diary-sexp-entry sexp entry date)) | 1607 | literal entry ; before evaluation |
| 1612 | temp literal) | 1608 | entry (if (consp diary-entry) |
| 1613 | (setq literal entry ; before evaluation | 1609 | (cdr diary-entry) |
| 1614 | entry (if (consp diary-entry) | 1610 | diary-entry)) |
| 1615 | (cdr diary-entry) | 1611 | (when diary-entry |
| 1616 | diary-entry)) | 1612 | (remove-overlays line-start (point) 'invisible 'diary) |
| 1617 | (when diary-entry | 1613 | (if (< 0 (length entry)) |
| 1618 | (remove-overlays line-start (point) 'invisible 'diary) | 1614 | (setq temp (diary-pull-attrs entry file-glob-attrs) |
| 1619 | (if (< 0 (length entry)) | 1615 | entry (nth 0 temp) |
| 1620 | (setq temp (diary-pull-attrs entry file-glob-attrs) | 1616 | marks (nth 1 temp)))) |
| 1621 | entry (nth 0 temp) | 1617 | (add-to-diary-list date entry specifier |
| 1622 | marks (nth 1 temp)))) | 1618 | (if entry-start (copy-marker entry-start)) |
| 1623 | (add-to-diary-list date | 1619 | marks literal) |
| 1624 | entry | 1620 | (setq entry-found (or entry-found diary-entry))) |
| 1625 | specifier | ||
| 1626 | (if entry-start (copy-marker entry-start)) | ||
| 1627 | marks | ||
| 1628 | literal) | ||
| 1629 | (setq entry-found (or entry-found diary-entry))))) | ||
| 1630 | entry-found)) | 1621 | entry-found)) |
| 1631 | 1622 | ||
| 1632 | 1623 | ||
| @@ -1833,7 +1824,8 @@ entry specifies that the diary entry (not the reminder) is non-marking. | |||
| 1833 | Marking of reminders is independent of whether the entry itself is a marking | 1824 | Marking of reminders is independent of whether the entry itself is a marking |
| 1834 | or nonmarking; if optional parameter MARKING is non-nil then the reminders are | 1825 | or nonmarking; if optional parameter MARKING is non-nil then the reminders are |
| 1835 | marked on the calendar." | 1826 | marked on the calendar." |
| 1836 | (let ((diary-entry (eval sexp))) | 1827 | (let ((diary-entry (eval sexp)) |
| 1828 | date) | ||
| 1837 | (cond | 1829 | (cond |
| 1838 | ;; Diary entry applies on date. | 1830 | ;; Diary entry applies on date. |
| 1839 | ((and diary-entry | 1831 | ((and diary-entry |
| @@ -1843,12 +1835,12 @@ marked on the calendar." | |||
| 1843 | ((and (integerp days) | 1835 | ((and (integerp days) |
| 1844 | (not diary-entry) ; diary entry does not apply to date | 1836 | (not diary-entry) ; diary entry does not apply to date |
| 1845 | (or (not marking-diary-entries) marking)) | 1837 | (or (not marking-diary-entries) marking)) |
| 1846 | (let ((date (calendar-gregorian-from-absolute | 1838 | (setq date (calendar-gregorian-from-absolute |
| 1847 | (+ (calendar-absolute-from-gregorian date) days)))) | 1839 | (+ (calendar-absolute-from-gregorian date) days))) |
| 1848 | (when (setq diary-entry (eval sexp)) ; re-evaluate with adjusted date | 1840 | (when (setq diary-entry (eval sexp)) ; re-evaluate with adjusted date |
| 1849 | ;; Discard any mark portion from diary-anniversary, etc. | 1841 | ;; Discard any mark portion from diary-anniversary, etc. |
| 1850 | (if (consp diary-entry) (setq diary-entry (cdr diary-entry))) | 1842 | (if (consp diary-entry) (setq diary-entry (cdr diary-entry))) |
| 1851 | (mapconcat 'eval diary-remind-message "")))) | 1843 | (mapconcat 'eval diary-remind-message ""))) |
| 1852 | ;; Diary entry may apply to one of a list of days before date. | 1844 | ;; Diary entry may apply to one of a list of days before date. |
| 1853 | ((and (listp days) days) | 1845 | ((and (listp days) days) |
| 1854 | (or (diary-remind sexp (car days) marking) | 1846 | (or (diary-remind sexp (car days) marking) |