GNU bug report logs - #10452
24.0.92; calendar-abbrev-length in calendar.el

Previous Next

Package: emacs;

Reported by: Peter Dyballa <Peter_Dyballa <at> Freenet.DE>

Date: Sun, 8 Jan 2012 11:03:02 UTC

Severity: wishlist

Tags: notabug, wontfix

Found in version 24.0.92

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#10452: 24.0.92; calendar-abbrev-length in calendar.el
Date: Wed, 11 Jan 2012 22:55:22 -0700
On 1/8/12 5:30 AM, Andreas Schwab wrote:
> Peter Dyballa<Peter_Dyballa <at> 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





This bug report was last modified 13 years and 137 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.