Subject: Re: bug#21054: Reopen

From: Stephen Leake <[email-masked]>
Date: Thu, 19 Nov 2015 11:11:45 -0600

Eli Zaretskii <[email-masked]> writes:

>> From: Óscar Fuentes <[email-masked]>
>> Date: Wed, 18 Nov 2015 05:00:15 +0100
>> 
>> After a proper build (full rebuild from a pristine checkout; something
>> is wrong with the Emacs build system) the problem is still there.
>
> The changeset you identified as the one to blame is huge, even if we
> look only at changes in ses.el.

That change introduced the function `ses--curcell'. It appears that the
variable `ses--curcell' is supposed to be the cached value of the
function `ses--curcell', but that is failing in this case.

`ses--curcell-overlay' is another variable that must be set for the
current cell; it adds the underline of the current cell. I noticed that
the underline is correct in this use case, so I looked for places where
`ses--curcell-overlay' is set but `ses--curcell' is not. I only found
one, in `ses-setup'. This patch fixes the problem for me:

diff --git a/lisp/ses.el b/lisp/ses.el
index ec1359b..03aca0a 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -1905,6 +1905,8 @@ Narrows the buffer to show only the print area.  Gives it `read-only' and
                           (forward-char)
                           (point))))
             (put-text-property pos end 'cursor-intangible sym))))))
+  (goto-char (point-min))
+  (ses-set-curcell)
   ;; Create the underlining overlay.  It's impossible for (point) to be 2,
   ;; because column A must be at least 1 column wide.
   (setq ses--curcell-overlay (make-overlay (1+ (point-min)) (1+ (point-min))))

-- 
-- Stephe