comparison lisp/calc/calc.el @ 59228:30ee5fc56ad0

(calc-same-interface, calc-quit): Remove obsolete MacEdit code.
author Jay Belanger <jay.p.belanger@gmail.com>
date Fri, 31 Dec 2004 03:29:25 +0000
parents a26862f74305
children d736a1979b98 95879cc1ed20
comparison
equal deleted inserted replaced
59227:70f5459eb260 59228:30ee5fc56ad0
1165 (if (and (equal (buffer-name) "*Gnuplot Trail*") 1165 (if (and (equal (buffer-name) "*Gnuplot Trail*")
1166 (> (recursion-depth) 0)) 1166 (> (recursion-depth) 0))
1167 (exit-recursive-edit) 1167 (exit-recursive-edit)
1168 (if (eq major-mode 'calc-edit-mode) 1168 (if (eq major-mode 'calc-edit-mode)
1169 (calc-edit-finish arg) 1169 (calc-edit-finish arg)
1170 (if (eq major-mode 'MacEdit-mode) 1170 (if calc-was-keypad-mode
1171 (MacEdit-finish-edit) 1171 (calc-keypad)
1172 (if calc-was-keypad-mode 1172 (calc arg calc-full-mode t)))))
1173 (calc-keypad)
1174 (calc arg calc-full-mode t))))))
1175
1176 1173
1177 (defun calc-quit (&optional non-fatal interactive) 1174 (defun calc-quit (&optional non-fatal interactive)
1178 (interactive "i\np") 1175 (interactive "i\np")
1179 (and calc-standalone-flag (not non-fatal) 1176 (and calc-standalone-flag (not non-fatal)
1180 (save-buffers-kill-emacs nil)) 1177 (save-buffers-kill-emacs nil))
1181 (if (and (equal (buffer-name) "*Gnuplot Trail*") 1178 (if (and (equal (buffer-name) "*Gnuplot Trail*")
1182 (> (recursion-depth) 0)) 1179 (> (recursion-depth) 0))
1183 (exit-recursive-edit)) 1180 (exit-recursive-edit))
1184 (if (eq major-mode 'calc-edit-mode) 1181 (if (eq major-mode 'calc-edit-mode)
1185 (calc-edit-cancel) 1182 (calc-edit-cancel)
1186 (if (eq major-mode 'MacEdit-mode) 1183 (if (and interactive
1187 (MacEdit-cancel-edit) 1184 calc-embedded-info
1188 (if (and interactive 1185 (eq (current-buffer) (aref calc-embedded-info 0)))
1189 calc-embedded-info 1186 (calc-embedded nil)
1190 (eq (current-buffer) (aref calc-embedded-info 0))) 1187 (unless (eq major-mode 'calc-mode)
1191 (calc-embedded nil) 1188 (calc-create-buffer))
1192 (unless (eq major-mode 'calc-mode) 1189 (run-hooks 'calc-end-hook)
1193 (calc-create-buffer)) 1190 (setq calc-undo-list nil calc-redo-list nil)
1194 (run-hooks 'calc-end-hook) 1191 (mapcar (function (lambda (v) (set-default v (symbol-value v))))
1195 (setq calc-undo-list nil calc-redo-list nil) 1192 calc-local-var-list)
1196 (mapcar (function (lambda (v) (set-default v (symbol-value v)))) 1193 (let ((buf (current-buffer))
1197 calc-local-var-list) 1194 (win (get-buffer-window (current-buffer)))
1198 (let ((buf (current-buffer)) 1195 (kbuf (get-buffer "*Calc Keypad*")))
1199 (win (get-buffer-window (current-buffer))) 1196 (delete-windows-on (calc-trail-buffer))
1200 (kbuf (get-buffer "*Calc Keypad*"))) 1197 (if (and win
1201 (delete-windows-on (calc-trail-buffer)) 1198 (< (window-height win) (1- (frame-height)))
1202 (if (and win 1199 (= (window-width win) (frame-width)) ; avoid calc-keypad
1203 (< (window-height win) (1- (frame-height))) 1200 (not (get-buffer-window "*Calc Keypad*")))
1204 (= (window-width win) (frame-width)) ; avoid calc-keypad 1201 (setq calc-window-height (- (window-height win) 2)))
1205 (not (get-buffer-window "*Calc Keypad*"))) 1202 (progn
1206 (setq calc-window-height (- (window-height win) 2))) 1203 (delete-windows-on buf)
1207 (progn 1204 (delete-windows-on kbuf))
1208 (delete-windows-on buf) 1205 (bury-buffer buf)
1209 (delete-windows-on kbuf)) 1206 (bury-buffer calc-trail-buffer)
1210 (bury-buffer buf) 1207 (and kbuf (bury-buffer kbuf))))))
1211 (bury-buffer calc-trail-buffer)
1212 (and kbuf (bury-buffer kbuf)))))))
1213 1208
1214 ;;;###autoload 1209 ;;;###autoload
1215 (defun quick-calc () 1210 (defun quick-calc ()
1216 "Do a quick calculation in the minibuffer without invoking full Calculator." 1211 "Do a quick calculation in the minibuffer without invoking full Calculator."
1217 (interactive) 1212 (interactive)