# HG changeset patch # User Karl Heuer # Date 881545594 0 # Node ID ad8d3c6d3d94b387ece187f8bfa5b352c1c8880d # Parent 7351dc9f1c94833014b67363921f94591f80067c (calendar-day-name): Truncate properly when multibyte. diff -r 7351dc9f1c94 -r ad8d3c6d3d94 lisp/calendar/calendar.el --- a/lisp/calendar/calendar.el Mon Dec 08 01:35:12 1997 +0000 +++ b/lisp/calendar/calendar.el Mon Dec 08 01:46:34 1997 +0000 @@ -2313,19 +2313,13 @@ (defun calendar-day-name (date &optional width absolute) "Returns a string with the name of the day of the week of DATE. If WIDTH is non-nil, return just the first WIDTH characters of the name. -If ABSOLUTE is non-nil, then DATE is actual the day-of-the-week +If ABSOLUTE is non-nil, then DATE is actually the day-of-the-week rather than a date." (let ((string (aref calendar-day-name-array (if absolute date (calendar-day-of-week date))))) - (if width - (let ((i 0) (result "") (pos 0)) - (while (< i width) - (let ((chartext (char-to-string (sref string pos)))) - (setq pos (+ pos (length chartext))) - (setq result (concat result chartext))) - (setq i (1+ i))) - result) - string))) + (cond ((null width) string) + (enable-multibyte-characters (truncate-string-to-width string width)) + (t (substring string 0 width))))) (defvar calendar-day-name-array ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"])