From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Gemini Lasswell Newsgroups: gmane.emacs.bugs Subject: bug#27653: Patch for bug#27653: 25.2; ses.el text cell justification Date: Sat, 30 Sep 2017 11:11:40 -0700 Message-ID: <87tvzkf47p.fsf_-_@runbox.com> References: <20170711140222.GA9802@miroslavurbanek.com> <83y3pxxkff.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1506795128 17902 195.159.176.226 (30 Sep 2017 18:12:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 30 Sep 2017 18:12:08 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux) Cc: 27653@debbugs.gnu.org, Miroslav Urbanek To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 30 20:12:04 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyMF9-0004GF-0s for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Sep 2017 20:12:03 +0200 Original-Received: from localhost ([::1]:40003 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyMFG-0007GA-D9 for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Sep 2017 14:12:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyMFA-0007G3-3q for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 14:12:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dyMF8-0007Jb-U9 for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 14:12:04 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60963) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dyMF8-0007JG-Qj for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 14:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dyMF8-0002Br-GV for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 14:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Sep 2017 18:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27653 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27653-submit@debbugs.gnu.org id=B27653.15067951168407 (code B ref 27653); Sat, 30 Sep 2017 18:12:02 +0000 Original-Received: (at 27653) by debbugs.gnu.org; 30 Sep 2017 18:11:56 +0000 Original-Received: from localhost ([127.0.0.1]:41411 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyMF2-0002BW-Ej for submit@debbugs.gnu.org; Sat, 30 Sep 2017 14:11:56 -0400 Original-Received: from aibo.runbox.com ([91.220.196.211]:35480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyMF0-0002BO-Pw for 27653@debbugs.gnu.org; Sat, 30 Sep 2017 14:11:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Type:MIME-Version:In-Reply-To:Date:References: Message-ID:Subject:Cc:To:From; bh=qdw+EaYUdOcQ5D5XNNmY9SpJ/tajaKWGCLztSuwD/EA=; b=e3DIe2pAQbrDaRHdXiKxqnFYK4 a8/rv10lLgRKZjRKG5+f+a6m8Sb7XsfxZQDH6Ps9J6FXisORBk2xtqTDxs22wih5SxIACdkG1E+25 it3dbzP8eqy1C/L8Xq2XK/4Zl+Oou7J1+2JOfOCnhco9BH608GgBlJiv/zw1uPopZ/X0VX4CsqQtu YwfpgYa9yb/nxp5EnDGi8brBM2puI2kdDiwzXMbB+LlbColyPmJCt69GFQTJMEvMuqVb0IqrzXgIj t7WwL5x4vjBtymjwdrsGYQUnGIbQwYyek1Ct09pFpciQbd/K8G9QPCEjZ97PjuPF661pz5MlCPBhs sQc9OaQQ==; Original-Received: from [10.9.9.211] (helo=mailfront11.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1dyMEy-0006Zz-Ax; Sat, 30 Sep 2017 20:11:52 +0200 Original-Received: from c-24-22-244-161.hsd1.wa.comcast.net ([24.22.244.161] helo=chinook) by mailfront11.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1dyMEp-0000qW-C2; Sat, 30 Sep 2017 20:11:43 +0200 In-Reply-To: <83y3pxxkff.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 02 Sep 2017 17:08:20 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:137700 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: > Could you please provide a minimal recipe, starting from "emacs -Q", > that could be used to reproduce the problem? >From emacs -Q: C-x C-f abc.ses RET " abc RET Result: The text is left justified. Emacs 24 wouldn't build for me, but I found that I could run the ses.el from Emacs 24 in Emacs 25, and that the bug was not present when I did so. Some manual bisecting of commits affecting ses.el produced these results: [bad]7348668952 * * lisp/ses.el (ses--letref): Quote value before it gets r= e-evaluated. [skip]0f2ed59206 * Spelling fixes. [skip]da8b9ab0d8 * Correct ses-truncate-cell bug implied by setting ses.el = in lexical binding: row and col had been erronously made unbound. [skip]df5703a00d * * lisp/ses.el: Miscellaneous cleanups; use lexical-bindi= ng; avoid add-to-list. (ses-localvars): Remove ses--local-printer-list, unu= sed. (ses--metaprogramming): New macro. Use it to defvar variables. (ses-s= et-localvars): Simplify. (ses--locprn, ses-cell): Use defstruct. Change se= s-cell's property-list into an alist. (ses-locprn-get-compiled, ses-locprn-= compiled-aset) (ses-locprn-get-def, ses-locprn-def-aset, ses-locprn-get-num= ber): Remove; use defstruct accessors/setters instead. (ses-cell-formula-as= et, ses-cell-printer-aset) (ses-cell-references-aset): Remove, use setf ins= tead. (ses--alist-get): New function. (ses-cell-property): Rename from ses-= cell-property-get and rewrite. Use an alist instead of a plist and don't do= move-to-front since the list is always short. (ses-cell-property-get-fun, = ses-cell-property-delq-fun) (ses-cell-property-set-fun, ses-cell-property-s= et) (ses-cell-property-pop-fun, ses-cell-property-get-handle) (ses-cell-pro= perty-handle-car, ses-cell-property-handle-setcar): Remove. (ses--letref): = New macro. (ses-cell-property-pop): Rewrite. (ses--cell): Rename from ses-c= ell and make it into a function. Make `formula' fallback on `value' if nil.= (ses--local-printer): Rename from ses-local-printer and make it into a fun= ction. (ses-set-cell): Turn it into a macro so finding the accessor from th= e field name is done at compile time. (ses-repair-cell-reference-all): Test= presence of `sym' rather than `ref' before adding `sym' to :ses-repair-ref= erence. (ses-calculate-cell): Use ses--letref rather than ses-cell-property= -get-handle. (ses-write-cells): Use a single prin1-to-string. (ses-setter-w= ith-undo): New function. (ses-aset-with-undo, ses-set-with-undo): Rewrite u= sing it. (ses-unset-with-undo): Remove. (ses-load): Prefer apply' over `eva= l'. (ses-read-printer, ses-set-column-width): Use standard "(default foo)" = format. [good]4f11561b82 * Adding support for SES local printer functions I looked through those and found a change in df5703a00d which looked like a likely suspect. Reverting it fixes the bug. It looks to me like the only thing the change affects is justification of text cells, but someone who is familiar with ses.el should have a look at it. Miroslav, once you have a version of Emacs with this bug fixed, using C-c C-l (for ses-recalculate-all) on your saved spreadsheets will fix the incorrect left alignment. --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=0001-lisp-ses.el-ses-print-cell-Fix-alignment-of-text-cel.patch >From da3b761e2e5fb10f1512befb7399a198e2419faa Mon Sep 17 00:00:00 2001 From: Gemini Lasswell Date: Sat, 30 Sep 2017 10:31:25 -0700 Subject: [PATCH] * lisp/ses.el (ses-print-cell): Fix alignment of text cells (bug#27653) --- lisp/ses.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/ses.el b/lisp/ses.el index 9221476e7a..4c19c70c5d 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -1254,8 +1254,7 @@ ses-print-cell ((< len width) ;; Fill field to length with spaces. (setq len (make-string (- width len) ?\s) - text (if (or (stringp value) - (eq ses-call-printer-return t)) + text (if (eq ses-call-printer-return t) (concat text len) (concat len text)))) ((> len width) -- 2.14.1 --=-=-=--