unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: 10452@debbugs.gnu.org
Subject: bug#10452: 24.0.92; calendar-abbrev-length in calendar.el
Date: Wed, 11 Jan 2012 22:55:22 -0700	[thread overview]
Message-ID: <jelsjo$nss$1@dough.gmane.org> (raw)
In-Reply-To: <m2zkdyl6lc.fsf@igel.home>

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






      parent reply	other threads:[~2012-01-12  5:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-08 10:59 bug#10452: 24.0.92; calendar-abbrev-length in calendar.el Peter Dyballa
2012-01-08 12:30 ` Andreas Schwab
2012-01-08 19:19   ` Glenn Morris
2012-01-12  5:55   ` Kevin Rodgers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='jelsjo$nss$1@dough.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --cc=10452@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).