[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10452: 24.0.92; calendar-abbrev-length in calendar.el
From: |
Kevin Rodgers |
Subject: |
bug#10452: 24.0.92; calendar-abbrev-length in calendar.el |
Date: |
Wed, 11 Jan 2012 22:55:22 -0700 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.25) Gecko/20111213 Thunderbird/3.1.17 |
On 1/8/12 5:30 AM, Andreas Schwab wrote:
Peter Dyballa<Peter_Dyballa@Freenet.DE> writes:
The introduction of this variable is no good idea. In German we are using two
values: the number 2 for day names and the number 3 for month names.
You can set calendar-day-abbrev-array to anything you like.
Here's some code I posted in 2006 to automatically set localized day and month
names. To set localized abbrevs, just use the lowercase "%a" and "%b" formats
instead.
(let ((days (locale-info 'days))
(months (locale-info 'months)))
(if days
(setq calendar-day-name-array days)
(let ((this-year
(string-to-number (format-time-string "%Y")))
(this-month
(string-to-number (format-time-string "%m"))))
(setq calendar-day-name-array
(apply 'vector
(mapcar (lambda (time)
(format-time-string "%A" time))
(sort (mapcar (lambda (day)
(encode-time 0 0 0 day
this-month this-year
0))
'(1 2 3 4 5 6 7))
;; by day of week:
(lambda (time-1 time-2)
(< (nth 6 (decode-time time-1))
(nth 6 (decode-time time-2))))))))))
(if months
(setq calendar-month-name-array months)
(let ((this-year
(string-to-number (format-time-string "%Y"))))
(setq calendar-month-name-array
(apply 'vector
(mapcar (lambda (month)
(let ((first (encode-time 0 0 0 1 month
this-year
0)))
(format-time-string "%B" first t)))
'(1 2 3 4 5 6 7 8 9 10 11 12)))))))
--
Kevin Rodgers
Denver, Colorado, USA