* subr.el (last-input-char, last-command-char):
Move here from src/keyboard.c.
+ * calc/calc-aent.el, calc/calc-ext.el, calc/calc-incom.el:
+ * calc/calc-keypd.el, calc/calc-misc.el, calc/calc-prog.el:
+ * calc/calc-sel.el, calc/calc-store.el, calc/calc-stuff.el:
+ * calc/calc-units.el, calc/calc-yank.el, calc/calc.el:
+ Replace last-command-char with last-command-event.
+
2009-01-09 Dave Love <fx@gnu.org>
* calendar/time-date.el: Require cl for `declare'.
(setq buf long))))
(calc-handle-whys)
(message "Result: %s" buf)))
- (if (eq last-command-char 10)
+ (if (eq last-command-event 10)
(insert shortbuf)
(kill-new shortbuf)))))
(calc-wrapper
(let ((calc-language (if prefix nil calc-language))
(math-expr-opers (if prefix (math-standard-ops) (math-expr-ops))))
- (calc-alg-entry (and auto (char-to-string last-command-char))))))
+ (calc-alg-entry (and auto (char-to-string last-command-event))))))
(defvar calc-alg-entry-history nil
"History for algebraic entry.")
(progn
(require 'calc-ext)
(calc-alg-edit alg-exp))
- (let* ((calc-simplify-mode (if (eq last-command-char ?\C-j)
+ (let* ((calc-simplify-mode (if (eq last-command-event ?\C-j)
'none
calc-simplify-mode))
(nvals (mapcar 'calc-normalize alg-exp)))
;;;###autoload
(defun calc-alg-digit-entry ()
(calc-alg-entry
- (cond ((eq last-command-char ?e)
+ (cond ((eq last-command-event ?e)
(if (> calc-number-radix 14) (format "%d.^" calc-number-radix) "1e"))
- ((eq last-command-char ?#) (format "%d#" calc-number-radix))
- ((eq last-command-char ?_) "-")
- ((eq last-command-char ?@) "0@ ")
- (t (char-to-string last-command-char)))))
+ ((eq last-command-event ?#) (format "%d#" calc-number-radix))
+ ((eq last-command-event ?_) "-")
+ ((eq last-command-event ?@) "0@ ")
+ (t (char-to-string last-command-event)))))
;; The variable calc-digit-value is initially declared in calc.el,
;; but can be set by calcDigit-algebraic and calcDigit-edit.
(if (boundp 'overriding-terminal-local-map)
(setq overriding-terminal-local-map calc-fancy-prefix-map)
(let ((event (calc-read-key t)))
- (if (eq (setq last-command-char (car event)) ?\C-u)
+ (if (eq (setq last-command-event (car event)) ?\C-u)
(universal-argument)
- (if (or (not (integerp last-command-char))
- (and (>= last-command-char 0) (< last-command-char ? )
- (not (memq last-command-char '(?\e)))))
+ (if (or (not (integerp last-command-event))
+ (and (>= last-command-event 0) (< last-command-event ? )
+ (not (memq last-command-event '(?\e)))))
(calc-wrapper)) ; clear flags if not a Calc command.
(setq last-command-event (cdr event))
- (if (or (not (integerp last-command-char))
- (eq last-command-char ?-))
+ (if (or (not (integerp last-command-event))
+ (eq last-command-event ?-))
(calc-unread-command)
(digit-argument n))))))))
(defun calc-fancy-prefix-other-key (arg)
(interactive "P")
(if (and
- (not (eq last-command-char 'tab))
- (not (eq last-command-char 'M-tab))
- (or (not (integerp last-command-char))
- (and (>= last-command-char 0) (< last-command-char ? )
- (not (eq last-command-char meta-prefix-char)))))
+ (not (eq last-command-event 'tab))
+ (not (eq last-command-event 'M-tab))
+ (or (not (integerp last-command-event))
+ (and (>= last-command-event 0) (< last-command-event ? )
+ (not (eq last-command-event meta-prefix-char)))))
(calc-wrapper)) ; clear flags if not a Calc command.
(setq prefix-arg arg)
(calc-unread-command)
(if (calc-minibuffer-contains ".*\\.\\'")
(delete-backward-char 1))
(setq calc-prev-char 'dots
- last-command-char 32)
+ last-command-event 32)
(if calc-prev-prev-char
(calcDigit-nondigit)
(setq calc-digit-value nil)
negative-argument))
(and prefix (string-match "\\`\e?[-0-9]\\'" keys)))
(progn
- (setq last-command-char (aref keys (1- (length keys))))
+ (setq last-command-event (aref keys (1- (length keys))))
(command-execute cmd)
(setq flush 'not-any-more
prefix t
loaded and the keystroke automatically re-typed."
(interactive "P")
(require 'calc-ext)
- (if (keymapp (key-binding (char-to-string last-command-char)))
- (message "%s%c-" (calc-num-prefix-name n) last-command-char))
+ (if (keymapp (key-binding (char-to-string last-command-event)))
+ (message "%s%c-" (calc-num-prefix-name n) last-command-event))
(calc-unread-command)
(setq prefix-arg n))
(interactive)
(if (calc-minibuffer-contains "[-+]?\\(1[1-9]\\|[2-9][0-9]\\)#.*")
(progn
- (setq last-command-char (upcase last-command-char))
+ (setq last-command-event (upcase last-command-event))
(calcDigit-key))
(calcDigit-nondigit)))
(let* ((count 0)
(parts nil)
(body "")
- (open last-command-char)
+ (open last-command-event)
(counter initial)
ch)
(or executing-kbd-macro
(defun calc-select-part (num)
(interactive "P")
- (or num (setq num (- last-command-char ?0)))
+ (or num (setq num (- last-command-event ?0)))
(calc-wrapper
(calc-prepare-selection)
(let ((sel (calc-find-nth-part (or (nth 2 calc-selection-cache-entry)
(defun calc-store-quick ()
(interactive)
- (calc-store (intern (format "var-q%c" last-command-char))))
+ (calc-store (intern (format "var-q%c" last-command-event))))
(defun calc-store-into-quick ()
(interactive)
- (calc-store-into (intern (format "var-q%c" last-command-char))))
+ (calc-store-into (intern (format "var-q%c" last-command-event))))
(defun calc-recall-quick ()
(interactive)
- (calc-recall (intern (format "var-q%c" last-command-char))))
+ (calc-recall (intern (format "var-q%c" last-command-event))))
(defun calc-copy-special-constant (&optional sconst var)
(interactive)
(interactive "P")
(calc-clean (- (if num
(prefix-numeric-value num)
- (if (and (>= last-command-char ?0)
- (<= last-command-char ?9))
- (- last-command-char ?0)
+ (if (and (>= last-command-event ?0)
+ (<= last-command-event ?9))
+ (- last-command-event ?0)
(error "Number required"))))))
(defun calc-quick-units ()
(interactive)
(calc-slow-wrapper
- (let* ((num (- last-command-char ?0))
+ (let* ((num (- last-command-event ?0))
(pos (if (= num 0) 10 num))
(units (calc-var-value 'var-Units))
(expr (calc-top-n 1)))
(insert str))
(let ((i 0))
(while (< i (length str))
- (if (= (setq last-command-char (aref str i)) ?\n)
+ (if (= (setq last-command-event (aref str i)) ?\n)
(or (= i (1- (length str)))
(let ((pt (point)))
(end-of-line)
(if calc-edit-disp-trail
(calc-trail-display 1 t))
(and vals
- (let ((calc-simplify-mode (if (eq last-command-char ?\C-j)
+ (let ((calc-simplify-mode (if (eq last-command-event ?\C-j)
'none
calc-simplify-mode)))
(if (>= num 0)
(interactive)
(calc-wrapper
(if (or calc-algebraic-mode
- (and (> calc-number-radix 14) (eq last-command-char ?e)))
+ (and (> calc-number-radix 14) (eq last-command-event ?e)))
(calc-alg-digit-entry)
(calc-unread-command)
(setq calc-aborted-prefix nil)
(progn
(beep)
(calc-temp-minibuffer-message " [Bad format]"))
- (or (memq last-command-char '(32 13))
+ (or (memq last-command-event '(32 13))
(progn (setq prefix-arg current-prefix-arg)
- (calc-unread-command (if (and (eq last-command-char 27)
+ (calc-unread-command (if (and (eq last-command-event 27)
(>= last-input-char 128))
last-input-char
nil))))
(defun calcDigit-key ()
(interactive)
(goto-char (point-max))
- (if (or (and (memq last-command-char '(?+ ?-))
+ (if (or (and (memq last-command-event '(?+ ?-))
(> (buffer-size) 0)
(/= (preceding-char) ?e))
- (and (memq last-command-char '(?m ?s))
+ (and (memq last-command-event '(?m ?s))
(not (calc-minibuffer-contains "[-+]?[0-9]+\\.?0*[@oh].*"))
(not (calc-minibuffer-contains "[-+]?\\(1[1-9]\\|[2-9][0-9]\\)#.*"))))
(calcDigit-nondigit)
(if (calc-minibuffer-contains "\\([-+]?\\|.* \\)\\'")
- (cond ((memq last-command-char '(?. ?@)) (insert "0"))
- ((and (memq last-command-char '(?o ?h ?m))
+ (cond ((memq last-command-event '(?. ?@)) (insert "0"))
+ ((and (memq last-command-event '(?o ?h ?m))
(not (calc-minibuffer-contains ".*#.*"))) (insert "0"))
- ((memq last-command-char '(?: ?e)) (insert "1"))
- ((eq last-command-char ?#)
+ ((memq last-command-event '(?: ?e)) (insert "1"))
+ ((eq last-command-event ?#)
(insert (int-to-string calc-number-radix)))))
(if (and (calc-minibuffer-contains "\\([-+]?[0-9]+#\\|[^:]*:\\)\\'")
- (eq last-command-char ?:))
+ (eq last-command-event ?:))
(insert "1"))
(if (and (calc-minibuffer-contains "[-+]?[0-9]+#\\'")
- (eq last-command-char ?.))
+ (eq last-command-event ?.))
(insert "0"))
(if (and (calc-minibuffer-contains "[-+]?0*\\([2-9]\\|1[0-4]\\)#\\'")
- (eq last-command-char ?e))
+ (eq last-command-event ?e))
(insert "1"))
- (if (or (and (memq last-command-char '(?h ?o ?m ?s ?p))
+ (if (or (and (memq last-command-event '(?h ?o ?m ?s ?p))
(calc-minibuffer-contains ".*#.*"))
- (and (eq last-command-char ?e)
+ (and (eq last-command-event ?e)
(calc-minibuffer-contains "[-+]?\\(1[5-9]\\|[2-9][0-9]\\)#.*"))
- (and (eq last-command-char ?n)
+ (and (eq last-command-event ?n)
(calc-minibuffer-contains "[-+]?\\(2[4-9]\\|[3-9][0-9]\\)#.*")))
- (setq last-command-char (upcase last-command-char)))
+ (setq last-command-event (upcase last-command-event)))
(cond
- ((memq last-command-char '(?_ ?n))
+ ((memq last-command-event '(?_ ?n))
(goto-char (minibuffer-prompt-end))
(if (and (search-forward " +/- " nil t)
(not (search-forward "e" nil t)))
(delete-char 1)
(insert "-")))
(goto-char (point-max)))
- ((eq last-command-char ?p)
+ ((eq last-command-event ?p)
(if (or (calc-minibuffer-contains ".*\\+/-.*")
(calc-minibuffer-contains ".*mod.*")
(calc-minibuffer-contains ".*#.*")
(if (not (calc-minibuffer-contains ".* \\'"))
(insert " "))
(insert "+/- ")))
- ((and (eq last-command-char ?M)
+ ((and (eq last-command-event ?M)
(not (calc-minibuffer-contains
"[-+]?\\(2[3-9]\\|[3-9][0-9]\\)#.*")))
(if (or (calc-minibuffer-contains ".*\\+/-.*")
(insert " "))
(insert "mod "))))
(t
- (insert (char-to-string last-command-char))
+ (insert (char-to-string last-command-event))
(if (or (and (calc-minibuffer-contains "[-+]?\\(.*\\+/- *\\|.*mod *\\)?\\([0-9][0-9]?\\)#[0-9a-zA-Z]*\\(:[0-9a-zA-Z]*\\(:[0-9a-zA-Z]*\\)?\\|.[0-9a-zA-Z]*\\(e[-+]?[0-9]*\\)?\\)?\\'")
(let ((radix (string-to-number
(buffer-substring
(match-beginning 2) (match-end 2)))))
(and (>= radix 2)
(<= radix 36)
- (or (memq last-command-char '(?# ?: ?. ?e ?+ ?-))
+ (or (memq last-command-event '(?# ?: ?. ?e ?+ ?-))
(let ((dig (math-read-radix-digit
- (upcase last-command-char))))
+ (upcase last-command-event))))
(and dig
(< dig radix)))))))
(calc-minibuffer-contains
"[-+]?\\(.*\\+/- *\\|.*mod *\\)?\\([0-9]+\\.?0*[@oh] *\\)?\\([0-9]+\\.?0*['m] *\\)?[0-9]*\\(\\.?[0-9]*\\(e[-+]?[0-3]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?\\)?\\|[0-9]:\\([0-9]+:\\)?[0-9]*\\)?[\"s]?\\'"))
- (if (and (memq last-command-char '(?@ ?o ?h ?\' ?m))
+ (if (and (memq last-command-event '(?@ ?o ?h ?\' ?m))
(string-match " " calc-hms-format))
(insert " "))
(if (and (eq this-command last-command)
- (eq last-command-char ?.))
+ (eq last-command-event ?.))
(progn
(require 'calc-ext)
(calc-digit-dots))
(beep)
(calc-temp-minibuffer-message " [Bad format]"))))))
(setq calc-prev-prev-char calc-prev-char
- calc-prev-char last-command-char))
+ calc-prev-char last-command-event))
(defun calcDigit-backspace ()
(t (backward-delete-char 1)))
(if (= (calc-minibuffer-size) 0)
(progn
- (setq last-command-char 13)
+ (setq last-command-event 13)
(calcDigit-nondigit))))