diff options
| author | Stefan Monnier | 2004-03-26 14:50:41 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-03-26 14:50:41 +0000 |
| commit | e9c8c8e7e6520459bfa9a7b4c4a9f4e35abfeaea (patch) | |
| tree | fbe02c53340a814279c574ec62aa19e0f266a421 | |
| parent | 9bf2aa6a719f09761aa93e6365e17af751469045 (diff) | |
| download | emacs-e9c8c8e7e6520459bfa9a7b4c4a9f4e35abfeaea.tar.gz emacs-e9c8c8e7e6520459bfa9a7b4c4a9f4e35abfeaea.zip | |
(ses-read-number): Move to subr.el.
(ses-set-header-row): Use read-number.
| -rw-r--r-- | lisp/ses.el | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/lisp/ses.el b/lisp/ses.el index 314ca603861..a5cc6bf657c 100644 --- a/lisp/ses.el +++ b/lisp/ses.el | |||
| @@ -2658,27 +2658,6 @@ WANT-FORMULAS is non-nil. Newlines and tabs in the export text are escaped." | |||
| 2658 | ;;;; Other user commands | 2658 | ;;;; Other user commands |
| 2659 | ;;;---------------------------------------------------------------------------- | 2659 | ;;;---------------------------------------------------------------------------- |
| 2660 | 2660 | ||
| 2661 | ;; This should be used by `call-interactively'. | ||
| 2662 | (defun ses-read-number (prompt &optional default) | ||
| 2663 | (let ((n nil)) | ||
| 2664 | (when default | ||
| 2665 | (setq prompt | ||
| 2666 | (if (string-match "\\(\\):[^:]*" prompt) | ||
| 2667 | (replace-match (format " [%s]" default) t t prompt 1) | ||
| 2668 | (concat prompt (format " [%s] " default))))) | ||
| 2669 | (while | ||
| 2670 | (progn | ||
| 2671 | (let ((str (read-from-minibuffer prompt nil nil nil nil | ||
| 2672 | (number-to-string default)))) | ||
| 2673 | (setq n (cond | ||
| 2674 | ((zerop (length str)) default) | ||
| 2675 | ((stringp str) (read str))))) | ||
| 2676 | (unless (numberp n) | ||
| 2677 | (message "Please enter a number.") | ||
| 2678 | (sit-for 1) | ||
| 2679 | t))) | ||
| 2680 | n)) | ||
| 2681 | |||
| 2682 | (defun ses-unset-header-row () | 2661 | (defun ses-unset-header-row () |
| 2683 | "Select the default header row." | 2662 | "Select the default header row." |
| 2684 | (interactive) | 2663 | (interactive) |
| @@ -2694,7 +2673,7 @@ The top row is row 1. Selecting row 0 displays the default header row." | |||
| 2694 | (list (if (numberp current-prefix-arg) current-prefix-arg | 2673 | (list (if (numberp current-prefix-arg) current-prefix-arg |
| 2695 | (let ((currow (1+ (car (ses-sym-rowcol ses--curcell))))) | 2674 | (let ((currow (1+ (car (ses-sym-rowcol ses--curcell))))) |
| 2696 | (if current-prefix-arg | 2675 | (if current-prefix-arg |
| 2697 | (ses-read-number "Header row: " currow) | 2676 | (read-number "Header row: " currow) |
| 2698 | currow))))) | 2677 | currow))))) |
| 2699 | (if (or (< row 0) (> row ses--numrows)) | 2678 | (if (or (< row 0) (> row ses--numrows)) |
| 2700 | (error "Invalid header-row")) | 2679 | (error "Invalid header-row")) |