From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs Subject: bug#10978: `calendar-string-spread' loses with double-width characters Date: Mon, 12 Mar 2012 16:26:26 -0400 Message-ID: References: <87vcme6l79.fsf@gmail.com> <83r4x2ymwu.fsf@gnu.org> <8pipidtclf.fsf@fencepost.gnu.org> <837gyszscr.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1331584061 2981 80.91.229.3 (12 Mar 2012 20:27:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 12 Mar 2012 20:27:41 +0000 (UTC) Cc: 10978@debbugs.gnu.org, stepnem@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Mar 12 21:27:40 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S7Bq9-0008St-My for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Mar 2012 21:27:33 +0100 Original-Received: from localhost ([::1]:43967 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7Bq9-00066m-2R for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Mar 2012 16:27:33 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7Bq6-00066U-Ej for bug-gnu-emacs@gnu.org; Mon, 12 Mar 2012 16:27:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7Bpm-0006OZ-6c for bug-gnu-emacs@gnu.org; Mon, 12 Mar 2012 16:27:30 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40492) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7Bpm-0006OU-2t for bug-gnu-emacs@gnu.org; Mon, 12 Mar 2012 16:27:10 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1S7CIg-0004Nt-0v for bug-gnu-emacs@gnu.org; Mon, 12 Mar 2012 16:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Glenn Morris Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Mar 2012 20:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10978 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10978-submit@debbugs.gnu.org id=B10978.133158578316807 (code B ref 10978); Mon, 12 Mar 2012 20:57:01 +0000 Original-Received: (at 10978) by debbugs.gnu.org; 12 Mar 2012 20:56:23 +0000 Original-Received: from localhost ([127.0.0.1]:47324 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S7CI3-0004N1-3h for submit@debbugs.gnu.org; Mon, 12 Mar 2012 16:56:23 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:39649) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S7CI0-0004Mu-Oq for 10978@debbugs.gnu.org; Mon, 12 Mar 2012 16:56:22 -0400 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1S7Bp4-0002d9-Ig; Mon, 12 Mar 2012 16:26:26 -0400 X-Spook: Ceridian SP4 DRM Downing Street doctrine NATO United X-Ran: %&=]\\,i)IW/^+aTfUe6>>m8Q)ciRYDyf0ao8I6|Cq=KQ%3"NHV1Gs (Eli Zaretskii's message of "Sat, 10 Mar 2012 12:02:28 +0200") User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:57743 Archived-At: Eli Zaretskii wrote: > But it looks like calendar-insert-at-column and calendar-string-spread > also need similar changes. ACK on calendar-insert-at-column, but calendar-string-spread is the function already being discussed - was there a third? > Sorry, I don't follow. Could you elaborate on what you had in mind? I meant, don't do this: (calendar-string-spread '("a" "b" "c") ?=E7=9F=A2 10) ie, a restriction similar to that of truncate-string-to-width: The optional 4th arg PADDING, if non-nil, specifies a padding character (which should have a display width of 1) But, it can be handled a bit better with: *** lisp/calendar/calendar.el 2012-03-06 02:18:29 +0000 --- lisp/calendar/calendar.el 2012-03-12 20:23:23 +0000 *************** *** 1756,1763 **** (if (< (length strings) 2) (append (list "") strings (list "")) strings))) ! (n (- length (length (apply 'concat strings)))) ! (m (1- (length strings))) (s (car strings)) (strings (cdr strings)) (i 0)) --- 1756,1763 ---- (if (< (length strings) 2) (append (list "") strings (list "")) strings))) ! (n (- length (string-width (apply 'concat strings)))) ! (m (* (1- (length strings)) (char-width char))) (s (car strings)) (strings (cdr strings)) (i 0)) *************** *** 1766,1772 **** (make-string (max 0 (/ (+ n i) m)) char) string) i (1+ i))) ! (substring s 0 length))) =20=20 (defun calendar-update-mode-line () "Update the calendar mode line with the current date and date style." --- 1766,1772 ---- (make-string (max 0 (/ (+ n i) m)) char) string) i (1+ i))) ! (truncate-string-to-width s length))) =20=20 (defun calendar-update-mode-line () "Update the calendar mode line with the current date and date style."