654 |
calc-word-size |
calc-word-size |
655 |
calc-internal-prec)) |
calc-internal-prec)) |
656 |
|
|
657 |
|
(defvar calc-mode-hook nil |
658 |
|
"Hook run when entering calc-mode.") |
659 |
|
|
660 |
|
(defvar calc-trail-mode-hook nil |
661 |
|
"Hook run when entering calc-trail-mode.") |
662 |
|
|
663 |
|
(defvar calc-start-hook nil |
664 |
|
"Hook run when calc is started.") |
665 |
|
|
666 |
|
(defvar calc-end-hook nil |
667 |
|
"Hook run when calc is quit.") |
668 |
|
|
669 |
|
(defvar calc-load-hook nil |
670 |
|
"Hook run when calc.el is loaded.") |
671 |
|
|
672 |
;; Verify that Calc is running on the right kind of system. |
;; Verify that Calc is running on the right kind of system. |
673 |
(defvar calc-emacs-type-lucid (not (not (string-match "Lucid" emacs-version)))) |
(defvar calc-emacs-type-lucid (not (not (string-match "Lucid" emacs-version)))) |
1070 |
(progn |
(progn |
1071 |
(setq calc-loaded-settings-file t) |
(setq calc-loaded-settings-file t) |
1072 |
(load calc-settings-file t))) ; t = missing-ok |
(load calc-settings-file t))) ; t = missing-ok |
|
(if (and (eq window-system 'x) (boundp 'mouse-map)) |
|
|
(substitute-key-definition 'x-paste-text 'calc-x-paste-text |
|
|
mouse-map)) |
|
1073 |
(let ((p command-line-args)) |
(let ((p command-line-args)) |
1074 |
(while p |
(while p |
1075 |
(and (equal (car p) "-f") |
(and (equal (car p) "-f") |
1080 |
(run-hooks 'calc-mode-hook) |
(run-hooks 'calc-mode-hook) |
1081 |
(calc-refresh t) |
(calc-refresh t) |
1082 |
(calc-set-mode-line) |
(calc-set-mode-line) |
|
;; The calc-defs variable is a relic. Use calc-define properties instead. |
|
|
(when (and (boundp 'calc-defs) |
|
|
calc-defs) |
|
|
(message "Evaluating calc-defs...") |
|
|
(calc-need-macros) |
|
|
(eval (cons 'progn calc-defs)) |
|
|
(setq calc-defs nil) |
|
|
(calc-set-mode-line)) |
|
1083 |
(calc-check-defines)) |
(calc-check-defines)) |
1084 |
|
|
1085 |
(defvar calc-check-defines 'calc-check-defines) ; suitable for run-hooks |
(defvar calc-check-defines 'calc-check-defines) ; suitable for run-hooks |
1166 |
(switch-to-buffer (current-buffer) t) |
(switch-to-buffer (current-buffer) t) |
1167 |
(if (get-buffer-window (current-buffer)) |
(if (get-buffer-window (current-buffer)) |
1168 |
(select-window (get-buffer-window (current-buffer))) |
(select-window (get-buffer-window (current-buffer))) |
1169 |
(if (and (boundp 'calc-window-hook) calc-window-hook) |
(let ((w (get-largest-window))) |
1170 |
(run-hooks 'calc-window-hook) |
(if (and pop-up-windows |
1171 |
(let ((w (get-largest-window))) |
(> (window-height w) |
1172 |
(if (and pop-up-windows |
(+ window-min-height calc-window-height 2))) |
1173 |
(> (window-height w) |
(progn |
1174 |
(+ window-min-height calc-window-height 2))) |
(setq w (split-window w |
1175 |
(progn |
(- (window-height w) |
1176 |
(setq w (split-window w |
calc-window-height 2) |
1177 |
(- (window-height w) |
nil)) |
1178 |
calc-window-height 2) |
(set-window-buffer w (current-buffer)) |
1179 |
nil)) |
(select-window w)) |
1180 |
(set-window-buffer w (current-buffer)) |
(pop-to-buffer (current-buffer)))))) |
|
(select-window w)) |
|
|
(pop-to-buffer (current-buffer))))))) |
|
1181 |
(save-excursion |
(save-excursion |
1182 |
(set-buffer (calc-trail-buffer)) |
(set-buffer (calc-trail-buffer)) |
1183 |
(and calc-display-trail |
(and calc-display-trail |
1723 |
(calc-refresh align))) |
(calc-refresh align))) |
1724 |
(setq calc-refresh-count (1+ calc-refresh-count))) |
(setq calc-refresh-count (1+ calc-refresh-count))) |
1725 |
|
|
|
|
|
|
(defun calc-x-paste-text (arg) |
|
|
"Move point to mouse position and insert window system cut buffer contents. |
|
|
If mouse is pressed in Calc window, push cut buffer contents onto the stack." |
|
|
(x-mouse-select arg) |
|
|
(if (memq major-mode '(calc-mode calc-trail-mode)) |
|
|
(progn |
|
|
(calc-wrapper |
|
|
(calc-extensions) |
|
|
(let* ((buf (x-get-cut-buffer)) |
|
|
(val (math-read-exprs (calc-clean-newlines buf)))) |
|
|
(if (eq (car-safe val) 'error) |
|
|
(progn |
|
|
(setq val (math-read-exprs buf)) |
|
|
(if (eq (car-safe val) 'error) |
|
|
(error "%s in yanked data" (nth 2 val))))) |
|
|
(calc-enter-result 0 "Xynk" val)))) |
|
|
(x-paste-text arg))) |
|
|
|
|
|
|
|
|
|
|
1726 |
;;;; The Calc Trail buffer. |
;;;; The Calc Trail buffer. |
1727 |
|
|
1728 |
(defun calc-check-trail-aligned () |
(defun calc-check-trail-aligned () |
1788 |
(not (if flag (memq flag '(nil 0)) win))) |
(not (if flag (memq flag '(nil 0)) win))) |
1789 |
(if (null win) |
(if (null win) |
1790 |
(progn |
(progn |
1791 |
(if (and (boundp 'calc-trail-window-hook) calc-trail-window-hook) |
(let ((w (split-window nil (/ (* (window-width) 2) 3) t))) |
1792 |
(run-hooks 'calc-trail-window-hook) |
(set-window-buffer w calc-trail-buffer)) |
|
(let ((w (split-window nil (/ (* (window-width) 2) 3) t))) |
|
|
(set-window-buffer w calc-trail-buffer))) |
|
1793 |
(calc-wrapper |
(calc-wrapper |
1794 |
(setq overlay-arrow-string calc-trail-overlay |
(setq overlay-arrow-string calc-trail-overlay |
1795 |
overlay-arrow-position calc-trail-pointer) |
overlay-arrow-position calc-trail-pointer) |