comparison lisp/ses.el @ 68359:b9aec3e50e4f

(ses-read-cell): Provide a default value.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 23 Jan 2006 22:04:36 +0000
parents 96187e7edd1b
children e5adfcfcffa0 5b7d410e31f9
comparison
equal deleted inserted replaced
68358:db3ba0142623 68359:b9aec3e50e4f
1 ;;; ses.el -- Simple Emacs Spreadsheet -*- coding: utf-8 -*- 1 ;;; ses.el -- Simple Emacs Spreadsheet -*- coding: utf-8 -*-
2 2
3 ;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
4 4
5 ;; Author: Jonathan Yavner <jyavner@member.fsf.org> 5 ;; Author: Jonathan Yavner <jyavner@member.fsf.org>
6 ;; Maintainer: Jonathan Yavner <jyavner@member.fsf.org> 6 ;; Maintainer: Jonathan Yavner <jyavner@member.fsf.org>
7 ;; Keywords: spreadsheet 7 ;; Keywords: spreadsheet
8 8
146 [C-S-mouse-3] ses-insert-ses-range-click 146 [C-S-mouse-3] ses-insert-ses-range-click
147 "\M-\C-i" lisp-complete-symbol)) 147 "\M-\C-i" lisp-complete-symbol))
148 (newmap (make-sparse-keymap))) 148 (newmap (make-sparse-keymap)))
149 (set-keymap-parent newmap minibuffer-local-map) 149 (set-keymap-parent newmap minibuffer-local-map)
150 (while keys 150 (while keys
151 (define-key newmap (car keys) (cadr keys)) 151 (define-key newmap (pop keys) (pop keys)))
152 (setq keys (cddr keys)))
153 newmap) 152 newmap)
154 "Local keymap for SES minibuffer cell-editing.") 153 "Local keymap for SES minibuffer cell-editing.")
155 154
156 ;Local keymap for SES print area 155 ;Local keymap for SES print area
157 (defalias 'ses-mode-print-map 156 (defalias 'ses-mode-print-map
1863 t)) 1862 t))
1864 1863
1865 (defun ses-read-cell (row col newval) 1864 (defun ses-read-cell (row col newval)
1866 "Self-insert for initial character of cell function." 1865 "Self-insert for initial character of cell function."
1867 (interactive 1866 (interactive
1868 (let ((initial (this-command-keys)) 1867 (let* ((initial (this-command-keys))
1869 (rowcol (progn (ses-check-curcell) (ses-sym-rowcol ses--curcell)))) 1868 (rowcol (progn (ses-check-curcell) (ses-sym-rowcol ses--curcell)))
1869 (curval (ses-cell-formula (car rowcol) (cdr rowcol))))
1870 (barf-if-buffer-read-only) 1870 (barf-if-buffer-read-only)
1871 (if (string= initial "\"")
1872 (setq initial "\"\"") ;Enter a string
1873 (if (string= initial "(")
1874 (setq initial "()"))) ;Enter a formula list
1875 (list (car rowcol) 1871 (list (car rowcol)
1876 (cdr rowcol) 1872 (cdr rowcol)
1877 (read-from-minibuffer (format "Cell %s: " ses--curcell) 1873 (read-from-minibuffer
1878 (cons initial 2) 1874 (format "Cell %s: " ses--curcell)
1879 ses-mode-edit-map 1875 (cons (if (equal initial "\"") "\"\""
1880 t ;Convert to Lisp object 1876 (if (equal initial "(") "()" initial)) 2)
1881 'ses-read-cell-history)))) 1877 ses-mode-edit-map
1878 t ;Convert to Lisp object
1879 'ses-read-cell-history
1880 (prin1-to-string curval)))))
1882 (when (ses-edit-cell row col newval) 1881 (when (ses-edit-cell row col newval)
1883 (ses-command-hook) ;Update cell widths before movement 1882 (ses-command-hook) ;Update cell widths before movement
1884 (dolist (x ses-after-entry-functions) 1883 (dolist (x ses-after-entry-functions)
1885 (funcall x 1)))) 1884 (funcall x 1))))
1886 1885