]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix error in ses.el when setting the current row
authorBoruch Baum <boruch_baum@gmx.com>
Wed, 5 May 2021 13:05:50 +0000 (15:05 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 5 May 2021 13:05:50 +0000 (15:05 +0200)
* lisp/ses.el (ses-jump, ses-list-local-printers)
(ses-list-named-cells): Use `user-error' for user errors.
(ses-set-header-row): Function `ses-set-header-row' was
determining the current row based upon variable `ses--curcell',
but that variable is NIL until one begins an operation on a cell
(eg. keybindings '=', '"'), so navigating to a row was
insufficient to select that row, and further generated an ERROR
because the code was not expecting a NIL value for variable
`ses--curcell' (bug#47784).

lisp/ses.el

index bc3c2deaa1b5a1eec71add459074a8cdb41190a3..ca515f829dc5c29bd0ce7404c899ca6568adad3f 100644 (file)
@@ -2252,9 +2252,8 @@ Based on the current set of columns and `window-hscroll' position."
                                                  (push (symbol-name key) names))
                                               ses--named-cell-hashmap)
                                      names)))))
-                (if
-                    (string= s "")
-                    (error "Invalid cell name")
+                (if (string= s "")
+                    (user-error "Invalid cell name")
                   (list (intern s)))))
   (let ((rowcol (ses-sym-rowcol sym)))
     (or rowcol (error "Invalid cell name"))
@@ -3381,7 +3380,7 @@ while in the SES buffer."
           ((derived-mode-p 'ses-mode) ses--local-printer-hashmap)
           ((minibufferp) ses--completion-table)
           ((derived-mode-p 'help-mode) nil)
-          (t (error "Not in a SES buffer")))))
+          (t (user-error "Not in a SES buffer")))))
   (when local-printer-hashmap
     (let ((ses--list-orig-buffer (or ses--list-orig-buffer (current-buffer))))
       (help-setup-xref
@@ -3415,7 +3414,7 @@ while in the SES buffer."
           ((derived-mode-p 'ses-mode) ses--named-cell-hashmap)
           ((minibufferp) ses--completion-table)
           ((derived-mode-p 'help-mode) nil)
-          (t (error "Not in a SES buffer")))))
+          (t (user-error "Not in a SES buffer")))))
   (when named-cell-hashmap
     (let ((ses--list-orig-buffer (or ses--list-orig-buffer (current-buffer))))
       (help-setup-xref
@@ -3458,7 +3457,9 @@ With a \\[universal-argument] prefix arg, prompt the user.
 The top row is row 1.  Selecting row 0 displays the default header row."
   (interactive
    (list (if (numberp current-prefix-arg) current-prefix-arg
-          (let ((currow (1+ (car (ses-sym-rowcol ses--curcell)))))
+          (let* ((curcell (or (ses--cell-at-pos (point))
+                               (user-error "Invalid header-row")))
+                  (currow (1+ (car (ses-sym-rowcol curcell)))))
             (if current-prefix-arg
                 (read-number "Header row: " currow)
               currow)))))