1 |
;; Calculator for GNU Emacs, part II [calc-prog.el] |
;; Calculator for GNU Emacs, part II [calc-prog.el] |
2 |
;; Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. |
;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. |
3 |
;; Written by Dave Gillespie, daveg@synaptics.com. |
;; Written by Dave Gillespie, daveg@synaptics.com. |
4 |
|
|
5 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
666 |
(symbolp (cdr def)) |
(symbolp (cdr def)) |
667 |
(eq major-mode 'calc-mode)) |
(eq major-mode 'calc-mode)) |
668 |
(progn |
(progn |
669 |
(if (and (< (window-width) (screen-width)) |
(if (and (< (window-width) (frame-width)) |
670 |
calc-display-trail) |
calc-display-trail) |
671 |
(let ((win (get-buffer-window (calc-trail-buffer)))) |
(let ((win (get-buffer-window (calc-trail-buffer)))) |
672 |
(if win |
(if win |
722 |
(if (>= (prog2 (forward-char -1) |
(if (>= (prog2 (forward-char -1) |
723 |
(current-column) |
(current-column) |
724 |
(forward-char 1)) |
(forward-char 1)) |
725 |
(screen-width)) |
(frame-width)) |
726 |
(fill-region top (point)))) |
(fill-region top (point)))) |
727 |
(insert "Press C-q to quote control characters like RET" |
(insert "Press C-q to quote control characters like RET" |
728 |
" and TAB.\n" |
" and TAB.\n" |
743 |
(calc-edit-mode (list 'calc-finish-formula-edit |
(calc-edit-mode (list 'calc-finish-formula-edit |
744 |
(list 'quote func))) |
(list 'quote func))) |
745 |
(insert (math-showing-full-precision |
(insert (math-showing-full-precision |
746 |
(math-format-nice-expr defn (screen-width))) |
(math-format-nice-expr defn (frame-width))) |
747 |
"\n")) |
"\n")) |
748 |
(calc-show-edit-buffer)) |
(calc-show-edit-buffer)) |
749 |
(error "That command's definition cannot be edited")))))) |
(error "That command's definition cannot be edited")))))) |
1241 |
(open last-command-char) |
(open last-command-char) |
1242 |
(counter initial) |
(counter initial) |
1243 |
ch) |
ch) |
1244 |
(or executing-macro |
(or executing-kbd-macro |
1245 |
(message "Reading loop body...")) |
(message "Reading loop body...")) |
1246 |
(while (>= count 0) |
(while (>= count 0) |
1247 |
(setq ch (read-char)) |
(setq ch (read-char)) |
1265 |
(setq body (concat body (char-to-string ch))))) |
(setq body (concat body (char-to-string ch))))) |
1266 |
(if (/= ch (cdr (assq open '( (?\< . ?\>) (?\( . ?\)) (?\{ . ?\}) )))) |
(if (/= ch (cdr (assq open '( (?\< . ?\>) (?\( . ?\)) (?\{ . ?\}) )))) |
1267 |
(error "Mismatched Z%c and Z%c in keyboard macro" open ch)) |
(error "Mismatched Z%c and Z%c in keyboard macro" open ch)) |
1268 |
(or executing-macro |
(or executing-kbd-macro |
1269 |
(message "Looping...")) |
(message "Looping...")) |
1270 |
(setq body (concat (substring body 0 -2) "Z]")) |
(setq body (concat (substring body 0 -2) "Z]")) |
1271 |
(and (not executing-macro) |
(and (not executing-kbd-macro) |
1272 |
(= rpt-count 1000000) |
(= rpt-count 1000000) |
1273 |
(null parts) |
(null parts) |
1274 |
(null counter) |
(null counter) |
1300 |
(calc-pop-stack 1) |
(calc-pop-stack 1) |
1301 |
(setq counter (calcFunc-add counter step))) |
(setq counter (calcFunc-add counter step))) |
1302 |
(setq rpt-count (1- rpt-count)))))))) |
(setq rpt-count (1- rpt-count)))))))) |
1303 |
(or executing-macro |
(or executing-kbd-macro |
1304 |
(message "Looping...done"))) |
(message "Looping...done"))) |
1305 |
) |
) |
1306 |
|
|
1358 |
(count 0) |
(count 0) |
1359 |
(body "") |
(body "") |
1360 |
ch) |
ch) |
1361 |
(if (or executing-macro defining-kbd-macro) |
(if (or executing-kbd-macro defining-kbd-macro) |
1362 |
(progn |
(progn |
1363 |
(if defining-kbd-macro |
(if defining-kbd-macro |
1364 |
(message "Reading body...")) |
(message "Reading body...")) |
1400 |
(defun calc-kbd-report (msg) |
(defun calc-kbd-report (msg) |
1401 |
(interactive "sMessage: ") |
(interactive "sMessage: ") |
1402 |
(calc-wrapper |
(calc-wrapper |
1403 |
(let ((executing-macro nil) |
(let ((executing-kbd-macro nil) |
1404 |
(defining-kbd-macro nil)) |
(defining-kbd-macro nil)) |
1405 |
(math-working msg (calc-top-n 1)))) |
(math-working msg (calc-top-n 1)))) |
1406 |
) |
) |
1408 |
(defun calc-kbd-query (msg) |
(defun calc-kbd-query (msg) |
1409 |
(interactive "sPrompt: ") |
(interactive "sPrompt: ") |
1410 |
(calc-wrapper |
(calc-wrapper |
1411 |
(let ((executing-macro nil) |
(let ((executing-kbd-macro nil) |
1412 |
(defining-kbd-macro nil)) |
(defining-kbd-macro nil)) |
1413 |
(calc-alg-entry nil (and (not (equal msg "")) msg)))) |
(calc-alg-entry nil (and (not (equal msg "")) msg)))) |
1414 |
) |
) |