diff options
| author | Glenn Morris | 2013-08-06 19:53:49 -0400 |
|---|---|---|
| committer | Glenn Morris | 2013-08-06 19:53:49 -0400 |
| commit | 3b5c03d32b5917f1d14aabeb2bf082a0451ae3da (patch) | |
| tree | 9fbf49a4230dc33c3c41231d5dbd3698f0ac75ea | |
| parent | ec9564383ba1599be3e253d0b6643d392938de41 (diff) | |
| download | emacs-3b5c03d32b5917f1d14aabeb2bf082a0451ae3da.tar.gz emacs-3b5c03d32b5917f1d14aabeb2bf082a0451ae3da.zip | |
calendar.el: Add new faces, and day-header-array
* lisp/calendar/calendar.el (calendar-weekday-header)
(calendar-weekend-header, calendar-month-header): New faces.
(calendar-day-header-construct): New function.
(calendar-day-header-width): Also :set calendar-day-header-array.
(calendar-american-month-header, calendar-european-month-header)
(calendar-iso-month-header): Use calendar- faces.
(calendar-generate-month):
Use calendar-day-header-array for day headers; apply faces to them.
(calendar-mode): Check calendar-font-lock-keywords non-nil.
(calendar-abbrev-construct): Add optional maxlen argument.
(calendar-day-name-array): Doc fix.
(calendar-day-name-array, calendar-abbrev-length)
(calendar-day-abbrev-array):
Also :set calendar-day-header-array, and maybe redraw.
(calendar-day-header-array): New option.
(calendar-font-lock-keywords): Use calendar-day-header-array,
and calendar- faces. Make obsolete.
(calendar-day-name): Add option to use header array.
* etc/NEWS: Mention this.
Fixes: debbugs:15007
| -rw-r--r-- | etc/NEWS | 7 | ||||
| -rw-r--r-- | lisp/ChangeLog | 22 | ||||
| -rw-r--r-- | lisp/calendar/calendar.el | 167 |
3 files changed, 156 insertions, 40 deletions
| @@ -233,6 +233,13 @@ The default separator is changed to allow surrounding spaces around the comma. | |||
| 233 | 233 | ||
| 234 | ** Calendar and Diary | 234 | ** Calendar and Diary |
| 235 | 235 | ||
| 236 | *** New faces: `calendar-weekday-header', `calendar-weekend-header', | ||
| 237 | `calendar-month-header'. | ||
| 238 | |||
| 239 | *** New option `calendar-day-header-array'. | ||
| 240 | |||
| 241 | *** The variable `calendar-font-lock-keywords' is obsolete. | ||
| 242 | |||
| 236 | +++ | 243 | +++ |
| 237 | *** New variable `diary-from-outlook-function', used by the command | 244 | *** New variable `diary-from-outlook-function', used by the command |
| 238 | `diary-from-outlook'. | 245 | `diary-from-outlook'. |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 666fab55bf4..ff9b68e1987 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,25 @@ | |||
| 1 | 2013-08-06 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * calendar/calendar.el: Add new faces, and day-header-array. | ||
| 4 | (calendar-weekday-header, calendar-weekend-header) | ||
| 5 | (calendar-month-header): New faces. | ||
| 6 | (calendar-day-header-construct): New function. | ||
| 7 | (calendar-day-header-width): Also :set calendar-day-header-array. | ||
| 8 | (calendar-american-month-header, calendar-european-month-header) | ||
| 9 | (calendar-iso-month-header): Use calendar- faces. | ||
| 10 | (calendar-generate-month): | ||
| 11 | Use calendar-day-header-array for day headers; apply faces to them. | ||
| 12 | (calendar-mode): Check calendar-font-lock-keywords non-nil. | ||
| 13 | (calendar-abbrev-construct): Add optional maxlen argument. | ||
| 14 | (calendar-day-name-array): Doc fix. | ||
| 15 | (calendar-day-name-array, calendar-abbrev-length) | ||
| 16 | (calendar-day-abbrev-array): | ||
| 17 | Also :set calendar-day-header-array, and maybe redraw. | ||
| 18 | (calendar-day-header-array): New option. (Bug#15007) | ||
| 19 | (calendar-font-lock-keywords): Use calendar-day-header-array, | ||
| 20 | and calendar- faces. Make obsolete. | ||
| 21 | (calendar-day-name): Add option to use header array. | ||
| 22 | |||
| 1 | 2013-08-06 Lars Magne Ingebrigtsen <larsi@gnus.org> | 23 | 2013-08-06 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 24 | ||
| 3 | * net/shr.el (shr-render-td): Remove debugging. | 25 | * net/shr.el (shr-render-td): Remove debugging. |
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 40dcb25bc30..b5d06aba135 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el | |||
| @@ -259,6 +259,23 @@ See `calendar-holiday-marker'." | |||
| 259 | 259 | ||
| 260 | (define-obsolete-face-alias 'holiday-face 'holiday "22.1") | 260 | (define-obsolete-face-alias 'holiday-face 'holiday "22.1") |
| 261 | 261 | ||
| 262 | (defface calendar-weekday-header '((t :inherit font-lock-constant-face)) | ||
| 263 | "Face used for weekday column headers in the calendar. | ||
| 264 | See also the face `calendar-weekend-header'." | ||
| 265 | :version "24.4" | ||
| 266 | :group 'calendar-faces) | ||
| 267 | |||
| 268 | (defface calendar-weekend-header '((t :inherit font-lock-comment-face)) | ||
| 269 | "Face used for weekend column headers in the calendar. | ||
| 270 | See also the face `calendar-weekday-header'." | ||
| 271 | :version "24.4" | ||
| 272 | :group 'calendar-faces) | ||
| 273 | |||
| 274 | (defface calendar-month-header '((t :inherit font-lock-function-name-face)) | ||
| 275 | "Face used for month headers in the calendar." | ||
| 276 | :version "24.4" | ||
| 277 | :group 'calendar-faces) | ||
| 278 | |||
| 262 | ;; These briefly checked font-lock-mode, but that is broken, since it | 279 | ;; These briefly checked font-lock-mode, but that is broken, since it |
| 263 | ;; is a buffer-local variable, and which buffer happens to be current | 280 | ;; is a buffer-local variable, and which buffer happens to be current |
| 264 | ;; when this file is loaded shouldn't make a difference. One could | 281 | ;; when this file is loaded shouldn't make a difference. One could |
| @@ -447,7 +464,6 @@ rightmost column." | |||
| 447 | (push (cons i (calendar-month-edges i)) calendar-month-edges)) | 464 | (push (cons i (calendar-month-edges i)) calendar-month-edges)) |
| 448 | (setq calendar-month-edges (reverse calendar-month-edges))) | 465 | (setq calendar-month-edges (reverse calendar-month-edges))) |
| 449 | 466 | ||
| 450 | ;; FIXME add font-lock-keywords. | ||
| 451 | (defun calendar-set-layout-variable (symbol value &optional minmax) | 467 | (defun calendar-set-layout-variable (symbol value &optional minmax) |
| 452 | "Set SYMBOL's value to VALUE, an integer. | 468 | "Set SYMBOL's value to VALUE, an integer. |
| 453 | A positive/negative MINMAX enforces a minimum/maximum value. | 469 | A positive/negative MINMAX enforces a minimum/maximum value. |
| @@ -491,12 +507,25 @@ Then redraw the calendar, if necessary." | |||
| 491 | :type 'integer | 507 | :type 'integer |
| 492 | :version "23.1") | 508 | :version "23.1") |
| 493 | 509 | ||
| 510 | (defun calendar-day-header-construct (&optional width) | ||
| 511 | "Return the default value for `calendar-day-header-array'. | ||
| 512 | WIDTH defaults to `calendar-day-header-width'." | ||
| 513 | (or width (setq width calendar-day-header-width)) | ||
| 514 | (calendar-abbrev-construct (if (<= width calendar-abbrev-length) | ||
| 515 | calendar-day-abbrev-array | ||
| 516 | calendar-day-name-array) | ||
| 517 | width)) | ||
| 518 | |||
| 519 | ;; FIXME better to use a format spec? | ||
| 494 | (defcustom calendar-day-header-width 2 | 520 | (defcustom calendar-day-header-width 2 |
| 495 | "Width of the day column headers in the calendar. | 521 | "Width of the day column headers in the calendar. |
| 496 | Must be at least one less than `calendar-column-width'." | 522 | Must be at least one less than `calendar-column-width'." |
| 497 | :group 'calendar | 523 | :group 'calendar |
| 498 | :initialize 'custom-initialize-default | 524 | :initialize 'custom-initialize-default |
| 499 | :set (lambda (sym val) | 525 | :set (lambda (sym val) |
| 526 | (or (calendar-customized-p 'calendar-day-header-array) | ||
| 527 | (setq calendar-day-header-array | ||
| 528 | (calendar-day-header-construct val))) | ||
| 500 | (calendar-set-layout-variable sym val (- 1 calendar-column-width))) | 529 | (calendar-set-layout-variable sym val (- 1 calendar-column-width))) |
| 501 | :type 'integer | 530 | :type 'integer |
| 502 | :version "23.1") | 531 | :version "23.1") |
| @@ -924,33 +953,33 @@ styles." | |||
| 924 | 953 | ||
| 925 | (defcustom calendar-american-month-header | 954 | (defcustom calendar-american-month-header |
| 926 | '(propertize (format "%s %d" (calendar-month-name month) year) | 955 | '(propertize (format "%s %d" (calendar-month-name month) year) |
| 927 | 'font-lock-face 'font-lock-function-name-face) | 956 | 'font-lock-face 'calendar-month-header) |
| 928 | "Default format for calendar month headings with the American date style. | 957 | "Default format for calendar month headings with the American date style. |
| 929 | Normally you should not customize this, but `calender-month-header'." | 958 | Normally you should not customize this, but `calender-month-header'." |
| 930 | :group 'calendar | 959 | :group 'calendar |
| 931 | :risky t | 960 | :risky t |
| 932 | :type 'sexp | 961 | :type 'sexp |
| 933 | :version "24.3") | 962 | :version "24.4") ; font-lock-function-name-face -> calendar-month-header |
| 934 | 963 | ||
| 935 | (defcustom calendar-european-month-header | 964 | (defcustom calendar-european-month-header |
| 936 | '(propertize (format "%s %d" (calendar-month-name month) year) | 965 | '(propertize (format "%s %d" (calendar-month-name month) year) |
| 937 | 'font-lock-face 'font-lock-function-name-face) | 966 | 'font-lock-face 'calendar-month-header) |
| 938 | "Default format for calendar month headings with the European date style. | 967 | "Default format for calendar month headings with the European date style. |
| 939 | Normally you should not customize this, but `calender-month-header'." | 968 | Normally you should not customize this, but `calender-month-header'." |
| 940 | :group 'calendar | 969 | :group 'calendar |
| 941 | :risky t | 970 | :risky t |
| 942 | :type 'sexp | 971 | :type 'sexp |
| 943 | :version "24.3") | 972 | :version "24.4") ; font-lock-function-name-face -> calendar-month-header |
| 944 | 973 | ||
| 945 | (defcustom calendar-iso-month-header | 974 | (defcustom calendar-iso-month-header |
| 946 | '(propertize (format "%d %s" year (calendar-month-name month)) | 975 | '(propertize (format "%d %s" year (calendar-month-name month)) |
| 947 | 'font-lock-face 'font-lock-function-name-face) | 976 | 'font-lock-face 'calendar-month-header) |
| 948 | "Default format for calendar month headings with the ISO date style. | 977 | "Default format for calendar month headings with the ISO date style. |
| 949 | Normally you should not customize this, but `calender-month-header'." | 978 | Normally you should not customize this, but `calender-month-header'." |
| 950 | :group 'calendar | 979 | :group 'calendar |
| 951 | :risky t | 980 | :risky t |
| 952 | :type 'sexp | 981 | :type 'sexp |
| 953 | :version "24.3") | 982 | :version "24.4") ; font-lock-function-name-face -> calendar-month-header |
| 954 | 983 | ||
| 955 | (defcustom calendar-month-header | 984 | (defcustom calendar-month-header |
| 956 | (cond ((eq calendar-date-style 'iso) | 985 | (cond ((eq calendar-date-style 'iso) |
| @@ -1517,8 +1546,7 @@ line." | |||
| 1517 | (last (calendar-last-day-of-month month year)) | 1546 | (last (calendar-last-day-of-month month year)) |
| 1518 | (trunc (min calendar-intermonth-spacing | 1547 | (trunc (min calendar-intermonth-spacing |
| 1519 | (1- calendar-left-margin))) | 1548 | (1- calendar-left-margin))) |
| 1520 | (day 1) | 1549 | (day 1)) |
| 1521 | string) | ||
| 1522 | (goto-char (point-min)) | 1550 | (goto-char (point-min)) |
| 1523 | (calendar-move-to-column indent) | 1551 | (calendar-move-to-column indent) |
| 1524 | (insert | 1552 | (insert |
| @@ -1526,13 +1554,16 @@ line." | |||
| 1526 | ?\s calendar-month-digit-width)) | 1554 | ?\s calendar-month-digit-width)) |
| 1527 | (calendar-ensure-newline) | 1555 | (calendar-ensure-newline) |
| 1528 | (calendar-insert-at-column indent calendar-intermonth-header trunc) | 1556 | (calendar-insert-at-column indent calendar-intermonth-header trunc) |
| 1529 | ;; Use the first two characters of each day to head the columns. | 1557 | ;; Use the first N characters of each day to head the columns. |
| 1530 | (dotimes (i 7) | 1558 | (dotimes (i 7) |
| 1531 | (insert | 1559 | (insert |
| 1532 | (progn | 1560 | (truncate-string-to-width |
| 1533 | (setq string | 1561 | (propertize (calendar-day-name (mod (+ calendar-week-start-day i) 7) |
| 1534 | (calendar-day-name (mod (+ calendar-week-start-day i) 7) nil t)) | 1562 | 'header t) |
| 1535 | (truncate-string-to-width string calendar-day-header-width nil ?\s)) | 1563 | 'font-lock-face (if (memq i '(0 6)) |
| 1564 | 'calendar-weekend-header | ||
| 1565 | 'calendar-weekday-header)) | ||
| 1566 | calendar-day-header-width nil ?\s) | ||
| 1536 | (make-string (- calendar-column-width calendar-day-header-width) ?\s))) | 1567 | (make-string (- calendar-column-width calendar-day-header-width) ?\s))) |
| 1537 | (calendar-ensure-newline) | 1568 | (calendar-ensure-newline) |
| 1538 | (calendar-insert-at-column indent calendar-intermonth-text trunc) | 1569 | (calendar-insert-at-column indent calendar-intermonth-text trunc) |
| @@ -1808,8 +1839,9 @@ For a complete description, see the info node `Calendar/Diary'. | |||
| 1808 | ;; soon in calendar-generate, but better safe than sorry. | 1839 | ;; soon in calendar-generate, but better safe than sorry. |
| 1809 | (unless (boundp 'displayed-month) (setq displayed-month 1)) | 1840 | (unless (boundp 'displayed-month) (setq displayed-month 1)) |
| 1810 | (unless (boundp 'displayed-year) (setq displayed-year 2001)) | 1841 | (unless (boundp 'displayed-year) (setq displayed-year 2001)) |
| 1811 | (set (make-local-variable 'font-lock-defaults) | 1842 | (if (bound-and-true-p calendar-font-lock-keywords) |
| 1812 | '(calendar-font-lock-keywords t))) | 1843 | (set (make-local-variable 'font-lock-defaults) |
| 1844 | '(calendar-font-lock-keywords t)))) | ||
| 1813 | 1845 | ||
| 1814 | (defun calendar-string-spread (strings char length) | 1846 | (defun calendar-string-spread (strings char length) |
| 1815 | "Concatenate list of STRINGS separated with copies of CHAR to fill LENGTH. | 1847 | "Concatenate list of STRINGS separated with copies of CHAR to fill LENGTH. |
| @@ -2079,33 +2111,41 @@ is a string to insert in the minibuffer before reading." | |||
| 2079 | (and standard | 2111 | (and standard |
| 2080 | (not (equal (eval (car standard)) (default-value symbol))))))) | 2112 | (not (equal (eval (car standard)) (default-value symbol))))))) |
| 2081 | 2113 | ||
| 2082 | (defun calendar-abbrev-construct (full) | 2114 | (defun calendar-abbrev-construct (full &optional maxlen) |
| 2083 | "From sequence FULL, return a vector of abbreviations. | 2115 | "From sequence FULL, return a vector of abbreviations. |
| 2084 | Each abbreviation is no longer than `calendar-abbrev-length' characters." | 2116 | Each abbreviation is no longer than MAXLEN (default `calendar-abbrev-length') |
| 2117 | characters." | ||
| 2118 | (or maxlen (setq maxlen calendar-abbrev-length)) | ||
| 2085 | (apply 'vector (mapcar | 2119 | (apply 'vector (mapcar |
| 2086 | (lambda (f) | 2120 | (lambda (f) |
| 2087 | (substring f 0 (min calendar-abbrev-length (length f)))) | 2121 | ;; TODO? truncate-string-to-width? |
| 2122 | (substring f 0 (min maxlen (length f)))) | ||
| 2088 | full))) | 2123 | full))) |
| 2089 | 2124 | ||
| 2090 | (defcustom calendar-day-name-array | 2125 | (defcustom calendar-day-name-array |
| 2091 | ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"] | 2126 | ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"] |
| 2092 | "Array of capitalized strings giving, in order from Sunday, the day names. | 2127 | "Array of capitalized strings giving, in order from Sunday, the day names. |
| 2093 | The first two characters of each string will be used to head the | ||
| 2094 | day columns in the calendar. | ||
| 2095 | If you change this without using customize after the calendar has loaded, | 2128 | If you change this without using customize after the calendar has loaded, |
| 2096 | then you may also want to change `calendar-day-abbrev-array'." | 2129 | then you may also want to change `calendar-day-abbrev-array' |
| 2130 | and `calendar-day-header-array'." | ||
| 2097 | :group 'calendar | 2131 | :group 'calendar |
| 2098 | :initialize 'custom-initialize-default | 2132 | :initialize 'custom-initialize-default |
| 2099 | :set (lambda (symbol value) | 2133 | :set (lambda (symbol value) |
| 2100 | (let ((dcustomized (calendar-customized-p 'calendar-day-abbrev-array)) | 2134 | (let ((dcustomized (calendar-customized-p 'calendar-day-abbrev-array)) |
| 2101 | (hcustomized (calendar-customized-p 'cal-html-day-abbrev-array))) | 2135 | (hcustomized (calendar-customized-p 'cal-html-day-abbrev-array)) |
| 2136 | (ccustomized (calendar-customized-p 'calendar-day-header-array))) | ||
| 2102 | (set symbol value) | 2137 | (set symbol value) |
| 2103 | (or dcustomized | 2138 | (or dcustomized |
| 2104 | (setq calendar-day-abbrev-array | 2139 | (setq calendar-day-abbrev-array |
| 2105 | (calendar-abbrev-construct calendar-day-name-array))) | 2140 | (calendar-abbrev-construct calendar-day-name-array))) |
| 2106 | (and (not hcustomized) | 2141 | (and (not hcustomized) |
| 2107 | (boundp 'cal-html-day-abbrev-array) | 2142 | (boundp 'cal-html-day-abbrev-array) |
| 2108 | (setq cal-html-day-abbrev-array calendar-day-abbrev-array)))) | 2143 | (setq cal-html-day-abbrev-array calendar-day-abbrev-array)) |
| 2144 | (or ccustomized | ||
| 2145 | (equal calendar-day-header-array | ||
| 2146 | (setq calendar-day-header-array | ||
| 2147 | (calendar-day-header-construct))) | ||
| 2148 | (calendar-redraw)))) | ||
| 2109 | :type '(vector (string :tag "Sunday") | 2149 | :type '(vector (string :tag "Sunday") |
| 2110 | (string :tag "Monday") | 2150 | (string :tag "Monday") |
| 2111 | (string :tag "Tuesday") | 2151 | (string :tag "Tuesday") |
| @@ -2125,7 +2165,8 @@ then you may also want to change `calendar-day-abbrev-array' and | |||
| 2125 | (let ((dcustomized (calendar-customized-p 'calendar-day-abbrev-array)) | 2165 | (let ((dcustomized (calendar-customized-p 'calendar-day-abbrev-array)) |
| 2126 | (mcustomized (calendar-customized-p | 2166 | (mcustomized (calendar-customized-p |
| 2127 | 'calendar-month-abbrev-array)) | 2167 | 'calendar-month-abbrev-array)) |
| 2128 | (hcustomized (calendar-customized-p 'cal-html-day-abbrev-array))) | 2168 | (hcustomized (calendar-customized-p 'cal-html-day-abbrev-array)) |
| 2169 | (ccustomized (calendar-customized-p 'calendar-day-header-array))) | ||
| 2129 | (set symbol value) | 2170 | (set symbol value) |
| 2130 | (or dcustomized | 2171 | (or dcustomized |
| 2131 | (setq calendar-day-abbrev-array | 2172 | (setq calendar-day-abbrev-array |
| @@ -2135,7 +2176,12 @@ then you may also want to change `calendar-day-abbrev-array' and | |||
| 2135 | (calendar-abbrev-construct calendar-month-name-array))) | 2176 | (calendar-abbrev-construct calendar-month-name-array))) |
| 2136 | (and (not hcustomized) | 2177 | (and (not hcustomized) |
| 2137 | (boundp 'cal-html-day-abbrev-array) | 2178 | (boundp 'cal-html-day-abbrev-array) |
| 2138 | (setq cal-html-day-abbrev-array calendar-day-abbrev-array)))) | 2179 | (setq cal-html-day-abbrev-array calendar-day-abbrev-array)) |
| 2180 | (or ccustomized | ||
| 2181 | (equal calendar-day-header-array | ||
| 2182 | (setq calendar-day-header-array | ||
| 2183 | (calendar-day-header-construct))) | ||
| 2184 | (calendar-redraw)))) | ||
| 2139 | :type 'integer) | 2185 | :type 'integer) |
| 2140 | 2186 | ||
| 2141 | (defcustom calendar-day-abbrev-array | 2187 | (defcustom calendar-day-abbrev-array |
| @@ -2152,11 +2198,17 @@ full name." | |||
| 2152 | :initialize 'custom-initialize-default | 2198 | :initialize 'custom-initialize-default |
| 2153 | :set-after '(calendar-abbrev-length calendar-day-name-array) | 2199 | :set-after '(calendar-abbrev-length calendar-day-name-array) |
| 2154 | :set (lambda (symbol value) | 2200 | :set (lambda (symbol value) |
| 2155 | (let ((hcustomized (calendar-customized-p 'cal-html-day-abbrev-array))) | 2201 | (let ((hcustomized (calendar-customized-p 'cal-html-day-abbrev-array)) |
| 2202 | (ccustomized (calendar-customized-p 'calendar-day-header-array))) | ||
| 2156 | (set symbol value) | 2203 | (set symbol value) |
| 2157 | (and (not hcustomized) | 2204 | (and (not hcustomized) |
| 2158 | (boundp 'cal-html-day-abbrev-array) | 2205 | (boundp 'cal-html-day-abbrev-array) |
| 2159 | (setq cal-html-day-abbrev-array calendar-day-abbrev-array)))) | 2206 | (setq cal-html-day-abbrev-array calendar-day-abbrev-array)) |
| 2207 | (or ccustomized | ||
| 2208 | (equal calendar-day-header-array | ||
| 2209 | (setq calendar-day-header-array | ||
| 2210 | (calendar-day-header-construct))) | ||
| 2211 | (calendar-redraw)))) | ||
| 2160 | :type '(vector (string :tag "Sun") | 2212 | :type '(vector (string :tag "Sun") |
| 2161 | (string :tag "Mon") | 2213 | (string :tag "Mon") |
| 2162 | (string :tag "Tue") | 2214 | (string :tag "Tue") |
| @@ -2167,6 +2219,33 @@ full name." | |||
| 2167 | ;; Made defcustom, changed defaults from nil nil... | 2219 | ;; Made defcustom, changed defaults from nil nil... |
| 2168 | :version "24.1") | 2220 | :version "24.1") |
| 2169 | 2221 | ||
| 2222 | (defcustom calendar-day-header-array (calendar-day-header-construct) | ||
| 2223 | "Array of strings to use for the headers of the calendar's day columns. | ||
| 2224 | The order should be the same as in `calendar-day-name-array'. | ||
| 2225 | In use, the calendar truncates elements to no more than | ||
| 2226 | `calendar-day-header-width' columns wide. | ||
| 2227 | Emacs constructs the default from either `calendar-day-name-array' | ||
| 2228 | \(if `calendar-day-header-width' is more than `calendar-abbrev-length'), | ||
| 2229 | or from `calendar-day-abbrev-array' (assuming that the abbreviated | ||
| 2230 | name are more likely to be unique when truncated)." | ||
| 2231 | :group 'calendar | ||
| 2232 | :initialize 'custom-initialize-default | ||
| 2233 | :set-after '(calendar-day-header-width | ||
| 2234 | calendar-abbrev-length calendar-day-name-array | ||
| 2235 | calendar-day-abbrev-array) | ||
| 2236 | :set (lambda (symbol value) | ||
| 2237 | (or (equal calendar-day-header-array | ||
| 2238 | (set symbol value)) | ||
| 2239 | (calendar-redraw))) | ||
| 2240 | :type '(vector (string :tag "Su") | ||
| 2241 | (string :tag "Mo") | ||
| 2242 | (string :tag "Tu") | ||
| 2243 | (string :tag "We") | ||
| 2244 | (string :tag "Th") | ||
| 2245 | (string :tag "Fr") | ||
| 2246 | (string :tag "Sa")) | ||
| 2247 | :version "24.4") | ||
| 2248 | |||
| 2170 | (defcustom calendar-month-name-array | 2249 | (defcustom calendar-month-name-array |
| 2171 | ["January" "February" "March" "April" "May" "June" | 2250 | ["January" "February" "March" "April" "May" "June" |
| 2172 | "July" "August" "September" "October" "November" "December"] | 2251 | "July" "August" "September" "October" "November" "December"] |
| @@ -2287,30 +2366,38 @@ Negative years are interpreted as years BC; -1 being 1 BC, and so on." | |||
| 2287 | ;; of that variable. | 2366 | ;; of that variable. |
| 2288 | `((,(concat (regexp-opt (mapcar 'identity calendar-month-name-array) t) | 2367 | `((,(concat (regexp-opt (mapcar 'identity calendar-month-name-array) t) |
| 2289 | " -?[0-9]+") | 2368 | " -?[0-9]+") |
| 2290 | . font-lock-function-name-face) | 2369 | . 'calendar-month-header) |
| 2370 | ;; Day headers. | ||
| 2371 | ;; Also not needed now that calendar-generate-month uses propertize. | ||
| 2291 | (,(regexp-opt | 2372 | (,(regexp-opt |
| 2292 | (list (truncate-string-to-width (aref calendar-day-name-array 6) | 2373 | (list (truncate-string-to-width (aref calendar-day-header-array 6) |
| 2293 | calendar-day-header-width) | 2374 | calendar-day-header-width) |
| 2294 | (truncate-string-to-width (aref calendar-day-name-array 0) | 2375 | (truncate-string-to-width (aref calendar-day-header-array 0) |
| 2295 | calendar-day-header-width))) | 2376 | calendar-day-header-width))) |
| 2296 | ;; Saturdays and Sundays are highlighted differently. | 2377 | ;; Saturdays and Sundays are highlighted differently. |
| 2297 | . font-lock-comment-face) | 2378 | . 'calendar-weekend-header) |
| 2298 | ;; First two chars of each day are used in the calendar. | 2379 | (,(regexp-opt (mapcar (lambda (x) (truncate-string-to-width |
| 2299 | (,(regexp-opt (mapcar (lambda (x) (truncate-string-to-width | 2380 | x calendar-day-header-width)) |
| 2300 | x calendar-day-header-width)) | 2381 | calendar-day-header-array)) |
| 2301 | calendar-day-name-array)) | 2382 | . 'calendar-day-header)) |
| 2302 | . font-lock-constant-face)) | ||
| 2303 | "Default keywords to highlight in Calendar mode.") | 2383 | "Default keywords to highlight in Calendar mode.") |
| 2304 | 2384 | ||
| 2385 | (make-obsolete-variable 'calendar-font-lock-keywords | ||
| 2386 | "set font-lock keywords in `calendar-mode-hook', \ | ||
| 2387 | or customize calendar faces." "24.4") | ||
| 2388 | |||
| 2305 | (defun calendar-day-name (date &optional abbrev absolute) | 2389 | (defun calendar-day-name (date &optional abbrev absolute) |
| 2306 | "Return a string with the name of the day of the week of DATE. | 2390 | "Return a string with the name of the day of the week of DATE. |
| 2307 | DATE should be a list in the format (MONTH DAY YEAR), unless the | 2391 | DATE should be a list in the format (MONTH DAY YEAR), unless the |
| 2308 | optional argument ABSOLUTE is non-nil, in which case DATE should | 2392 | optional argument ABSOLUTE is non-nil, in which case DATE should |
| 2309 | be an integer in the range 0 to 6 corresponding to the day of the | 2393 | be an integer in the range 0 to 6 corresponding to the day of the |
| 2310 | week. Day names are taken from the variable `calendar-day-name-array', | 2394 | week. Day names are taken from the variable `calendar-day-name-array', |
| 2311 | unless the optional argument ABBREV is non-nil, in which case | 2395 | unless the optional argument ABBREV is non-nil: |
| 2312 | the variable `calendar-day-abbrev-array' is used." | 2396 | `header' means to use `calendar-day-header-array'; |
| 2313 | (aref (if abbrev calendar-day-abbrev-array calendar-day-name-array) | 2397 | t to use `calendar-day-abbrev-array'." |
| 2398 | (aref (cond ((eq abbrev 'header) calendar-day-header-array) | ||
| 2399 | (abbrev calendar-day-abbrev-array) | ||
| 2400 | (t calendar-day-name-array)) | ||
| 2314 | (if absolute date (calendar-day-of-week date)))) | 2401 | (if absolute date (calendar-day-of-week date)))) |
| 2315 | 2402 | ||
| 2316 | (defun calendar-month-name (month &optional abbrev) | 2403 | (defun calendar-month-name (month &optional abbrev) |