diff options
| -rw-r--r-- | lisp/calc/calc-yank.el | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el index 6f75613b014..53d5946e073 100644 --- a/lisp/calc/calc-yank.el +++ b/lisp/calc/calc-yank.el | |||
| @@ -430,6 +430,7 @@ | |||
| 430 | (defvar calc-edit-handler) | 430 | (defvar calc-edit-handler) |
| 431 | (defvar calc-restore-trail) | 431 | (defvar calc-restore-trail) |
| 432 | (defvar calc-allow-ret) | 432 | (defvar calc-allow-ret) |
| 433 | (defvar calc-edit-top) | ||
| 433 | 434 | ||
| 434 | (defun calc-edit-mode (&optional handler allow-ret title) | 435 | (defun calc-edit-mode (&optional handler allow-ret title) |
| 435 | "Calculator editing mode. Press RET, LFD, or C-c C-c to finish. | 436 | "Calculator editing mode. Press RET, LFD, or C-c C-c to finish. |
| @@ -470,7 +471,9 @@ To cancel the edit, simply kill the *Calc Edit* buffer." | |||
| 470 | "Press `C-c C-c'" | 471 | "Press `C-c C-c'" |
| 471 | (if allow-ret "" " or RET") | 472 | (if allow-ret "" " or RET") |
| 472 | " to finish, `C-x k RET' to cancel.\n\n") | 473 | " to finish, `C-x k RET' to cancel.\n\n") |
| 473 | 'font-lock-face 'italic)))) | 474 | 'font-lock-face 'italic 'read-only t 'rear-nonsticky t 'front-sticky t)) |
| 475 | (make-local-variable 'calc-edit-top) | ||
| 476 | (setq calc-edit-top (point)))) | ||
| 474 | (put 'calc-edit-mode 'mode-class 'special) | 477 | (put 'calc-edit-mode 'mode-class 'special) |
| 475 | 478 | ||
| 476 | (defun calc-show-edit-buffer () | 479 | (defun calc-show-edit-buffer () |
| @@ -487,8 +490,7 @@ To cancel the edit, simply kill the *Calc Edit* buffer." | |||
| 487 | (if win | 490 | (if win |
| 488 | (delete-window win)))) | 491 | (delete-window win)))) |
| 489 | (set-buffer-modified-p nil) | 492 | (set-buffer-modified-p nil) |
| 490 | (goto-char (point-min)) | 493 | (goto-char calc-edit-top))) |
| 491 | (forward-line 2))) | ||
| 492 | 494 | ||
| 493 | (defun calc-edit-return () | 495 | (defun calc-edit-return () |
| 494 | (interactive) | 496 | (interactive) |
| @@ -522,11 +524,7 @@ To cancel the edit, simply kill the *Calc Edit* buffer." | |||
| 522 | (set-buffer original) | 524 | (set-buffer original) |
| 523 | (not (eq major-mode 'calc-mode)))) | 525 | (not (eq major-mode 'calc-mode)))) |
| 524 | (error "Original calculator buffer has been corrupted"))) | 526 | (error "Original calculator buffer has been corrupted"))) |
| 525 | (goto-char (point-min)) | 527 | (goto-char calc-edit-top) |
| 526 | (when (looking-at "Calc Edit\\|Editing ") | ||
| 527 | (forward-line 1)) | ||
| 528 | (if (looking-at "^ *$") | ||
| 529 | (forward-line 1)) | ||
| 530 | (if (buffer-modified-p) | 528 | (if (buffer-modified-p) |
| 531 | (eval calc-edit-handler)) | 529 | (eval calc-edit-handler)) |
| 532 | (if one-window | 530 | (if one-window |
| @@ -551,7 +549,7 @@ To cancel the edit, simply kill the *Calc Edit* buffer." | |||
| 551 | 549 | ||
| 552 | (defun calc-finish-stack-edit (num) | 550 | (defun calc-finish-stack-edit (num) |
| 553 | (let ((buf (current-buffer)) | 551 | (let ((buf (current-buffer)) |
| 554 | (str (buffer-substring (point) (point-max))) | 552 | (str (buffer-substring calc-edit-top (point-max))) |
| 555 | (start (point)) | 553 | (start (point)) |
| 556 | pos) | 554 | pos) |
| 557 | (if (and (integerp num) (> num 1)) | 555 | (if (and (integerp num) (> num 1)) |