unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#47784: 27.2: ses-header-row [PATCH INCLUDED]
@ 2021-04-15  3:31 Boruch Baum
  2021-04-17 19:30 ` Eli Zaretskii
  2021-05-05 13:08 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 17+ messages in thread
From: Boruch Baum @ 2021-04-15  3:31 UTC (permalink / raw)
  To: 47784

[-- Attachment #1: Type: text/plain, Size: 997 bytes --]

Two patch files are attached.

+ ses-header-row.patch

  + 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'

  + Using function `user-error' instead of `error' doesn't spawn a
    debug session and backtrace buffer when variable
    `toggle-debug-on-error' is set.

+ ses-user-error.patch

  + Quasi-randomly replaces some calls to function `error' with
    `user-error'.

  + There could be many other desirable points of replacement, but these
    were some obvious ones, and without knowing whether the patch would
    be accepted at all, it's what I invested.


--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0

[-- Attachment #2: ses-header-row.patch --]
[-- Type: text/x-diff, Size: 650 bytes --]

diff --git a/ses.el b/ses.el
index a2e6033..06a3d51 100644
--- a/ses.el
+++ b/ses.el
@@ -3457,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)))))

[-- Attachment #3: ses-user-error.patch --]
[-- Type: text/x-diff, Size: 1267 bytes --]

diff --git a/ses.el b/ses.el
index 06a3d51..f7893de 100644
--- a/ses.el
+++ b/ses.el
@@ -2252,7 +2252,7 @@ Based on the current set of columns and `window-hscroll' position."
 				      names)))))
 		 (if
 		     (string= s "")
-		     (error "Invalid cell name")
+		     (user-error "Invalid cell name")
 		   (list (intern s)))))
   (let ((rowcol (ses-sym-rowcol sym)))
     (or rowcol (error "Invalid cell name"))
@@ -3380,7 +3380,7 @@ 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
@@ -3414,7 +3414,7 @@ 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

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-05-07 11:14 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-15  3:31 bug#47784: 27.2: ses-header-row [PATCH INCLUDED] Boruch Baum
2021-04-17 19:30 ` Eli Zaretskii
2021-04-19  9:24   ` Boruch Baum
2021-04-19 13:03     ` Eli Zaretskii
2021-04-19 13:27       ` Boruch Baum
2021-04-21  0:02       ` Stefan Kangas
2021-04-21  9:23         ` Eli Zaretskii
2021-05-05 13:08 ` Lars Ingebrigtsen
2021-05-05 16:40   ` Boruch Baum
2021-05-05 19:15     ` Eli Zaretskii
2021-05-05 19:40       ` Boruch Baum
2021-05-05 19:46         ` Eli Zaretskii
2021-05-06  8:10           ` Robert Pluim
2021-05-06 11:05             ` Boruch Baum
2021-05-06  8:17     ` Lars Ingebrigtsen
2021-05-06 10:16       ` Boruch Baum
2021-05-07 11:14         ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).