diff options
| author | Stefan Monnier | 2008-03-08 22:43:09 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-03-08 22:43:09 +0000 |
| commit | f0a51f2a94e9010ed827c7dfe8c337403e7d0fd9 (patch) | |
| tree | 48163d7ac11a8d92c96278aee277eb94bb73383a | |
| parent | 7027c07b6cfa0167c006e7fb722cc56638606cd7 (diff) | |
| download | emacs-f0a51f2a94e9010ed827c7dfe8c337403e7d0fd9.tar.gz emacs-f0a51f2a94e9010ed827c7dfe8c337403e7d0fd9.zip | |
(diary-list-entries, include-other-diary-files, mark-diary-entries)
(mark-sexp-diary-entries, mark-included-diary-files)
(diary-entry-time, list-sexp-diary-entries): Remove the special
handling of ^M that dates back to the use of selective-display.
(simple-diary-display): Obey setting of pop-up-frames.
(body, entry): Remove unnecessary declarations.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/calendar/diary-lib.el | 107 |
2 files changed, 48 insertions, 67 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 74be1d7d3cb..fd981dedbf6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,13 @@ | |||
| 1 | 2008-03-08 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2008-03-08 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * calendar/diary-lib.el (diary-list-entries) | ||
| 4 | (include-other-diary-files, mark-diary-entries) | ||
| 5 | (mark-sexp-diary-entries, mark-included-diary-files) | ||
| 6 | (diary-entry-time, list-sexp-diary-entries): Remove the special | ||
| 7 | handling of ^M that dates back to the use of selective-display. | ||
| 8 | (simple-diary-display): Obey setting of pop-up-frames. | ||
| 9 | (body, entry): Remove unnecessary declarations. | ||
| 10 | |||
| 3 | * bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs. | 11 | * bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs. |
| 4 | (bookmark-get-annotation, bookmark-set-annotation) | 12 | (bookmark-get-annotation, bookmark-set-annotation) |
| 5 | (bookmark-get-filename, bookmark-set-filename, bookmark-get-position) | 13 | (bookmark-get-filename, bookmark-set-filename, bookmark-get-position) |
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index c4aa6f4a773..c09bbc4360b 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el | |||
| @@ -118,9 +118,9 @@ function `mark-included-diary-files' as part of `mark-diary-entries-hook'. | |||
| 118 | 118 | ||
| 119 | For example, you could use | 119 | For example, you could use |
| 120 | 120 | ||
| 121 | (setq list-diary-entries-hook | 121 | (add-hook 'list-diary-entries-hook 'include-other-diary-files) |
| 122 | '(include-other-diary-files sort-diary-entries)) | 122 | (add-hook 'list-diary-entries-hook 'sort-diary-entries) |
| 123 | (setq diary-display-hook 'fancy-diary-display) | 123 | (add-hook 'diary-display-hook 'fancy-diary-display) |
| 124 | 124 | ||
| 125 | in your `.emacs' file to cause the fancy diary buffer to be displayed with | 125 | in your `.emacs' file to cause the fancy diary buffer to be displayed with |
| 126 | diary entries from various included files, each day's entries sorted into | 126 | diary entries from various included files, each day's entries sorted into |
| @@ -413,7 +413,6 @@ syntax of `*' and `:' changed to be word constituents.") | |||
| 413 | (defvar diary-entries-list) | 413 | (defvar diary-entries-list) |
| 414 | (defvar displayed-year) | 414 | (defvar displayed-year) |
| 415 | (defvar displayed-month) | 415 | (defvar displayed-month) |
| 416 | (defvar entry) | ||
| 417 | (defvar date) | 416 | (defvar date) |
| 418 | (defvar number) | 417 | (defvar number) |
| 419 | (defvar date-string) | 418 | (defvar date-string) |
| @@ -722,38 +721,28 @@ If LIST-ONLY is non-nil don't modify or display the buffer, only return a list." | |||
| 722 | ""))) | 721 | ""))) |
| 723 | (regexp | 722 | (regexp |
| 724 | (concat | 723 | (concat |
| 725 | "\\(\\`\\|\^M\\|\n\\)" mark "?\\(" | 724 | "^" mark "?\\(" |
| 726 | (mapconcat 'eval date-form "\\)\\(?:") | 725 | (mapconcat 'eval date-form "\\)\\(?:") |
| 727 | "\\)")) | 726 | "\\)")) |
| 728 | (case-fold-search t)) | 727 | (case-fold-search t)) |
| 729 | (goto-char (point-min)) | 728 | (goto-char (point-min)) |
| 730 | (while (re-search-forward regexp nil t) | 729 | (while (re-search-forward regexp nil t) |
| 731 | (if backup (re-search-backward "\\<" nil t)) | 730 | (if backup (re-search-backward "\\<" nil t)) |
| 732 | (if (and (or (char-equal (preceding-char) ?\^M) | 731 | (if (and (bolp) (not (looking-at "[ \t]"))) |
| 733 | (char-equal (preceding-char) ?\n)) | ||
| 734 | (not (looking-at " \\|\^I"))) | ||
| 735 | ;; Diary entry that consists only of date. | 732 | ;; Diary entry that consists only of date. |
| 736 | (backward-char 1) | 733 | (backward-char 1) |
| 737 | ;; Found a nonempty diary entry--make it | 734 | ;; Found a nonempty diary entry--make it |
| 738 | ;; visible and add it to the list. | 735 | ;; visible and add it to the list. |
| 739 | (setq entry-found t) | 736 | (setq entry-found t) |
| 737 | (if (looking-at "[ \t]*\n[ \t]") (forward-line 1)) | ||
| 740 | (let ((entry-start (point)) | 738 | (let ((entry-start (point)) |
| 741 | date-start temp) | 739 | date-start temp) |
| 742 | (re-search-backward "\^M\\|\n\\|\\`") | 740 | (setq date-start |
| 743 | (setq date-start (point)) | 741 | (line-end-position |
| 744 | ;; When selective display (rather than | 742 | (if (and (bolp) (> number 1)) -1 0))) |
| 745 | ;; overlays) was used, diary file used to | 743 | (forward-line 1) |
| 746 | ;; start in a blank line and end in a | 744 | (while (looking-at "[ \t]") |
| 747 | ;; newline. Now that neither of these | 745 | (forward-line 1)) |
| 748 | ;; need be true, 'move handles the latter | ||
| 749 | ;; and 1/2 kludge the former. | ||
| 750 | (re-search-forward | ||
| 751 | "\^M\\|\n" nil 'move | ||
| 752 | (if (and (bobp) (not (looking-at "\^M\\|\n"))) | ||
| 753 | 1 | ||
| 754 | 2)) | ||
| 755 | (while (looking-at " \\|\^I") | ||
| 756 | (re-search-forward "\^M\\|\n" nil 'move)) | ||
| 757 | (unless (and (eobp) (not (bolp))) | 746 | (unless (and (eobp) (not (bolp))) |
| 758 | (backward-char 1)) | 747 | (backward-char 1)) |
| 759 | (unless list-only | 748 | (unless list-only |
| @@ -802,7 +791,7 @@ changing the variable `diary-include-string'." | |||
| 802 | (goto-char (point-min)) | 791 | (goto-char (point-min)) |
| 803 | (while (re-search-forward | 792 | (while (re-search-forward |
| 804 | (concat | 793 | (concat |
| 805 | "\\(?:\\`\\|\^M\\|\n\\)" | 794 | "^" |
| 806 | (regexp-quote diary-include-string) | 795 | (regexp-quote diary-include-string) |
| 807 | " \"\\([^\"]*\\)\"") | 796 | " \"\\([^\"]*\\)\"") |
| 808 | nil t) | 797 | nil t) |
| @@ -839,7 +828,8 @@ changing the variable `diary-include-string'." | |||
| 839 | (msg (format "No diary entries for %s" hol-string)) | 828 | (msg (format "No diary entries for %s" hol-string)) |
| 840 | ;; If selected window is dedicated (to the calendar), | 829 | ;; If selected window is dedicated (to the calendar), |
| 841 | ;; need a new one to display the diary. | 830 | ;; need a new one to display the diary. |
| 842 | (pop-up-frames (window-dedicated-p (selected-window)))) | 831 | (pop-up-frames (or pop-up-frames |
| 832 | (window-dedicated-p (selected-window))))) | ||
| 843 | (calendar-set-mode-line (format "Diary for %s" hol-string)) | 833 | (calendar-set-mode-line (format "Diary for %s" hol-string)) |
| 844 | (if (or (not diary-entries-list) | 834 | (if (or (not diary-entries-list) |
| 845 | (and (not (cdr diary-entries-list)) | 835 | (and (not (cdr diary-entries-list)) |
| @@ -1209,18 +1199,18 @@ diary entries." | |||
| 1209 | (year "[0-9]+\\|\\*") | 1199 | (year "[0-9]+\\|\\*") |
| 1210 | (l (length date-form)) | 1200 | (l (length date-form)) |
| 1211 | (d-name-pos (- l (length (memq 'dayname date-form)))) | 1201 | (d-name-pos (- l (length (memq 'dayname date-form)))) |
| 1212 | (d-name-pos (if (/= l d-name-pos) (+ 2 d-name-pos))) | 1202 | (d-name-pos (if (/= l d-name-pos) (+ 1 d-name-pos))) |
| 1213 | (m-name-pos (- l (length (memq 'monthname date-form)))) | 1203 | (m-name-pos (- l (length (memq 'monthname date-form)))) |
| 1214 | (m-name-pos (if (/= l m-name-pos) (+ 2 m-name-pos))) | 1204 | (m-name-pos (if (/= l m-name-pos) (+ 1 m-name-pos))) |
| 1215 | (d-pos (- l (length (memq 'day date-form)))) | 1205 | (d-pos (- l (length (memq 'day date-form)))) |
| 1216 | (d-pos (if (/= l d-pos) (+ 2 d-pos))) | 1206 | (d-pos (if (/= l d-pos) (+ 1 d-pos))) |
| 1217 | (m-pos (- l (length (memq 'month date-form)))) | 1207 | (m-pos (- l (length (memq 'month date-form)))) |
| 1218 | (m-pos (if (/= l m-pos) (+ 2 m-pos))) | 1208 | (m-pos (if (/= l m-pos) (+ 1 m-pos))) |
| 1219 | (y-pos (- l (length (memq 'year date-form)))) | 1209 | (y-pos (- l (length (memq 'year date-form)))) |
| 1220 | (y-pos (if (/= l y-pos) (+ 2 y-pos))) | 1210 | (y-pos (if (/= l y-pos) (+ 1 y-pos))) |
| 1221 | (regexp | 1211 | (regexp |
| 1222 | (concat | 1212 | (concat |
| 1223 | "\\(\\`\\|\^M\\|\n\\)\\(" | 1213 | "^\\(" |
| 1224 | (mapconcat 'eval date-form "\\)\\(") | 1214 | (mapconcat 'eval date-form "\\)\\(") |
| 1225 | "\\)")) | 1215 | "\\)")) |
| 1226 | (case-fold-search t)) | 1216 | (case-fold-search t)) |
| @@ -1289,7 +1279,7 @@ diary entries." | |||
| 1289 | Each entry in the diary file (or included files) visible in the calendar window | 1279 | Each entry in the diary file (or included files) visible in the calendar window |
| 1290 | is marked. See the documentation for the function `list-sexp-diary-entries'." | 1280 | is marked. See the documentation for the function `list-sexp-diary-entries'." |
| 1291 | (let* ((sexp-mark (regexp-quote sexp-diary-entry-symbol)) | 1281 | (let* ((sexp-mark (regexp-quote sexp-diary-entry-symbol)) |
| 1292 | (s-entry (concat "\\(\\`\\|\^M\\|\n\\)\\(" | 1282 | (s-entry (concat "^\\(" |
| 1293 | sexp-mark "(\\)\\|\\(" | 1283 | sexp-mark "(\\)\\|\\(" |
| 1294 | (regexp-quote diary-nonmarking-symbol) | 1284 | (regexp-quote diary-nonmarking-symbol) |
| 1295 | sexp-mark "(diary-remind\\)")) | 1285 | sexp-mark "(diary-remind\\)")) |
| @@ -1310,31 +1300,21 @@ is marked. See the documentation for the function `list-sexp-diary-entries'." | |||
| 1310 | (setq marking-diary-entry (char-equal (preceding-char) ?\()) | 1300 | (setq marking-diary-entry (char-equal (preceding-char) ?\()) |
| 1311 | (re-search-backward "(") | 1301 | (re-search-backward "(") |
| 1312 | (let ((sexp-start (point)) | 1302 | (let ((sexp-start (point)) |
| 1313 | sexp entry entry-start line-start marks) | 1303 | sexp entry entry-start marks) |
| 1314 | (forward-sexp) | 1304 | (forward-sexp) |
| 1315 | (setq sexp (buffer-substring-no-properties sexp-start (point))) | 1305 | (setq sexp (buffer-substring-no-properties sexp-start (point))) |
| 1316 | (save-excursion | ||
| 1317 | (re-search-backward "\^M\\|\n\\|\\`") | ||
| 1318 | (setq line-start (point))) | ||
| 1319 | (forward-char 1) | 1306 | (forward-char 1) |
| 1320 | (if (and (or (char-equal (preceding-char) ?\^M) | 1307 | (if (and (bolp) (not (looking-at "[ \t]"))) |
| 1321 | (char-equal (preceding-char) ?\n)) | ||
| 1322 | (not (looking-at " \\|\^I"))) | ||
| 1323 | (progn;; Diary entry consists only of the sexp | 1308 | (progn;; Diary entry consists only of the sexp |
| 1324 | (backward-char 1) | 1309 | (backward-char 1) |
| 1325 | (setq entry "")) | 1310 | (setq entry "")) |
| 1326 | (setq entry-start (point)) | 1311 | (setq entry-start (point)) |
| 1327 | ;; Find end of entry | 1312 | ;; Find end of entry |
| 1328 | (re-search-forward "\^M\\|\n" nil t) | 1313 | (forward-line 1) |
| 1329 | (while (looking-at " \\|\^I") | 1314 | (while (looking-at "[ \t]") |
| 1330 | (or (re-search-forward "\^M\\|\n" nil t) | 1315 | (forward-line 1)) |
| 1331 | (re-search-forward "$" nil t))) | 1316 | (if (bolp) (backward-char 1)) |
| 1332 | (if (or (char-equal (preceding-char) ?\^M) | 1317 | (setq entry (buffer-substring-no-properties entry-start (point)))) |
| 1333 | (char-equal (preceding-char) ?\n)) | ||
| 1334 | (backward-char 1)) | ||
| 1335 | (setq entry (buffer-substring-no-properties entry-start (point))) | ||
| 1336 | (while (string-match "[\^M]" entry) | ||
| 1337 | (aset entry (match-beginning 0) ?\n ))) | ||
| 1338 | (calendar-for-loop date from first-date to last-date do | 1318 | (calendar-for-loop date from first-date to last-date do |
| 1339 | (if (setq mark (diary-sexp-entry sexp entry | 1319 | (if (setq mark (diary-sexp-entry sexp entry |
| 1340 | (calendar-gregorian-from-absolute date))) | 1320 | (calendar-gregorian-from-absolute date))) |
| @@ -1360,7 +1340,7 @@ changing the variable `diary-include-string'." | |||
| 1360 | (goto-char (point-min)) | 1340 | (goto-char (point-min)) |
| 1361 | (while (re-search-forward | 1341 | (while (re-search-forward |
| 1362 | (concat | 1342 | (concat |
| 1363 | "\\(?:\\`\\|\^M\\|\n\\)" | 1343 | "^" |
| 1364 | (regexp-quote diary-include-string) | 1344 | (regexp-quote diary-include-string) |
| 1365 | " \"\\([^\"]*\\)\"") | 1345 | " \"\\([^\"]*\\)\"") |
| 1366 | nil t) | 1346 | nil t) |
| @@ -1450,17 +1430,17 @@ XXAM, XXpm, XXPM, XX:XXam, XX:XXAM XX:XXpm, or XX:XXPM. A period (.) can | |||
| 1450 | be used instead of a colon (:) to separate the hour and minute parts." | 1430 | be used instead of a colon (:) to separate the hour and minute parts." |
| 1451 | (let ((case-fold-search nil)) | 1431 | (let ((case-fold-search nil)) |
| 1452 | (cond ((string-match ; Military time | 1432 | (cond ((string-match ; Military time |
| 1453 | "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)[:.]?\\([0-9][0-9]\\)\\(\\>\\|[^ap]\\)" | 1433 | "\\`[ \t\n]*\\([0-9]?[0-9]\\)[:.]?\\([0-9][0-9]\\)\\(\\>\\|[^ap]\\)" |
| 1454 | s) | 1434 | s) |
| 1455 | (+ (* 100 (string-to-number (match-string 1 s))) | 1435 | (+ (* 100 (string-to-number (match-string 1 s))) |
| 1456 | (string-to-number (match-string 2 s)))) | 1436 | (string-to-number (match-string 2 s)))) |
| 1457 | ((string-match ; Hour only XXam or XXpm | 1437 | ((string-match ; Hour only XXam or XXpm |
| 1458 | "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)\\([ap]\\)m\\>" s) | 1438 | "\\`[ \t\n]*\\([0-9]?[0-9]\\)\\([ap]\\)m\\>" s) |
| 1459 | (+ (* 100 (% (string-to-number (match-string 1 s)) 12)) | 1439 | (+ (* 100 (% (string-to-number (match-string 1 s)) 12)) |
| 1460 | (if (equal ?a (downcase (aref s (match-beginning 2)))) | 1440 | (if (equal ?a (downcase (aref s (match-beginning 2)))) |
| 1461 | 0 1200))) | 1441 | 0 1200))) |
| 1462 | ((string-match ; Hour and minute XX:XXam or XX:XXpm | 1442 | ((string-match ; Hour and minute XX:XXam or XX:XXpm |
| 1463 | "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)[:.]\\([0-9][0-9]\\)\\([ap]\\)m\\>" s) | 1443 | "\\`[ \t\n]*\\([0-9]?[0-9]\\)[:.]\\([0-9][0-9]\\)\\([ap]\\)m\\>" s) |
| 1464 | (+ (* 100 (% (string-to-number (match-string 1 s)) 12)) | 1444 | (+ (* 100 (% (string-to-number (match-string 1 s)) 12)) |
| 1465 | (string-to-number (match-string 2 s)) | 1445 | (string-to-number (match-string 2 s)) |
| 1466 | (if (equal ?a (downcase (aref s (match-beginning 3)))) | 1446 | (if (equal ?a (downcase (aref s (match-beginning 3)))) |
| @@ -1630,7 +1610,7 @@ A number of built-in functions are available for this type of diary entry: | |||
| 1630 | 1610 | ||
| 1631 | Marking these entries is *extremely* time consuming, so these entries are | 1611 | Marking these entries is *extremely* time consuming, so these entries are |
| 1632 | best if they are nonmarking." | 1612 | best if they are nonmarking." |
| 1633 | (let ((s-entry (concat "\\(\\`\\|\^M\\|\n\\)" | 1613 | (let ((s-entry (concat "^" |
| 1634 | (regexp-quote diary-nonmarking-symbol) | 1614 | (regexp-quote diary-nonmarking-symbol) |
| 1635 | "?" | 1615 | "?" |
| 1636 | (regexp-quote sexp-diary-entry-symbol) | 1616 | (regexp-quote sexp-diary-entry-symbol) |
| @@ -1645,27 +1625,21 @@ best if they are nonmarking." | |||
| 1645 | sexp entry specifier entry-start line-start) | 1625 | sexp entry specifier entry-start line-start) |
| 1646 | (forward-sexp) | 1626 | (forward-sexp) |
| 1647 | (setq sexp (buffer-substring-no-properties sexp-start (point))) | 1627 | (setq sexp (buffer-substring-no-properties sexp-start (point))) |
| 1648 | (save-excursion | 1628 | (setq line-start (line-end-position 0)) |
| 1649 | (re-search-backward "\^M\\|\n\\|\\`") | ||
| 1650 | (setq line-start (point))) | ||
| 1651 | (setq specifier | 1629 | (setq specifier |
| 1652 | (buffer-substring-no-properties (1+ line-start) (point)) | 1630 | (buffer-substring-no-properties (1+ line-start) (point)) |
| 1653 | entry-start (1+ line-start)) | 1631 | entry-start (1+ line-start)) |
| 1654 | (forward-char 1) | 1632 | (forward-char 1) |
| 1655 | (if (and (or (char-equal (preceding-char) ?\^M) | 1633 | (if (and (bolp) (not (looking-at "[ \t]"))) |
| 1656 | (char-equal (preceding-char) ?\n)) | ||
| 1657 | (not (looking-at " \\|\^I"))) | ||
| 1658 | (progn;; Diary entry consists only of the sexp | 1634 | (progn;; Diary entry consists only of the sexp |
| 1659 | (backward-char 1) | 1635 | (backward-char 1) |
| 1660 | (setq entry "")) | 1636 | (setq entry "")) |
| 1661 | (setq entry-start (point)) | 1637 | (setq entry-start (point)) |
| 1662 | (re-search-forward "\^M\\|\n" nil t) | 1638 | (forward-line 1) |
| 1663 | (while (looking-at " \\|\^I") | 1639 | (while (looking-at "[ \t]") |
| 1664 | (re-search-forward "\^M\\|\n" nil t)) | 1640 | (forward-line 1)) |
| 1665 | (backward-char 1) | 1641 | (backward-char 1) |
| 1666 | (setq entry (buffer-substring-no-properties entry-start (point))) | 1642 | (setq entry (buffer-substring-no-properties entry-start (point)))) |
| 1667 | (while (string-match "[\^M]" entry) | ||
| 1668 | (aset entry (match-beginning 0) ?\n ))) | ||
| 1669 | (let ((diary-entry (diary-sexp-entry sexp entry date)) | 1643 | (let ((diary-entry (diary-sexp-entry sexp entry date)) |
| 1670 | temp literal) | 1644 | temp literal) |
| 1671 | (setq literal entry ; before evaluation | 1645 | (setq literal entry ; before evaluation |
| @@ -2255,7 +2229,6 @@ names." | |||
| 2255 | ;; `diary-outlook-formats'. | 2229 | ;; `diary-outlook-formats'. |
| 2256 | 2230 | ||
| 2257 | ;; Dynamically bound. | 2231 | ;; Dynamically bound. |
| 2258 | (defvar body) | ||
| 2259 | (defvar subject) | 2232 | (defvar subject) |
| 2260 | 2233 | ||
| 2261 | (defun diary-from-outlook-internal (&optional test-only) | 2234 | (defun diary-from-outlook-internal (&optional test-only) |