GNU bug report logs - #27653
25.2; ses.el text cell justification

Previous Next

Package: emacs;

Reported by: Miroslav Urbanek <mu <at> miroslavurbanek.com>

Date: Tue, 11 Jul 2017 16:25:02 UTC

Severity: normal

Tags: patch

Found in version 25.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27653 in the body.
You can then email your comments to 27653 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#27653; Package emacs. (Tue, 11 Jul 2017 16:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Miroslav Urbanek <mu <at> miroslavurbanek.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 11 Jul 2017 16:25:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Miroslav Urbanek <mu <at> miroslavurbanek.com>
To: GNU Emacs Bugs <bug-gnu-emacs <at> gnu.org>
Subject: 25.2; ses.el text cell justification
Date: Tue, 11 Jul 2017 16:02:24 +0200
According to the SES manual, text cells are right-justified by
default. Justification can be changed by defining a printer function
("%s"). This worked as described in Emacs 24.5. In Emacs 25.2.1, all
text cells are left-justified, and I can't find a way to right-justify
them.




Added indication that bug 27653 blocks24655 Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 14 Jul 2017 18:09:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27653; Package emacs. (Sat, 02 Sep 2017 14:09:02 GMT) Full text and rfc822 format available.

Message #10 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Miroslav Urbanek <mu <at> miroslavurbanek.com>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: 25.2; ses.el text cell justification
Date: Sat, 02 Sep 2017 17:08:20 +0300
> Date: Tue, 11 Jul 2017 16:02:24 +0200
> From: Miroslav Urbanek <mu <at> miroslavurbanek.com>
> 
> According to the SES manual, text cells are right-justified by
> default. Justification can be changed by defining a printer function
> ("%s"). This worked as described in Emacs 24.5. In Emacs 25.2.1, all
> text cells are left-justified, and I can't find a way to right-justify
> them.

Thank you for your report, and sorry for the delay in responding.

Could you please provide a minimal recipe, starting from "emacs -Q",
that could be used to reproduce the problem?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27653; Package emacs. (Sat, 30 Sep 2017 18:12:02 GMT) Full text and rfc822 format available.

Message #13 received at 27653 <at> debbugs.gnu.org (full text, mbox):

From: Gemini Lasswell <gazally <at> runbox.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 27653 <at> debbugs.gnu.org, Miroslav Urbanek <mu <at> miroslavurbanek.com>
Subject: Patch for bug#27653: 25.2; ses.el text cell justification
Date: Sat, 30 Sep 2017 11:11:40 -0700
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> 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 re-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-binding; avoid add-to-list. (ses-localvars): Remove ses--local-printer-list, unused. (ses--metaprogramming): New macro.  Use it to defvar variables. (ses-set-localvars): Simplify. (ses--locprn, ses-cell): Use defstruct.  Change ses-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-number): Remove; use defstruct accessors/setters instead. (ses-cell-formula-aset, ses-cell-printer-aset) (ses-cell-references-aset): Remove, use setf instead. (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-set) (ses-cell-property-pop-fun, ses-cell-property-get-handle) (ses-cell-property-handle-car, ses-cell-property-handle-setcar): Remove. (ses--letref): New macro. (ses-cell-property-pop): Rewrite. (ses--cell): Rename from ses-cell 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 function. (ses-set-cell): Turn it into a macro so finding the accessor from the 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-reference. (ses-calculate-cell): Use ses--letref rather than ses-cell-property-get-handle. (ses-write-cells): Use a single prin1-to-string. (ses-setter-with-undo): New function. (ses-aset-with-undo, ses-set-with-undo): Rewrite using it. (ses-unset-with-undo): Remove. (ses-load): Prefer apply' over `eval'. (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.

[0001-lisp-ses.el-ses-print-cell-Fix-alignment-of-text-cel.patch (text/plain, inline)]
From da3b761e2e5fb10f1512befb7399a198e2419faa Mon Sep 17 00:00:00 2001
From: Gemini Lasswell <gazally <at> runbox.com>
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


Added tag(s) patch. Request was from Gemini Lasswell <gazally <at> runbox.com> to control <at> debbugs.gnu.org. (Sat, 30 Sep 2017 18:13:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27653; Package emacs. (Thu, 05 Oct 2017 10:10:02 GMT) Full text and rfc822 format available.

Message #18 received at 27653 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gemini Lasswell <gazally <at> runbox.com>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 27653 <at> debbugs.gnu.org, mu <at> miroslavurbanek.com
Subject: Re: Patch for bug#27653: 25.2; ses.el text cell justification
Date: Thu, 05 Oct 2017 13:09:31 +0300
> From: Gemini Lasswell <gazally <at> runbox.com>
> Cc: Miroslav Urbanek <mu <at> miroslavurbanek.com>,  27653 <at> debbugs.gnu.org
> Date: Sat, 30 Sep 2017 11:11:40 -0700
> 
> Eli Zaretskii <eliz <at> gnu.org> 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.
> 
> 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.

Stefan, the change in ses-print-cell that causes this bug is not
mentioned in the log message of df5703a00d.  Can you tell why you made
that change?

> >From da3b761e2e5fb10f1512befb7399a198e2419faa Mon Sep 17 00:00:00 2001
> From: Gemini Lasswell <gazally <at> runbox.com>
> 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
> 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27653; Package emacs. (Thu, 05 Oct 2017 13:19:02 GMT) Full text and rfc822 format available.

Message #21 received at 27653 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Gemini Lasswell <gazally <at> runbox.com>, 27653 <at> debbugs.gnu.org,
 mu <at> miroslavurbanek.com
Subject: Re: bug#27653: Patch for bug#27653: 25.2;
 ses.el text cell justification
Date: Thu, 05 Oct 2017 09:18:43 -0400
> Stefan, the change in ses-print-cell that causes this bug is not
> mentioned in the log message of df5703a00d.  Can you tell why you made
> that change?

No, sorry.  That looks like a mess up on my part,


        Stefan




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Thu, 05 Oct 2017 13:56:02 GMT) Full text and rfc822 format available.

Notification sent to Miroslav Urbanek <mu <at> miroslavurbanek.com>:
bug acknowledged by developer. (Thu, 05 Oct 2017 13:56:02 GMT) Full text and rfc822 format available.

Message #26 received at 27653-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: gazally <at> runbox.com, 27653-done <at> debbugs.gnu.org, mu <at> miroslavurbanek.com
Subject: Re: bug#27653: Patch for bug#27653: 25.2;
 ses.el text cell justification
Date: Thu, 05 Oct 2017 16:54:39 +0300
> From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
> Cc: Gemini Lasswell <gazally <at> runbox.com>, 27653 <at> debbugs.gnu.org,
>         mu <at> miroslavurbanek.com
> Date: Thu, 05 Oct 2017 09:18:43 -0400
> 
> > Stefan, the change in ses-print-cell that causes this bug is not
> > mentioned in the log message of df5703a00d.  Can you tell why you made
> > that change?
> 
> No, sorry.  That looks like a mess up on my part,

OK, thanks.  I've pushed Gemini's patch to the emacs-26 branch, and
I'm marking this bug done.

Btw, compiling ses.el emits 2 warnings:

  In toplevel form:
  ses.el:2475:1:Warning: Unused lexical argument `val'
  ses.el:2630:1:Warning: Unused lexical argument `val'

They look spot-on to me: the lambda forms there don't use 'val'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27653; Package emacs. (Wed, 11 Oct 2017 11:51:01 GMT) Full text and rfc822 format available.

Message #29 received at 27653 <at> debbugs.gnu.org (full text, mbox):

From: Miroslav Urbanek <mu <at> miroslavurbanek.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Gemini Lasswell <gazally <at> runbox.com>, GNU Emacs Bug <27653 <at> debbugs.gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#27653: Patch for bug#27653: 25.2; ses.el text cell
 justification
Date: Wed, 11 Oct 2017 12:28:19 +0200
> OK, thanks. I've pushed Gemini's patch to the emacs-26 branch, and
> I'm marking this bug done.

Sorry for the delay in responding. I tested the patch and it fixed the
problem. Thanks.

MU




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 08 Nov 2017 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 164 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.