From 09e6d5475e16614a178ff90d0ac9f3b3d5197217 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 4 Aug 2013 23:54:30 -0700 Subject: [PATCH] * calendar/calendar.el (calendar-generate-month, calendar-font-lock-keywords): Fix for calendar-day-header-width > length of any day name. --- lisp/ChangeLog | 2 ++ lisp/calendar/calendar.el | 20 +++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f7dbcfd3a27..0b766235e04 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,8 @@ * calendar/calendar.el (calendar-generate-month): Fix for calendar-column-width != 1 + calendar-day-digit-width. + (calendar-generate-month, calendar-font-lock-keywords): + Fix for calendar-day-header-width > length of any day name. 2013-08-05 Juanma Barranquero diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 00c6404af7c..d7e6ea68efa 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -1532,9 +1532,7 @@ line." (progn (setq string (calendar-day-name (mod (+ calendar-week-start-day i) 7) nil t)) - (if enable-multibyte-characters - (truncate-string-to-width string calendar-day-header-width) - (substring string 0 calendar-day-header-width))) + (truncate-string-to-width string calendar-day-header-width nil ?\s)) (make-string (- calendar-column-width calendar-day-header-width) ?\s))) (calendar-ensure-newline) (calendar-insert-at-column indent calendar-intermonth-text trunc) @@ -1548,9 +1546,8 @@ line." (format (format "%%%dd" calendar-day-digit-width) day) 'mouse-face 'highlight 'help-echo (eval calendar-date-echo-text) - ;; 'date property prevents intermonth text confusing - ;; re-searches. (Tried intangible, it did not - ;; really work.) + ;; 'date property prevents intermonth text confusing re-searches. + ;; (Tried intangible, it did not really work.) 'date t) (make-string (- calendar-column-width calendar-day-digit-width) ?\s)) @@ -2292,14 +2289,15 @@ Negative years are interpreted as years BC; -1 being 1 BC, and so on." " -?[0-9]+") . font-lock-function-name-face) (,(regexp-opt - (list (substring (aref calendar-day-name-array 6) - 0 calendar-day-header-width) - (substring (aref calendar-day-name-array 0) - 0 calendar-day-header-width))) + (list (truncate-string-to-width (aref calendar-day-name-array 6) + calendar-day-header-width) + (truncate-string-to-width (aref calendar-day-name-array 0) + calendar-day-header-width))) ;; Saturdays and Sundays are highlighted differently. . font-lock-comment-face) ;; First two chars of each day are used in the calendar. - (,(regexp-opt (mapcar (lambda (x) (substring x 0 calendar-day-header-width)) + (,(regexp-opt (mapcar (lambda (x) (truncate-string-to-width + x calendar-day-header-width)) calendar-day-name-array)) . font-lock-constant-face)) "Default keywords to highlight in Calendar mode.") -- 2.39.2